From a4b7021accdcd17ffdd7402543a84a0bd274e8dc Mon Sep 17 00:00:00 2001 From: Brian Beck Date: Tue, 9 Dec 2025 14:59:47 -0800 Subject: [PATCH] improve lighting, fog, clouds, force fields --- app/page.tsx | 15 +- docs/404.html | 2 +- docs/404/index.html | 2 +- .../_buildManifest.js | 0 .../_clientMiddlewareManifest.json | 0 .../_ssgManifest.js | 0 docs/_next/static/chunks/40a2f59d0c05dc35.js | 1 + ...70f08013a69708a.js => 49f75d30e4f6ac74.js} | 2 +- docs/_next/static/chunks/544fd4f09b7df0da.js | 1 - docs/_next/static/chunks/6a22d5a06cf91e1e.js | 1 - docs/_next/static/chunks/a99c02adf7563d85.js | 1 + docs/_next/static/chunks/bce28defe6a29ff5.js | 1 + docs/_next/static/chunks/bd1dcee0b953cac2.js | 1 - docs/_next/static/chunks/d07990f13ea8bb98.js | 1 - docs/_next/static/chunks/f863efae27259b81.js | 1 + docs/index.html | 2 +- docs/index.txt | 4 +- package-lock.json | 1152 +++++++++++++++++ package.json | 1 + reference/Tribes2_Fog_System.md | 1004 ++++++++++++++ scripts/screenshot.ts | 114 ++ src/components/CloudLayers.tsx | 21 +- src/components/FogProvider.tsx | 303 +++++ src/components/ForceFieldBare.tsx | 20 +- src/components/GenericShape.tsx | 22 + src/components/InteriorInstance.tsx | 49 +- src/components/SettingsProvider.tsx | 13 +- src/components/Sky.tsx | 539 +++++--- src/components/Sun.tsx | 12 +- src/components/TerrainBlock.tsx | 280 +++- src/components/TerrainTile.tsx | 25 +- src/components/WaterBlock.tsx | 6 +- src/fogShader.ts | 322 +++++ src/forceFieldMaterial.ts | 31 +- src/globalFogUniforms.ts | 79 ++ src/interiorMaterial.ts | 37 + src/lightingConfig.ts | 33 + src/shapeMaterial.ts | 36 + src/terrainMaterial.ts | 128 +- src/waterMaterial.ts | 75 +- 40 files changed, 4046 insertions(+), 291 deletions(-) rename docs/_next/static/{phNqOyvmceJswVwTPTCoJ => Z2orC9Oxj30KOCL7Wakqt}/_buildManifest.js (100%) rename docs/_next/static/{phNqOyvmceJswVwTPTCoJ => Z2orC9Oxj30KOCL7Wakqt}/_clientMiddlewareManifest.json (100%) rename docs/_next/static/{phNqOyvmceJswVwTPTCoJ => Z2orC9Oxj30KOCL7Wakqt}/_ssgManifest.js (100%) create mode 100644 docs/_next/static/chunks/40a2f59d0c05dc35.js rename docs/_next/static/chunks/{b70f08013a69708a.js => 49f75d30e4f6ac74.js} (86%) delete mode 100644 docs/_next/static/chunks/544fd4f09b7df0da.js delete mode 100644 docs/_next/static/chunks/6a22d5a06cf91e1e.js create mode 100644 docs/_next/static/chunks/a99c02adf7563d85.js create mode 100644 docs/_next/static/chunks/bce28defe6a29ff5.js delete mode 100644 docs/_next/static/chunks/bd1dcee0b953cac2.js delete mode 100644 docs/_next/static/chunks/d07990f13ea8bb98.js create mode 100644 docs/_next/static/chunks/f863efae27259b81.js create mode 100644 reference/Tribes2_Fog_System.md create mode 100644 scripts/screenshot.ts create mode 100644 src/components/FogProvider.tsx create mode 100644 src/fogShader.ts create mode 100644 src/globalFogUniforms.ts create mode 100644 src/interiorMaterial.ts create mode 100644 src/lightingConfig.ts diff --git a/app/page.tsx b/app/page.tsx index 1c9518ac..9907b7f8 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, Suspense } from "react"; import { useSearchParams, useRouter } from "next/navigation"; import { Canvas } from "@react-three/fiber"; -import { EffectComposer, N8AO } from "@react-three/postprocessing"; +import { NoToneMapping, SRGBColorSpace } from "three"; import { Mission } from "@/src/components/Mission"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ObserverControls } from "@/src/components/ObserverControls"; @@ -18,6 +18,14 @@ import { getMissionList, getMissionInfo } from "@/src/manifest"; // stuff too, e.g. missions, terrains, and more. This client is used for those. const queryClient = new QueryClient(); +// Renderer settings to match Tribes 2's simple rendering pipeline. +// Tribes 2 (Torque engine, 2001) worked entirely in gamma/sRGB space with no HDR +// or tone mapping. We disable tone mapping and ensure proper sRGB output. +const glSettings = { + toneMapping: NoToneMapping, + outputColorSpace: SRGBColorSpace, +}; + function MapInspector() { const searchParams = useSearchParams(); const router = useRouter(); @@ -86,7 +94,7 @@ function MapInspector() { )} - + - - - 404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file diff --git a/docs/404/index.html b/docs/404/index.html index de1e1f69..c705d824 100644 --- a/docs/404/index.html +++ b/docs/404/index.html @@ -1 +1 @@ -404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file diff --git a/docs/_next/static/phNqOyvmceJswVwTPTCoJ/_buildManifest.js b/docs/_next/static/Z2orC9Oxj30KOCL7Wakqt/_buildManifest.js similarity index 100% rename from docs/_next/static/phNqOyvmceJswVwTPTCoJ/_buildManifest.js rename to docs/_next/static/Z2orC9Oxj30KOCL7Wakqt/_buildManifest.js diff --git a/docs/_next/static/phNqOyvmceJswVwTPTCoJ/_clientMiddlewareManifest.json b/docs/_next/static/Z2orC9Oxj30KOCL7Wakqt/_clientMiddlewareManifest.json similarity index 100% rename from docs/_next/static/phNqOyvmceJswVwTPTCoJ/_clientMiddlewareManifest.json rename to docs/_next/static/Z2orC9Oxj30KOCL7Wakqt/_clientMiddlewareManifest.json diff --git a/docs/_next/static/phNqOyvmceJswVwTPTCoJ/_ssgManifest.js b/docs/_next/static/Z2orC9Oxj30KOCL7Wakqt/_ssgManifest.js similarity index 100% rename from docs/_next/static/phNqOyvmceJswVwTPTCoJ/_ssgManifest.js rename to docs/_next/static/Z2orC9Oxj30KOCL7Wakqt/_ssgManifest.js diff --git a/docs/_next/static/chunks/40a2f59d0c05dc35.js b/docs/_next/static/chunks/40a2f59d0c05dc35.js new file mode 100644 index 00000000..3f138209 --- /dev/null +++ b/docs/_next/static/chunks/40a2f59d0c05dc35.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63724,e=>{"use strict";e.s(["ForceFieldBare",()=>d],63724);var r=e.i(43476),o=e.i(71645),t=e.i(47071),n=e.i(5230),a=e.i(90072),l=e.i(62395),i=e.i(12979),u=e.i(79123),s=e.i(6112);function c(e){let r=(0,o.useMemo)(()=>{let[r,o,t]=e,n=new a.BoxGeometry(r,o,t);return n.translate(r/2,o/2,t/2),n},[e]);return(0,o.useEffect)(()=>()=>r.dispose(),[r]),r}function f(e){let{scale:l,color:i,baseTranslucency:s,textureUrls:f,numFrames:m,framesPerSec:d,scrollSpeed:v,umapping:p,vmapping:g}=e,{animationEnabled:x}=(0,u.useSettings)(),F=c(l),y=(0,t.useTexture)(f,e=>{e.forEach(e=>{e.wrapS=e.wrapT=a.RepeatWrapping,e.colorSpace=a.NoColorSpace,e.flipY=!1,e.needsUpdate=!0})}),S=(0,o.useMemo)(()=>(function(e){var r,o,t,n;let{textures:l,scale:i,umapping:u,vmapping:s,color:c,baseTranslucency:f}=e,m=[...i].sort((e,r)=>r-e),d=new a.Vector2(m[0]*u,m[1]*s),v=l[0];return new a.ShaderMaterial({uniforms:{frame0:{value:v},frame1:{value:null!=(r=l[1])?r:v},frame2:{value:null!=(o=l[2])?o:v},frame3:{value:null!=(t=l[3])?t:v},frame4:{value:null!=(n=l[4])?n:v},currentFrame:{value:0},vScroll:{value:0},uvScale:{value:d},tintColor:{value:new a.Color(...c)},opacity:{value:f},opacityFactor:{value:1},fogColor:{value:new a.Color},fogNear:{value:1},fogFar:{value:2e3}},vertexShader:"\n#include \n\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n #include \n}\n",fragmentShader:"\n#include \n\nuniform sampler2D frame0;\nuniform sampler2D frame1;\nuniform sampler2D frame2;\nuniform sampler2D frame3;\nuniform sampler2D frame4;\nuniform int currentFrame;\nuniform float vScroll;\nuniform vec2 uvScale;\nuniform vec3 tintColor;\nuniform float opacity;\nuniform float opacityFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n // Scale and scroll UVs\n vec2 scrolledUv = vec2(vUv.x * uvScale.x, vUv.y * uvScale.y + vScroll);\n\n // Sample the current frame\n vec4 texColor;\n if (currentFrame == 0) {\n texColor = texture2D(frame0, scrolledUv);\n } else if (currentFrame == 1) {\n texColor = texture2D(frame1, scrolledUv);\n } else if (currentFrame == 2) {\n texColor = texture2D(frame2, scrolledUv);\n } else if (currentFrame == 3) {\n texColor = texture2D(frame3, scrolledUv);\n } else {\n texColor = texture2D(frame4, scrolledUv);\n }\n\n // Tribes 2 GL_MODULATE: output = texture * vertexColor\n // No gamma correction - textures use NoColorSpace and values pass through\n // directly to display, matching how WaterBlock handles sRGB textures.\n vec3 modulatedColor = texColor.rgb * tintColor;\n\n float adjustedOpacity = opacity * opacityFactor;\n\n gl_FragColor = vec4(modulatedColor, adjustedOpacity);\n\n // Custom fog for additive blending: fade out rather than blend to fog color.\n // Standard fog (mix toward fogColor) doesn't work with additive blending\n // because we'd still be adding fogColor to the framebuffer.\n // Uses Torque's quadratic haze formula for consistency.\n #ifdef USE_FOG\n float dist = vFogDepth;\n float fogFactor = 0.0;\n if (dist > fogNear) {\n if (dist >= fogFar) {\n fogFactor = 1.0;\n } else {\n float fogScale = 1.0 / (fogFar - fogNear);\n float distFactor = (dist - fogNear) * fogScale - 1.0;\n fogFactor = 1.0 - distFactor * distFactor;\n }\n }\n gl_FragColor.a *= 1.0 - fogFactor;\n #endif\n}\n",transparent:!0,blending:a.AdditiveBlending,side:a.DoubleSide,depthWrite:!1,fog:!0})})({textures:y,scale:l,umapping:p,vmapping:g,color:i,baseTranslucency:s}),[y,l,p,g,i,s]);(0,o.useEffect)(()=>()=>S.dispose(),[S]);let h=(0,o.useRef)(0);return(0,n.useFrame)((e,r)=>{if(!x){h.current=0,S.uniforms.currentFrame.value=0,S.uniforms.vScroll.value=0;return}h.current+=r,S.uniforms.currentFrame.value=Math.floor(h.current*d)%m,S.uniforms.vScroll.value=h.current*v}),(0,r.jsx)("mesh",{geometry:F,material:S,renderOrder:1})}function m(e){let{scale:t,color:n,baseTranslucency:l}=e,i=c(t),u=(0,o.useMemo)(()=>new a.Color(n[0],n[1],n[2]),[n]);return(0,r.jsx)("mesh",{geometry:i,renderOrder:1,children:(0,r.jsx)("meshBasicMaterial",{color:u,transparent:!0,opacity:+l,blending:a.AdditiveBlending,side:a.DoubleSide,depthWrite:!1,fog:!1})})}let d=(0,o.memo)(function(e){let{object:t}=e,n=(0,o.useMemo)(()=>(0,l.getPosition)(t),[t]),a=(0,o.useMemo)(()=>(0,l.getRotation)(t),[t]),u=(0,o.useMemo)(()=>(0,l.getScale)(t),[t]),c=(0,s.useDatablock)((0,l.getProperty)(t,"dataBlock")),d=(0,l.getProperty)(c,"color"),v=(0,o.useMemo)(()=>d?function(e){var r,o,t;let n=e.split(" ").map(e=>parseFloat(e));return[null!=(r=n[0])?r:0,null!=(o=n[1])?o:0,null!=(t=n[2])?t:0]}(d):[1,1,1],[d]),p=parseFloat((0,l.getProperty)(c,"baseTranslucency"))||1,g=parseInt((0,l.getProperty)(c,"numFrames"),10)||1,x=parseFloat((0,l.getProperty)(c,"framesPerSec"))||1,F=parseFloat((0,l.getProperty)(c,"scrollSpeed"))||0,y=parseFloat((0,l.getProperty)(c,"umapping"))||1,S=parseFloat((0,l.getProperty)(c,"vmapping"))||1,h=(0,o.useMemo)(()=>(function(e,r){let o=[];for(let t=0;t{"use strict";n.ConcurrentRoot=1,n.ContinuousEventPriority=8,n.DefaultEventPriority=32,n.DiscreteEventPriority=2,n.IdleEventPriority=0x10000000,n.LegacyRoot=0,n.NoEventPriority=0},39695,(e,t,n)=>{"use strict";t.exports=e.r(24478)},55838,(e,t,n)=>{"use strict";var r=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,l=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,c=r[1];return o(function(){i.value=n,i.getSnapshot=t,u(i)&&c({inst:i})},[e,n,t]),s(function(){return u(i)&&c({inst:i}),e(function(){u(i)&&c({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,t,n)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var r=e.r(71645),i=e.r(2239),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,o=r.useRef,l=r.useEffect,u=r.useMemo,c=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var p=s(e,(h=u(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&d.hasValue){var t=d.value;if(i(t,e))return o=t}return o=e}if(t=o,a(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,o=n)}var s,o,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,r,i]))[0],h[1]);return l(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},30224,(e,t,n)=>{"use strict";t.exports=e.r(52822)},29779,(e,t,n)=>{"use strict";function r(e,t){var n=e.length;for(e.push(t);0>>1,i=e[r];if(0>>1;rs(l,n))us(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[o]=n,r=o);else if(us(c,n))e[r]=c,e[u]=n,r=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,y=!1,_="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=i(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,r(h,t);else break;t=i(d)}}function M(e){if(y=!1,S(e),!v)if(null!==i(h))v=!0,L();else{var t=i(d);null!==t&&N(M,t.startTime-e)}}var w=!1,E=-1,T=5,A=-1;function C(){return!(n.unstable_now()-Ae&&C());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,S(e),t=!0;break t}f===i(h)&&a(h),S(e)}else a(h);f=i(h)}if(null!==f)t=!0;else{var u=i(d);null!==u&&N(M,u.startTime-e),t=!1}}break e}finally{f=null,m=r,g=!1}}}finally{t?o():w=!1}}}if("function"==typeof b)o=function(){b(R)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=R,o=function(){I.postMessage(null)}}else o=function(){_(R,0)};function L(){w||(w=!0,o())}function N(e,t){E=_(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_continueExecution=function(){v||g||(v=!0,L())},n.unstable_forceFrameRate=function(e){0>e||125s?(e.sortIndex=a,r(d,e),null===i(h)&&e===i(d)&&(y?(x(E),E=-1):y=!0,N(M,a-s))):(e.sortIndex=o,r(h,e),v||g||(v=!0,L())),e},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},51849,(e,t,n)=>{"use strict";t.exports=e.r(29779)},40336,(e,t,n)=>{"use strict";var r=e.i(47167);t.exports=function(t){function n(e,t,n,r){return new rP(e,t,n,r)}function i(){}function a(e){var t="https://react.dev/errors/"+e;if(1)":-1i||u[r]!==c[i]){var h="\n"+u[r].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=r&&0<=i)break}}}finally{io=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?l(n):""}function c(e){try{var t="";do t+=function(e){switch(e.tag){case 26:case 27:case 5:return l(e.type);case 16:return l("Lazy");case 13:return l("Suspense");case 19:return l("SuspenseList");case 0:case 15:return u(e.type,!1);case 11:return u(e.type.render,!1);case 1:return u(e.type,!0);default:return""}}(e),e=e.return;while(e)return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function h(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do 0!=(4098&(t=e).flags)&&(n=t.return),e=t.return;while(e)}return 3===t.tag?n:null}function d(e){if(h(e)!==e)throw Error(a(188))}function p(e){var t=e.alternate;if(!t){if(null===(t=h(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var s=i.alternate;if(null===s){if(null!==(r=i.return)){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return d(i),e;if(s===r)return d(i),t;s=s.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){return{current:e}}function m(e){0>a4||(e.current=a3[a4],a3[a4]=null,a4--)}function g(e,t){a3[++a4]=e.current,e.current=t}function v(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194176&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function y(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,s=e.warmLanes;e=0!==e.finishedLanes;var o=0x7ffffff&n;return 0!==o?0!=(n=o&~i)?r=v(n):0!=(a&=o)?r=v(a):e||0!=(s=o&~s)&&(r=v(s)):0!=(o=n&~i)?r=v(o):0!==a?r=v(a):e||0!=(s=n&~s)&&(r=v(s)),0===r?0:0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(s=t&-t)||32===i&&0!=(4194176&s))?t:r}function _(e,t){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function x(){var e=a7;return 0==(4194176&(a7<<=1))&&(a7=128),e}function b(){var e=se;return 0==(0x3c00000&(se<<=1))&&(se=4194304),e}function S(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function M(e,t){e.pendingLanes|=t,0x10000000!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function w(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-a6(t);e.entangledLanes|=t,e.entanglements[r]=0x40000000|e.entanglements[r]|4194218&n}function E(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-a6(n),i=1<>=s,i-=s,sb=1<<32-a6(t)+i|n<d?(p=h,h=null):p=h.sibling;var v=m(n,h,s[d],o);if(null===v){null===h&&(h=p);break}e&&h&&null===v.alternate&&t(n,h),a=l(v,a,d),null===c?u=v:c.sibling=v,c=v,h=p}if(d===s.length)return r(n,h),sR&&C(n,d),u;if(null===h){for(;dp?(v=d,d=null):v=d.sibling;var _=m(n,d,y.value,u);if(null===_){null===d&&(d=v);break}e&&d&&null===_.alternate&&t(n,d),s=l(_,s,p),null===h?c=_:h.sibling=_,h=_,d=v}if(y.done)return r(n,d),sR&&C(n,p),c;if(null===d){for(;!y.done;p++,y=o.next())null!==(y=f(n,y.value,u))&&(s=l(y,s,p),null===h?c=y:h.sibling=y,h=y);return sR&&C(n,p),c}for(d=i(d);!y.done;p++,y=o.next())null!==(y=g(d,n,p,y.value,u))&&(e&&null!==y.alternate&&d.delete(null===y.key?p:y.key),s=l(y,s,p),null===h?c=y:h.sibling=y,h=y);return e&&d.forEach(function(e){return t(n,e)}),sR&&C(n,p),c}(c,h,d=v.call(d),p)}if("function"==typeof d.then)return n(c,h,ev(d),p);if(d.$$typeof===r3)return n(c,h,nl(c,d),p);e_(c,d)}return"string"==typeof d&&""!==d||"number"==typeof d||"bigint"==typeof d?(d=""+d,null!==h&&6===h.tag?(r(c,h.sibling),(p=o(h,d)).return=c):(r(c,h),(p=rF(d,c.mode,p)).return=c),u(c=p)):r(c,h)}(c,h,d,p);return sQ=null,v}catch(e){if(e===sJ)throw e;var y=n(29,e,null,c.mode);return y.lanes=p,y.return=c,y}finally{}}}function eS(e,t){g(s4,e=o1),g(s3,t),o1=e|t.baseLanes}function eM(){g(s4,o1),g(s3,s3.current)}function ew(){o1=s4.current,m(s3),m(s4)}function eE(e){var t=e.alternate;g(s8,1&s8.current),g(s5,e),null===s6&&(null===t||null!==s3.current?s6=e:null!==t.memoizedState&&(s6=e))}function eT(e){if(22===e.tag){if(g(s8,s8.current),g(s5,e),null===s6){var t=e.alternate;null!==t&&null!==t.memoizedState&&(s6=e)}}else eA(e)}function eA(){g(s8,s8.current),g(s5,s5.current)}function eC(e){m(s5),s6===e&&(s6=null),m(s8)}function eR(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||ap(n)||af(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function eP(){throw Error(a(321))}function eI(e,t){if(null===t)return!1;for(var n=0;na?a:8);var s=is.T,o={};is.T=o,tC(e,!1,t,n);try{var l=i(),u=is.S;if(null!==u&&u(o,l),null!==l&&"object"==typeof l&&"function"==typeof l.then){var c,h,d=(c=[],h={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},l.then(function(){h.status="fulfilled",h.value=r;for(var e=0;e";case oB:return":has("+(n6(e)||"")+")";case oH:return'[role="'+e.value+'"]';case oG:return'"'+e.value+'"';case oV:return'[data-testname="'+e.value+'"]';default:throw Error(a(365))}}function n8(e,t){var n=[];e=[e,0];for(var r=0;rln&&(t.flags|=128,r=!0,nM(i,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=eR(s))){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,nS(t,e),nM(i,!0),null===i.tail&&"hidden"===i.tailMode&&!s.alternate&&!sR)return nw(t),null}else 2*sa()-i.renderingStartTime>ln&&0x20000000!==n&&(t.flags|=128,r=!0,nM(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(null!==(e=i.last)?e.sibling=s:t.child=s,i.last=s)}if(null!==i.tail)return t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=sa(),t.sibling=null,e=s8.current,g(s8,r?1&e|2:1&e),t;return nw(t),null;case 22:case 23:return eC(t),ew(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?0!=(0x20000000&n)&&0==(128&t.flags)&&(nw(t),6&t.subtreeFlags&&(t.flags|=8192)):nw(t),null!==(n=t.updateQueue)&&nS(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&m(oA),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),nt(oE),nw(t),null;case 25:return null}throw Error(a(156,t.tag))}(t.alternate,t,o1);if(null!==n){oY=n;return}if(null!==(t=t.sibling)){oY=t;return}oY=t=e}while(null!==t)0===o2&&(o2=5)}function r_(e,t){do{var n=function(e,t){switch(I(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return nt(oE),N(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return U(t),null;case 13:if(eC(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));B()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return m(s8),null;case 4:return N(),null;case 10:return nt(t.type),null;case 22:case 23:return eC(t),ew(),null!==e&&m(oA),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return nt(oE),null;default:return null}}(e.alternate,e);if(null!==n){n.flags&=32767,oY=n;return}if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling)){oY=e;return}oY=e=n}while(null!==e)o2=6,oY=null}function rx(e,t,n,r,i,s,o,l,u,c){var h=is.T,d=iN();try{iL(2),is.T=null,function(e,t,n,r,i,s,o,l){do rS();while(null!==ls)if(0!=(6&oX))throw Error(a(327));var u,c,h=e.finishedWork;if(r=e.finishedLanes,null!==h){if(e.finishedWork=null,e.finishedLanes=0,h===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var d=h.lanes|h.childLanes;!function(e,t,n,r,i,a){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=s&~n;0n?32:n;n=is.T;var i=iN();try{if(iL(r),is.T=null,null===ls)var s=!1;else{r=lu,lu=null;var o=ls,l=lo;if(ls=null,lo=0,0!=(6&oX))throw Error(a(331));var u=oX;if(oX|=4,n2(o.current),nZ(o,o.current,l,r),oX=u,J(0,!1),sh&&"function"==typeof sh.onPostCommitFiberRoot)try{sh.onPostCommitFiberRoot(sc,o)}catch(e){}s=!0}return s}finally{iL(i),is.T=n,rb(e,t)}}return!1}function rM(e,t,n){t=A(n,t),t=tk(e.stateNode,t,2),null!==(e=ea(e,t,2))&&(M(e,2),Y(e))}function rw(e,t,n){if(3===e.tag)rM(e,e,n);else for(;null!==t;){if(3===t.tag){rM(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===li||!li.has(r))){e=A(n,e),null!==(r=ea(t,n=tz(2),2))&&(tB(n,r,t,e),M(r,2),Y(r));break}}t=t.return}}function rE(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new oj;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(o0=!0,i.add(n),e=rT.bind(null,e,t,n),t.then(e,e))}function rT(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,oq===e&&(oJ&n)===n&&(4===o2||3===o2&&(0x3c00000&oJ)===oJ&&300>sa()-lt?0==(2&oX)&&rl(e,0):o5|=n,o8===oJ&&(o8=0)),Y(e)}function rA(e,t){0===t&&(t=b()),null!==(e=j(e,t))&&(M(e,t),Y(e))}function rC(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),rA(e,n)}function rR(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}null!==r&&r.delete(t),rA(e,n)}function rP(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rI(e){return!(!(e=e.prototype)||!e.isReactComponent)}function rL(e,t){var r=e.alternate;return null===r?((r=n(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x1e00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function rN(e,t){e.flags&=0x1e00002;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,e.dependencies=null===(t=n.dependencies)?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function rD(e,t,r,i,s,o){var l=0;if(i=e,"function"==typeof e)rI(e)&&(l=1);else if("string"==typeof e)l=aF&&aK?ak(e,r,sM.current)?26:a2(e)?27:5:aF?ak(e,r,sM.current)?26:5:aK&&a2(e)?27:5;else e:switch(e){case r$:return rU(r.children,s,o,t);case rQ:l=8,s|=24;break;case r0:return(e=n(12,r,t,2|s)).elementType=r0,e.lanes=o,e;case r5:return(e=n(13,r,t,s)).elementType=r5,e.lanes=o,e;case r6:return(e=n(19,r,t,s)).elementType=r6,e.lanes=o,e;case r7:return rO(r,s,o,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case r1:case r3:l=10;break e;case r2:l=9;break e;case r4:l=11;break e;case r8:l=14;break e;case r9:l=16,i=null;break e}l=29,r=Error(a(130,null===e?"null":typeof e,"")),i=null}return(t=n(l,r,t,s)).elementType=e,t.type=i,t.lanes=o,t}function rU(e,t,r,i){return(e=n(7,e,i,t)).lanes=r,e}function rO(e,t,r,i){(e=n(22,e,i,t)).elementType=r7,e.lanes=r;var s={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var e=s._current;if(null===e)throw Error(a(456));if(0==(2&s._pendingVisibility)){var t=j(e,2);null!==t&&(s._pendingVisibility|=2,rt(t,e,2))}},attach:function(){var e=s._current;if(null===e)throw Error(a(456));if(0!=(2&s._pendingVisibility)){var t=j(e,2);null!==t&&(s._pendingVisibility&=-3,rt(t,e,2))}}};return e.stateNode=s,e}function rF(e,t,r){return(e=n(6,e,null,t)).lanes=r,e}function rk(e,t,r){return(t=n(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function rz(e,t,n,r,i,a,s,o){this.tag=1,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=iE,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=S(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=S(0),this.hiddenUpdates=S(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function rB(e,t,r,i,a,s,o,l,u,c,h,d){return e=new rz(e,t,r,o,l,u,c,d),t=1,!0===s&&(t|=24),s=n(3,null,null,t),e.current=s,s.stateNode=e,t=nc(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:i,isDehydrated:r,cache:t},en(s),e}function rH(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw Error(a(268,e=Object.keys(e).join(",")))}return null===(e=null!==(e=p(t))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:id(e.stateNode)}function rV(e,t,n,r,i,a){i=i?a5:a5,null===r.context?r.context=i:r.pendingContext=i,(r=ei(t)).payload={element:n},null!==(a=void 0===a?null:a)&&(r.callback=a),null!==(n=ea(e,r,t))&&(rt(n,e,t),es(n,e,t))}function rG(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n>>=0)?32:31-(a8(e)/a9|0)|0},a8=Math.log,a9=Math.LN2,a7=128,se=4194304,st=rq.unstable_scheduleCallback,sn=rq.unstable_cancelCallback,sr=rq.unstable_shouldYield,si=rq.unstable_requestPaint,sa=rq.unstable_now,ss=rq.unstable_ImmediatePriority,so=rq.unstable_UserBlockingPriority,sl=rq.unstable_NormalPriority,su=rq.unstable_IdlePriority,sc=(rq.log,rq.unstable_setDisableYieldValue,null),sh=null,sd="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},sp=new WeakMap,sf=[],sm=0,sg=null,sv=0,sy=[],s_=0,sx=null,sb=1,sS="",sM=f(null),sw=f(null),sE=f(null),sT=f(null),sA=null,sC=null,sR=!1,sP=null,sI=!1,sL=Error(a(519)),sN=[],sD=0,sU=0,sO=null,sF=null,sk=!1,sz=!1,sB=!1,sH=0,sV=null,sG=0,sW=0,sj=null,sX=!1,sq=!1,sY=Object.prototype.hasOwnProperty,sJ=Error(a(460)),sZ=Error(a(474)),sK={then:function(){}},s$=null,sQ=null,s0=0,s1=eb(!0),s2=eb(!1),s3=f(null),s4=f(0),s5=f(null),s6=null,s8=f(0),s9=0,s7=null,oe=null,ot=null,on=!1,or=!1,oi=!1,oa=0,os=0,oo=null,ol=0,ou=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},oc={readContext:no,use:eV,useCallback:eP,useContext:eP,useEffect:eP,useImperativeHandle:eP,useLayoutEffect:eP,useInsertionEffect:eP,useMemo:eP,useReducer:eP,useRef:eP,useState:eP,useDebugValue:eP,useDeferredValue:eP,useTransition:eP,useSyncExternalStore:eP,useId:eP};oc.useCacheRefresh=eP,oc.useMemoCache=eP,oc.useHostTransitionStatus=eP,oc.useFormState=eP,oc.useActionState=eP,oc.useOptimistic=eP;var oh={readContext:no,use:eV,useCallback:function(e,t){return ez().memoizedState=[e,void 0===t?null:t],e},useContext:no,useEffect:tl,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,ts(4194308,4,td.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){ts(4,2,e,t)},useMemo:function(e,t){var n=ez();t=void 0===t?null:t;var r=e();return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ez();if(void 0!==n)var i=n(t);else i=t;return r.memoizedState=r.baseState=i,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},e=e.dispatch=tE.bind(null,s7,e),[r.memoizedState,e]},useRef:function(e){return ez().memoizedState={current:e}},useState:function(e){var t=(e=e0(e)).queue,n=tT.bind(null,s7,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tf,useDeferredValue:function(e,t){return tv(ez(),e,t)},useTransition:function(){var e=e0(!1);return e=t_.bind(null,s7,e.queue,!0,!1),ez().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=s7,i=ez();if(sR){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===oq)throw Error(a(349));0!=(60&oJ)||eJ(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,tl(eK.bind(null,r,s,e),[e]),r.flags|=2048,ti(9,eZ.bind(null,r,s,n,t),{destroy:void 0},null),n},useId:function(){var e=ez(),t=oq.identifierPrefix;if(sR){var n=sS,r=sb;t=":"+t+"R"+(n=(r&~(1<<32-a6(r)-1)).toString(32)+n),0<(n=oa++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=ol++).toString(32)+":";return e.memoizedState=t},useCacheRefresh:function(){return ez().memoizedState=tw.bind(null,s7)}};oh.useMemoCache=eG,oh.useHostTransitionStatus=tb,oh.useFormState=e7,oh.useActionState=e7,oh.useOptimistic=function(e){var t=ez();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=tC.bind(null,s7,!0,n),n.dispatch=t,[e,t]};var od={readContext:no,use:eV,useCallback:tm,useContext:no,useEffect:tu,useImperativeHandle:tp,useInsertionEffect:tc,useLayoutEffect:th,useMemo:tg,useReducer:ej,useRef:ta,useState:function(){return ej(eW)},useDebugValue:tf,useDeferredValue:function(e,t){return ty(eB(),oe.memoizedState,e,t)},useTransition:function(){var e=ej(eW)[0],t=eB().memoizedState;return["boolean"==typeof e?e:eH(e),t]},useSyncExternalStore:eY,useId:tS};od.useCacheRefresh=tM,od.useMemoCache=eG,od.useHostTransitionStatus=tb,od.useFormState=te,od.useActionState=te,od.useOptimistic=function(e,t){return e1(eB(),oe,e,t)};var op={readContext:no,use:eV,useCallback:tm,useContext:no,useEffect:tu,useImperativeHandle:tp,useInsertionEffect:tc,useLayoutEffect:th,useMemo:tg,useReducer:eq,useRef:ta,useState:function(){return eq(eW)},useDebugValue:tf,useDeferredValue:function(e,t){var n=eB();return null===oe?tv(n,e,t):ty(n,oe.memoizedState,e,t)},useTransition:function(){var e=eq(eW)[0],t=eB().memoizedState;return["boolean"==typeof e?e:eH(e),t]},useSyncExternalStore:eY,useId:tS};op.useCacheRefresh=tM,op.useMemoCache=eG,op.useHostTransitionStatus=tb,op.useFormState=tr,op.useActionState=tr,op.useOptimistic=function(e,t){var n=eB();return null!==oe?e1(n,oe,e,t):(n.baseState=e,[e,n.queue.dispatch])};var of={isMounted:function(e){return!!(e=e._reactInternals)&&h(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=n7(),i=ei(r);i.payload=t,null!=n&&(i.callback=n),null!==(t=ea(e,i,r))&&(rt(t,e,r),es(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=n7(),i=ei(r);i.tag=1,i.payload=t,null!=n&&(i.callback=n),null!==(t=ea(e,i,r))&&(rt(t,e,r),es(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=n7(),r=ei(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=ea(e,r,n))&&(rt(t,e,n),es(t,e,n))}},om="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof r.default&&"function"==typeof r.default.emit)return void r.default.emit("uncaughtException",e);console.error(e)},og=Error(a(461)),ov=!1,oy={dehydrated:null,treeContext:null,retryLane:0},o_=f(null),ox=null,ob=null,oS="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},oM=rq.unstable_scheduleCallback,ow=rq.unstable_NormalPriority,oE={$$typeof:r3,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},oT=is.S;is.S=function(e,t){"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===sV){var n=sV=[];sG=0,sW=ee(),sj={status:"pending",value:void 0,then:function(e){n.push(e)}}}sG++,t.then(et,et)}(0,t),null!==oT&&oT(e,t)};var oA=f(null),oC=!1,oR=!1,oP=!1,oI="function"==typeof WeakSet?WeakSet:Set,oL=null,oN=!1,oD=null,oU=!1,oO=null,oF=8192,ok={getCacheForType:function(e){var t=no(oE),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n}},oz=0,oB=1,oH=2,oV=3,oG=4;if("function"==typeof Symbol&&Symbol.for){var oW=Symbol.for;oz=oW("selector.component"),oB=oW("selector.has_pseudo_class"),oH=oW("selector.role"),oV=oW("selector.test_id"),oG=oW("selector.text")}var oj="function"==typeof WeakMap?WeakMap:Map,oX=0,oq=null,oY=null,oJ=0,oZ=0,oK=null,o$=!1,oQ=!1,o0=!1,o1=0,o2=0,o3=0,o4=0,o5=0,o6=0,o8=0,o9=null,o7=null,le=!1,lt=0,ln=1/0,lr=null,li=null,la=!1,ls=null,lo=0,ll=0,lu=null,lc=0,lh=null;return rj.attemptContinuousHydration=function(e){if(13===e.tag){var t=j(e,0x4000000);null!==t&&rt(t,e,0x4000000),rW(e,0x4000000)}},rj.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=n7(),n=j(e,t);null!==n&&rt(n,e,t),rW(e,t)}},rj.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var t=v(e.pendingLanes);if(0!==t){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-a6(t);e.entanglements[1]|=n,t&=~n}Y(e),0==(6&oX)&&(ln=sa()+500,J(0,!1))}}break;case 13:null!==(t=j(e,2))&&rt(t,e,2),rs(),rW(e,2)}},rj.batchedUpdates=function(e,t){return e(t)},rj.createComponentSelector=function(e){return{$$typeof:oz,value:e}},rj.createContainer=function(e,t,n,r,i,a,s,o,l,u){return rB(e,t,!1,null,n,r,a,s,o,l,u,null)},rj.createHasPseudoClassSelector=function(e){return{$$typeof:oB,value:e}},rj.createHydrationContainer=function(e,t,n,r,i,a,s,o,l,u,c,h,d){var p;return(e=rB(n,r,!0,e,i,a,o,l,u,c,h,d)).context=(p=null,a5),n=e.current,(i=ei(r=n7())).callback=null!=t?t:null,ea(n,i,r),e.current.lanes=r,M(e,r),Y(e),e},rj.createPortal=function(e,t,n){var r=3=c&&s>=d&&i<=h&&o<=p){e.splice(t,1);break}if(r!==c||n.width!==u.width||po){if(!(s!==d||n.height!==u.height||hi)){c>r&&(u.width+=c-r,u.x=r),hs&&(u.height+=d-s,u.y=s),pn&&(n=l)),l ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},rj.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return id(e.child.stateNode);default:return e.child.stateNode}},rj.injectIntoDevTools=function(){var e={bundleType:0,version:iu,rendererPackageName:ic,currentDispatcherRef:is,findFiberByHostInstance:iP,reconcilerVersion:"19.0.0"};if(null!==ih&&(e.rendererConfig=ih),"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{sc=t.inject(e),sh=t}catch(e){}e=!!t.checkDCE}}return e},rj.isAlreadyRendering=function(){return!1},rj.observeVisibleRects=function(e,t,n,r){if(!iq)throw Error(a(363));var i=i0(e=n9(e,t),n,r).disconnect;return{disconnect:function(){i()}}},rj.shouldError=function(){return null},rj.shouldSuspend=function(){return!1},rj.startHostTransition=function(e,t,n,r){if(5!==e.tag)throw Error(a(476));var s=tx(e).queue;t_(e,s,t,iV,null===n?i:function(){var t=tx(e).next.queue;return tA(e,t,{},n7()),n(r)})},rj.updateContainer=function(e,t,n,r){var i=t.current,a=n7();return rV(i,a,e,t,n,r),a},rj.updateContainerSync=function(e,t,n,r){return 0===t.tag&&rS(),rV(t.current,2,e,t,n,r),2},rj},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})},98133,(e,t,n)=>{"use strict";t.exports=e.r(40336)},45015,(e,t,n)=>{"use strict";function r(e,t){var n=e.length;for(e.push(t);0>>1,i=e[r];if(0>>1;rs(l,n))us(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[o]=n,r=o);else if(us(c,n))e[r]=c,e[u]=n,r=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,y=!1,_="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=i(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,r(h,t);else break;t=i(d)}}function M(e){if(y=!1,S(e),!v)if(null!==i(h))v=!0,L();else{var t=i(d);null!==t&&N(M,t.startTime-e)}}var w=!1,E=-1,T=5,A=-1;function C(){return!(n.unstable_now()-Ae&&C());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,S(e),t=!0;break t}f===i(h)&&a(h),S(e)}else a(h);f=i(h)}if(null!==f)t=!0;else{var u=i(d);null!==u&&N(M,u.startTime-e),t=!1}}break e}finally{f=null,m=r,g=!1}}}finally{t?o():w=!1}}}if("function"==typeof b)o=function(){b(R)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=R,o=function(){I.postMessage(null)}}else o=function(){_(R,0)};function L(){w||(w=!0,o())}function N(e,t){E=_(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_continueExecution=function(){v||g||(v=!0,L())},n.unstable_forceFrameRate=function(e){0>e||125s?(e.sortIndex=a,r(d,e),null===i(h)&&e===i(d)&&(y?(x(E),E=-1):y=!0,N(M,a-s))):(e.sortIndex=o,r(h,e),v||g||(v=!0,L())),e},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},95087,(e,t,n)=>{"use strict";t.exports=e.r(45015)},16096,90072,8560,8155,46791,46712,5230,e=>{"use strict";let t,n,r,i,a,s,o,l,u,c;e.s(["useThree",()=>pj],16096),e.s(["B",()=>pb,"C",()=>pj,"D",()=>pX,"E",()=>pS,"G",()=>pJ,"a",()=>p_,"b",()=>py,"c",()=>fa,"d",()=>fo,"e",()=>p0,"f",()=>fE,"i",()=>pg,"j",()=>ff,"k",()=>fm,"o",()=>fl,"s",()=>pO,"u",()=>px],46712),e.i(47167);var h=e.i(71645),d=e.i(39695);e.s(["ACESFilmicToneMapping",()=>ef,"AddEquation",()=>N,"AddOperation",()=>eu,"AdditiveAnimationBlendMode",()=>tH,"AdditiveBlending",()=>R,"AgXToneMapping",()=>eg,"AlphaFormat",()=>e$,"AlwaysCompare",()=>nm,"AlwaysDepth",()=>ee,"AlwaysStencilFunc",()=>no,"AmbientLight",()=>un,"AnimationAction",()=>uY,"AnimationClip",()=>lU,"AnimationLoader",()=>lG,"AnimationMixer",()=>uZ,"AnimationObjectGroup",()=>uq,"AnimationUtils",()=>lS,"ArcCurve",()=>od,"ArrayCamera",()=>uS,"ArrowHelper",()=>ck,"AttachedBindMode",()=>ey,"Audio",()=>uP,"AudioAnalyser",()=>uO,"AudioContext",()=>ug,"AudioListener",()=>uR,"AudioLoader",()=>uv,"AxesHelper",()=>cz,"BackSide",()=>E,"BasicDepthPacking",()=>tj,"BasicShadowMap",()=>x,"BatchedMesh",()=>sL,"Bone",()=>a1,"BooleanKeyframeTrack",()=>lC,"Box2",()=>cr,"Box3",()=>rf,"Box3Helper",()=>cU,"BoxGeometry",()=>ai,"BoxHelper",()=>cD,"BufferAttribute",()=>iF,"BufferGeometry",()=>i0,"BufferGeometryLoader",()=>uu,"ByteType",()=>eB,"Cache",()=>lO,"Camera",()=>ac,"CameraHelper",()=>cI,"CanvasTexture",()=>s6,"CapsuleGeometry",()=>s7,"CatmullRomCurve3",()=>oy,"CineonToneMapping",()=>ep,"CircleGeometry",()=>oe,"ClampToEdgeWrapping",()=>eA,"Clock",()=>uM,"Color",()=>iE,"ColorKeyframeTrack",()=>lR,"ColorManagement",()=>n8,"CompressedArrayTexture",()=>s4,"CompressedCubeTexture",()=>s5,"CompressedTexture",()=>s3,"CompressedTextureLoader",()=>lW,"ConeGeometry",()=>on,"ConstantAlphaFactor",()=>K,"ConstantColorFactor",()=>J,"Controls",()=>cH,"CubeCamera",()=>am,"CubeReflectionMapping",()=>eb,"CubeRefractionMapping",()=>eS,"CubeTexture",()=>ag,"CubeTextureLoader",()=>lq,"CubeUVReflectionMapping",()=>eE,"CubicBezierCurve",()=>oS,"CubicBezierCurve3",()=>oM,"CubicInterpolant",()=>lw,"CullFaceBack",()=>v,"CullFaceFront",()=>y,"CullFaceFrontBack",()=>_,"CullFaceNone",()=>g,"Curve",()=>oc,"CurvePath",()=>oP,"CustomBlending",()=>L,"CustomToneMapping",()=>em,"CylinderGeometry",()=>ot,"Cylindrical",()=>ce,"Data3DTexture",()=>rd,"DataArrayTexture",()=>rc,"DataTexture",()=>a2,"DataTextureLoader",()=>lY,"DataUtils",()=>iN,"DecrementStencilOp",()=>t6,"DecrementWrapStencilOp",()=>t9,"DefaultLoadingManager",()=>lk,"DepthFormat",()=>e1,"DepthStencilFormat",()=>e2,"DepthTexture",()=>s8,"DetachedBindMode",()=>e_,"DirectionalLight",()=>ut,"DirectionalLightHelper",()=>cC,"DiscreteInterpolant",()=>lT,"DodecahedronGeometry",()=>oi,"DoubleSide",()=>T,"DstAlphaFactor",()=>W,"DstColorFactor",()=>X,"DynamicCopyUsage",()=>nM,"DynamicDrawUsage",()=>nv,"DynamicReadUsage",()=>nx,"EdgesGeometry",()=>ou,"EllipseCurve",()=>oh,"EqualCompare",()=>nc,"EqualDepth",()=>er,"EqualStencilFunc",()=>nn,"EquirectangularReflectionMapping",()=>eM,"EquirectangularRefractionMapping",()=>ew,"Euler",()=>rK,"EventDispatcher",()=>nL,"ExternalTexture",()=>s9,"ExtrudeGeometry",()=>oQ,"FileLoader",()=>lV,"Float16BufferAttribute",()=>ij,"Float32BufferAttribute",()=>iX,"FloatType",()=>ej,"Fog",()=>aS,"FogExp2",()=>ab,"FramebufferTexture",()=>s2,"FrontSide",()=>w,"Frustum",()=>sd,"FrustumArray",()=>sm,"GLBufferAttribute",()=>u2,"GLSL1",()=>nE,"GLSL3",()=>nT,"GreaterCompare",()=>nd,"GreaterDepth",()=>ea,"GreaterEqualCompare",()=>nf,"GreaterEqualDepth",()=>ei,"GreaterEqualStencilFunc",()=>ns,"GreaterStencilFunc",()=>ni,"GridHelper",()=>cM,"Group",()=>ay,"HalfFloatType",()=>eX,"HemisphereLight",()=>lK,"HemisphereLightHelper",()=>cS,"IcosahedronGeometry",()=>o1,"ImageBitmapLoader",()=>um,"ImageLoader",()=>lX,"ImageUtils",()=>re,"IncrementStencilOp",()=>t5,"IncrementWrapStencilOp",()=>t8,"InstancedBufferAttribute",()=>a6,"InstancedBufferGeometry",()=>ul,"InstancedInterleavedBuffer",()=>u1,"InstancedMesh",()=>si,"Int16BufferAttribute",()=>iH,"Int32BufferAttribute",()=>iG,"Int8BufferAttribute",()=>ik,"IntType",()=>eG,"InterleavedBuffer",()=>aw,"InterleavedBufferAttribute",()=>aT,"Interpolant",()=>lM,"InterpolateDiscrete",()=>tD,"InterpolateLinear",()=>tU,"InterpolateSmooth",()=>tO,"InterpolationSamplingMode",()=>nI,"InterpolationSamplingType",()=>nP,"InvertStencilOp",()=>t7,"KeepStencilOp",()=>t3,"KeyframeTrack",()=>lA,"LOD",()=>aW,"LatheGeometry",()=>o2,"Layers",()=>r$,"LessCompare",()=>nu,"LessDepth",()=>et,"LessEqualCompare",()=>nh,"LessEqualDepth",()=>en,"LessEqualStencilFunc",()=>nr,"LessStencilFunc",()=>nt,"Light",()=>lZ,"LightProbe",()=>ua,"Line",()=>sH,"Line3",()=>ch,"LineBasicMaterial",()=>sN,"LineCurve",()=>ow,"LineCurve3",()=>oE,"LineDashedMaterial",()=>lg,"LineLoop",()=>sX,"LineSegments",()=>sj,"LinearFilter",()=>eD,"LinearInterpolant",()=>lE,"LinearMipMapLinearFilter",()=>ek,"LinearMipMapNearestFilter",()=>eO,"LinearMipmapLinearFilter",()=>eF,"LinearMipmapNearestFilter",()=>eU,"LinearSRGBColorSpace",()=>tQ,"LinearToneMapping",()=>eh,"LinearTransfer",()=>t0,"Loader",()=>lz,"LoaderUtils",()=>uo,"LoadingManager",()=>lF,"LoopOnce",()=>tI,"LoopPingPong",()=>tN,"LoopRepeat",()=>tL,"MOUSE",()=>f,"Material",()=>iC,"MaterialLoader",()=>us,"MathUtils",()=>nG,"Matrix2",()=>ct,"Matrix3",()=>nJ,"Matrix4",()=>rH,"MaxEquation",()=>F,"Mesh",()=>an,"MeshBasicMaterial",()=>iR,"MeshDepthMaterial",()=>lp,"MeshDistanceMaterial",()=>lf,"MeshLambertMaterial",()=>ld,"MeshMatcapMaterial",()=>lm,"MeshNormalMaterial",()=>lh,"MeshPhongMaterial",()=>lu,"MeshPhysicalMaterial",()=>ll,"MeshStandardMaterial",()=>lo,"MeshToonMaterial",()=>lc,"MinEquation",()=>O,"MirroredRepeatWrapping",()=>eC,"MixOperation",()=>el,"MultiplyBlending",()=>I,"MultiplyOperation",()=>eo,"NearestFilter",()=>eR,"NearestMipMapLinearFilter",()=>eN,"NearestMipMapNearestFilter",()=>eI,"NearestMipmapLinearFilter",()=>eL,"NearestMipmapNearestFilter",()=>eP,"NeutralToneMapping",()=>ev,"NeverCompare",()=>nl,"NeverDepth",()=>Q,"NeverStencilFunc",()=>ne,"NoBlending",()=>A,"NoColorSpace",()=>tK,"NoToneMapping",()=>ec,"NormalAnimationBlendMode",()=>tB,"NormalBlending",()=>C,"NotEqualCompare",()=>np,"NotEqualDepth",()=>es,"NotEqualStencilFunc",()=>na,"NumberKeyframeTrack",()=>lP,"Object3D",()=>ia,"ObjectLoader",()=>uc,"ObjectSpaceNormalMap",()=>tZ,"OctahedronGeometry",()=>o3,"OneFactor",()=>z,"OneMinusConstantAlphaFactor",()=>$,"OneMinusConstantColorFactor",()=>Z,"OneMinusDstAlphaFactor",()=>j,"OneMinusDstColorFactor",()=>q,"OneMinusSrcAlphaFactor",()=>G,"OneMinusSrcColorFactor",()=>H,"OrthographicCamera",()=>l7,"PCFShadowMap",()=>b,"PCFSoftShadowMap",()=>S,"Path",()=>oI,"PerspectiveCamera",()=>af,"Plane",()=>sl,"PlaneGeometry",()=>o4,"PlaneHelper",()=>cO,"PointLight",()=>l9,"PointLightHelper",()=>cy,"Points",()=>s$,"PointsMaterial",()=>sq,"PolarGridHelper",()=>cw,"PolyhedronGeometry",()=>or,"PositionalAudio",()=>uU,"PropertyBinding",()=>uX,"PropertyMixer",()=>uF,"QuadraticBezierCurve",()=>oT,"QuadraticBezierCurve3",()=>oA,"Quaternion",()=>nj,"QuaternionKeyframeTrack",()=>lL,"QuaternionLinearInterpolant",()=>lI,"RAD2DEG",()=>nO,"RED_GREEN_RGTC2_Format",()=>tR,"RED_RGTC1_Format",()=>tA,"REVISION",()=>p,"RGBADepthPacking",()=>tX,"RGBAFormat",()=>e0,"RGBAIntegerFormat",()=>e9,"RGBA_ASTC_10x10_Format",()=>tb,"RGBA_ASTC_10x5_Format",()=>ty,"RGBA_ASTC_10x6_Format",()=>t_,"RGBA_ASTC_10x8_Format",()=>tx,"RGBA_ASTC_12x10_Format",()=>tS,"RGBA_ASTC_12x12_Format",()=>tM,"RGBA_ASTC_4x4_Format",()=>tc,"RGBA_ASTC_5x4_Format",()=>th,"RGBA_ASTC_5x5_Format",()=>td,"RGBA_ASTC_6x5_Format",()=>tp,"RGBA_ASTC_6x6_Format",()=>tf,"RGBA_ASTC_8x5_Format",()=>tm,"RGBA_ASTC_8x6_Format",()=>tg,"RGBA_ASTC_8x8_Format",()=>tv,"RGBA_BPTC_Format",()=>tw,"RGBA_ETC2_EAC_Format",()=>tu,"RGBA_PVRTC_2BPPV1_Format",()=>ts,"RGBA_PVRTC_4BPPV1_Format",()=>ta,"RGBA_S3TC_DXT1_Format",()=>te,"RGBA_S3TC_DXT3_Format",()=>tt,"RGBA_S3TC_DXT5_Format",()=>tn,"RGBDepthPacking",()=>tq,"RGBFormat",()=>eQ,"RGBIntegerFormat",()=>e8,"RGB_BPTC_SIGNED_Format",()=>tE,"RGB_BPTC_UNSIGNED_Format",()=>tT,"RGB_ETC1_Format",()=>to,"RGB_ETC2_Format",()=>tl,"RGB_PVRTC_2BPPV1_Format",()=>ti,"RGB_PVRTC_4BPPV1_Format",()=>tr,"RGB_S3TC_DXT1_Format",()=>e7,"RGDepthPacking",()=>tY,"RGFormat",()=>e5,"RGIntegerFormat",()=>e6,"RawShaderMaterial",()=>ls,"Ray",()=>rB,"Raycaster",()=>u4,"RectAreaLight",()=>ur,"RedFormat",()=>e3,"RedIntegerFormat",()=>e4,"ReinhardToneMapping",()=>ed,"RenderTarget",()=>rl,"RenderTarget3D",()=>uK,"RepeatWrapping",()=>eT,"ReplaceStencilOp",()=>t4,"ReverseSubtractEquation",()=>U,"RingGeometry",()=>o5,"SIGNED_RED_GREEN_RGTC2_Format",()=>tP,"SIGNED_RED_RGTC1_Format",()=>tC,"SRGBColorSpace",()=>t$,"SRGBTransfer",()=>t1,"Scene",()=>aM,"ShaderMaterial",()=>au,"ShadowMaterial",()=>la,"Shape",()=>oL,"ShapeGeometry",()=>o6,"ShapePath",()=>cB,"ShapeUtils",()=>oZ,"ShortType",()=>eH,"Skeleton",()=>a5,"SkeletonHelper",()=>cv,"SkinnedMesh",()=>a0,"Source",()=>rn,"Sphere",()=>rL,"SphereGeometry",()=>o8,"Spherical",()=>u7,"SphericalHarmonics3",()=>ui,"SplineCurve",()=>oC,"SpotLight",()=>l3,"SpotLightHelper",()=>cp,"Sprite",()=>aB,"SpriteMaterial",()=>aA,"SrcAlphaFactor",()=>V,"SrcAlphaSaturateFactor",()=>Y,"SrcColorFactor",()=>B,"StaticCopyUsage",()=>nS,"StaticDrawUsage",()=>ng,"StaticReadUsage",()=>n_,"StereoCamera",()=>ub,"StreamCopyUsage",()=>nw,"StreamDrawUsage",()=>ny,"StreamReadUsage",()=>nb,"StringKeyframeTrack",()=>lN,"SubtractEquation",()=>D,"SubtractiveBlending",()=>P,"TOUCH",()=>m,"TangentSpaceNormalMap",()=>tJ,"TetrahedronGeometry",()=>o9,"Texture",()=>rs,"TextureLoader",()=>lJ,"TextureUtils",()=>cG,"Timer",()=>u8,"TimestampQuery",()=>nR,"TorusGeometry",()=>o7,"TorusKnotGeometry",()=>le,"Triangle",()=>ix,"TriangleFanDrawMode",()=>tW,"TriangleStripDrawMode",()=>tG,"TrianglesDrawMode",()=>tV,"TubeGeometry",()=>lt,"UVMapping",()=>ex,"Uint16BufferAttribute",()=>iV,"Uint32BufferAttribute",()=>iW,"Uint8BufferAttribute",()=>iz,"Uint8ClampedBufferAttribute",()=>iB,"Uniform",()=>u$,"UniformsGroup",()=>u0,"UniformsUtils",()=>al,"UnsignedByteType",()=>ez,"UnsignedInt101111Type",()=>eK,"UnsignedInt248Type",()=>eJ,"UnsignedInt5999Type",()=>eZ,"UnsignedIntType",()=>eW,"UnsignedShort4444Type",()=>eq,"UnsignedShort5551Type",()=>eY,"UnsignedShortType",()=>eV,"VSMShadowMap",()=>M,"Vector2",()=>nW,"Vector3",()=>nX,"Vector4",()=>ro,"VectorKeyframeTrack",()=>lD,"VideoFrameTexture",()=>s1,"VideoTexture",()=>s0,"WebGL3DRenderTarget",()=>rp,"WebGLArrayRenderTarget",()=>rh,"WebGLCoordinateSystem",()=>nA,"WebGLCubeRenderTarget",()=>av,"WebGLRenderTarget",()=>ru,"WebGPUCoordinateSystem",()=>nC,"WebXRController",()=>ax,"WireframeGeometry",()=>ln,"WrapAroundEnding",()=>tz,"ZeroCurvatureEnding",()=>tF,"ZeroFactor",()=>k,"ZeroSlopeEnding",()=>tk,"ZeroStencilOp",()=>t2,"arrayNeedsUint32",()=>nK,"cloneUniforms",()=>aa,"createCanvasElement",()=>n1,"createElementNS",()=>n0,"getByteLength",()=>cV,"getUnlitUniformColorSpace",()=>ao,"mergeUniforms",()=>as,"probeAsync",()=>n4,"warnOnce",()=>n3],90072);let p="180",f={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},m={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},g=0,v=1,y=2,_=3,x=0,b=1,S=2,M=3,w=0,E=1,T=2,A=0,C=1,R=2,P=3,I=4,L=5,N=100,D=101,U=102,O=103,F=104,k=200,z=201,B=202,H=203,V=204,G=205,W=206,j=207,X=208,q=209,Y=210,J=211,Z=212,K=213,$=214,Q=0,ee=1,et=2,en=3,er=4,ei=5,ea=6,es=7,eo=0,el=1,eu=2,ec=0,eh=1,ed=2,ep=3,ef=4,em=5,eg=6,ev=7,ey="attached",e_="detached",ex=300,eb=301,eS=302,eM=303,ew=304,eE=306,eT=1e3,eA=1001,eC=1002,eR=1003,eP=1004,eI=1004,eL=1005,eN=1005,eD=1006,eU=1007,eO=1007,eF=1008,ek=1008,ez=1009,eB=1010,eH=1011,eV=1012,eG=1013,eW=1014,ej=1015,eX=1016,eq=1017,eY=1018,eJ=1020,eZ=35902,eK=35899,e$=1021,eQ=1022,e0=1023,e1=1026,e2=1027,e3=1028,e4=1029,e5=1030,e6=1031,e8=1032,e9=1033,e7=33776,te=33777,tt=33778,tn=33779,tr=35840,ti=35841,ta=35842,ts=35843,to=36196,tl=37492,tu=37496,tc=37808,th=37809,td=37810,tp=37811,tf=37812,tm=37813,tg=37814,tv=37815,ty=37816,t_=37817,tx=37818,tb=37819,tS=37820,tM=37821,tw=36492,tE=36494,tT=36495,tA=36283,tC=36284,tR=36285,tP=36286,tI=2200,tL=2201,tN=2202,tD=2300,tU=2301,tO=2302,tF=2400,tk=2401,tz=2402,tB=2500,tH=2501,tV=0,tG=1,tW=2,tj=3200,tX=3201,tq=3202,tY=3203,tJ=0,tZ=1,tK="",t$="srgb",tQ="srgb-linear",t0="linear",t1="srgb",t2=0,t3=7680,t4=7681,t5=7682,t6=7683,t8=34055,t9=34056,t7=5386,ne=512,nt=513,nn=514,nr=515,ni=516,na=517,ns=518,no=519,nl=512,nu=513,nc=514,nh=515,nd=516,np=517,nf=518,nm=519,ng=35044,nv=35048,ny=35040,n_=35045,nx=35049,nb=35041,nS=35046,nM=35050,nw=35042,nE="100",nT="300 es",nA=2e3,nC=2001,nR={COMPUTE:"compute",RENDER:"render"},nP={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},nI={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};class nL{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return void 0!==n&&void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){let n=this._listeners;if(void 0===n)return;let r=n[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+nN[e>>16&255]+nN[e>>24&255]+"-"+nN[255&t]+nN[t>>8&255]+"-"+nN[t>>16&15|64]+nN[t>>24&255]+"-"+nN[63&n|128]+nN[n>>8&255]+"-"+nN[n>>16&255]+nN[n>>24&255]+nN[255&r]+nN[r>>8&255]+nN[r>>16&255]+nN[r>>24&255]).toLowerCase()}function nk(e,t,n){return Math.max(t,Math.min(n,e))}function nz(e,t){return(e%t+t)%t}function nB(e,t,n){return(1-n)*e+n*t}function nH(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function nV(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let nG={DEG2RAD:nU,RAD2DEG:nO,generateUUID:nF,clamp:nk,euclideanModulo:nz,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:nB,damp:function(e,t,n,r){return nB(e,t,1-Math.exp(-n*r))},pingpong:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(nz(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(nD=e);let t=nD+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*nU},radToDeg:function(e){return e*nO},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+r)/2),c=s((t+r)/2),h=a((t-r)/2),d=s((t-r)/2),p=a((r-t)/2),f=s((r-t)/2);switch(i){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:nV,denormalize:nH};class nW{get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(nk(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}constructor(e=0,t=0){nW.prototype.isVector2=!0,this.x=e,this.y=t}}class nj{static slerpFlat(e,t,n,r,i,a,s){let o=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(1===s){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==h||l!==d||u!==p){let e=1-s,t=o*h+l*d+u*p+c*f,n=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,s=Math.sin(s*a)/i}let i=s*n;if(o=o*e+h*i,l=l*e+d*i,u=u*e+p*i,c=c*e+f*i,e===1-s){let e=1/Math.sqrt(o*o+l*l+u*u+c*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,a){let s=n[r],o=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=e._x,r=e._y,i=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(r/2),c=s(i/2),h=o(n/2),d=o(r/2),p=o(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(i-l)*e,this._z=(a-r)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(i-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-r)/e,this._x=(i+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(nk(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+r*l-i*o,this._y=r*u+a*o+i*s-n*l,this._z=i*u+a*l+n*o-r*s,this._w=a*u-n*s-r*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,s=a*e._w+n*e._x+r*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let l=Math.sqrt(o),u=Math.atan2(l,s),c=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=a*c+this._w*h,this._x=n*c+this._x*h,this._y=r*c+this._y*h,this._z=i*c+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}}class nX{set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(nY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(nY.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*r-s*n),u=2*(s*t-i*r),c=2*(i*n-a*t);return this.x=t+o*l+a*c-s*u,this.y=n+o*u+s*l-i*c,this.z=r+o*c+i*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this.z=nk(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this.z=nk(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,s=t.y,o=t.z;return this.x=r*o-i*s,this.y=i*a-n*o,this.z=n*s-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return nq.copy(this).projectOnVector(e),this.sub(nq)}reflect(e){return this.sub(nq.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(nk(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}constructor(e=0,t=0,n=0){nX.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}}let nq=new nX,nY=new nj;class nJ{set(e,t,n,r,i,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=r,u[2]=s,u[3]=t,u[4]=i,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],_=r[7],x=r[2],b=r[5],S=r[8];return i[0]=a*f+s*v+o*x,i[3]=a*m+s*y+o*b,i[6]=a*g+s*_+o*S,i[1]=l*f+u*v+c*x,i[4]=l*m+u*y+c*b,i[7]=l*g+u*_+c*S,i[2]=h*f+d*v+p*x,i[5]=h*m+d*y+p*b,i[8]=h*g+d*_+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*i*u+n*s*o+r*i*l-r*a*o}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*i,d=l*i-a*o,p=t*c+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(r*l-u*n)*f,e[2]=(s*n-r*a)*f,e[3]=h*f,e[4]=(u*t-r*o)*f,e[5]=(r*i-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*i)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,s){let o=Math.cos(i),l=Math.sin(i);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-r*l,r*o,-r*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(nZ.makeScale(e,t)),this}rotate(e){return this.premultiply(nZ.makeRotation(-e)),this}translate(e,t){return this.premultiply(nZ.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}constructor(e,t,n,r,i,a,s,o,l){nJ.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,a,s,o,l)}}let nZ=new nJ;function nK(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let n$={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function nQ(e,t){return new n$[e](t)}function n0(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function n1(){let e=n0("canvas");return e.style.display="block",e}let n2={};function n3(e){e in n2||(n2[e]=!0,console.warn(e))}function n4(e,t,n){return new Promise(function(r,i){setTimeout(function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}},n)})}let n5=new nJ().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),n6=new nJ().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),n8=function(){let e={enabled:!0,workingColorSpace:tQ,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n&&(this.spaces[t].transfer===t1&&(e.r=n9(e.r),e.g=n9(e.g),e.b=n9(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===t1&&(e.r=n7(e.r),e.g=n7(e.g),e.b=n7(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===tK?t0:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.workingColorSpace;return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.workingColorSpace;return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return n3("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return n3("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[tQ]:{primaries:t,whitePoint:r,transfer:t0,toXYZ:n5,fromXYZ:n6,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:t$},outputColorSpaceConfig:{drawingBufferColorSpace:t$}},[t$]:{primaries:t,whitePoint:r,transfer:t1,toXYZ:n5,fromXYZ:n6,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:t$}}}),e}();function n9(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function n7(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class re{static getDataURL(e){let n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/png";if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)n=e;else{void 0===t&&(t=n0("canvas")),t.width=e.width,t.height=e.height;let r=t.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=t}return n.toDataURL(r)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=n0("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ex)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case eT:e.x=e.x-Math.floor(e.x);break;case eA:e.x=e.x<0?0:1;break;case eC:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case eT:e.y=e.y-Math.floor(e.y);break;case eA:e.y=e.y<0?0:1;break;case eC:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}constructor(e=rs.DEFAULT_IMAGE,t=rs.DEFAULT_MAPPING,n=eA,r=eA,i=eD,a=eF,s=e0,o=ez,l=rs.DEFAULT_ANISOTROPY,u=tK){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ri++}),this.uuid=nF(),this.name="",this.source=new rn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new nW(0,0),this.repeat=new nW(1,1),this.center=new nW(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nJ,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}}rs.DEFAULT_IMAGE=null,rs.DEFAULT_MAPPING=ex,rs.DEFAULT_ANISOTROPY=1;class ro{get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=e.elements,s=a[0],o=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-u)&&.01>Math.abs(l-d)&&.01>Math.abs(h-p)){if(.1>Math.abs(o+u)&&.1>Math.abs(l+d)&&.1>Math.abs(h+p)&&.1>Math.abs(s+c+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+u)/4,v=(l+d)/4,y=(h+p)/4;return e>a&&e>m?e<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(e)),i=v/n):a>m?a<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(a)),i=y/r):m<.01?(n=.707106781,r=.707106781,i=0):(n=v/(i=Math.sqrt(m)),r=y/i),this.set(n,r,i,t),this}let m=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-o)*(u-o));return .001>Math.abs(m)&&(m=1),this.x=(p-h)/m,this.y=(l-d)/m,this.z=(u-o)/m,this.w=Math.acos((s+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this.z=nk(this.z,e.z,t.z),this.w=nk(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this.z=nk(this.z,e,t),this.w=nk(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}constructor(e=0,t=0,n=0,r=1){ro.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}}class rl extends nL{_setTextureOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={minFilter:eD,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);let n=e.geometry;if(void 0!==n){let r=n.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,n=r.count;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,rg),rg.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(rw),rE.subVectors(this.max,rw),ry.subVectors(e.a,rw),r_.subVectors(e.b,rw),rx.subVectors(e.c,rw),rb.subVectors(r_,ry),rS.subVectors(rx,r_),rM.subVectors(ry,rx);let t=[0,-rb.z,rb.y,0,-rS.z,rS.y,0,-rM.z,rM.y,rb.z,0,-rb.x,rS.z,0,-rS.x,rM.z,0,-rM.x,-rb.y,rb.x,0,-rS.y,rS.x,0,-rM.y,rM.x,0];return!!rC(t,ry,r_,rx,rE)&&!!rC(t=[1,0,0,0,1,0,0,0,1],ry,r_,rx,rE)&&(rT.crossVectors(rb,rS),rC(t=[rT.x,rT.y,rT.z],ry,r_,rx,rE))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,rg).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(rg).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(rm[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rm[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rm[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rm[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rm[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rm[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rm[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rm[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rm)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}constructor(e=new nX(Infinity,Infinity,Infinity),t=new nX(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}}let rm=[new nX,new nX,new nX,new nX,new nX,new nX,new nX,new nX],rg=new nX,rv=new rf,ry=new nX,r_=new nX,rx=new nX,rb=new nX,rS=new nX,rM=new nX,rw=new nX,rE=new nX,rT=new nX,rA=new nX;function rC(e,t,n,r,i){for(let a=0,s=e.length-3;a<=s;a+=3){rA.fromArray(e,a);let s=i.x*Math.abs(rA.x)+i.y*Math.abs(rA.y)+i.z*Math.abs(rA.z),o=t.dot(rA),l=n.dot(rA),u=r.dot(rA);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let rR=new rf,rP=new nX,rI=new nX;class rL{set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):rR.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;rP.subVectors(e,this.center);let t=rP.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(rP,n/e),this.radius+=n}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(rI.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(rP.copy(e.center).add(rI)),this.expandByPoint(rP.copy(e.center).sub(rI)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}constructor(e=new nX,t=-1){this.isSphere=!0,this.center=e,this.radius=t}}let rN=new nX,rD=new nX,rU=new nX,rO=new nX,rF=new nX,rk=new nX,rz=new nX;class rB{set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,rN)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=rN.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(rN.copy(this.origin).addScaledVector(this.direction,t),rN.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){let i,a,s,o;rD.copy(e).add(t).multiplyScalar(.5),rU.copy(t).sub(e).normalize(),rO.copy(this.origin).sub(rD);let l=.5*e.distanceTo(t),u=-this.direction.dot(rU),c=rO.dot(this.direction),h=-rO.dot(rU),d=rO.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(i=u*h-c,a=u*c-h,o=l*p,i>=0)if(a>=-o)if(a<=o){let e=1/p;i*=e,a*=e,s=i*(i+u*a+2*c)+a*(u*i+a+2*h)+d}else s=-(i=Math.max(0,-(u*(a=l)+c)))*i+a*(a+2*h)+d;else s=-(i=Math.max(0,-(u*(a=-l)+c)))*i+a*(a+2*h)+d;else a<=-o?(a=(i=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d):a<=o?(i=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(i=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d);else a=u>0?-l:l,s=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,i),r&&r.copy(rD).addScaledVector(rU,a),s}intersectSphere(e,t){rN.subVectors(e.center,this.origin);let n=rN.dot(this.direction),r=rN.dot(rN)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let n,r,i,a,s,o,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return(l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>r||((s>n||n!=n)&&(n=s),(o=0?n:r,t)}intersectsBox(e){return null!==this.intersectBox(e,rN)}intersectTriangle(e,t,n,r,i){let a;rF.subVectors(t,e),rk.subVectors(n,e),rz.crossVectors(rF,rk);let s=this.direction.dot(rz);if(s>0){if(r)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}rO.subVectors(this.origin,e);let o=a*this.direction.dot(rk.crossVectors(rO,rk));if(o<0)return null;let l=a*this.direction.dot(rF.cross(rO));if(l<0||o+l>s)return null;let u=-a*rO.dot(rz);return u<0?null:this.at(u/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}constructor(e=new nX,t=new nX(0,0,-1)){this.origin=e,this.direction=t}}class rH{set(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new rH().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/rV.setFromMatrixColumn(e,0).length(),i=1/rV.setFromMatrixColumn(e,1).length(),a=1/rV.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-s*o,t[2]=i-e*l,t[6]=r+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e+i*s,t[4]=r*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-r,t[6]=i+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e-i*s,t[4]=-a*c,t[8]=r+n*s,t[1]=n+r*s,t[5]=a*u,t[9]=i-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=r*l-n,t[8]=e*l+i,t[1]=o*c,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+i,t[5]=a*u,t[9]=n*c-r,t[2]=r*c-n,t[6]=s*u,t[10]=i*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rW,e,rj)}lookAt(e,t,n){let r=this.elements;return rY.subVectors(e,t),0===rY.lengthSq()&&(rY.z=1),rY.normalize(),rX.crossVectors(n,rY),0===rX.lengthSq()&&(1===Math.abs(n.z)?rY.x+=1e-4:rY.z+=1e-4,rY.normalize(),rX.crossVectors(n,rY)),rX.normalize(),rq.crossVectors(rY,rX),r[0]=rX.x,r[4]=rq.x,r[8]=rY.x,r[1]=rX.y,r[5]=rq.y,r[9]=rY.y,r[2]=rX.z,r[6]=rq.z,r[10]=rY.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],_=n[11],x=n[15],b=r[0],S=r[4],M=r[8],w=r[12],E=r[1],T=r[5],A=r[9],C=r[13],R=r[2],P=r[6],I=r[10],L=r[14],N=r[3],D=r[7],U=r[11],O=r[15];return i[0]=a*b+s*E+o*R+l*N,i[4]=a*S+s*T+o*P+l*D,i[8]=a*M+s*A+o*I+l*U,i[12]=a*w+s*C+o*L+l*O,i[1]=u*b+c*E+h*R+d*N,i[5]=u*S+c*T+h*P+d*D,i[9]=u*M+c*A+h*I+d*U,i[13]=u*w+c*C+h*L+d*O,i[2]=p*b+f*E+m*R+g*N,i[6]=p*S+f*T+m*P+g*D,i[10]=p*M+f*A+m*I+g*U,i[14]=p*w+f*C+m*L+g*O,i[3]=v*b+y*E+_*R+x*N,i[7]=v*S+y*T+_*P+x*D,i[11]=v*M+y*A+_*I+x*U,i[15]=v*w+y*C+_*L+x*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7];return p*(i*o*c-r*l*c-i*s*h+n*l*h+r*s*d-n*o*d)+f*(t*o*d-t*l*h+i*a*h-r*a*d+r*l*u-i*o*u)+e[11]*(t*l*c-t*s*d-i*a*c+n*a*d+i*s*u-n*l*u)+e[15]*(-r*s*u-t*o*c+t*s*h+r*a*c-n*a*h+n*o*u)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*h*l+f*o*d-s*m*d-c*o*g+s*h*g,y=p*h*l-u*m*l-p*o*d+a*m*d+u*o*g-a*h*g,_=u*f*l-p*c*l+p*s*d-a*f*d-u*s*g+a*c*g,x=p*c*o-u*f*o-p*s*h+a*f*h+u*s*m-a*c*m,b=t*v+n*y+r*_+i*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/b;return e[0]=v*S,e[1]=(f*h*i-c*m*i-f*r*d+n*m*d+c*r*g-n*h*g)*S,e[2]=(s*m*i-f*o*i+f*r*l-n*m*l-s*r*g+n*o*g)*S,e[3]=(c*o*i-s*h*i-c*r*l+n*h*l+s*r*d-n*o*d)*S,e[4]=y*S,e[5]=(u*m*i-p*h*i+p*r*d-t*m*d-u*r*g+t*h*g)*S,e[6]=(p*o*i-a*m*i-p*r*l+t*m*l+a*r*g-t*o*g)*S,e[7]=(a*h*i-u*o*i+u*r*l-t*h*l-a*r*d+t*o*d)*S,e[8]=_*S,e[9]=(p*c*i-u*f*i-p*n*d+t*f*d+u*n*g-t*c*g)*S,e[10]=(a*f*i-p*s*i+p*n*l-t*f*l-a*n*g+t*s*g)*S,e[11]=(u*s*i-a*c*i-u*n*l+t*c*l+a*n*d-t*s*d)*S,e[12]=x*S,e[13]=(u*f*r-p*c*r+p*n*h-t*f*h-u*n*m+t*c*m)*S,e[14]=(p*s*r-a*f*r-p*n*o+t*f*o+a*n*m-t*s*m)*S,e[15]=(a*c*r-u*s*r+u*n*o-t*c*o-a*n*h+t*s*h)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];return Math.sqrt(Math.max(t,e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,s=e.y,o=e.z,l=i*a,u=i*s;return this.set(l*a+n,l*s-r*o,l*o+r*s,0,l*s+r*o,u*s+n,u*o-r*a,0,l*o-r*s,u*o+r*a,i*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,s=t._z,o=t._w,l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,p=i*c,f=a*u,m=a*c,g=s*c,v=o*l,y=o*u,_=o*c,x=n.x,b=n.y,S=n.z;return r[0]=(1-(f+g))*x,r[1]=(d+_)*x,r[2]=(p-y)*x,r[3]=0,r[4]=(d-_)*b,r[5]=(1-(h+g))*b,r[6]=(m+v)*b,r[7]=0,r[8]=(p+y)*S,r[9]=(m-v)*S,r[10]=(1-(h+f))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=rV.set(r[0],r[1],r[2]).length(),a=rV.set(r[4],r[5],r[6]).length(),s=rV.set(r[8],r[9],r[10]).length();0>this.determinant()&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],rG.copy(this);let o=1/i,l=1/a,u=1/s;return rG.elements[0]*=o,rG.elements[1]*=o,rG.elements[2]*=o,rG.elements[4]*=l,rG.elements[5]*=l,rG.elements[6]*=l,rG.elements[8]*=u,rG.elements[9]*=u,rG.elements[10]*=u,t.setFromRotationMatrix(rG),n.x=i,n.y=a,n.z=s,this}makePerspective(e,t,n,r,i,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:nA,u=arguments.length>7&&void 0!==arguments[7]&&arguments[7],c=this.elements;if(u)s=i/(a-i),o=a*i/(a-i);else if(l===nA)s=-(a+i)/(a-i),o=-2*a*i/(a-i);else if(l===nC)s=-a/(a-i),o=-a*i/(a-i);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return c[0]=2*i/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*i/(n-r),c[9]=(n+r)/(n-r),c[13]=0,c[2]=0,c[6]=0,c[10]=s,c[14]=o,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:nA,u=arguments.length>7&&void 0!==arguments[7]&&arguments[7],c=this.elements;if(u)s=1/(a-i),o=a/(a-i);else if(l===nA)s=-2/(a-i),o=-(a+i)/(a-i);else if(l===nC)s=-1/(a-i),o=-i/(a-i);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(n-r),c[9]=0,c[13]=-(n+r)/(n-r),c[2]=0,c[6]=0,c[10]=s,c[14]=o,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}constructor(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m){rH.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m)}}let rV=new nX,rG=new rH,rW=new nX(0,0,0),rj=new nX(1,1,1),rX=new nX,rq=new nX,rY=new nX,rJ=new rH,rZ=new nj;class rK{get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=e.elements,i=r[0],a=r[4],s=r[8],o=r[1],l=r[5],u=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(nk(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-nk(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(nk(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,i));break;case"ZYX":this._y=Math.asin(-nk(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(nk(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-nk(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,i)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return rJ.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rJ,t,n)}setFromVector3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return rZ.setFromEuler(this),this.setFromQuaternion(rZ,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}constructor(e=0,t=0,n=0,r=rK.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}}rK.DEFAULT_ORDER="XYZ";class r${set(e){this.mask=1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:[];this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(r.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){is.subVectors(r,t),io.subVectors(n,t),il.subVectors(e,t);let a=is.dot(is),s=is.dot(io),o=is.dot(il),l=io.dot(io),u=io.dot(il),c=a*l-s*s;if(0===c)return i.set(0,0,0),null;let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return i.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return null!==this.getBarycoord(e,t,n,r,iu)&&iu.x>=0&&iu.y>=0&&iu.x+iu.y<=1}static getInterpolation(e,t,n,r,i,a,s,o){return null===this.getBarycoord(e,t,n,r,iu)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(i,iu.x),o.addScaledVector(a,iu.y),o.addScaledVector(s,iu.z),o)}static getInterpolatedAttribute(e,t,n,r,i,a){return iv.setScalar(0),iy.setScalar(0),i_.setScalar(0),iv.fromBufferAttribute(e,t),iy.fromBufferAttribute(e,n),i_.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(iv,i.x),a.addScaledVector(iy,i.y),a.addScaledVector(i_,i.z),a}static isFrontFacing(e,t,n,r){return is.subVectors(n,t),io.subVectors(e,t),0>is.cross(io).dot(r)}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return is.subVectors(this.c,this.b),io.subVectors(this.a,this.b),.5*is.cross(io).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ix.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ix.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,i){return ix.getInterpolation(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return ix.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ix.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,r,i=this.a,a=this.b,s=this.c;ic.subVectors(a,i),ih.subVectors(s,i),ip.subVectors(e,i);let o=ic.dot(ip),l=ih.dot(ip);if(o<=0&&l<=0)return t.copy(i);im.subVectors(e,a);let u=ic.dot(im),c=ih.dot(im);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(i).addScaledVector(ic,n);ig.subVectors(e,s);let d=ic.dot(ig),p=ih.dot(ig);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(ih,r);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return id.subVectors(s,a),r=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(id,r);let g=1/(m+f+h);return n=f*g,r=h*g,t.copy(i).addScaledVector(ic,n).addScaledVector(ih,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}constructor(e=new nX,t=new nX,n=new nX){this.a=e,this.b=t,this.c=n}}let ib={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},iS={h:0,s:0,l:0},iM={h:0,s:0,l:0};function iw(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}class iE{set(e,t,n){return void 0===t&&void 0===n?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,n),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,n8.colorSpaceToWorking(this,t),this}setRGB(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n8.workingColorSpace;return this.r=e,this.g=t,this.b=n,n8.colorSpaceToWorking(this,r),this}setHSL(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n8.workingColorSpace;if(e=nz(e,1),t=nk(t,0,1),n=nk(n,0,1),0===t)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=iw(i,r,e+1/3),this.g=iw(i,r,e),this.b=iw(i,r,e-1/3)}return n8.colorSpaceToWorking(this,r),this}setStyle(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$;function r(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=t[1],s=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,n);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,n);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=t[1],i=r.length;if(3===i)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,n);if(6===i)return this.setHex(parseInt(r,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$,n=ib[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=n9(e.r),this.g=n9(e.g),this.b=n9(e.b),this}copyLinearToSRGB(e){return this.r=n7(e.r),this.g=n7(e.g),this.b=n7(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;return n8.workingToColorSpace(iT.copy(this),e),65536*Math.round(nk(255*iT.r,0,255))+256*Math.round(nk(255*iT.g,0,255))+Math.round(nk(255*iT.b,0,255))}getHexString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n8.workingColorSpace;n8.workingToColorSpace(iT.copy(this),r);let i=iT.r,a=iT.g,s=iT.b,o=Math.max(i,a,s),l=Math.min(i,a,s),u=(l+o)/2;if(l===o)t=0,n=0;else{let e=o-l;switch(n=u<=.5?e/(o+l):e/(2-o-l),o){case i:t=(a-s)/e+6*(a1&&void 0!==arguments[1]?arguments[1]:n8.workingColorSpace;return n8.workingToColorSpace(iT.copy(this),t),e.r=iT.r,e.g=iT.g,e.b=iT.b,e}getStyle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;n8.workingToColorSpace(iT.copy(this),e);let t=iT.r,n=iT.g,r=iT.b;return e!==t$?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*r),")")}offsetHSL(e,t,n){return this.getHSL(iS),this.setHSL(iS.h+e,iS.s+t,iS.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(iS),e.getHSL(iM);let n=nB(iS.h,iM.h,t),r=nB(iS.s,iM.s,t),i=nB(iS.l,iM.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}}let iT=new iE;iE.NAMES=ib;let iA=0;class iC extends nL{get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."));continue}let r=this[t];if(void 0===r){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."));continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==C&&(n.blending=this.blending),this.side!==w&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==V&&(n.blendSrc=this.blendSrc),this.blendDst!==G&&(n.blendDst=this.blendDst),this.blendEquation!==N&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==en&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==no&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==t3&&(n.stencilFail=this.stencilFail),this.stencilZFail!==t3&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==t3&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:iA++}),this.uuid=nF(),this.name="",this.type="Material",this.blending=C,this.side=w,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=V,this.blendDst=G,this.blendEquation=N,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new iE(0,0,0),this.blendAlpha=0,this.depthFunc=en,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=no,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=t3,this.stencilZFail=t3,this.stencilZPass=t3,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}}class iR extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new iE(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}}let iP=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[256|e]=32768,i[e]=24,i[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,i[e]=-t-1,i[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,i[e]=13,i[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,i[e]=24,i[256|e]=24):(r[e]=31744,r[256|e]=64512,i[e]=13,i[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;(8388608&t)==0;)t<<=1,n-=8388608;t&=-8388609,n+=0x38800000,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:s,offsetTable:o}}();function iI(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=nk(e,-65504,65504),iP.floatView[0]=e;let t=iP.uint32View[0],n=t>>23&511;return iP.baseTable[n]+((8388607&t)>>iP.shiftTable[n])}function iL(e){let t=e>>10;return iP.uint32View[0]=iP.mantissaTable[iP.offsetTable[t]+(1023&e)]+iP.exponentTable[t],iP.floatView[0]}class iN{static toHalfFloat(e){return iI(e)}static fromHalfFloat(e){return iL(e)}}let iD=new nX,iU=new nW,iO=0;class iF{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=nH(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=nV(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=nH(t,this.array)),t}setX(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=nH(t,this.array)),t}setY(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=nH(t,this.array)),t}setZ(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=nH(t,this.array)),t}setW(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array),i=nV(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==ng&&(e.usage=this.usage),e}constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iO++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=ng,this.updateRanges=[],this.gpuType=ej,this.version=0}}class ik extends iF{constructor(e,t,n){super(new Int8Array(e),t,n)}}class iz extends iF{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class iB extends iF{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class iH extends iF{constructor(e,t,n){super(new Int16Array(e),t,n)}}class iV extends iF{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class iG extends iF{constructor(e,t,n){super(new Int32Array(e),t,n)}}class iW extends iF{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class ij extends iF{getX(e){let t=iL(this.array[e*this.itemSize]);return this.normalized&&(t=nH(t,this.array)),t}setX(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize]=iI(t),this}getY(e){let t=iL(this.array[e*this.itemSize+1]);return this.normalized&&(t=nH(t,this.array)),t}setY(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+1]=iI(t),this}getZ(e){let t=iL(this.array[e*this.itemSize+2]);return this.normalized&&(t=nH(t,this.array)),t}setZ(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+2]=iI(t),this}getW(e){let t=iL(this.array[e*this.itemSize+3]);return this.normalized&&(t=nH(t,this.array)),t}setW(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+3]=iI(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this.array[e+2]=iI(r),this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array),i=nV(i,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this.array[e+2]=iI(r),this.array[e+3]=iI(i),this}constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}}class iX extends iF{constructor(e,t,n){super(new Float32Array(e),t,n)}}let iq=0,iY=new rH,iJ=new ia,iZ=new nX,iK=new rf,i$=new rf,iQ=new nX;class i0 extends nL{getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(nK(e)?iW:iV)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(void 0!==n){let t=new nJ().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return iY.makeRotationFromQuaternion(e),this.applyMatrix4(iY),this}rotateX(e){return iY.makeRotationX(e),this.applyMatrix4(iY),this}rotateY(e){return iY.makeRotationY(e),this.applyMatrix4(iY),this}rotateZ(e){return iY.makeRotationZ(e),this.applyMatrix4(iY),this}translate(e,t,n){return iY.makeTranslation(e,t,n),this.applyMatrix4(iY),this}scale(e,t,n){return iY.makeScale(e,t,n),this.applyMatrix4(iY),this}lookAt(e){return iJ.lookAt(e),iJ.updateMatrix(),this.applyMatrix4(iJ.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(iZ).negate(),this.translate(iZ.x,iZ.y,iZ.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let n=0,r=e.length;nt.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new rf);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new nX(-1/0,-1/0,-1/0),new nX(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2)||(i1.copy(i).invert(),i2.copy(e.ray).applyMatrix4(i1),(null===n.boundingBox||!1!==i2.intersectsBox(n.boundingBox))&&this._computeIntersections(e,t,i2))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,s=i.index,o=i.attributes.position,l=i.attributes.uv,u=i.attributes.uv1,c=i.attributes.normal,h=i.groups,d=i.drawRange;if(null!==s)if(Array.isArray(a))for(let i=0,o=h.length;in.far?null:{distance:l,point:at.clone(),object:e}}(e,t,n,r,i5,i6,i8,ae);if(c){let e=new nX;ix.getBarycoord(ae,i5,i6,i8,e),i&&(c.uv=ix.getInterpolatedAttribute(i,o,l,u,e,new nW)),a&&(c.uv1=ix.getInterpolatedAttribute(a,o,l,u,e,new nW)),s&&(c.normal=ix.getInterpolatedAttribute(s,o,l,u,e,new nX),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:u,normal:new nX,materialIndex:0};ix.getNormal(i5,i6,i8,t.normal),c.face=t,c.barycoord=e}return c}class ai extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ai(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let s=this;r=Math.floor(r),i=Math.floor(i);let o=[],l=[],u=[],c=[],h=0,d=0;function p(e,t,n,r,i,a,p,f,m,g,v){let y=a/m,_=p/g,x=a/2,b=p/2,S=f/2,M=m+1,w=g+1,E=0,T=0,A=new nX;for(let a=0;a0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),E+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}}class ac extends ia{get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rH,this.projectionMatrix=new rH,this.projectionMatrixInverse=new rH,this.coordinateSystem=nA,this._reversedDepth=!1}}let ah=new nX,ad=new nW,ap=new nW;class af extends ac{copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*nO*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*nU*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*nO*Math.atan(Math.tan(.5*nU*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ah.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ah.x,ah.y).multiplyScalar(-e/ah.z),ah.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ah.x,ah.y).multiplyScalar(-e/ah.z)}getViewSize(e,t){return this.getViewBounds(e,ad,ap),t.subVectors(ap,ad)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*nU*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/s,r*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(i+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}}class am extends ia{updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,s,o]=t;for(let e of t)this.remove(e);if(e===nA)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(e===nC)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,s,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,s),e.setRenderTarget(n,3,r),e.render(t,o),e.setRenderTarget(n,4,r),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(c,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new af(-90,1,e,t);r.layers=this.layers,this.add(r);let i=new af(-90,1,e,t);i.layers=this.layers,this.add(i);let a=new af(-90,1,e,t);a.layers=this.layers,this.add(a);let s=new af(-90,1,e,t);s.layers=this.layers,this.add(s);let o=new af(-90,1,e,t);o.layers=this.layers,this.add(o);let l=new af(-90,1,e,t);l.layers=this.layers,this.add(l)}}class ag extends rs{get images(){return this.image}set images(e){this.image=e}constructor(e=[],t=eb,n,r,i,a,s,o,l,u){super(e,t,n,r,i,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}}class av extends ru{fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n=new ai(5,5,5),r=new au({name:"CubemapFromEquirect",uniforms:aa({tEquirect:{value:null}}),vertexShader:"\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include \n #include \n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include \n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n ",side:E,blending:A});r.uniforms.tEquirect.value=t;let i=new an(n,r),a=t.minFilter;return t.minFilter===eF&&(t.minFilter=eD),new am(1,10,this).update(e,i),t.minFilter=a,i.geometry.dispose(),i.material.dispose(),this}clear(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1};this.texture=new ag([n,n,n,n,n,n]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}}class ay extends ia{constructor(){super(),this.isGroup=!0,this.type="Group"}}let a_={type:"move"};class ax{getHandSpace(){return null===this._hand&&(this._hand=new ay,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ay,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new nX,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new nX),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ay,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new nX,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new nX),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let r of(a=!0,e.hand.values())){let e=t.getJointPose(r,n),i=this._getHandJoint(l,r);null!==e&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=null!==e}let r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],s=r.position.distanceTo(i.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(a_)))}return null!==s&&(s.visible=null!==r),null!==o&&(o.visible=null!==i),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let n=new ay;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}constructor(){this._targetRay=null,this._grip=null,this._hand=null}}class ab{clone(){return new ab(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new iE(e),this.density=t}}class aS{clone(){return new aS(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new iE(e),this.near=t,this.far=n}}class aM extends ia{copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new rK,this.environmentIntensity=1,this.environmentRotation=new rK,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class aw{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=nF()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=nF()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=ng,this.updateRanges=[],this.version=0,this.uuid=nF()}}let aE=new nX;class aT{get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;te.far||t.push({distance:o,point:aC.clone(),uv:ix.getInterpolation(aC,aD,aU,aO,aF,ak,az,new nW),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}constructor(e=new aA){if(super(),this.isSprite=!0,this.type="Sprite",void 0===n){n=new i0;let e=new aw(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);n.setIndex([0,1,2,0,2,3]),n.setAttribute("position",new aT(e,3,0,!1)),n.setAttribute("uv",new aT(e,2,3,!1))}this.geometry=n,this.material=e,this.center=new nW(.5,.5),this.count=1}}function aH(e,t,n,r,i,a){aI.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(aL.x=a*aI.x-i*aI.y,aL.y=i*aI.x+a*aI.y):aL.copy(aI),e.copy(t),e.x+=aL.x,e.y+=aL.y,e.applyMatrix4(aN)}let aV=new nX,aG=new nX;class aW extends ia{copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;n=Math.abs(n);let i=this.levels;for(t=0;t0){let n,r;for(n=1,r=t.length;n0){aV.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo(aV);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){let n,r;aV.setFromMatrixPosition(e.matrixWorld),aG.setFromMatrixPosition(this.matrixWorld);let i=aV.distanceTo(aG)/e.zoom;for(n=1,t[0].object.visible=!0,r=t.length;n=e)t[n-1].object.visible=!1,t[n].object.visible=!0;else break}for(this._currentLevel=n-1;n1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||so.getNormalMatrix(e),r=this.coplanarPoint(sa).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}constructor(e=new nX(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}}let su=new rL,sc=new nW(.5,.5),sh=new nX;class sd{set(e,t,n,r,i,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nA,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.planes,i=e.elements,a=i[0],s=i[1],o=i[2],l=i[3],u=i[4],c=i[5],h=i[6],d=i[7],p=i[8],f=i[9],m=i[10],g=i[11],v=i[12],y=i[13],_=i[14],x=i[15];if(r[0].setComponents(l-a,d-u,g-p,x-v).normalize(),r[1].setComponents(l+a,d+u,g+p,x+v).normalize(),r[2].setComponents(l+s,d+c,g+f,x+y).normalize(),r[3].setComponents(l-s,d-c,g-f,x-y).normalize(),n)r[4].setComponents(o,h,m,_).normalize(),r[5].setComponents(l-o,d-h,g-m,x-_).normalize();else if(r[4].setComponents(l-o,d-h,g-m,x-_).normalize(),t===nA)r[5].setComponents(l+o,d+h,g+m,x+_).normalize();else if(t===nC)r[5].setComponents(o,h,m,_).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),su.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),su.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(su)}intersectsSprite(e){return su.center.set(0,0,0),su.radius=.7071067811865476+sc.distanceTo(e.center),su.applyMatrix4(e.matrixWorld),this.intersectsSphere(su)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,sh.y=r.normal.y>0?e.max.y:e.min.y,sh.z=r.normal.z>0?e.max.z:e.min.z,0>r.distanceToPoint(sh))return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(0>t[n].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}constructor(e=new sl,t=new sl,n=new sl,r=new sl,i=new sl,a=new sl){this.planes=[e,t,n,r,i,a]}}let sp=new rH,sf=new sd;class sm{intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let n=0;n=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let s=i[this.index];a.push(s),this.index++,s.start=e,s.count=t,s.z=n,s.index=r}reset(){this.list.length=0,this.index=0}constructor(){this.index=0,this.pool=[],this.list=[]}},sR=new an,sP=[];function sI(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let r=0;r65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new iF(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let n in t.attributes){if(!e.hasAttribute(n))throw Error('THREE.BatchedMesh: Added geometry missing "'.concat(n,'". All geometries must have consistent attributes.'));let r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error("THREE.BatchedMesh: Invalid instanceId ".concat(e,". Instance is either out of range or has been deleted."))}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error("THREE.BatchedMesh: Invalid geometryId ".concat(e,". Geometry is either out of range or has been deleted."))}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new rf);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sg),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let r=this._matricesTexture;s_.identity().toArray(r.image.data,16*n),r.needsUpdate=!0;let i=this._colorsTexture;return i&&(sx.toArray(i.image.data,4*n),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this._initializeGeometry(e),this._validateGeometry(e);let i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},a=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===n?e.getAttribute("position").count:n;let s=e.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===r?s.count:r),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sg),a[t=this._availableGeometryIds.shift()]=i):(t=this._geometryCount,this._geometryCount++,a.push(i)),this.setGeometryAt(t,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,t}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);let n=this.geometry,r=null!==n.getIndex(),i=n.getIndex(),a=t.getIndex(),s=this._geometryInfo[e];if(r&&a.count>s.reservedIndexCount||t.attributes.position.count>s.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=s.vertexStart,l=s.reservedVertexCount;for(let e in s.vertexCount=t.getAttribute("position").count,n.attributes){let r=t.getAttribute(e),i=n.getAttribute(e);!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let i=e.count;for(let a=0;a=t.length||!1===t[e].active)return this;let n=this._instanceInfo;for(let t=0,r=n.length;tt).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let a=0,s=n.length;a=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(null===r.boundingBox){let e=new rf,t=n.index,i=n.attributes.position;for(let n=r.start,a=r.start+r.count;n=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(null===r.boundingSphere){let t=new rL;this.getBoundingBoxAt(e,sM),sM.getCenter(t.center);let i=n.index,a=n.attributes.position,s=0;for(let e=r.start,n=r.start+r.count;e1&&void 0!==arguments[1]?arguments[1]:{};this.validateGeometryId(e);let n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){let t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(sg);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(ee.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error("BatchedMesh: Geometry vertex values are being used outside the range ".concat(t,". Cannot shrink further."));if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error("BatchedMesh: Geometry index values are being used outside the range ".concat(t,". Cannot shrink further."));let r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new i0,this._initializeGeometry(r));let i=this.geometry;for(let e in r.index&&sI(r.index.array,i.index.array),r.attributes)sI(r.attributes[e].array,i.attributes[e].array)}raycast(e,t){let n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,a=this.geometry;sR.material=this.material,sR.geometry.index=a.index,sR.geometry.attributes=a.attributes,null===sR.geometry.boundingBox&&(sR.geometry.boundingBox=new rf),null===sR.geometry.boundingSphere&&(sR.geometry.boundingSphere=new rL);for(let a=0,s=n.length;a({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,i){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=r.getIndex(),s=null===a?1:a.array.BYTES_PER_ELEMENT,o=this._instanceInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,c=this._geometryInfo,h=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data,f=n.isArrayCamera?sS:sb;h&&!n.isArrayCamera&&(s_.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),sb.setFromProjectionMatrix(s_,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sE.setFromMatrixPosition(n.matrixWorld).applyMatrix4(s_),sT.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(s_);for(let e=0,t=o.length;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;sz.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(sz);if(!(lt.far))return{distance:l,point:sB.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let sG=new nX,sW=new nX;class sj extends sH{computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class s0 extends rs{clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}constructor(e,t,n,r,i=eD,a=eD,s,o,l){super(e,t,n,r,i,a,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let u=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}}class s1 extends s0{update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}constructor(e,t,n,r,i,a,s,o){super({},e,t,n,r,i,a,s,o),this.isVideoFrameTexture=!0}}class s2 extends rs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=eR,this.minFilter=eR,this.generateMipmaps=!1,this.needsUpdate=!0}}class s3 extends rs{constructor(e,t,n,r,i,a,s,o,l,u,c,h){super(null,a,s,o,l,u,r,i,c,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class s4 extends s3{addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}constructor(e,t,n,r,i,a){super(e,t,n,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=eA,this.layerUpdates=new Set}}class s5 extends s3{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,eb),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class s6 extends rs{constructor(e,t,n,r,i,a,s,o,l){super(e,t,n,r,i,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class s8 extends rs{copy(e){return super.copy(e),this.source=new rn(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}constructor(e,t,n=eW,r,i,a,s=eR,o=eR,l,u=e1,c=1){if(u!==e1&&u!==e2)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},r,i,a,s,o,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}}class s9 extends rs{copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}}class s7 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s7(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r));let a=[],s=[],o=[],l=[],u=t/2,c=Math.PI/2*e,h=t,d=2*c+h,p=2*n+(i=Math.max(1,Math.floor(i))),f=r+1,m=new nX,g=new nX;for(let v=0;v<=p;v++){let y=0,_=0,x=0,b=0;if(v<=n){let t=v/n,r=t*Math.PI/2;_=-u-e*Math.cos(r),x=e*Math.sin(r),b=-e*Math.cos(r),y=t*c}else if(v<=n+i){let r=(v-n)/i;_=-u+r*t,x=e,b=0,y=c+r*h}else{let t=(v-n-i)/n,r=t*Math.PI/2;_=u+e*Math.sin(r),x=e*Math.cos(r),b=e*Math.sin(r),y=c+h+t*c}let S=Math.max(0,Math.min(1,y/d)),M=0;0===v?M=.5/r:v===p&&(M=-.5/r);for(let e=0;e<=r;e++){let t=e/r,n=t*Math.PI*2,i=Math.sin(n),a=Math.cos(n);g.x=-x*a,g.y=_,g.z=x*i,s.push(g.x,g.y,g.z),m.set(-x*a,b,x*i),m.normalize(),o.push(m.x,m.y,m.z),l.push(t+M,S)}if(v>0){let e=(v-1)*f;for(let t=0;t0||0!==r)&&(u.push(a,s,l),y+=3),(t>0||r!==i-1)&&(u.push(s,o,l),y+=3)}l.addGroup(g,y,0),g+=y})(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new iX(c,3)),this.setAttribute("normal",new iX(h,3)),this.setAttribute("uv",new iX(d,2))}}class on extends ot{static fromJSON(e){return new on(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}constructor(e=1,t=1,n=32,r=1,i=!1,a=0,s=2*Math.PI){super(0,e,t,n,r,i,a,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:s}}}class or extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new or(e.vertices,e.indices,e.radius,e.details)}constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};let i=[],a=[];function s(e){i.push(e.x,e.y,e.z)}function o(t,n){let r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function l(e,t,n,r){r<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}(function(e){let n=new nX,r=new nX,i=new nX;for(let a=0;a.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new iX(i,3)),this.setAttribute("normal",new iX(i.slice(),3)),this.setAttribute("uv",new iX(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}class oi extends or{static fromJSON(e){return new oi(e.radius,e.detail)}constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}}let oa=new nX,os=new nX,oo=new nX,ol=new ix;class ou extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){let n=Math.cos(nU*t),r=e.getIndex(),i=e.getAttribute("position"),a=r?r.count:i.count,s=[0,0,0],o=["a","b","c"],l=[,,,],u={},c=[];for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)t.push(i+=(n=this.getPoint(a/e)).distanceTo(r)),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.getLengths(),i=0,a=r.length;t=n||e*r[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=r[i=Math.floor(s+(o-s)/2)]-t)<0)s=i+1;else if(l>0)o=i-1;else{o=i;break}if(r[i=o]===t)return i/(a-1);let u=r[i],c=r[i+1];return(i+(t-u)/(c-u))/(a-1)}getTangent(e,t){let n=e-1e-4,r=e+1e-4;n<0&&(n=0),r>1&&(r=1);let i=this.getPoint(n),a=this.getPoint(r),s=t||(i.isVector2?new nW:new nX);return s.copy(a).sub(i).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new nX,r=[],i=[],a=[],s=new nX,o=new rH;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new nX)}i[0]=new nX,a[0]=new nX;let l=Number.MAX_VALUE,u=Math.abs(r[0].x),c=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=l&&(l=u,n.set(1,0,0)),c<=l&&(l=c,n.set(0,1,0)),h<=l&&n.set(0,0,1),s.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],s),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(r[t-1],r[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(nk(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(r[t],i[t])}if(!0===t){let t=Math.acos(nk(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(s.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(o.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}}class oh extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,i=Math.abs(r)n;)r-=n;r1&&void 0!==arguments[1]?arguments[1]:new nX,i=this.points,a=i.length,s=(a-!this.closed)*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?t=i[(o-1)%a]:(of.subVectors(i[0],i[1]).add(i[0]),t=of);let u=i[o%a],c=i[(o+1)%a];if(this.closed||o+21&&void 0!==arguments[1]?arguments[1]:new nW,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(ob(e,n.x,r.x,i.x,a.x),ob(e,n.y,r.y,i.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new nW,t=new nW,n=new nW,r=new nW){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}}class oM extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(ob(e,n.x,r.x,i.x,a.x),ob(e,n.y,r.y,i.y,a.y),ob(e,n.z,r.z,i.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new nX,t=new nX,n=new nX,r=new nX){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}}class ow extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nW,t=new nW){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}}class oE extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nX,t=new nX){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}}class oT extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=this.v0,r=this.v1,i=this.v2;return t.set(ox(e,n.x,r.x,i.x),ox(e,n.y,r.y,i.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nW,t=new nW,n=new nW){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}}class oA extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX,n=this.v0,r=this.v1,i=this.v2;return t.set(ox(e,n.x,r.x,i.x),ox(e,n.y,r.y,i.y),ox(e,n.z,r.z,i.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nX,t=new nX,n=new nX){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}}class oC extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=this.points,r=(n.length-1)*e,i=Math.floor(r),a=r-i,s=n[0===i?i:i-1],o=n[i],l=n[i>n.length-2?n.length-1:i+1],u=n[i>n.length-3?n.length-1:i+2];return t.set(o_(a,s.x,o.x,l.x,u.x),o_(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){let e=r[i]-n,a=this.curves[i],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n0&&void 0!==arguments[0]?arguments[0]:40,t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[];for(let r=0,i=this.curves;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}constructor(e){super(),this.type="Path",this.currentPoint=new nW,e&&this.setFromPoints(e)}}class oL extends oI{getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n0)for(let i=t;i=t;i-=r)a=oX(i/r|0,e[i],e[i+1],a);return a&&oB(a,a.next)&&(oq(a),a=a.next),a}function oD(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(oB(n,n.next)||0===oz(n.prev,n,n.next))){if(oq(n),(n=t=n.prev)===n.next)break;r=!0}else n=n.next;while(r||n!==t)return t}function oU(e,t){let n=e.x-t.x;return 0===n&&0==(n=e.y-t.y)&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function oO(e,t,n,r,i){return(e=((e=((e=((e=((e=(e-n)*i|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-r)*i|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function oF(e,t,n,r,i,a,s,o){return(i-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(r-o)>=(n-s)*(t-o)&&(n-s)*(a-o)>=(i-s)*(r-o)}function ok(e,t,n,r,i,a,s,o){return(e!==s||t!==o)&&oF(e,t,n,r,i,a,s,o)}function oz(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function oB(e,t){return e.x===t.x&&e.y===t.y}function oH(e,t,n,r){let i=oG(oz(e,t,n)),a=oG(oz(e,t,r)),s=oG(oz(n,r,e)),o=oG(oz(n,r,t));return!!(i!==a&&s!==o||0===i&&oV(e,n,t)||0===a&&oV(e,r,t)||0===s&&oV(n,e,r)||0===o&&oV(n,t,r))}function oV(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function oG(e){return e>0?1:e<0?-1:0}function oW(e,t){return 0>oz(e.prev,e,e.next)?oz(e,t,e.next)>=0&&oz(e,e.prev,t)>=0:0>oz(e,t,e.prev)||0>oz(e,e.next,t)}function oj(e,t){let n=oY(e.i,e.x,e.y),r=oY(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function oX(e,t,n,r){let i=oY(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function oq(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function oY(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class oJ{static triangulate(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;return function(e,t){let n,r,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,s=t&&t.length,o=s?t[0]*a:e.length,l=oN(e,0,o,a,!0),u=[];if(!l||l.next===l.prev)return u;if(s&&(l=function(e,t,n,r){let i=[];for(let n=0,a=t.length;n=r.next.y&&r.next.y!==r.y){let e=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=i&&e>s&&(s=e,n=r.x=r.x&&r.x>=l&&i!==r.x&&oF(an.x||r.x===n.x&&(h=n,d=r,0>oz(h.prev,h,d.prev)&&0>oz(d.next,h,h.next))))&&(n=r,c=t)}r=r.next}while(r!==o)return n}(e,t);if(!n)return t;let r=oj(n,e);return oD(r,r.next),oD(n,n.next)}(i[e],n);return n}(e,t,l,a)),e.length>80*a){n=1/0,r=1/0;let t=-1/0,s=-1/0;for(let i=a;it&&(t=a),o>s&&(s=o)}i=0!==(i=Math.max(t-n,s-r))?32767/i:0}return function e(t,n,r,i,a,s,o){if(!t)return;!o&&s&&function(e,t,n,r){let i=e;do 0===i.z&&(i.z=oO(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e)i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let a=null;for(t=0;i;){t++;let s=i,o=0;for(let e=0;e0||l>0&&s;)0!==o&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,o--):(r=s,s=s.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=s}a.nextZ=null,n*=2}while(t>1)}(i)}(t,i,a,s);let l=t;for(;t.prev!==t.next;){let u=t.prev,c=t.next;if(s?function(e,t,n,r){let i=e.prev,a=e.next;if(oz(i,e,a)>=0)return!1;let s=i.x,o=e.x,l=a.x,u=i.y,c=e.y,h=a.y,d=Math.min(s,o,l),p=Math.min(u,c,h),f=Math.max(s,o,l),m=Math.max(u,c,h),g=oO(d,p,t,n,r),v=oO(f,m,t,n,r),y=e.prevZ,_=e.nextZ;for(;y&&y.z>=g&&_&&_.z<=v;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&ok(s,u,o,c,l,h,y.x,y.y)&&oz(y.prev,y,y.next)>=0||(y=y.prevZ,_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&ok(s,u,o,c,l,h,_.x,_.y)&&oz(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;y&&y.z>=g;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&ok(s,u,o,c,l,h,y.x,y.y)&&oz(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&ok(s,u,o,c,l,h,_.x,_.y)&&oz(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}(t,i,a,s):function(e){let t=e.prev,n=e.next;if(oz(t,e,n)>=0)return!1;let r=t.x,i=e.x,a=n.x,s=t.y,o=e.y,l=n.y,u=Math.min(r,i,a),c=Math.min(s,o,l),h=Math.max(r,i,a),d=Math.max(s,o,l),p=n.next;for(;p!==t;){if(p.x>=u&&p.x<=h&&p.y>=c&&p.y<=d&&ok(r,s,i,o,a,l,p.x,p.y)&&oz(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){n.push(u.i,t.i,c.i),oq(t),t=c.next,l=c.next;continue}if((t=c)===l){o?1===o?e(t=function(e,t){let n=e;do{let r=n.prev,i=n.next.next;!oB(r,i)&&oH(r,n,n.next,i)&&oW(r,i)&&oW(i,r)&&(t.push(r.i,n.i,i.i),oq(n),oq(n.next),n=e=i),n=n.next}while(n!==e)return oD(n)}(oD(t),n),n,r,i,a,s,2):2===o&&function(t,n,r,i,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,u;if(o.i!==t.i&&(l=o,u=t,l.next.i!==u.i&&l.prev.i!==u.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&oH(n,n.next,e,t))return!0;n=n.next}while(n!==e)return!1}(l,u)&&(oW(l,u)&&oW(u,l)&&function(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e)return r}(l,u)&&(oz(l.prev,l,u.prev)||oz(l,u.prev,u))||oB(l,u)&&oz(l.prev,l,l.next)>0&&oz(u.prev,u,u.next)>0))){let l=oj(o,t);o=oD(o,o.next),l=oD(l,l.next),e(o,n,r,i,a,s,0),e(l,n,r,i,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,n,r,i,a,s):e(oD(t),n,r,i,a,s,1);break}}}(l,u,a,n,r,i,0),u}(e,t,n)}}class oZ{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;ioZ.area(e)}static triangulateShape(e,t){let n=[],r=[],i=[];oK(e),o$(n,e);let a=e.length;t.forEach(oK);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function o$(e,t){for(let n=0;nNumber.EPSILON){let h=Math.sqrt(c),d=Math.sqrt(l*l+u*u),p=t.x-o/h,f=t.y+s/h,m=((n.x-u/d-p)*u-(n.y+l/d-f)*l)/(s*u-o*l),g=(r=p+s*m-e.x)*r+(i=f+o*m-e.y)*i;if(g<=2)return new nW(r,i);a=Math.sqrt(g/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(r=-o,i=s,a=Math.sqrt(c)):(r=s,i=o,a=Math.sqrt(c/2))}return new nW(r/a,i/a)}let L=[];for(let e=0,t=C.length,n=t-1,r=e+1;e=0;e--){let t=e/y,n=m*Math.cos(t*Math.PI/2),r=g*Math.sin(t*Math.PI/2)+v;for(let e=0,t=C.length;e=0;){let a=i,s=i-1;s<0&&(s=e.length-1);for(let e=0,i=d+2*y;e0)&&d.push(t,i,l),(e!==n-1||o0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new nW(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return nk(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new iE(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new iE(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new iE(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}}class lu extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new iE(0xffffff),this.specular=new iE(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lc extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new iE(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}}class lh extends iC{copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}}class ld extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new iE(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lp extends iC{copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=tj,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}}class lf extends iC{copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}}class lm extends iC{copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new iE(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lg extends sN{copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}}function lv(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function ly(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function l_(e){let t=e.length,n=Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function lx(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,s=0;s!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[s++]=e[r+n]}return i}function lb(e,t,n,r){let i=1,a=e[0];for(;void 0!==a&&void 0===a[r];)a=e[i++];if(void 0===a)return;let s=a[r];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[r])&&(t.push(a.time),n.push(...s)),a=e[i++];while(void 0!==a)else if(void 0!==s.toArray)do void 0!==(s=a[r])&&(t.push(a.time),s.toArray(n,n.length)),a=e[i++];while(void 0!==a)else do void 0!==(s=a[r])&&(t.push(a.time),n.push(s)),a=e[i++];while(void 0!==a)}class lS{static convertArray(e,t){return lv(e,t)}static isTypedArray(e){return ly(e)}static getKeyframeOrder(e){return l_(e)}static sortedArray(e,t,n){return lx(e,t,n)}static flattenJSON(e,t,n,r){lb(e,t,n,r)}static subclip(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30;return function(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;let s=[];for(let e=0;e=r)){l.push(t.times[e]);for(let n=0;na.tracks[e].times[0]&&(o=a.tracks[e].times[0]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);let i=n.tracks.length,a=t/r;for(let t=0;t=i.times[d]){let e=d*u+l,t=e+u-l;r=i.values.slice(e,t)}else{let e=i.createInterpolant(),t=l,n=u-l;e.evaluate(a),r=e.resultBuffer.slice(t,n)}"quaternion"===s&&new nj().fromArray(r).normalize().conjugate().toArray(r);let p=o.times.length;for(let e=0;e=i)){let s=t[1];e=(i=t[--n-1]))break r}a=n,n=0;break i}break n}for(;n>>1;et;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==a&&a>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,a),e=!1;break}a=r}if(void 0!==r&&ly(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===tO,i=e.length-1,a=1;for(let s=1;s0){e[a]=e[i];for(let e=i*n,r=a*n,s=0;s!==n;++s)t[r+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}constructor(e,t,n,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=lv(t,this.TimeBufferType),this.values=lv(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}}lA.prototype.ValueTypeName="",lA.prototype.TimeBufferType=Float32Array,lA.prototype.ValueBufferType=Float32Array,lA.prototype.DefaultInterpolation=tU;class lC extends lA{constructor(e,t,n){super(e,t,n)}}lC.prototype.ValueTypeName="bool",lC.prototype.ValueBufferType=Array,lC.prototype.DefaultInterpolation=tD,lC.prototype.InterpolantFactoryMethodLinear=void 0,lC.prototype.InterpolantFactoryMethodSmooth=void 0;class lR extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lR.prototype.ValueTypeName="color";class lP extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lP.prototype.ValueTypeName="number";class lI extends lM{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(r-t),l=e*s;for(let e=l+s;l!==e;l+=4)nj.slerpFlat(i,0,a,l-s,a,l,o);return i}constructor(e,t,n,r){super(e,t,n,r)}}class lL extends lA{InterpolantFactoryMethodLinear(e){return new lI(this.times,this.values,this.getValueSize(),e)}constructor(e,t,n,r){super(e,t,n,r)}}lL.prototype.ValueTypeName="quaternion",lL.prototype.InterpolantFactoryMethodSmooth=void 0;class lN extends lA{constructor(e,t,n){super(e,t,n)}}lN.prototype.ValueTypeName="string",lN.prototype.ValueBufferType=Array,lN.prototype.DefaultInterpolation=tD,lN.prototype.InterpolantFactoryMethodLinear=void 0,lN.prototype.InterpolantFactoryMethodSmooth=void 0;class lD extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lD.prototype.ValueTypeName="vector";class lU{static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return lP;case"vector":case"vector2":case"vector3":case"vector4":return lD;case"color":return lR;case"quaternion":return lL;case"bool":case"boolean":return lC;case"string":return lN}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],n=[];lb(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i.userData=JSON.parse(e.userData||"{}"),i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=n.length;e!==r;++e)t.push(lA.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(e,t,n,r,i){if(0!==n.length){let a=[],s=[];lb(n,a,s,r),0!==a.length&&i.push(new e(t,a,s))}},r=[],i=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(void 0!==lB[e])return void lB[e].push({onLoad:t,onProgress:n,onError:r});lB[e]=[],lB[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let n=lB[e],r=t.body.getReader(),i=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=i?parseInt(i):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){r.read().then(r=>{let{done:i,value:l}=r;if(i)e.close();else{let r=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=l.byteLength,total:a});for(let e=0,t=n.length;e{e.error(t)})}()}}))}throw new lH('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),n=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{lO.add("file:".concat(e),t);let n=lB[e];delete lB[e];for(let e=0,r=n.length;e{let n=lB[e];if(void 0===n)throw this.manager.itemError(e),t;delete lB[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}}class lG extends lz{load(e,t,n,r){let i=this,a=new lV(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=[];for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),l5.setFromMatrixPosition(e.matrixWorld),n.position.copy(l5),l6.copy(n.position),l6.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(l6),n.updateMatrixWorld(),r.makeTranslation(-l5.x,-l5.y,-l5.z),l4.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(l4,n.coordinateSystem,n.reversedDepth)}constructor(){super(new af(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new nW(4,2),this._viewportCount=6,this._viewports=[new ro(2,1,1,1),new ro(0,1,1,1),new ro(3,1,1,1),new ro(1,1,1,1),new ro(3,0,1,1),new ro(1,0,1,1)],this._cubeDirections=[new nX(1,0,0),new nX(-1,0,0),new nX(0,0,1),new nX(0,0,-1),new nX(0,1,0),new nX(0,-1,0)],this._cubeUps=[new nX(0,1,0),new nX(0,1,0),new nX(0,1,0),new nX(0,1,0),new nX(0,0,1),new nX(0,0,-1)]}}class l9 extends lZ{get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new l8}}class l7 extends ac{copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,s=r+t,o=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}}class ue extends l1{constructor(){super(new l7(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ut extends lZ{dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.target=new ia,this.shadow=new ue}}class un extends lZ{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class ur extends lZ{get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}}class ui{set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){let n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new nX)}}class ua extends lZ{copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}constructor(e=new ui,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}}class us extends lz{load(e,t,n,r){let i=this,a=new lV(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}let r=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=e.sheen),void 0!==e.sheenColor&&(r.sheenColor=new iE().setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(r.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.specularIntensity&&(r.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(r.dispersion=e.dispersion),void 0!==e.iridescence&&(r.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(r.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.thickness&&(r.thickness=e.thickness),void 0!==e.attenuationDistance&&(r.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(r.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(r.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.shadowSide&&(r.shadowSide=e.shadowSide),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(r.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(r.depthFunc=e.depthFunc),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(r.blendSrc=e.blendSrc),void 0!==e.blendDst&&(r.blendDst=e.blendDst),void 0!==e.blendEquation&&(r.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(r.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(r.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(r.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==r.blendColor&&r.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(r.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),void 0!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.alphaToCoverage&&(r.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(r.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(r.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(let t in e.uniforms){let i=e.uniforms[t];switch(r.uniforms[t]={},i.type){case"t":r.uniforms[t].value=n(i.value);break;case"c":r.uniforms[t].value=new iE().setHex(i.value);break;case"v2":r.uniforms[t].value=new nW().fromArray(i.value);break;case"v3":r.uniforms[t].value=new nX().fromArray(i.value);break;case"v4":r.uniforms[t].value=new ro().fromArray(i.value);break;case"m3":r.uniforms[t].value=new nJ().fromArray(i.value);break;case"m4":r.uniforms[t].value=new rH().fromArray(i.value);break;default:r.uniforms[t].value=i.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(r.glslVersion=e.glslVersion),void 0!==e.extensions)for(let t in e.extensions)r.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(r.lights=e.lights),void 0!==e.clipping&&(r.clipping=e.clipping),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),r.normalScale=new nW().fromArray(t)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(r.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(r.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapRotation&&r.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=new nW().fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(r.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(r.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(r.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(r.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(r.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return us.createMaterialFromType(e)}static createMaterialFromType(e){return new({ShadowMaterial:la,SpriteMaterial:aA,RawShaderMaterial:ls,ShaderMaterial:au,PointsMaterial:sq,MeshPhysicalMaterial:ll,MeshStandardMaterial:lo,MeshPhongMaterial:lu,MeshToonMaterial:lc,MeshNormalMaterial:lh,MeshLambertMaterial:ld,MeshDepthMaterial:lp,MeshDistanceMaterial:lf,MeshBasicMaterial:iR,MeshMatcapMaterial:lm,LineDashedMaterial:lg,LineBasicMaterial:sN,Material:iC})[e]}constructor(e){super(e),this.textures={}}}class uo{static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}}class ul extends i0{copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}}class uu extends lz{load(e,t,n,r){let i=this,a=new lV(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t={},n={};function r(e,r){if(void 0!==t[r])return t[r];let i=e.interleavedBuffers[r],a=function(e,t){if(void 0!==n[t])return n[t];let r=new Uint32Array(e.arrayBuffers[t]).buffer;return n[t]=r,r}(e,i.buffer),s=new aw(nQ(i.type,a),i.stride);return s.uuid=i.uuid,t[r]=s,s}let i=e.isInstancedBufferGeometry?new ul:new i0,a=e.data.index;if(void 0!==a){let e=nQ(a.type,a.array);i.setIndex(new iF(e,1))}let s=e.data.attributes;for(let t in s){let n,a=s[t];if(a.isInterleavedBufferAttribute)n=new aT(r(e.data,a.data),a.itemSize,a.offset,a.normalized);else{let e=nQ(a.type,a.array);n=new(a.isInstancedBufferAttribute?a6:iF)(e,a.itemSize,a.normalized)}void 0!==a.name&&(n.name=a.name),void 0!==a.usage&&n.setUsage(a.usage),i.setAttribute(t,n)}let o=e.data.morphAttributes;if(o)for(let t in o){let n=o[t],a=[];for(let t=0,i=n.length;t0){(n=new lX(new lF(t))).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){(t=new lX(this.manager)).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t{let t=null,n=null;return void 0!==e.boundingBox&&(t=new rf().fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(n=new rL().fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(a._colorsTexture=c(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(a.boundingSphere=new rL().fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&(a.boundingBox=new rf().fromJSON(e.boundingBox));break;case"LOD":a=new aW;break;case"Line":a=new sH(l(e.geometry),u(e.material));break;case"LineLoop":a=new sX(l(e.geometry),u(e.material));break;case"LineSegments":a=new sj(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new s$(l(e.geometry),u(e.material));break;case"Sprite":a=new aB(u(e.material));break;case"Group":a=new ay;break;case"Bone":a=new a1;break;default:a=new ia}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.up&&a.up.fromArray(e.up),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(a.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children){let s=e.children;for(let e=0;e{if(!0!==uf.has(a))return t&&t(n),i.manager.itemEnd(e),n;r&&r(uf.get(a)),i.manager.itemError(e),i.manager.itemEnd(e)}):(setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(n){return lO.add("image-bitmap:".concat(e),n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),uf.set(o,t),lO.remove("image-bitmap:".concat(e)),i.manager.itemError(e),i.manager.itemEnd(e)});lO.add("image-bitmap:".concat(e),o),i.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}}class ug{static getContext(){return void 0===r&&(r=new(window.AudioContext||window.webkitAudioContext)),r}static setContext(e){r=e}}class uv extends lz{load(e,t,n,r){let i=this,a=new lV(this.manager);function s(t){r?r(t):console.error(t),i.manager.itemError(e)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(e){try{let n=e.slice(0);ug.getContext().decodeAudioData(n,function(e){t(e)}).catch(s)}catch(e){s(e)}},n,r)}constructor(e){super(e)}}let uy=new rH,u_=new rH,ux=new rH;class ub{update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){let n,r;t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,ux.copy(e.projectionMatrix);let i=t.eyeSep/2,a=i*t.near/t.focus,s=t.near*Math.tan(nU*t.fov*.5)/t.zoom;u_.elements[12]=-i,uy.elements[12]=i,n=-s*t.aspect+a,r=s*t.aspect+a,ux.elements[0]=2*t.near/(r-n),ux.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(ux),n=-s*t.aspect-a,r=s*t.aspect-a,ux.elements[0]=2*t.near/(r-n),ux.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(ux)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(u_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(uy)}constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new af,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new af,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}}class uS extends af{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class uM{start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}}let uw=new nX,uE=new nj,uT=new nX,uA=new nX,uC=new nX;class uR extends ia{getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(uw,uE,uT),uA.set(0,0,-1).applyQuaternion(uE),uC.set(0,1,0).applyQuaternion(uE),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(uw.x,e),t.positionY.linearRampToValueAtTime(uw.y,e),t.positionZ.linearRampToValueAtTime(uw.z,e),t.forwardX.linearRampToValueAtTime(uA.x,e),t.forwardY.linearRampToValueAtTime(uA.y,e),t.forwardZ.linearRampToValueAtTime(uA.z,e),t.upX.linearRampToValueAtTime(uC.x,e),t.upY.linearRampToValueAtTime(uC.y,e),t.upZ.linearRampToValueAtTime(uC.z,e)}else t.setPosition(uw.x,uw.y,uw.z),t.setOrientation(uA.x,uA.y,uA.z,uC.x,uC.y,uC.z)}constructor(){super(),this.type="AudioListener",this.context=ug.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uM}}class uP extends ia{getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){s.setValue(n,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n;e!==r;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]}_slerp(e,t,n,r){nj.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,i){let a=this._workIndex*i;nj.multiplyQuaternionsFlat(e,a,e,t,e,n),nj.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,i){let a=1-r;for(let s=0;s!==i;++s){let i=t+s;e[i]=e[i]*a+e[n+s]*r}}_lerpAdditive(e,t,n,r,i){for(let a=0;a!==i;++a){let i=t+a;e[i]=e[i]+e[n+a]*r}}constructor(e,t,n){let r,i,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}}let uk="\\[\\]\\.:\\/",uz=RegExp("["+uk+"]","g"),uB="[^"+uk+"]",uH="[^"+uk.replace("\\.","")+"]",uV=/((?:WC+[\/:])*)/.source.replace("WC",uB),uG=/(WCOD+)?/.source.replace("WCOD",uH),uW=RegExp("^"+uV+uG+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uB)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uB)+"$"),uj=["material","materials","bones","map"];class uX{static create(e,t,n){return e&&e.isAnimationObjectGroup?new uX.Composite(e,t,n):new uX(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uz,"")}static parseTrackName(e){let t=uW.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){let e=n.nodeName.substring(r+1);-1!==uj.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){let n=function(e){for(let r=0;r=i){let a=i++,u=e[a];t[u.uuid]=l,e[l]=u,t[o]=a,e[a]=s;for(let e=0;e!==r;++e){let t=n[e],r=t[a],i=t[l];t[l]=r,t[a]=i}}}this.nCachedObjects_=i}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){let o=arguments[s],l=o.uuid,u=t[l];if(void 0!==u)if(delete t[l],u0&&(t[s.uuid]=u),e[u]=s,e.pop();for(let e=0;e!==r;++e){let t=n[e];t[u]=t[i],t.pop()}}}this.nCachedObjects_=i}subscribe_(e,t){let n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];let a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,c=Array(l);r=i.length,n[e]=r,a.push(e),s.push(t),i.push(c);for(let n=u,r=o.length;n!==r;++n){let r=o[n];c[n]=new uX(r,e,t)}return c}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){let r=this._paths,i=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=n,a[n]=o,a.pop(),i[n]=i[s],i.pop(),r[n]=r[s],r.pop()}}constructor(){this.isAnimationObjectGroup=!0,this.uuid=nF(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}}class uY{play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.fadeOut(t),this.fadeIn(t),!0===n){let n=this._clip.duration,r=e._clip.duration;e.warp(1,r/n,t),this.warp(n/r,1,t)}return this}crossFadeTo(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let r=this._mixer,i=r.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=i,o[1]=i+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled)return void this._updateWeight(e);let i=this._startTime;if(null!==i){let r=(e-i)*n;r<0||0===n?t=0:(this._startTime=null,t=n*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(this.blendMode===tH)for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulateAdditive(s);else for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulate(r,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(null!==n){let r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===tN;if(0===e)return -1===i?r:a&&(1&i)==1?t-r:r;if(n===tI){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));s:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break s}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){let n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);let s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(a&&(1&i)==1)return t-r}return r}_setEndings(e,t,n){let r=this._interpolantSettings;n?(r.endingStart=tk,r.endingEnd=tk):(e?r.endingStart=this.zeroSlopeAtStart?tk:tF:r.endingStart=tz,t?r.endingEnd=this.zeroSlopeAtEnd?tk:tF:r.endingEnd=tz)}_scheduleFading(e,t,n){let r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=i,o[0]=t,s[1]=i+e,o[1]=n,this}constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;let i=t.tracks,a=i.length,s=Array(a),o={endingStart:tF,endingEnd:tF};for(let e=0;e!==a;++e){let t=i[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=tL,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}}let uJ=new Float32Array(1);class uZ extends nL{_bindAction(e,t){let n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,s=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName,u=l[o];void 0===u&&(u={},l[o]=u);for(let e=0;e!==i;++e){let i=r[e],l=i.name,c=u[l];if(void 0!==c)++c.referenceCount,a[e]=c;else{if(void 0!==(c=a[e])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;c=new uF(uX.create(n,l,r),i.ValueTypeName,i.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[e]=c}s[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==n;++s)t[s]._update(r,e,i,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e1)||void 0===arguments[1]||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return u6(e,this,n,t),n.sort(u5),n}intersectObjects(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let r=0,i=e.length;r1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}constructor(e,t,n,r){ct.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,r)}}let cn=new nW;class cr{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,cn).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}constructor(e=new nW(Infinity,Infinity),t=new nW(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}}let ci=new nX,ca=new nX,cs=new nX,co=new nX,cl=new nX,cu=new nX,cc=new nX;class ch{set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ci.subVectors(e,this.start),ca.subVectors(this.end,this.start);let n=ca.dot(ca),r=ca.dot(ci)/n;return t&&(r=nk(r,0,1)),r}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cu,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:cc,a=1e-8*1e-8,s=this.start,o=e.start,l=this.end,u=e.end;cs.subVectors(l,s),co.subVectors(u,o),cl.subVectors(s,o);let c=cs.dot(cs),h=co.dot(co),d=co.dot(cl);if(c<=a&&h<=a)return r.copy(s),i.copy(o),r.sub(i),r.dot(r);if(c<=a)t=0,n=nk(n=d/h,0,1);else{let e=cs.dot(cl);if(h<=a)n=0,t=nk(-e/c,0,1);else{let r=cs.dot(co),i=c*h-r*r;t=0!==i?nk((r*d-e*h)/i,0,1):0,(n=(r*t+d)/h)<0?(n=0,t=nk(-e/c,0,1)):n>1&&(n=1,t=nk((r-e)/c,0,1))}}return r.copy(s).add(cs.multiplyScalar(t)),i.copy(o).add(co.multiplyScalar(n)),r.sub(i),r.dot(r)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}constructor(e=new nX,t=new nX){this.start=e,this.end=t}}let cd=new nX;class cp extends ia{dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),cd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(cd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let n=new i0,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){let n=e/32*Math.PI*2,i=t/32*Math.PI*2;r.push(Math.cos(n),Math.sin(n),1,Math.cos(i),Math.sin(i),1)}n.setAttribute("position",new iX(r,3));let i=new sN({fog:!1,toneMapped:!1});this.cone=new sj(n,i),this.add(this.cone),this.update()}}let cf=new nX,cm=new rH,cg=new rH;class cv extends sj{updateMatrixWorld(e){let t=this.bones,n=this.geometry,r=n.getAttribute("position");cg.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e1)for(let n=0;n.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{cF.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(cF,t)}}setLength(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}constructor(e=new nX(0,0,1),t=new nX(0,0,0),n=1,r=0xffff00,s=.2*n,o=.2*s){super(),this.type="ArrowHelper",void 0===i&&((i=new i0).setAttribute("position",new iX([0,0,0,0,1,0],3)),(a=new on(.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new sH(i,new sN({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new an(a,new iR({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}}class cz extends sj{setColors(e,t,n){let r=new iE,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=1){let t=new i0;t.setAttribute("position",new iX([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],3)),t.setAttribute("color",new iX([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(t,new sN({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}class cB{moveTo(e,t){return this.currentPath=new oI,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){let t,n,r,i,a,s=oZ.isClockWise,o=this.subPaths;if(0===o.length)return[];let l=[];if(1===o.length)return n=o[0],(r=new oL).curves=n.curves,l.push(r),l;let u=!s(o[0].getPoints());u=e?!u:u;let c=[],h=[],d=[],p=0;h[0]=void 0,d[p]=[];for(let r=0,a=o.length;r1){let e=!1,t=0;for(let e=0,t=h.length;eNumber.EPSILON){if(l<0&&(n=t[a],o=-o,s=t[i],l=-l),e.ys.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{let t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(s.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=s.x)return!0}}return r})(a.p,h[r].p)&&(n!==r&&t++,s?(s=!1,c[r].push(a)):e=!0);s&&c[n].push(a)}}t>0&&!1===e&&(d=c)}for(let e=0,t=h.length;et?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}static cover(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}static fill(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}static getByteLength(e,t,n,r){return cV(e,t,n,r)}}function cW(){let e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function cj(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){let e=t.get(n);(!e||e.versione.start-t.start);let t=0;for(let e=1;eha,"ShaderChunk",()=>cX,"ShaderLib",()=>cY,"UniformsLib",()=>cq,"WebGLRenderer",()=>d2,"WebGLUtils",()=>dJ],8560);let cX={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n float depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n #ifdef USE_REVERSED_DEPTH_BUFFER\n return step( depth, compare );\n #else\n return step( compare, depth );\n #endif\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( distribution.x, compare );\n #else\n float hard_shadow = step( compare, distribution.x );\n #endif\n if ( hard_shadow != 1.0 ) {\n float distance = compare - distribution.x;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n shadow = (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},cq={common:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new nJ},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new nJ}},envmap:{envMap:{value:null},envMapRotation:{value:new nJ},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new nJ}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new nJ}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new nJ},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new nJ},normalScale:{value:new nW(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new nJ},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new nJ}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new nJ}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new nJ}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new iE(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0},uvTransform:{value:new nJ}},sprite:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},center:{value:new nW(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new nJ},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0}}},cY={basic:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.fog]),vertexShader:cX.meshbasic_vert,fragmentShader:cX.meshbasic_frag},lambert:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,cq.lights,{emissive:{value:new iE(0)}}]),vertexShader:cX.meshlambert_vert,fragmentShader:cX.meshlambert_frag},phong:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,cq.lights,{emissive:{value:new iE(0)},specular:{value:new iE(1118481)},shininess:{value:30}}]),vertexShader:cX.meshphong_vert,fragmentShader:cX.meshphong_frag},standard:{uniforms:as([cq.common,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.roughnessmap,cq.metalnessmap,cq.fog,cq.lights,{emissive:{value:new iE(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:cX.meshphysical_vert,fragmentShader:cX.meshphysical_frag},toon:{uniforms:as([cq.common,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.gradientmap,cq.fog,cq.lights,{emissive:{value:new iE(0)}}]),vertexShader:cX.meshtoon_vert,fragmentShader:cX.meshtoon_frag},matcap:{uniforms:as([cq.common,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,{matcap:{value:null}}]),vertexShader:cX.meshmatcap_vert,fragmentShader:cX.meshmatcap_frag},points:{uniforms:as([cq.points,cq.fog]),vertexShader:cX.points_vert,fragmentShader:cX.points_frag},dashed:{uniforms:as([cq.common,cq.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:cX.linedashed_vert,fragmentShader:cX.linedashed_frag},depth:{uniforms:as([cq.common,cq.displacementmap]),vertexShader:cX.depth_vert,fragmentShader:cX.depth_frag},normal:{uniforms:as([cq.common,cq.bumpmap,cq.normalmap,cq.displacementmap,{opacity:{value:1}}]),vertexShader:cX.meshnormal_vert,fragmentShader:cX.meshnormal_frag},sprite:{uniforms:as([cq.sprite,cq.fog]),vertexShader:cX.sprite_vert,fragmentShader:cX.sprite_frag},background:{uniforms:{uvTransform:{value:new nJ},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:cX.background_vert,fragmentShader:cX.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new nJ}},vertexShader:cX.backgroundCube_vert,fragmentShader:cX.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:cX.cube_vert,fragmentShader:cX.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:cX.equirect_vert,fragmentShader:cX.equirect_frag},distanceRGBA:{uniforms:as([cq.common,cq.displacementmap,{referencePosition:{value:new nX},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:cX.distanceRGBA_vert,fragmentShader:cX.distanceRGBA_frag},shadow:{uniforms:as([cq.lights,cq.fog,{color:{value:new iE(0)},opacity:{value:1}}]),vertexShader:cX.shadow_vert,fragmentShader:cX.shadow_frag}};cY.physical={uniforms:as([cY.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new nJ},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new nJ},clearcoatNormalScale:{value:new nW(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new nJ},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new nJ},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new nJ},sheen:{value:0},sheenColor:{value:new iE(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new nJ},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new nJ},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new nJ},transmissionSamplerSize:{value:new nW},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new nJ},attenuationDistance:{value:0},attenuationColor:{value:new iE(0)},specularColor:{value:new iE(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new nJ},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new nJ},anisotropyVector:{value:new nW},anisotropyMap:{value:null},anisotropyMapTransform:{value:new nJ}}]),vertexShader:cX.meshphysical_vert,fragmentShader:cX.meshphysical_frag};let cJ={r:0,b:0,g:0},cZ=new rK,cK=new rH;function c$(e,t,n,r,i,a,s){let o,l,u=new iE(0),c=+(!0!==a),h=null,d=0,p=null;function f(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function m(t,n){t.getRGB(cJ,ao(e)),r.buffers.color.setClear(cJ.r,cJ.g,cJ.b,n,s)}return{getClearColor:function(){return u},setClearColor:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;u.set(e),m(u,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){m(u,c=e)},render:function(t){let n=!1,i=f(t);null===i?m(u,c):i&&i.isColor&&(m(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?r.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&r.buffers.color.setClear(0,0,0,0,s),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){let r=f(n);r&&(r.isCubeTexture||r.mapping===eE)?(void 0===l&&((l=new an(new ai(1,1,1),new au({name:"BackgroundCubeMaterial",uniforms:aa(cY.backgroundCube.uniforms),vertexShader:cY.backgroundCube.vertexShader,fragmentShader:cY.backgroundCube.fragmentShader,side:E,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),cZ.copy(n.backgroundRotation),cZ.x*=-1,cZ.y*=-1,cZ.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(cZ.y*=-1,cZ.z*=-1),l.material.uniforms.envMap.value=r,l.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(cK.makeRotationFromEuler(cZ)),l.material.toneMapped=n8.getTransfer(r.colorSpace)!==t1,(h!==r||d!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,h=r,d=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):r&&r.isTexture&&(void 0===o&&((o=new an(new o4(2,2),new au({name:"BackgroundMaterial",uniforms:aa(cY.background.uniforms),vertexShader:cY.background.vertexShader,fragmentShader:cY.background.fragmentShader,side:w,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=r,o.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,o.material.toneMapped=n8.getTransfer(r.colorSpace)!==t1,!0===r.matrixAutoUpdate&&r.updateMatrix(),o.material.uniforms.uvTransform.value.copy(r.matrix),(h!==r||d!==r.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,h=r,d=r.version,p=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))},dispose:function(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0)}}}function cQ(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=u(null),a=i,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=s[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===n||n.attribute!==r||r&&n.data!==r.data)return!0;o++}return a.attributesNum!==o||a.index!==r}(n,m,l,g))&&function(e,t,n,r){let i={},s=t.attributes,o=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,o++}a.attributes=i,a.attributesNum=o,a.index=r}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||s)&&(s=!1,function(n,r,i,a){c();let s=a.attributes,o=i.getAttributes(),l=r.defaultAttributeValues;for(let r in o){let i=o[r];if(i.location>=0){let o=s[r];if(void 0===o&&("instanceMatrix"===r&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===r&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){let r=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let u=l.buffer,c=l.type,p=l.bytesPerElement,m=c===e.INT||c===e.UNSIGNED_INT||o.gpuType===eG;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp",o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);let l=!0===n.logarithmicDepthBuffer,u=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control"),c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),f=e.getParameter(e.MAX_VERTEX_ATTRIBS),m=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){let n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:a,textureFormatReadable:function(t){return t===e0||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){let i=n===eX&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return n===ez||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||n===ej||!!i},precision:s,logarithmicDepthBuffer:l,reversedDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function c2(e){let t=this,n=null,r=0,i=!1,a=!1,s=new sl,o=new nJ,l={value:null,needsUpdate:!1};function u(e,n,r,i){let a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){let t=r+4*a,i=n.matrixWorldInverse;o.getNormalMatrix(i),(null===u||u.length0),t.numPlanes=r,t.numIntersection=0)}}function c3(e){let t=new WeakMap;function n(e,t){return t===eM?e.mapping=eb:t===ew&&(e.mapping=eS),e}function r(e){let n=e.target;n.removeEventListener("dispose",r);let i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){let a=i.mapping;if(a===eM||a===ew)if(t.has(i))return n(t.get(i).texture,i.mapping);else{let a=i.image;if(!a||!(a.height>0))return null;{let s=new av(a.height);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}}}return i},dispose:function(){t=new WeakMap}}}let c4=[.125,.215,.35,.446,.526,.582],c5=new l7,c6=new iE,c8=null,c9=0,c7=0,he=!1,ht=(1+Math.sqrt(5))/2,hn=1/ht,hr=[new nX(-ht,hn,0),new nX(ht,hn,0),new nX(-hn,0,ht),new nX(hn,0,ht),new nX(0,ht,-hn),new nX(0,ht,hn),new nX(-1,1,-1),new nX(1,1,-1),new nX(-1,1,1),new nX(1,1,1)],hi=new nX;class ha{fromScene(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},{size:a=256,position:s=hi}=i;c8=this._renderer.getRenderTarget(),c9=this._renderer.getActiveCubeFace(),c7=this._renderer.getActiveMipmapLevel(),he=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,r,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}fromCubemap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=hu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=hl(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=c4[s-e+4-1]:0===s&&(o=0),r.push(o);let l=1/(a-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];d.set(r,18*e),p.set(h,12*e);let i=[e,e,e,e,e,e];f.set(i,6*e)}let m=new i0;m.setAttribute("position",new iF(d,3)),m.setAttribute("uv",new iF(p,2)),m.setAttribute("faceIndex",new iF(f,1)),t.push(m),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(r)),this._blurMaterial=function(e,t,n){let r=new Float32Array(20),i=new nX(0,1,0);return new au({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include \n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}(r,e,t)}return r}_compileMaterial(e){let t=new an(this._lodPlanes[0],e);this._renderer.compile(t,c5)}_sceneToCubeUV(e,t,n,r,i){let a=new af(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(c6),l.toneMapping=ec,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(r),l.clearDepth(),l.setRenderTarget(null));let h=new iR({name:"PMREM.Background",side:E,depthWrite:!1,depthTest:!1}),d=new an(new ai,h),p=!1,f=e.background;f?f.isColor&&(h.color.copy(f),e.background=null,p=!0):(h.color.copy(c6),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(a.up.set(0,s[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+o[t],i.y,i.z)):1===n?(a.up.set(0,0,s[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+o[t],i.z)):(a.up.set(0,s[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+o[t]));let u=this._cubeSize;ho(r,n*u,t>2?u:0,u,u),l.setRenderTarget(r),p&&l.render(d,a),l.render(e,a)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=c,l.autoClear=u,e.background=f}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===eb||e.mapping===eS;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=hu()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=hl());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new an(this._lodPlanes[0],i);i.uniforms.envMap.value=e;let s=this._cubeSize;ho(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,c5)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;t20&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(20));let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ev-4?r-v+4:0),_,3*y,2*y),o.setRenderTarget(t),o.render(u,c5)}constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}}function hs(e,t,n){let r=new ru(e,t,n);return r.texture.mapping=eE,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function ho(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function hl(){return new au({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include \n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}function hu(){return new au({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}function hc(){return"\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n "}function hh(e){let t=new WeakMap,n=null;function r(e){let n=e.target;n.removeEventListener("dispose",r);let i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){let a=i.mapping,s=a===eM||a===ew,o=a===eb||a===eS;if(s||o){let a=t.get(i),l=void 0!==a?a.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==l)return null===n&&(n=new ha(e)),(a=s?n.fromEquirectangular(i,a):n.fromCubemap(i,a)).texture.pmremVersion=i.pmremVersion,t.set(i,a),a.texture;{if(void 0!==a)return a.texture;let l=i.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new ha(e)),(a=s?n.fromEquirectangular(i):n.fromCubemap(i)).texture.pmremVersion=i.pmremVersion,t.set(i,a),i.addEventListener("dispose",r),a.texture):null}}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function hd(e){let t={};function n(n){let r;if(void 0!==t[n])return t[n];switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){let t=n(e);return null===t&&n3("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function hp(e,t,n,r){let i={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete i[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),r.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){let n=[],r=e.index,i=e.attributes.position,s=0;if(null!==r){let e=r.array;s=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*c),g=new rc(m,p,f,c);g.type=ej,g.needsUpdate=!0;let v=4*d;for(let t=0;t0)return e;let i=t*n,a=hM[i];if(void 0===a&&(a=new Float32Array(i),hM[i]=a),0!==t){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function hR(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n":" "," ").concat(i,": ").concat(n[e]))}return r.join("\n")}(e.getShaderSource(t),r)}}let dv=new nX;function dy(e){return""!==e}function d_(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function dx(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let db=/^[ \t]*#include +<([\w\d./]+)>/gm;function dS(e){return e.replace(db,dw)}let dM=new Map;function dw(e,t){let n=cX[t];if(void 0===n){let e=dM.get(t);if(void 0!==e)n=cX[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return dS(n)}let dE=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function dT(e){return e.replace(dE,dA)}function dA(e,t,n,r){let i="";for(let e=parseInt(t);e0&&(i+="\n"),(a=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(dy).join("\n")).length>0&&(a+="\n")):(i=[dC(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+g:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(dy).join("\n"),a=[dC(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+m:"",n.envMap?"#define "+g:"",n.envMap?"#define "+v:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ec?"#define TONE_MAPPING":"",n.toneMapping!==ec?cX.tonemapping_pars_fragment:"",n.toneMapping!==ec?function(e,t){let n;switch(t){case eh:n="Linear";break;case ed:n="Reinhard";break;case ep:n="Cineon";break;case ef:n="ACESFilmic";break;case eg:n="AgX";break;case ev:n="Neutral";break;case em:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",cX.colorspace_pars_fragment,function(e,t){let n=function(e){n8._getMatrix(dm,n8.workingColorSpace,e);let t="mat3( ".concat(dm.elements.map(e=>e.toFixed(4))," )");switch(n8.getTransfer(e)){case t0:return[t,"LinearTransferOETF"];case t1:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return["vec4 ".concat(e,"( vec4 value ) {")," return ".concat(n[1],"( vec4( value.rgb * ").concat(n[0],", value.a ) );"),"}"].join("\n")}("linearToOutputTexel",n.outputColorSpace),function(){n8.getLuminanceCoefficients(dv);let e=dv.x.toFixed(4),t=dv.y.toFixed(4),n=dv.z.toFixed(4);return["float luminance( const in vec3 rgb ) {"," const vec3 weights = vec3( ".concat(e,", ").concat(t,", ").concat(n," );")," return dot( weights, rgb );\n}"].join("\n")}(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(dy).join("\n")),d=dx(d=d_(d=dS(d),n),n),p=dx(p=d_(p=dS(p),n),n),d=dT(d),p=dT(p),!0!==n.isRawShaderMaterial&&(E="#version 300 es\n",i=[_,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===nT?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===nT?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);let T=E+i+d,A=E+a+p,C=dp(c,c.VERTEX_SHADER,T),R=dp(c,c.FRAGMENT_SHADER,A);function P(t){if(e.debug.checkShaderErrors){let n=c.getProgramInfoLog(w)||"",r=c.getShaderInfoLog(C)||"",s=c.getShaderInfoLog(R)||"",o=n.trim(),l=r.trim(),u=s.trim(),h=!0,d=!0;if(!1===c.getProgramParameter(w,c.LINK_STATUS))if(h=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,w,C,R);else{let e=dg(c,C,"vertex"),n=dg(c,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(w,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+o+"\n"+e+"\n"+n)}else""!==o?console.warn("THREE.WebGLProgram: Program Info Log:",o):(""===l||""===u)&&(d=!1);d&&(t.diagnostics={runnable:h,programLog:o,vertexShader:{log:l,prefix:i},fragmentShader:{log:u,prefix:a}})}c.deleteShader(C),c.deleteShader(R),s=new dd(c,w),o=function(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i0,Z=a.clearcoat>0,K=a.dispersion>0,$=a.iridescence>0,Q=a.sheen>0,ee=a.transmission>0,et=J&&!!a.anisotropyMap,en=Z&&!!a.clearcoatMap,er=Z&&!!a.clearcoatNormalMap,ei=Z&&!!a.clearcoatRoughnessMap,ea=$&&!!a.iridescenceMap,es=$&&!!a.iridescenceThicknessMap,eo=Q&&!!a.sheenColorMap,el=Q&&!!a.sheenRoughnessMap,eu=!!a.specularMap,eh=!!a.specularColorMap,ed=!!a.specularIntensityMap,ep=ee&&!!a.transmissionMap,ef=ee&&!!a.thicknessMap,em=!!a.gradientMap,eg=!!a.alphaMap,ev=a.alphaTest>0,ey=!!a.alphaHash,e_=!!a.extensions,ex=ec;a.toneMapped&&(null===D||!0===D.isXRRenderTarget)&&(ex=e.toneMapping);let eb={shaderID:P,shaderType:a.type,shaderName:a.name,vertexShader:y,fragmentShader:_,defines:a.defines,customVertexShaderID:x,customFragmentShaderID:b,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:F,batchingColor:F&&null!==v._colorsTexture,instancing:O,instancingColor:O&&null!==v.instanceColor,instancingMorph:O&&null!==v.morphTexture,supportsVertexTextures:d,outputColorSpace:null===D?e.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:tQ,alphaToCoverage:!!a.alphaToCoverage,map:k,matcap:z,envMap:B,envMapMode:B&&A.mapping,envMapCubeUVHeight:R,aoMap:H,lightMap:V,bumpMap:G,normalMap:W,displacementMap:d&&j,emissiveMap:X,normalMapObjectSpace:W&&a.normalMapType===tZ,normalMapTangentSpace:W&&a.normalMapType===tJ,metalnessMap:q,roughnessMap:Y,anisotropy:J,anisotropyMap:et,clearcoat:Z,clearcoatMap:en,clearcoatNormalMap:er,clearcoatRoughnessMap:ei,dispersion:K,iridescence:$,iridescenceMap:ea,iridescenceThicknessMap:es,sheen:Q,sheenColorMap:eo,sheenRoughnessMap:el,specularMap:eu,specularColorMap:eh,specularIntensityMap:ed,transmission:ee,transmissionMap:ep,thicknessMap:ef,gradientMap:em,opaque:!1===a.transparent&&a.blending===C&&!1===a.alphaToCoverage,alphaMap:eg,alphaTest:ev,alphaHash:ey,combine:a.combine,mapUv:k&&m(a.map.channel),aoMapUv:H&&m(a.aoMap.channel),lightMapUv:V&&m(a.lightMap.channel),bumpMapUv:G&&m(a.bumpMap.channel),normalMapUv:W&&m(a.normalMap.channel),displacementMapUv:j&&m(a.displacementMap.channel),emissiveMapUv:X&&m(a.emissiveMap.channel),metalnessMapUv:q&&m(a.metalnessMap.channel),roughnessMapUv:Y&&m(a.roughnessMap.channel),anisotropyMapUv:et&&m(a.anisotropyMap.channel),clearcoatMapUv:en&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:er&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ei&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ea&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:es&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:eo&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:el&&m(a.sheenRoughnessMap.channel),specularMapUv:eu&&m(a.specularMap.channel),specularColorMapUv:eh&&m(a.specularColorMap.channel),specularIntensityMapUv:ed&&m(a.specularIntensityMap.channel),transmissionMapUv:ep&&m(a.transmissionMap.channel),thicknessMapUv:ef&&m(a.thicknessMap.channel),alphaMapUv:eg&&m(a.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(W||J),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!M.attributes.uv&&(k||eg),fog:!!S,useFog:!0===a.fog,fogExp2:!!S&&S.isFogExp2,flatShading:!0===a.flatShading&&!1===a.wireframe,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:U,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:L,morphTextureStride:N,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ex,decodeVideoTexture:k&&!0===a.map.isVideoTexture&&n8.getTransfer(a.map.colorSpace)===t1,decodeVideoTextureEmissive:X&&!0===a.emissiveMap.isVideoTexture&&n8.getTransfer(a.emissiveMap.colorSpace)===t1,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===T,flipSided:a.side===E,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:e_&&!0===a.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(e_&&!0===a.extensions.multiDraw||F)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return eb.vertexUv1s=u.has(1),eb.vertexUv2s=u.has(2),eb.vertexUv3s=u.has(3),u.clear(),eb},getProgramCacheKey:function(t){var n,r,i,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(n=s,r=t,n.push(r.precision),n.push(r.outputColorSpace),n.push(r.envMapMode),n.push(r.envMapCubeUVHeight),n.push(r.mapUv),n.push(r.alphaMapUv),n.push(r.lightMapUv),n.push(r.aoMapUv),n.push(r.bumpMapUv),n.push(r.normalMapUv),n.push(r.displacementMapUv),n.push(r.emissiveMapUv),n.push(r.metalnessMapUv),n.push(r.roughnessMapUv),n.push(r.anisotropyMapUv),n.push(r.clearcoatMapUv),n.push(r.clearcoatNormalMapUv),n.push(r.clearcoatRoughnessMapUv),n.push(r.iridescenceMapUv),n.push(r.iridescenceThicknessMapUv),n.push(r.sheenColorMapUv),n.push(r.sheenRoughnessMapUv),n.push(r.specularMapUv),n.push(r.specularColorMapUv),n.push(r.specularIntensityMapUv),n.push(r.transmissionMapUv),n.push(r.thicknessMapUv),n.push(r.combine),n.push(r.fogExp2),n.push(r.sizeAttenuation),n.push(r.morphTargetsCount),n.push(r.morphAttributeCount),n.push(r.numDirLights),n.push(r.numPointLights),n.push(r.numSpotLights),n.push(r.numSpotLightMaps),n.push(r.numHemiLights),n.push(r.numRectAreaLights),n.push(r.numDirLightShadows),n.push(r.numPointLightShadows),n.push(r.numSpotLightShadows),n.push(r.numSpotLightShadowsWithMaps),n.push(r.numLightProbes),n.push(r.shadowMapType),n.push(r.toneMapping),n.push(r.numClippingPlanes),n.push(r.numClipIntersection),n.push(r.depthPacking),i=s,a=t,o.disableAll(),a.supportsVertexTextures&&o.enable(0),a.instancing&&o.enable(1),a.instancingColor&&o.enable(2),a.instancingMorph&&o.enable(3),a.matcap&&o.enable(4),a.envMap&&o.enable(5),a.normalMapObjectSpace&&o.enable(6),a.normalMapTangentSpace&&o.enable(7),a.clearcoat&&o.enable(8),a.iridescence&&o.enable(9),a.alphaTest&&o.enable(10),a.vertexColors&&o.enable(11),a.vertexAlphas&&o.enable(12),a.vertexUv1s&&o.enable(13),a.vertexUv2s&&o.enable(14),a.vertexUv3s&&o.enable(15),a.vertexTangents&&o.enable(16),a.anisotropy&&o.enable(17),a.alphaHash&&o.enable(18),a.batching&&o.enable(19),a.dispersion&&o.enable(20),a.batchingColor&&o.enable(21),a.gradientMap&&o.enable(22),i.push(o.mask),o.disableAll(),a.fog&&o.enable(0),a.useFog&&o.enable(1),a.flatShading&&o.enable(2),a.logarithmicDepthBuffer&&o.enable(3),a.reversedDepthBuffer&&o.enable(4),a.skinning&&o.enable(5),a.morphTargets&&o.enable(6),a.morphNormals&&o.enable(7),a.morphColors&&o.enable(8),a.premultipliedAlpha&&o.enable(9),a.shadowMapEnabled&&o.enable(10),a.doubleSided&&o.enable(11),a.flipSided&&o.enable(12),a.useDepthPacking&&o.enable(13),a.dithering&&o.enable(14),a.transmission&&o.enable(15),a.sheen&&o.enable(16),a.opaque&&o.enable(17),a.pointsUvs&&o.enable(18),a.decodeVideoTexture&&o.enable(19),a.decodeVideoTextureEmissive&&o.enable(20),a.alphaToCoverage&&o.enable(21),i.push(o.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,n=f[e.type];if(n){let e=cY[n];t=al.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){let r;for(let e=0,t=c.length;e0?r.push(c):!0===s.transparent?i.push(c):n.push(c)},unshift:function(e,t,s,o,l,u){let c=a(e,t,s,o,l,u);s.transmission>0?r.unshift(c):!0===s.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(let n=t,r=e.length;n1&&n.sort(e||dU),r.length>1&&r.sort(t||dO),i.length>1&&i.sort(t||dO)}}}function dk(){let e=new WeakMap;return{get:function(t,n){let r,i=e.get(t);return void 0===i?(r=new dF,e.set(t,[r])):n>=i.length?(r=new dF,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function dz(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":n={direction:new nX,color:new iE};break;case"SpotLight":n={position:new nX,direction:new nX,color:new iE,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new nX,color:new iE,distance:0,decay:0};break;case"HemisphereLight":n={direction:new nX,skyColor:new iE,groundColor:new iE};break;case"RectAreaLight":n={color:new iE,position:new nX,halfWidth:new nX,halfHeight:new nX}}return e[t.id]=n,n}}}let dB=0;function dH(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function dV(e){let t=new dz,n=function(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nW};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nW,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new nX);let i=new nX,a=new rH,s=new rH;return{setup:function(i){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,u=0,c=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0,y=0;i.sort(dH);for(let e=0,_=i.length;e<_;e++){let _=i[e],x=_.color,b=_.intensity,S=_.distance,M=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)a+=x.r*b,s+=x.g*b,o+=x.b*b;else if(_.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(_.sh.coefficients[e],b);y++}else if(_.isDirectionalLight){let e=t.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),_.castShadow){let e=_.shadow,t=n.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=M,r.directionalShadowMatrix[l]=_.shadow.matrix,p++}r.directional[l]=e,l++}else if(_.isSpotLight){let e=t.get(_);e.position.setFromMatrixPosition(_.matrixWorld),e.color.copy(x).multiplyScalar(b),e.distance=S,e.coneCos=Math.cos(_.angle),e.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),e.decay=_.decay,r.spot[c]=e;let i=_.shadow;if(_.map&&(r.spotLightMap[g]=_.map,g++,i.updateMatrices(_),_.castShadow&&v++),r.spotLightMatrix[c]=i.matrix,_.castShadow){let e=n.get(_);e.shadowIntensity=i.intensity,e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,r.spotShadow[c]=e,r.spotShadowMap[c]=M,m++}c++}else if(_.isRectAreaLight){let e=t.get(_);e.color.copy(x).multiplyScalar(b),e.halfWidth.set(.5*_.width,0,0),e.halfHeight.set(0,.5*_.height,0),r.rectArea[h]=e,h++}else if(_.isPointLight){let e=t.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),e.distance=_.distance,e.decay=_.decay,_.castShadow){let e=_.shadow,t=n.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[u]=t,r.pointShadowMap[u]=M,r.pointShadowMatrix[u]=_.shadow.matrix,f++}r.point[u]=e,u++}else if(_.isHemisphereLight){let e=t.get(_);e.skyColor.copy(_.color).multiplyScalar(b),e.groundColor.copy(_.groundColor).multiplyScalar(b),r.hemi[d]=e,d++}}h>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=cq.LTC_FLOAT_1,r.rectAreaLTC2=cq.LTC_FLOAT_2):(r.rectAreaLTC1=cq.LTC_HALF_1,r.rectAreaLTC2=cq.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let _=r.hash;(_.directionalLength!==l||_.pointLength!==u||_.spotLength!==c||_.rectAreaLength!==h||_.hemiLength!==d||_.numDirectionalShadows!==p||_.numPointShadows!==f||_.numSpotShadows!==m||_.numSpotMaps!==g||_.numLightProbes!==y)&&(r.directional.length=l,r.spot.length=c,r.rectArea.length=h,r.point.length=u,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-v,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=v,r.numLightProbes=y,_.directionalLength=l,_.pointLength=u,_.spotLength=c,_.rectAreaLength=h,_.hemiLength=d,_.numDirectionalShadows=p,_.numPointShadows=f,_.numSpotShadows=m,_.numSpotMaps=g,_.numLightProbes=y,r.version=dB++)},setupView:function(e,t){let n=0,o=0,l=0,u=0,c=0,h=t.matrixWorldInverse;for(let t=0,d=e.length;t1&&void 0!==arguments[1]?arguments[1]:0,a=t.get(n);return void 0===a?(r=new dG(e),t.set(n,[r])):i>=a.length?(r=new dG(e),a.push(r)):r=a[i],r},dispose:function(){t=new WeakMap}}}function dj(e,t,n){let r=new sd,i=new nW,a=new nW,s=new ro,o=new lp({depthPacking:tX}),l=new lf,u={},c=n.maxTextureSize,h={[w]:E,[E]:w,[T]:T},d=new au({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new nW},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new i0;f.setAttribute("position",new iF(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new an(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b;let v=this.type;function y(t,n,r,i){let a=null,s=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===r.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){let e=a.uuid,t=n.uuid,r=u[e];void 0===r&&(r={},u[e]=r);let i=r[t];void 0===i&&(i=a.clone(),r[t]=i,n.addEventListener("dispose",_)),a=i}return a.visible=n.visible,a.wireframe=n.wireframe,i===M?a.side=null!==n.shadowSide?n.shadowSide:n.side:a.side=null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=r),a}function _(e){for(let t in e.target.removeEventListener("dispose",_),u){let n=u[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}this.render=function(n,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===n.length)return;let u=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.state;_.setBlending(A),!0===_.buffers.depth.getReversed()?_.buffers.color.setClear(0,0,0,0):_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);let x=v!==M&&this.type===M,b=v===M&&this.type!==M;for(let u=0,h=n.length;uc||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/g.x),i.x=a.x*g.x,f.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/g.y),i.y=a.y*g.y,f.mapSize.y=a.y)),null===f.map||!0===x||!0===b){let e=this.type!==M?{minFilter:eR,magFilter:eR}:{};null!==f.map&&f.map.dispose(),f.map=new ru(i.x,i.y,e),f.map.texture.name=h.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let v=f.getViewportCount();for(let n=0;n=1:-1!==em.indexOf("OpenGL ES")&&(ef=parseFloat(/^OpenGL ES (\d)/.exec(em)[1])>=2);let eg=null,ev={},ey=e.getParameter(e.SCISSOR_BOX),e_=e.getParameter(e.VIEWPORT),ex=new ro().fromArray(ey),eb=new ro().fromArray(e_);function eS(t,n,r,i){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;sn||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);void 0===o&&(o=f(n,a));let s=t?f(n,a):o;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+i.width+"x"+i.height+") to ("+n+"x"+a+")."),s}else"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+i.width+"x"+i.height+").");return e}function g(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function y(n,r,i,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=r;if(r===e.RED&&(i===e.FLOAT&&(o=e.R32F),i===e.HALF_FLOAT&&(o=e.R16F),i===e.UNSIGNED_BYTE&&(o=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.R8UI),i===e.UNSIGNED_SHORT&&(o=e.R16UI),i===e.UNSIGNED_INT&&(o=e.R32UI),i===e.BYTE&&(o=e.R8I),i===e.SHORT&&(o=e.R16I),i===e.INT&&(o=e.R32I)),r===e.RG&&(i===e.FLOAT&&(o=e.RG32F),i===e.HALF_FLOAT&&(o=e.RG16F),i===e.UNSIGNED_BYTE&&(o=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RG8UI),i===e.UNSIGNED_SHORT&&(o=e.RG16UI),i===e.UNSIGNED_INT&&(o=e.RG32UI),i===e.BYTE&&(o=e.RG8I),i===e.SHORT&&(o=e.RG16I),i===e.INT&&(o=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RGB8UI),i===e.UNSIGNED_SHORT&&(o=e.RGB16UI),i===e.UNSIGNED_INT&&(o=e.RGB32UI),i===e.BYTE&&(o=e.RGB8I),i===e.SHORT&&(o=e.RGB16I),i===e.INT&&(o=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),i===e.UNSIGNED_INT&&(o=e.RGBA32UI),i===e.BYTE&&(o=e.RGBA8I),i===e.SHORT&&(o=e.RGBA16I),i===e.INT&&(o=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),r===e.RGBA){let t=s?t0:n8.getTransfer(a);i===e.FLOAT&&(o=e.RGBA32F),i===e.HALF_FLOAT&&(o=e.RGBA16F),i===e.UNSIGNED_BYTE&&(o=t===t1?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function _(t,n){let r;return t?null===n||n===eW||n===eJ?r=e.DEPTH24_STENCIL8:n===ej?r=e.DEPTH32F_STENCIL8:n===eV&&(r=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===eW||n===eJ?r=e.DEPTH_COMPONENT24:n===ej?r=e.DEPTH_COMPONENT32F:n===eV&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==eR&&e.minFilter!==eD?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function b(e){let t=e.target;t.removeEventListener("dispose",b),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let n=e.source,i=d.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&M(e),0===Object.keys(i).length&&d.delete(n)}r.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function S(t){let n=t.target;n.removeEventListener("dispose",S),function(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r0&&a.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(a,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}let T={[eT]:e.REPEAT,[eA]:e.CLAMP_TO_EDGE,[eC]:e.MIRRORED_REPEAT},A={[eR]:e.NEAREST,[eP]:e.NEAREST_MIPMAP_NEAREST,[eL]:e.NEAREST_MIPMAP_LINEAR,[eD]:e.LINEAR,[eU]:e.LINEAR_MIPMAP_NEAREST,[eF]:e.LINEAR_MIPMAP_LINEAR},C={[nl]:e.NEVER,[nm]:e.ALWAYS,[nu]:e.LESS,[nh]:e.LEQUAL,[nc]:e.EQUAL,[nf]:e.GEQUAL,[nd]:e.GREATER,[np]:e.NOTEQUAL};function R(n,a){if((a.type===ej&&!1===t.has("OES_texture_float_linear")&&(a.magFilter===eD||a.magFilter===eU||a.magFilter===eL||a.magFilter===eF||a.minFilter===eD||a.minFilter===eU||a.minFilter===eL||a.minFilter===eF)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,T[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,T[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,T[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,C[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&a.magFilter!==eR&&(a.minFilter===eL||a.minFilter===eF)&&(a.type!==ej||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||r.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}function P(t,n){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",b));let i=n.source,a=d.get(i);void 0===a&&(a={},d.set(i,a));let o=function(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),a[o].usedTimes++;let i=a[t.__cacheKey];void 0!==i&&(a[t.__cacheKey].usedTimes--,0===i.usedTimes&&M(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return r}function I(e,t,n){return Math.floor(Math.floor(e/n)/t)}function L(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let u=P(t,s),c=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let h=r.get(c);if(c.version!==h.__version||!0===u){let t;n.activeTexture(e.TEXTURE0+o);let r=n8.getPrimaries(n8.workingColorSpace),d=s.colorSpace===tK?null:n8.getPrimaries(s.colorSpace),p=s.colorSpace===tK||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=m(s.image,!1,i.maxTextureSize);f=H(s,f);let b=a.convert(s.format,s.colorSpace),S=a.convert(s.type),M=y(s.internalFormat,b,S,s.colorSpace,s.isVideoTexture);R(l,s);let w=s.mipmaps,E=!0!==s.isVideoTexture,T=void 0===h.__version||!0===u,A=c.dataReady,C=x(s,f);if(s.isDepthTexture)M=_(s.format===e2,s.type),T&&(E?n.texStorage2D(e.TEXTURE_2D,1,M,f.width,f.height):n.texImage2D(e.TEXTURE_2D,0,M,f.width,f.height,0,b,S,null));else if(s.isDataTexture)if(w.length>0){E&&T&&n.texStorage2D(e.TEXTURE_2D,C,M,w[0].width,w[0].height);for(let r=0,i=w.length;re.start-t.start);let o=0;for(let e=1;e0){let i=cV(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*i/t.data.BYTES_PER_ELEMENT,(a+1)*i/t.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,a,t.width,t.height,1,b,s)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,b,t.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,M,t.width,t.height,f.depth,0,t.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?A&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,b,S,t.data):n.texImage3D(e.TEXTURE_2D_ARRAY,r,M,t.width,t.height,f.depth,0,b,S,t.data)}else{E&&T&&n.texStorage2D(e.TEXTURE_2D,C,M,w[0].width,w[0].height);for(let r=0,i=w.length;r0){let t=cV(f.width,f.height,s.format,s.type);for(let r of s.layerUpdates){let i=f.data.subarray(r*t/f.data.BYTES_PER_ELEMENT,(r+1)*t/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,f.width,f.height,1,b,S,i)}s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,M,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isData3DTexture)E?(T&&n.texStorage3D(e.TEXTURE_3D,C,M,f.width,f.height,f.depth),A&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)):n.texImage3D(e.TEXTURE_3D,0,M,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isFramebufferTexture){if(T)if(E)n.texStorage2D(e.TEXTURE_2D,C,M,f.width,f.height);else{let t=f.width,r=f.height;for(let i=0;i>=1,r>>=1}}else if(w.length>0){if(E&&T){let t=V(w[0]);n.texStorage2D(e.TEXTURE_2D,C,M,t.width,t.height)}for(let r=0,i=w.length;r>c),r=Math.max(1,i.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,p,t,r,i.depth,0,h,d,null):n.texImage2D(u,c,p,t,r,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),B(i)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,u,m.__webglTexture,0,z(i)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,u,m.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function D(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,s=_(n.stencilBuffer,a),o=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=z(n);B(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,s,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");let e=t.texture.mipmaps;e&&e.length>0?U(i.__webglFramebuffer[0],t):U(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),void 0===i.__webglDepthbuffer[r])i.__webglDepthbuffer[r]=e.createRenderbuffer(),D(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),void 0===i.__webglDepthbuffer)i.__webglDepthbuffer=e.createRenderbuffer(),D(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}let F=[],k=[];function z(e){return Math.min(i.maxSamples,e.samples)}function B(e){let n=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function H(e,t){let n=e.colorSpace,r=e.format,i=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==tQ&&n!==tK&&(n8.getTransfer(n)===t1?(r!==e0||i!==ez)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function V(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=w;return e>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+i.maxTextures),w+=1,e},this.resetTextureUnits=function(){w=0},this.setTexture2D=E,this.setTexture2DArray=function(t,i){let a=r.get(t);if(!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version)return void L(a,t,i);n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)},this.setTexture3D=function(t,i){let a=r.get(t);if(!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version)return void L(a,t,i);n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,s){let o=r.get(t);if(t.version>0&&o.__version!==t.version)return void function(t,s,o){if(6!==s.image.length)return;let l=P(t,s),u=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let c=r.get(u);if(u.version!==c.__version||!0===l){let t;n.activeTexture(e.TEXTURE0+o);let r=n8.getPrimaries(n8.workingColorSpace),h=s.colorSpace===tK?null:n8.getPrimaries(s.colorSpace),d=s.colorSpace===tK||r===h?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,_=[];for(let e=0;e<6;e++)p||f?_[e]=f?s.image[e].image:s.image[e]:_[e]=m(s.image[e],!0,i.maxCubemapSize),_[e]=H(s,_[e]);let b=_[0],S=a.convert(s.format,s.colorSpace),M=a.convert(s.type),w=y(s.internalFormat,S,M,s.colorSpace),E=!0!==s.isVideoTexture,T=void 0===c.__version||!0===l,A=u.dataReady,C=x(s,b);if(R(e.TEXTURE_CUBE_MAP,s),p){E&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,w,b.width,b.height);for(let r=0;r<6;r++){t=_[r].mipmaps;for(let i=0;i0&&C++;let r=V(_[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,C,w,r.width,r.height)}for(let r=0;r<6;r++)if(f){E?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,_[r].width,_[r].height,S,M,_[r].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,w,_[r].width,_[r].height,0,S,M,_[r].data);for(let i=0;i1;if(!h&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=i.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n0){o.__webglFramebuffer=[];for(let t=0;t0&&!1===B(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(!1===B(t)){let i=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),h=i.length>1;if(h)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:tK,a=n8.getTransfer(i);if(n===ez)return e.UNSIGNED_BYTE;if(n===eq)return e.UNSIGNED_SHORT_4_4_4_4;if(n===eY)return e.UNSIGNED_SHORT_5_5_5_1;if(n===eZ)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===eK)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===eB)return e.BYTE;if(n===eH)return e.SHORT;if(n===eV)return e.UNSIGNED_SHORT;if(n===eG)return e.INT;if(n===eW)return e.UNSIGNED_INT;if(n===ej)return e.FLOAT;if(n===eX)return e.HALF_FLOAT;if(n===e$)return e.ALPHA;if(n===eQ)return e.RGB;if(n===e0)return e.RGBA;if(n===e1)return e.DEPTH_COMPONENT;if(n===e2)return e.DEPTH_STENCIL;if(n===e3)return e.RED;if(n===e4)return e.RED_INTEGER;if(n===e5)return e.RG;if(n===e6)return e.RG_INTEGER;if(n===e9)return e.RGBA_INTEGER;if(n===e7||n===te||n===tt||n===tn)if(a===t1){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===e7)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===te)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===tt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===tn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===e7)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===te)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===tt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===tn)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===tr||n===ti||n===ta||n===ts){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===tr)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ti)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ta)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ts)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===to||n===tl||n===tu){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(n===to||n===tl)return a===t1?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===tu)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===tc||n===th||n===td||n===tp||n===tf||n===tm||n===tg||n===tv||n===ty||n===t_||n===tx||n===tb||n===tS||n===tM){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(n===tc)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===th)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===td)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===tp)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===tf)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===tm)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===tg)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===tv)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ty)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===t_)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===tx)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===tb)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===tS)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===tM)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===tw||n===tE||n===tT){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(n===tw)return a===t1?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===tE)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===tT)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===tA||n===tC||n===tR||n===tP){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(n===tA)return r.COMPRESSED_RED_RGTC1_EXT;if(n===tC)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===tR)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===tP)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===eJ?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class dZ{init(e,t){if(null===this.texture){let n=new s9(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,n=new au({vertexShader:"\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n if ( coord.x >= 1.0 ) {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n } else {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n }\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new an(new o4(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}}class dK extends nL{constructor(e,t){super();let n=this,r=null,i=1,a=null,s="local-floor",o=1,l=null,u=null,c=null,h=null,d=null,p=null,f="undefined"!=typeof XRWebGLBinding,m=new dZ,g={},v=t.getContextAttributes(),y=null,_=null,x=[],b=[],S=new nW,M=null,w=new af;w.viewport=new ro;let E=new af;E.viewport=new ro;let T=[w,E],A=new uS,C=null,R=null;function P(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function I(){r.removeEventListener("select",P),r.removeEventListener("selectstart",P),r.removeEventListener("selectend",P),r.removeEventListener("squeeze",P),r.removeEventListener("squeezestart",P),r.removeEventListener("squeezeend",P),r.removeEventListener("end",I),r.removeEventListener("inputsourceschange",L);for(let e=0;e=0&&(b[r]=null,x[r].disconnect(n))}for(let t=0;t=b.length){b.push(n),r=e;break}else if(null===b[e]){b[e]=n,r=e;break}if(-1===r)break}let i=x[r];i&&i.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return null===c&&f&&(c=new XRWebGLBinding(r,t)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(y=e.getRenderTarget(),r.addEventListener("select",P),r.addEventListener("selectstart",P),r.addEventListener("selectend",P),r.addEventListener("squeeze",P),r.addEventListener("squeezestart",P),r.addEventListener("squeezeend",P),r.addEventListener("end",I),r.addEventListener("inputsourceschange",L),!0!==v.xrCompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(S),f&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,a=null,s=null;v.depth&&(s=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?e2:e1,a=v.stencil?eJ:eW);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:i};h=(c=this.getBinding()).createProjectionLayer(o),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),_=new ru(h.textureWidth,h.textureHeight,{format:e0,type:ez,depthTexture:new s8(h.textureWidth,h.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:4*!!v.antialias,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{let n={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:i};d=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),_=new ru(d.framebufferWidth,d.framebufferHeight,{format:e0,type:ez,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await r.requestReferenceSpace(s),F.setContext(r),F.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};let N=new nX,D=new nX;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,n,i;if(null===r)return;let a=e.near,s=e.far;null!==m.texture&&(m.depthNear>0&&(a=m.depthNear),m.depthFar>0&&(s=m.depthFar)),A.near=E.near=w.near=a,A.far=E.far=w.far=s,(C!==A.near||R!==A.far)&&(r.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,R=A.far),A.layers.mask=6|e.layers.mask,w.layers.mask=3&A.layers.mask,E.layers.mask=5&A.layers.mask;let o=e.parent,l=A.cameras;U(A,o);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,s=i.envMapRotation;a&&(e.envMap.value=a,d$.copy(s),d$.x*=-1,d$.y*=-1,d$.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(d$.y*=-1,d$.z*=-1),e.envMapRotation.value.setFromMatrix4(dQ.makeRotationFromEuler(d$)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,ao(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,a,s,o){var l,u,c,h,d,p,f,m,g,v,y,_,x,b,S,M,w,T,A,C,R;i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),l=e,(u=i).gradientMap&&(l.gradientMap.value=u.gradientMap)):i.isMeshPhongMaterial?(r(e,i),c=e,h=i,c.specular.value.copy(h.specular),c.shininess.value=Math.max(h.shininess,1e-4)):i.isMeshStandardMaterial?(r(e,i),d=e,p=i,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),i.isMeshPhysicalMaterial&&(f=e,m=i,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===E&&f.clearcoatNormalScale.value.negate())),m.dispersion>0&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,f.specularIntensityMapTransform)))):i.isMeshMatcapMaterial?(r(e,i),v=e,(y=i).matcap&&(v.matcap.value=y.matcap)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(_=e,x=i,_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,x.map&&(_.map.value=x.map,n(x.map,_.mapTransform)),i.isLineDashedMaterial&&(b=e,S=i,b.dashSize.value=S.dashSize,b.totalSize.value=S.dashSize+S.gapSize,b.scale.value=S.scale)):i.isPointsMaterial?(M=e,w=i,T=a,A=s,M.diffuse.value.copy(w.color),M.opacity.value=w.opacity,M.size.value=w.size*T,M.scale.value=.5*A,w.map&&(M.map.value=w.map,n(w.map,M.uvTransform)),w.alphaMap&&(M.alphaMap.value=w.alphaMap,n(w.alphaMap,M.alphaMapTransform)),w.alphaTest>0&&(M.alphaTest.value=w.alphaTest)):i.isSpriteMaterial?(C=e,R=i,C.diffuse.value.copy(R.color),C.opacity.value=R.opacity,C.rotation.value=R.rotation,R.map&&(C.map.value=R.map,n(R.map,C.mapTransform)),R.alphaMap&&(C.alphaMap.value=R.alphaMap,n(R.alphaMap,C.alphaMapTransform)),R.alphaTest>0&&(C.alphaTest.value=R.alphaTest)):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function d1(e,t,n,r){let i={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function u(t){let n=t.target;n.removeEventListener("dispose",u);let r=s.indexOf(n.__bindingPointIndex);s.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(e,t){let n=t.program;r.uniformBlockBinding(e,n)},update:function(n,c){let h=i[n.id];void 0===h&&(function(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e0&&(n+=16-r),e.__size=n,e.__cache={}}(n),h=function(t){let n=function(){for(let e=0;e2)||void 0===arguments[2]||arguments[2];if(eT.isPresenting)return void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");ea=e,es=t,P.width=Math.floor(e*eo),P.height=Math.floor(t*eo),!0===n&&(P.style.width=e+"px",P.style.height=t+"px"),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(ea*eo,es*eo).floor()},this.setDrawingBufferSize=function(e,t,n){ea=e,es=t,eo=n,P.width=Math.floor(e*n),P.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(ee)},this.getViewport=function(e){return e.copy(eh)},this.setViewport=function(e,t,n,r){e.isVector4?eh.set(e.x,e.y,e.z,e.w):eh.set(e,t,n,r),i.viewport(ee.copy(eh).multiplyScalar(eo).round())},this.getScissor=function(e){return e.copy(ed)},this.setScissor=function(e,t,n,r){e.isVector4?ed.set(e.x,e.y,e.z,e.w):ed.set(e,t,n,r),i.scissor(et.copy(ed).multiplyScalar(eo).round())},this.getScissorTest=function(){return ep},this.setScissorTest=function(e){i.setScissorTest(ep=e)},this.setOpaqueSort=function(e){el=e},this.setTransparentSort=function(e){eu=e},this.getClearColor=function(e){return e.copy(x.getClearColor())},this.setClearColor=function(){x.setClearColor(...arguments)},this.getClearAlpha=function(){return x.getClearAlpha()},this.setClearAlpha=function(){x.setClearAlpha(...arguments)},this.clear=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=0;if(e){let e=!1;if(null!==K){let t=K.texture.format;e=t===e9||t===e6||t===e4}if(e){let e=K.texture.type,t=e===ez||e===eW||e===eV||e===eJ||e===eq||e===eY,n=x.getClearColor(),r=x.getClearAlpha(),i=n.r,a=n.g,s=n.b;t?(H[0]=i,H[1]=a,H[2]=s,H[3]=r,eM.clearBufferuiv(eM.COLOR,0,H)):(V[0]=i,V[1]=a,V[2]=s,V[3]=r,eM.clearBufferiv(eM.COLOR,0,V))}else r|=eM.COLOR_BUFFER_BIT}t&&(r|=eM.DEPTH_BUFFER_BIT),n&&(r|=eM.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),eM.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){P.removeEventListener("webglcontextlost",eA,!1),P.removeEventListener("webglcontextrestored",eC,!1),P.removeEventListener("webglcontextcreationerror",eR,!1),x.dispose(),g.dispose(),v.dispose(),s.dispose(),l.dispose(),u.dispose(),d.dispose(),C.dispose(),R.dispose(),f.dispose(),eT.dispose(),eT.removeEventListener("sessionstart",eN),eT.removeEventListener("sessionend",eD),eU.stop()},this.renderBufferDirect=function(e,t,a,d,p,f){let g;null===t&&(t=ex);let v=p.isMesh&&0>p.matrixWorld.determinant(),_=function(e,t,n,a,c){var h,d;!0!==t.isScene&&(t=ex),o.resetTextureUnits();let p=t.fog,f=a.isMeshStandardMaterial?t.environment:null,g=null===K?q.outputColorSpace:!0===K.isXRRenderTarget?K.texture.colorSpace:tQ,v=(a.isMeshStandardMaterial?u:l).get(a.envMap||f),_=!0===a.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,x=!!n.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),S=!!n.morphAttributes.position,M=!!n.morphAttributes.normal,w=!!n.morphAttributes.color,E=ec;a.toneMapped&&(null===K||!0===K.isXRRenderTarget)&&(E=q.toneMapping);let T=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,A=void 0!==T?T.length:0,C=s.get(a),P=W.state.lights;if(!0===em&&(!0===eg||e!==Q)){let t=e===Q&&a.id===$;y.setState(a,e,t)}let I=!1;a.version===C.__version?C.needsLights&&C.lightsStateVersion!==P.state.version||C.outputColorSpace!==g||c.isBatchedMesh&&!1===C.batching?I=!0:c.isBatchedMesh||!0!==C.batching?c.isBatchedMesh&&!0===C.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===C.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===C.instancing?I=!0:c.isInstancedMesh||!0!==C.instancing?c.isSkinnedMesh&&!1===C.skinning?I=!0:c.isSkinnedMesh||!0!==C.skinning?c.isInstancedMesh&&!0===C.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===C.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===C.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===C.instancingMorph&&null!==c.morphTexture||C.envMap!==v||!0===a.fog&&C.fog!==p||void 0!==C.numClippingPlanes&&(C.numClippingPlanes!==y.numPlanes||C.numIntersection!==y.numIntersection)||C.vertexAlphas!==_||C.vertexTangents!==x||C.morphTargets!==S||C.morphNormals!==M||C.morphColors!==w||C.toneMapping!==E?I=!0:C.morphTargetsCount!==A&&(I=!0):I=!0:I=!0:I=!0:(I=!0,C.__version=a.version);let L=C.currentProgram;!0===I&&(L=ej(a,t,c));let N=!1,D=!1,U=!1,O=L.getUniforms(),F=C.uniforms;if(i.useProgram(L.program)&&(N=!0,D=!0,U=!0),a.id!==$&&($=a.id,D=!0),N||Q!==e){i.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eM,"projectionMatrix",e.projectionMatrix),O.setValue(eM,"viewMatrix",e.matrixWorldInverse);let t=O.map.cameraPosition;void 0!==t&&t.setValue(eM,ey.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&O.setValue(eM,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&O.setValue(eM,"isOrthographic",!0===e.isOrthographicCamera),Q!==e&&(Q=e,D=!0,U=!0)}if(c.isSkinnedMesh){O.setOptional(eM,c,"bindMatrix"),O.setOptional(eM,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eM,"boneTexture",e.boneTexture,o))}c.isBatchedMesh&&(O.setOptional(eM,c,"batchingTexture"),O.setValue(eM,"batchingTexture",c._matricesTexture,o),O.setOptional(eM,c,"batchingIdTexture"),O.setValue(eM,"batchingIdTexture",c._indirectTexture,o),O.setOptional(eM,c,"batchingColorTexture"),null!==c._colorsTexture&&O.setValue(eM,"batchingColorTexture",c._colorsTexture,o));let k=n.morphAttributes;if((void 0!==k.position||void 0!==k.normal||void 0!==k.color)&&b.update(c,n,L),(D||C.receiveShadow!==c.receiveShadow)&&(C.receiveShadow=c.receiveShadow,O.setValue(eM,"receiveShadow",c.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(F.envMap.value=v,F.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(F.envMapIntensity.value=t.environmentIntensity),D&&(O.setValue(eM,"toneMappingExposure",q.toneMappingExposure),C.needsLights&&(h=F,d=U,h.ambientLightColor.needsUpdate=d,h.lightProbe.needsUpdate=d,h.directionalLights.needsUpdate=d,h.directionalLightShadows.needsUpdate=d,h.pointLights.needsUpdate=d,h.pointLightShadows.needsUpdate=d,h.spotLights.needsUpdate=d,h.spotLightShadows.needsUpdate=d,h.rectAreaLights.needsUpdate=d,h.hemisphereLights.needsUpdate=d),p&&!0===a.fog&&m.refreshFogUniforms(F,p),m.refreshMaterialUniforms(F,a,eo,es,W.state.transmissionRenderTarget[e.id]),dd.upload(eM,eZ(C),F,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(dd.upload(eM,eZ(C),F,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&O.setValue(eM,"center",c.center),O.setValue(eM,"modelViewMatrix",c.modelViewMatrix),O.setValue(eM,"normalMatrix",c.normalMatrix),O.setValue(eM,"modelMatrix",c.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,n=e.length;t2&&void 0!==arguments[2]?arguments[2]:null;null===n&&(n=e),(W=v.get(n)).init(t),X.push(W),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),W.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:null,i=this.compile(e,t,r);return new Promise(t=>{function r(){if(i.forEach(function(e){s.get(e).currentProgram.isReady()&&i.delete(e)}),0===i.size)return void t(e);setTimeout(r,10)}null!==n.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eL=null;function eN(){eU.stop()}function eD(){eU.start()}let eU=new cW;function eO(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)W.pushLight(e),e.castShadow&&W.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ef.intersectsSprite(e)){r&&e_.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ev);let t=d.update(e),i=e.material;i.visible&&G.push(e,t,i,n,e_.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ef.intersectsObject(e))){let t=d.update(e),i=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),e_.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),e_.copy(t.boundingSphere.center)),e_.applyMatrix4(e.matrixWorld).applyMatrix4(ev)),Array.isArray(i)){let r=t.groups;for(let a=0,s=r.length;a0&&eH(a,t,n),s.length>0&&eH(s,t,n),o.length>0&&eH(o,t,n),i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),i.setPolygonOffset(!1)}function eB(e,t,r,i){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;void 0===W.state.transmissionRenderTarget[i.id]&&(W.state.transmissionRenderTarget[i.id]=new ru(1,1,{generateMipmaps:!0,type:n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float")?eX:ez,minFilter:eF,samples:4,stencilBuffer:N,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:n8.workingColorSpace}));let a=W.state.transmissionRenderTarget[i.id],s=i.viewport||ee;a.setSize(s.z*q.transmissionResolutionScale,s.w*q.transmissionResolutionScale);let l=q.getRenderTarget(),u=q.getActiveCubeFace(),c=q.getActiveMipmapLevel();q.setRenderTarget(a),q.getClearColor(er),(ei=q.getClearAlpha())<1&&q.setClearColor(0xffffff,.5),q.clear(),eb&&x.render(r);let h=q.toneMapping;q.toneMapping=ec;let d=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),W.setupLightsView(i),!0===em&&y.setGlobalState(q.clippingPlanes,i),eH(e,r,i),o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a),!1===n.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let n=0,a=t.length;n0)for(let t=0,a=n.length;t0&&eB(r,i,e,t),eb&&x.render(e),ek(G,e,t);null!==K&&0===Z&&(o.updateMultisampleRenderTarget(K),o.updateRenderTargetMipmap(K)),!0===e.isScene&&e.onAfterRender(q,e,t),C.resetDefaultState(),$=-1,Q=null,X.pop(),X.length>0?(W=X[X.length-1],!0===em&&y.setGlobalState(q.clippingPlanes,W.state.camera)):W=null,j.pop(),G=j.length>0?j[j.length-1]:null},this.getActiveCubeFace=function(){return J},this.getActiveMipmapLevel=function(){return Z},this.getRenderTarget=function(){return K},this.setRenderTargetTextures=function(e,t,n){let r=s.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=s.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};let e$=eM.createFramebuffer();this.setRenderTarget=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;K=e,J=t,Z=n;let r=!0,a=null,l=!1,u=!1;if(e){let c=s.get(e);if(void 0!==c.__useDefaultFramebuffer)i.bindFramebuffer(eM.FRAMEBUFFER,null),r=!1;else if(void 0===c.__webglFramebuffer)o.setupRenderTarget(e);else if(c.__hasExternalTextures)o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(c.__boundDepthTexture!==t){if(null!==t&&s.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");o.setupDepthRenderbuffer(e)}}let h=e.texture;(h.isData3DTexture||h.isDataArrayTexture||h.isCompressedArrayTexture)&&(u=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(d[t])?d[t][n]:d[t],l=!0):a=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[n]:d,ee.copy(e.viewport),et.copy(e.scissor),en=e.scissorTest}else ee.copy(eh).multiplyScalar(eo).floor(),et.copy(ed).multiplyScalar(eo).floor(),en=ep;if(0!==n&&(a=e$),i.bindFramebuffer(eM.FRAMEBUFFER,a)&&r&&i.drawBuffers(e,a),i.viewport(ee),i.scissor(et),i.setScissorTest(en),l){let r=s.get(e.texture);eM.framebufferTexture2D(eM.FRAMEBUFFER,eM.COLOR_ATTACHMENT0,eM.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(u)for(let r=0;r7&&void 0!==arguments[7]?arguments[7]:0;if(!(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h){i.bindFramebuffer(eM.FRAMEBUFFER,h);try{let i=e.textures[c],s=i.format,u=i.type;if(!r.textureFormatReadable(s))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o&&(e.textures.length>1&&eM.readBuffer(eM.COLOR_ATTACHMENT0+c),eM.readPixels(t,n,a,o,A.convert(s),A.convert(u),l))}finally{let e=null!==K?s.get(K).__webglFramebuffer:null;i.bindFramebuffer(eM.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,a,o,l,u){let c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h)if(t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o){i.bindFramebuffer(eM.FRAMEBUFFER,h);let u=e.textures[c],d=u.format,p=u.type;if(!r.textureFormatReadable(d))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let f=eM.createBuffer();eM.bindBuffer(eM.PIXEL_PACK_BUFFER,f),eM.bufferData(eM.PIXEL_PACK_BUFFER,l.byteLength,eM.STREAM_READ),e.textures.length>1&&eM.readBuffer(eM.COLOR_ATTACHMENT0+c),eM.readPixels(t,n,a,o,A.convert(d),A.convert(p),0);let m=null!==K?s.get(K).__webglFramebuffer:null;i.bindFramebuffer(eM.FRAMEBUFFER,m);let g=eM.fenceSync(eM.SYNC_GPU_COMMANDS_COMPLETE,0);return eM.flush(),await n4(eM,g,4),eM.bindBuffer(eM.PIXEL_PACK_BUFFER,f),eM.getBufferSubData(eM.PIXEL_PACK_BUFFER,0,l),eM.deleteBuffer(f),eM.deleteSync(g),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Math.pow(2,-n),a=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),l=null!==t?t.x:0,u=null!==t?t.y:0;o.setTexture2D(e,0),eM.copyTexSubImage2D(eM.TEXTURE_2D,n,0,0,l,u,a,s),i.unbindTexture()};let eQ=eM.createFramebuffer(),e0=eM.createFramebuffer();this.copyTextureToTexture=function(e,t){let n,r,a,l,u,c,h,d,p,f,m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,g=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,y=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;null===y&&(0!==v?(n3("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),y=v,v=0):y=0);let _=e.isCompressedTexture?e.mipmaps[y]:e.image;if(null!==m)n=m.max.x-m.min.x,r=m.max.y-m.min.y,a=m.isBox3?m.max.z-m.min.z:1,l=m.min.x,u=m.min.y,c=m.isBox3?m.min.z:0;else{let t=Math.pow(2,-v);n=Math.floor(_.width*t),r=Math.floor(_.height*t),a=e.isDataArrayTexture?_.depth:e.isData3DTexture?Math.floor(_.depth*t):1,l=0,u=0,c=0}null!==g?(h=g.x,d=g.y,p=g.z):(h=0,d=0,p=0);let x=A.convert(t.format),b=A.convert(t.type);t.isData3DTexture?(o.setTexture3D(t,0),f=eM.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(o.setTexture2DArray(t,0),f=eM.TEXTURE_2D_ARRAY):(o.setTexture2D(t,0),f=eM.TEXTURE_2D),eM.pixelStorei(eM.UNPACK_FLIP_Y_WEBGL,t.flipY),eM.pixelStorei(eM.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eM.pixelStorei(eM.UNPACK_ALIGNMENT,t.unpackAlignment);let S=eM.getParameter(eM.UNPACK_ROW_LENGTH),M=eM.getParameter(eM.UNPACK_IMAGE_HEIGHT),w=eM.getParameter(eM.UNPACK_SKIP_PIXELS),E=eM.getParameter(eM.UNPACK_SKIP_ROWS),T=eM.getParameter(eM.UNPACK_SKIP_IMAGES);eM.pixelStorei(eM.UNPACK_ROW_LENGTH,_.width),eM.pixelStorei(eM.UNPACK_IMAGE_HEIGHT,_.height),eM.pixelStorei(eM.UNPACK_SKIP_PIXELS,l),eM.pixelStorei(eM.UNPACK_SKIP_ROWS,u),eM.pixelStorei(eM.UNPACK_SKIP_IMAGES,c);let C=e.isDataArrayTexture||e.isData3DTexture,R=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let o=s.get(e),f=s.get(t),m=s.get(o.__renderTarget),g=s.get(f.__renderTarget);i.bindFramebuffer(eM.READ_FRAMEBUFFER,m.__webglFramebuffer),i.bindFramebuffer(eM.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let i=0;id5],8155);let d4=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,i,a);return a},d5=e=>e?d4(e):d4,{useSyncExternalStoreWithSelector:d6}=d3.default,d8=e=>e,d9=(e,t)=>{let n=d5(e),r=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d8,n=arguments.length>2?arguments[2]:void 0,r=d6(e.subscribe,e.getState,e.getInitialState,t,n);return h.default.useDebugValue(r),r}(n,e,r)};return Object.assign(r,n),r},d7=(e,t)=>e?d9(e,t):d9,pe=[];function pt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(e,t)=>e===t;if(e===t)return!0;if(!e||!t)return!1;let r=e.length;if(t.length!==r)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};for(let i of(null===t&&(t=[e]),pe))if(pt(t,i.keys,i.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(i,"error"))throw i.error;if(Object.prototype.hasOwnProperty.call(i,"response"))return r.lifespan&&r.lifespan>0&&(i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(i.remove,r.lifespan)),i.response;if(!n)throw i.promise}let i={keys:t,equal:r.equal,remove:()=>{let e=pe.indexOf(i);-1!==e&&pe.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...t)).then(e=>{i.response=e,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(e=>i.error=e)};if(pe.push(i),!n)throw i.promise}var pr=e.i(98133),pi=e.i(95087),pa=e.i(43476);e.s(["FiberProvider",()=>pc,"traverseFiber",()=>po,"useContextBridge",()=>pf,"useFiber",()=>ph],46791);var ps=h;function po(e,t,n){if(!e)return;if(!0===n(e))return e;let r=t?e.return:e.child;for(;r;){let e=po(r,t,n);if(e)return e;r=t?null:r.sibling}}function pl(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}(()=>{var e,t;return"undefined"!=typeof window&&((null==(e=window.document)?void 0:e.createElement)||(null==(t=window.navigator)?void 0:t.product)==="ReactNative")})()?ps.useLayoutEffect:ps.useEffect;let pu=pl(ps.createContext(null));class pc extends ps.Component{render(){return ps.createElement(pu.Provider,{value:this._reactInternals},this.props.children)}}function ph(){let e=ps.useContext(pu);if(null===e)throw Error("its-fine: useFiber must be called within a !");let t=ps.useId();return ps.useMemo(()=>{for(let n of[e,null==e?void 0:e.alternate]){if(!n)continue;let e=po(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}let pd=Symbol.for("react.context"),pp=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===pd;function pf(){let e=function(){let e=ph(),[t]=ps.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;pp(e)&&e!==pu&&!t.has(e)&&t.set(e,ps.use(pl(e))),n=n.return}return t}();return ps.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>ps.createElement(t,null,ps.createElement(n.Provider,{...r,value:e.get(n)})),e=>ps.createElement(pc,{...e})),[e])}function pm(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}h.act;let pg=e=>e&&e.hasOwnProperty("current"),pv=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),py=((e,t)=>"undefined"!=typeof window&&((null==(e=window.document)?void 0:e.createElement)||(null==(t=window.navigator)?void 0:t.product)==="ReactNative"))()?h.useLayoutEffect:h.useEffect;function p_(e){let t=h.useRef(e);return py(()=>void(t.current=e),[e]),t}function px(){let e=ph(),t=pf();return h.useMemo(()=>n=>{let{children:r}=n,i=po(e,!0,e=>e.type===h.StrictMode)?h.StrictMode:h.Fragment;return(0,pa.jsx)(i,{children:(0,pa.jsx)(t,{children:r})})},[e,t])}function pb(e){let{set:t}=e;return py(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}let pS=(e=>((e=class extends h.Component{componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}constructor(...e){super(...e),this.state={error:!1}}}).getDerivedStateFromError=()=>({error:!0}),e))();function pM(e){var t;let n="undefined"!=typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}function pw(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()}let pE={obj:e=>e===Object(e)&&!pE.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,t){let n,{arrays:r="shallow",objects:i="reference",strict:a=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(typeof e!=typeof t||!!e!=!!t)return!1;if(pE.str(e)||pE.num(e)||pE.boo(e))return e===t;let s=pE.obj(e);if(s&&"reference"===i)return e===t;let o=pE.arr(e);if(o&&"reference"===r)return e===t;if((o||s)&&e===t)return!0;for(n in e)if(!(n in t))return!1;if(s&&"shallow"===r&&"shallow"===i){for(n in a?t:e)if(!pE.equ(e[n],t[n],{strict:a,objects:"reference"}))return!1}else for(n in a?t:e)if(e[n]!==t[n])return!1;if(pE.und(n)){if(o&&0===e.length&&0===t.length||s&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}},pT=["children","key","ref"];function pA(e,t,n,r){let i=null==e?void 0:e.__r3f;return!i&&(i={root:t,type:n,parent:null,children:[],props:function(e){let t={};for(let n in e)pT.includes(n)||(t[n]=e[n]);return t}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=i)),i}function pC(e,t){let n=e[t];if(!t.includes("-"))return{root:e,key:t,target:n};for(let i of(n=e,t.split("-"))){var r;t=i,e=n,n=null==(r=n)?void 0:r[t]}return{root:e,key:t,target:n}}let pR=/-\d+$/;function pP(e,t){if(pE.str(t.props.attach)){if(pR.test(t.props.attach)){let n=t.props.attach.replace(pR,""),{root:r,key:i}=pC(e.object,n);Array.isArray(r[i])||(r[i]=[])}let{root:n,key:r}=pC(e.object,t.props.attach);t.previousAttach=n[r],n[r]=t.object}else pE.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function pI(e,t){if(pE.str(t.props.attach)){let{root:n,key:r}=pC(e.object,t.props.attach),i=t.previousAttach;void 0===i?delete n[r]:n[r]=i}else null==t.previousAttach||t.previousAttach(e.object,t.object);delete t.previousAttach}let pL=[...pT,"args","dispose","attach","object","onUpdate","dispose"],pN=new Map,pD=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],pU=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function pO(e,t){var n,r;let i=e.__r3f,a=i&&pm(i).getState(),s=null==i?void 0:i.eventCount;for(let n in t){let s=t[n];if(pL.includes(n))continue;if(i&&pU.test(n)){"function"==typeof s?i.handlers[n]=s:delete i.handlers[n],i.eventCount=Object.keys(i.handlers).length;continue}if(void 0===s)continue;let{root:o,key:l,target:u}=pC(e,n);u instanceof r$&&s instanceof r$?u.mask=s.mask:u instanceof iE&&pv(s)?u.set(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=s&&s.constructor&&u.constructor===s.constructor?u.copy(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(s)?"function"==typeof u.fromArray?u.fromArray(s):u.set(...s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof s?"function"==typeof u.setScalar?u.setScalar(s):u.set(s):(o[l]=s,a&&!a.linear&&pD.includes(l)&&null!=(r=o[l])&&r.isTexture&&o[l].format===e0&&o[l].type===ez&&(o[l].colorSpace=t$))}if(null!=i&&i.parent&&null!=a&&a.internal&&null!=(n=i.object)&&n.isObject3D&&s!==i.eventCount){let e=i.object,t=a.internal.interaction.indexOf(e);t>-1&&a.internal.interaction.splice(t,1),i.eventCount&&null!==e.raycast&&a.internal.interaction.push(e)}return i&&void 0===i.props.attach&&(i.object.isBufferGeometry?i.props.attach="geometry":i.object.isMaterial&&(i.props.attach="material")),i&&pF(i),e}function pF(e){var t;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let n=null==(t=e.root)||null==t.getState?void 0:t.getState();n&&0===n.internal.frames&&n.invalidate()}function pk(e,t){!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(t.width/2),e.right=t.width/2,e.top=t.height/2,e.bottom=-(t.height/2)):e.aspect=t.width/t.height,e.updateProjectionMatrix())}let pz=e=>null==e?void 0:e.isObject3D;function pB(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function pH(e,t,n,r){let i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}let pV=e=>!!(null!=e&&e.render),pG=h.createContext(null);function pW(){let e=h.useContext(pG);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function pj(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e=>e,t=arguments.length>1?arguments[1]:void 0;return pW()(e,t)}function pX(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=pW(),r=n.getState().internal.subscribe,i=p_(e);return py(()=>r(i,t,n),[t,r,n]),null}let pq=new WeakMap;function pY(e,t){return function(n){let r;for(var i,a=arguments.length,s=Array(a>1?a-1:0),o=1;onew Promise((n,i)=>r.load(e,e=>{pz(null==e?void 0:e.scene)&&Object.assign(e,function(e){let t={nodes:{},materials:{},meshes:{}};return e&&e.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material),e.isMesh&&!t.meshes[e.name]&&(t.meshes[e.name]=e)}),t}(e.scene)),n(e)},t,t=>i(Error("Could not load ".concat(e,": ").concat(null==t?void 0:t.message)))))))}}function pJ(e,t,n,r){let i=Array.isArray(t)?t:[t],a=pn(pY(n,r),[e,...i],!1,{equal:pE.equ});return Array.isArray(t)?a:a[0]}pJ.preload=function(e,t,n){let r,i=Array.isArray(t)?t:[t];pn(pY(n),[e,...i],!0,r)},pJ.clear=function(e,t){var n=[e,...Array.isArray(t)?t:[t]];if(void 0===n||0===n.length)pe.splice(0,pe.length);else{let e=pe.find(e=>pt(n,e.keys,e.equal));e&&e.remove()}};let pZ={},pK=/^three(?=[A-Z])/,p$=e=>"".concat(e[0].toUpperCase()).concat(e.slice(1)),pQ=0;function p0(e){if("function"==typeof e){let t="".concat(pQ++);return pZ[t]=e,t}Object.assign(pZ,e)}function p1(e,t){let n=p$(e),r=pZ[n];if("primitive"!==e&&!r)throw Error("R3F: ".concat(n," is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively"));if("primitive"===e&&!t.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==t.args&&!Array.isArray(t.args))throw Error("R3F: The args prop must be an array!")}function p2(e){if(e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?pP(e.parent,e):pz(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,pF(e)}}function p3(e,t,n){let r=t.root.getState();if(e.parent||e.object===r.scene){if(!t.object){var i,a;let e=pZ[p$(t.type)];t.object=null!=(i=t.props.object)?i:new e(...null!=(a=t.props.args)?a:[]),t.object.__r3f=t}if(pO(t.object,t.props),t.props.attach)pP(e,t);else if(pz(t.object)&&pz(e.object)){let r=e.object.children.indexOf(null==n?void 0:n.object);if(n&&-1!==r){let n=e.object.children.indexOf(t.object);-1!==n?(e.object.children.splice(n,1),e.object.children.splice(n{try{e.dispose()}catch(e){}};"undefined"!=typeof IS_REACT_ACT_ENVIRONMENT?t():(0,pi.unstable_scheduleCallback)(pi.unstable_IdlePriority,t)}}function p8(e,t,n){if(!t)return;t.parent=null;let r=e.children.indexOf(t);-1!==r&&e.children.splice(r,1),t.props.attach?pI(e,t):pz(t.object)&&pz(e.object)&&(e.object.remove(t.object),function(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{pH(n.capturedMap,t,e,r)})}(pm(t),t.object));let i=null!==t.props.dispose&&!1!==n;for(let e=t.children.length-1;e>=0;e--){let n=t.children[e];p8(t,n,i)}t.children.length=0,delete t.object.__r3f,i&&"primitive"!==t.type&&"Scene"!==t.object.type&&p6(t.object),void 0===n&&pF(t)}let p9=[],p7=()=>{},fe={},ft=0,fn=function(e){let t=(0,pr.default)(e);return t.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:h.version}),t}({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,t,n){var r;return p1(e=p$(e)in pZ?e:e.replace(pK,""),t),"primitive"===e&&null!=(r=t.object)&&r.__r3f&&delete t.object.__r3f,pA(t.object,n,e,t)},removeChild:p8,appendChild:p4,appendInitialChild:p4,insertBefore:p5,appendChildToContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&p4(n,t)},removeChildFromContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&p8(n,t)},insertInContainerBefore(e,t,n){let r=e.getState().scene.__r3f;t&&n&&r&&p5(r,t,n)},getRootHostContext:()=>fe,getChildHostContext:()=>fe,commitUpdate(e,t,n,r,i){var a,s,o;p1(t,r);let l=!1;if("primitive"===e.type&&n.object!==r.object||(null==(a=r.args)?void 0:a.length)!==(null==(s=n.args)?void 0:s.length)?l=!0:null!=(o=r.args)&&o.some((e,t)=>{var r;return e!==(null==(r=n.args)?void 0:r[t])})&&(l=!0),l)p9.push([e,{...r},i]);else{let t=function(e,t){let n={};for(let r in t)if(!pL.includes(r)&&!pE.equ(t[r],e.props[r]))for(let e in n[r]=t[r],t)e.startsWith("".concat(r,"-"))&&(n[e]=t[e]);for(let r in e.props){if(pL.includes(r)||t.hasOwnProperty(r))continue;let{root:i,key:a}=pC(e.object,r);if(i.constructor&&0===i.constructor.length){let e=function(e){let t=pN.get(e.constructor);try{t||(t=new e.constructor,pN.set(e.constructor,t))}catch(e){}return t}(i);pE.und(e)||(n[a]=e[a])}else n[a]=0}return n}(e,r);Object.keys(t).length&&(Object.assign(e.props,t),pO(e.object,t))}(null===i.sibling||(4&i.flags)==0)&&function(){for(let[e]of p9){let t=e.parent;if(t)for(let n of(e.props.attach?pI(t,e):pz(e.object)&&pz(t.object)&&t.object.remove(e.object),e.children))n.props.attach?pI(e,n):pz(n.object)&&pz(e.object)&&e.object.remove(n.object);e.isHidden&&p2(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&p6(e.object)}for(let[r,i,a]of p9){r.props=i;let s=r.parent;if(s){let i=pZ[p$(r.type)];r.object=null!=(e=r.props.object)?e:new i(...null!=(t=r.props.args)?t:[]),r.object.__r3f=r;var e,t,n=r.object;for(let e of[a,a.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let t=e.ref(n);"function"==typeof t&&(e.refCleanup=t)}else e.ref&&(e.ref.current=n);for(let e of(pO(r.object,r.props),r.props.attach?pP(s,r):pz(r.object)&&pz(s.object)&&s.object.add(r.object),r.children))e.props.attach?pP(r,e):pz(e.object)&&pz(r.object)&&r.object.add(e.object);pF(r)}}p9.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>pA(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?pI(e.parent,e):pz(e.object)&&(e.object.visible=!1),e.isHidden=!0,pF(e)}},unhideInstance:p2,createTextInstance:p7,hideTextInstance:p7,unhideTextInstance:p7,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:h.createContext(null),setCurrentUpdatePriority(e){ft=e},getCurrentUpdatePriority:()=>ft,resolveUpdatePriority(){var e;if(0!==ft)return ft;switch("undefined"!=typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return d.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return d.ContinuousEventPriority;default:return d.DefaultEventPriority}},resetFormInstance(){}}),fr=new Map,fi={objects:"shallow",strict:!1};function fa(e){let t,n,r=fr.get(e),i=null==r?void 0:r.fiber,a=null==r?void 0:r.store;r&&console.warn("R3F.createRoot should only be called once!");let s="function"==typeof reportError?reportError:console.error,o=a||((e,t)=>{let n=d7((n,r)=>{let i,a=new nX,s=new nX,o=new nX;function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r().camera,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r().size,{width:i,height:l,top:u,left:c}=n,h=i/l;t.isVector3?o.copy(t):o.set(...t);let d=e.getWorldPosition(a).distanceTo(o);if(e&&e.isOrthographicCamera)return{width:i/e.zoom,height:l/e.zoom,top:u,left:c,factor:1,distance:d,aspect:h};{let t=2*Math.tan(e.fov*Math.PI/180/2)*d,n=i/l*t;return{width:n,height:t,top:u,left:c,factor:i/n,distance:d,aspect:h}}}let u=e=>n(t=>({performance:{...t.performance,current:e}})),c=new nW;return{set:n,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e(r(),t)},advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new uM,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();i&&clearTimeout(i),e.performance.current!==e.performance.min&&u(e.performance.min),i=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:l},setEvents:e=>n(t=>({...t,events:{...t.events,...e}})),setSize:function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=r().camera,u={width:e,height:t,top:i,left:a};n(e=>({size:u,viewport:{...e.viewport,...l(o,s,u)}}))},setDpr:e=>n(t=>{let n=pM(e);return{viewport:{...t.viewport,dpr:n,initialDpr:t.viewport.initialDpr||n}}}),setFrameloop:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",t=r().clock;t.stop(),t.elapsedTime=0,"never"!==e&&(t.start(),t.elapsedTime=0),n(()=>({frameloop:e}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:h.createRef(),active:!1,frames:0,priority:0,subscribe:(e,t,n)=>{let i=r().internal;return i.priority=i.priority+ +(t>0),i.subscribers.push({ref:e,priority:t,store:n}),i.subscribers=i.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let n=r().internal;null!=n&&n.subscribers&&(n.priority=n.priority-(t>0),n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}}}),r=n.getState(),i=r.size,a=r.viewport.dpr,s=r.camera;return n.subscribe(()=>{let{camera:e,size:t,viewport:r,gl:o,set:l}=n.getState();if(t.width!==i.width||t.height!==i.height||r.dpr!==a){i=t,a=r.dpr,pk(e,t),r.dpr>0&&o.setPixelRatio(r.dpr);let n="undefined"!=typeof HTMLCanvasElement&&o.domElement instanceof HTMLCanvasElement;o.setSize(t.width,t.height,n)}e!==s&&(s=e,l(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),n.subscribe(t=>e(t)),n})(fS,fM),l=i||fn.createContainer(o,d.ConcurrentRoot,null,!1,null,"",s,s,s,null);r||fr.set(e,{fiber:l,store:o});let u=!1,c=null;return{async configure(){var r,i;let a,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c=new Promise(e=>a=e);let{gl:l,size:h,scene:d,events:p,onCreated:f,shadows:m=!1,linear:g=!1,flat:v=!1,legacy:y=!1,orthographic:_=!1,frameloop:w="always",dpr:E=[1,2],performance:T,raycaster:A,camera:C,onPointerMissed:R}=s,P=o.getState(),I=P.gl;if(!P.gl){let t={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},n="function"==typeof l?await l(t):l;I=pV(n)?n:new d2({...t,...l}),P.set({gl:I})}let L=P.raycaster;L||P.set({raycaster:L=new u4});let{params:N,...D}=A||{};if(pE.equ(D,L,fi)||pO(L,{...D}),pE.equ(N,L.params,fi)||pO(L,{params:{...L.params,...N}}),!P.camera||P.camera===n&&!pE.equ(n,C,fi)){n=C;let e=null==C?void 0:C.isCamera,t=e?C:_?new l7(0,0,0,0,.1,1e3):new af(75,0,.1,1e3);!e&&(t.position.z=5,C&&(pO(t,C),!t.manual&&("aspect"in C||"left"in C||"right"in C||"bottom"in C||"top"in C)&&(t.manual=!0,t.updateProjectionMatrix())),P.camera||null!=C&&C.rotation||t.lookAt(0,0,0)),P.set({camera:t}),L.camera=t}if(!P.scene){let e;null!=d&&d.isScene?pA(e=d,o,"",{}):(pA(e=new aM,o,"",{}),d&&pO(e,d)),P.set({scene:e})}p&&!P.events.handlers&&P.set({events:p(o)});let U=function(e,t){if(!t&&"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:n,top:r,left:i}=e.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:i}}return!t&&"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...t}}(e,h);if(pE.equ(U,P.size,fi)||P.setSize(U.width,U.height,U.top,U.left),E&&P.viewport.dpr!==pM(E)&&P.setDpr(E),P.frameloop!==w&&P.setFrameloop(w),P.onPointerMissed||P.set({onPointerMissed:R}),T&&!pE.equ(T,P.performance,fi)&&P.set(e=>({performance:{...e.performance,...T}})),!P.xr){let e=(e,t)=>{let n=o.getState();"never"!==n.frameloop&&fM(e,!0,n,t)},t=()=>{let t=o.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||fS(t)},n={connect(){let e=o.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){let e=o.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};"function"==typeof(null==(r=I.xr)?void 0:r.addEventListener)&&n.connect(),P.set({xr:n})}if(I.shadowMap){let e=I.shadowMap.enabled,t=I.shadowMap.type;I.shadowMap.enabled=!!m,pE.boo(m)?I.shadowMap.type=S:pE.str(m)?I.shadowMap.type=null!=(i=({basic:x,percentage:b,soft:S,variance:M})[m])?i:S:pE.obj(m)&&Object.assign(I.shadowMap,m),(e!==I.shadowMap.enabled||t!==I.shadowMap.type)&&(I.shadowMap.needsUpdate=!0)}return n8.enabled=!y,u||(I.outputColorSpace=g?tQ:t$,I.toneMapping=v?ec:ef),P.legacy!==y&&P.set(()=>({legacy:y})),P.linear!==g&&P.set(()=>({linear:g})),P.flat!==v&&P.set(()=>({flat:v})),!l||pE.fun(l)||pV(l)||pE.equ(l,I,fi)||pO(I,l),t=f,u=!0,a(),this},render(n){return u||c||this.configure(),c.then(()=>{fn.updateContainer((0,pa.jsx)(fs,{store:o,children:n,onCreated:t,rootElement:e}),l,null,()=>void 0)}),o},unmount(){fo(e)}}}function fs(e){let{store:t,children:n,onCreated:r,rootElement:i}=e;return py(()=>{let e=t.getState();e.set(e=>({internal:{...e.internal,active:!0}})),r&&r(e),t.getState().events.connected||null==e.events.connect||e.events.connect(i)},[]),(0,pa.jsx)(pG.Provider,{value:t,children:n})}function fo(e,t){let n=fr.get(e),r=null==n?void 0:n.fiber;if(r){let i=null==n?void 0:n.store.getState();i&&(i.internal.active=!1),fn.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{null==i.events.disconnect||i.events.disconnect(),null==(n=i.gl)||null==(r=n.renderLists)||null==r.dispose||r.dispose(),null==(a=i.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(s=i.gl)&&s.xr&&i.xr.disconnect();var n,r,a,s,o=i.scene;for(let e in"Scene"!==o.type&&(null==o.dispose||o.dispose()),o){let t=o[e];(null==t?void 0:t.type)!=="Scene"&&(null==t||null==t.dispose||t.dispose())}fr.delete(e),t&&t(e)}catch(e){}},500)})}}function fl(e,t,n){return(0,pa.jsx)(fu,{children:e,container:t,state:n})}function fu(e){let{state:t={},children:n,container:r}=e,{events:i,size:a,...s}=t,o=pW(),[l]=h.useState(()=>new u4),[u]=h.useState(()=>new nW),c=p_((e,t)=>{let n;if(t.camera&&a){let r=t.camera;n=e.viewport.getCurrentViewport(r,new nX,a),r!==e.camera&&pk(r,a)}return{...e,...t,scene:r,raycaster:l,pointer:u,mouse:u,previousRoot:o,events:{...e.events,...t.events,...i},size:{...e.size,...a},viewport:{...e.viewport,...n},setEvents:e=>t.set(t=>({...t,events:{...t.events,...e}}))}}),d=h.useMemo(()=>{let e=d7((e,t)=>({...s,set:e,get:t})),t=t=>e.setState(e=>c.current(t,e));return t(o.getState()),o.subscribe(t),e},[o,r]);return(0,pa.jsx)(pa.Fragment,{children:fn.createPortal((0,pa.jsx)(pG.Provider,{value:d,children:n}),d,null)})}function fc(e,t){let n={callback:e};return t.add(n),()=>void t.delete(n)}let fh=new Set,fd=new Set,fp=new Set,ff=e=>fc(e,fh),fm=e=>fc(e,fd);function fg(e,t){if(e.size)for(let{callback:n}of e.values())n(t)}function fv(e,t){switch(e){case"before":return fg(fh,t);case"after":return fg(fd,t);case"tail":return fg(fp,t)}}function fy(e,t,n){let r=t.clock.getDelta();"never"===t.frameloop&&"number"==typeof e&&(r=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),s=t.internal.subscribers;for(let e=0;e0)&&!(null!=(t=c.gl.xr)&&t.isPresenting)&&(l+=fy(e,c))}if(fx=!1,fv("after",e),0===l)return fv("tail",e),f_=!1,cancelAnimationFrame(u)}function fS(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!e)return fr.forEach(e=>fS(e.store.getState(),n));(null==(t=e.gl.xr)||!t.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(n>1?e.internal.frames=Math.min(60,e.internal.frames+n):fx?e.internal.frames=2:e.internal.frames=1,f_||(f_=!0,requestAnimationFrame(fb)))}function fM(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(t&&fv("before",e),n)fy(e,n,r);else for(let t of fr.values())fy(e,t.store.getState());t&&fv("after",e)}let fw={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function fE(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(n.hovered.delete(pB(e)),null!=r&&r.eventCount){let n=r.handlers,i={...e,intersections:t};null==n.onPointerOut||n.onPointerOut(i),null==n.onPointerLeave||n.onPointerLeave(i)}}}function r(e,t){for(let n=0;nn([]);case"onLostPointerCapture":return t=>{let{internal:r}=e.getState();"pointerId"in t&&r.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(t.pointerId)&&(r.capturedMap.delete(t.pointerId),n([]))})}}return function(a){let{onPointerMissed:s,internal:o}=e.getState();o.lastEvent.current=a;let l="onPointerMove"===i,u="onClick"===i||"onContextMenu"===i||"onDoubleClick"===i,c=function(t,n){let r=e.getState(),i=new Set,a=[],s=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e{let n=pw(e.object),r=pw(t.object);return n&&r&&r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=pB(e);return!i.has(t)&&(i.add(t),!0)});for(let e of(r.events.filter&&(o=r.events.filter(o,r)),o)){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())i.has(pB(e.intersection))||a.push(e.intersection);return a}(a,l?t:void 0),h=u?function(t){let{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}(a):0;"onPointerDown"===i&&(o.initialClick=[a.offsetX,a.offsetY],o.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&h<=2&&(r(a,o.interaction),s&&s(a)),l&&n(c),!function(e,t,r,i){if(e.length){let a={stopped:!1};for(let s of e){let o=pw(s.object);if(o||s.object.traverseAncestors(e=>{let t=pw(e);if(t)return o=t,!1}),o){let{raycaster:l,pointer:u,camera:c,internal:h}=o,d=new nX(u.x,u.y,0).unproject(c),p=e=>{var t,n;return null!=(t=null==(n=h.capturedMap.get(e))?void 0:n.has(s.eventObject))&&t},f=e=>{let n={intersection:s,target:t.target};h.capturedMap.has(e)?h.capturedMap.get(e).set(s.eventObject,n):h.capturedMap.set(e,new Map([[s.eventObject,n]])),t.target.setPointerCapture(e)},m=e=>{let t=h.capturedMap.get(e);t&&pH(h.capturedMap,s.eventObject,t,e)},g={};for(let e in t){let n=t[e];"function"!=typeof n&&(g[e]=n)}let v={...s,...g,pointer:u,intersections:e,stopped:a.stopped,delta:r,unprojectedPoint:d,ray:l.ray,camera:c,stopPropagation(){let r="pointerId"in t&&h.capturedMap.get(t.pointerId);(!r||r.has(s.eventObject))&&(v.stopped=a.stopped=!0,h.hovered.size&&Array.from(h.hovered.values()).find(e=>e.eventObject===s.eventObject)&&n([...e.slice(0,e.indexOf(s)),s]))},target:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},currentTarget:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},nativeEvent:t};if(i(v),!0===a.stopped)break}}}}(c,a,h,function(e){let t=e.eventObject,n=t.__r3f;if(!(null!=n&&n.eventCount))return;let s=n.handlers;if(l){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){let t=pB(e),n=o.hovered.get(t);n?n.stopped&&e.stopPropagation():(o.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{let n=s[i];n?(!u||o.initialHits.includes(t))&&(r(a,o.interaction.filter(e=>!o.initialHits.includes(e))),n(e)):u&&o.initialHits.includes(t)&&r(a,o.interaction.filter(e=>!o.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(fw).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;let{events:n,internal:r}=e.getState();null!=(t=r.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{let{set:n,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),n(e=>({events:{...e.events,connected:t}})),r.handlers)for(let e in r.handlers){let n=r.handlers[e],[i,a]=fw[e];t.addEventListener(i,n,{passive:a})}},disconnect:()=>{let{set:t,events:n}=e.getState();if(n.connected){if(n.handlers)for(let e in n.handlers){let t=n.handlers[e],[r]=fw[e];n.connected.removeEventListener(r,t)}t(e=>({events:{...e.events,connected:void 0}}))}}}}e.s(["useFrame",()=>pX],5230)},99749,e=>{"use strict";function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e.s(["_",()=>t])},53487,(e,t,n)=>{"use strict";let r="[^".concat("\\\\/","]"),i="[^/]",a="(?:".concat("\\/","|$)"),s="(?:^|".concat("\\/",")"),o="".concat("\\.","{1,2}").concat(a),l="(?!".concat(s).concat(o,")"),u="(?!".concat("\\.","{0,1}").concat(a,")"),c="(?!".concat(o,")"),h={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:i,END_ANCHOR:a,DOTS_SLASH:o,NO_DOT:"(?!".concat("\\.",")"),NO_DOTS:l,NO_DOT_SLASH:u,NO_DOTS_SLASH:c,QMARK_NO_DOT:"[^.".concat("\\/","]"),STAR:"".concat(i,"*?"),START_ANCHOR:s,SEP:"/"},d={...h,SLASH_LITERAL:"[".concat("\\\\/","]"),QMARK:r,STAR:"".concat(r,"*?"),DOTS_SLASH:"".concat("\\.","{1,2}(?:[").concat("\\\\/","]|$)"),NO_DOT:"(?!".concat("\\.",")"),NO_DOTS:"(?!(?:^|[".concat("\\\\/","])").concat("\\.","{1,2}(?:[").concat("\\\\/","]|$))"),NO_DOT_SLASH:"(?!".concat("\\.","{0,1}(?:[").concat("\\\\/","]|$))"),NO_DOTS_SLASH:"(?!".concat("\\.","{1,2}(?:[").concat("\\\\/","]|$))"),QMARK_NO_DOT:"[^.".concat("\\\\/","]"),START_ANCHOR:"(?:^|[".concat("\\\\/","])"),END_ANCHOR:"(?:[".concat("\\\\/","]|$)"),SEP:"\\"};t.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:"))".concat(e.STAR,")")},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?d:h}},19241,(e,t,n)=>{"use strict";var r=e.i(47167);let{REGEX_BACKSLASH:i,REGEX_REMOVE_BACKSLASH:a,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:o}=e.r(53487);n.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n.hasRegexChars=e=>s.test(e),n.isRegexChar=e=>1===e.length&&n.hasRegexChars(e),n.escapeRegex=e=>e.replace(o,"\\$1"),n.toPosixSlashes=e=>e.replace(i,"/"),n.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){let e=navigator.platform.toLowerCase();return"win32"===e||"windows"===e}return void 0!==r.default&&!!r.default.platform&&"win32"===r.default.platform},n.removeBackslashes=e=>e.replace(a,e=>"\\"===e?"":e),n.escapeLast=(e,t,r)=>{let i=e.lastIndexOf(t,r);return -1===i?e:"\\"===e[i-1]?n.escapeLast(e,t,i-1):"".concat(e.slice(0,i),"\\").concat(e.slice(i))},n.removePrefix=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},n.wrapOutput=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.contains?"":"^",i=n.contains?"":"$",a="".concat(r,"(?:").concat(e,")").concat(i);return!0===t.negated&&(a="(?:^(?!".concat(a,").*$)")),a},n.basename=function(e){let{windows:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.split(t?/[\\/]/:"/"),r=n[n.length-1];return""===r?n[n.length-2]:r}},26094,(e,t,n)=>{"use strict";let r=e.r(19241),{CHAR_ASTERISK:i,CHAR_AT:a,CHAR_BACKWARD_SLASH:s,CHAR_COMMA:o,CHAR_DOT:l,CHAR_EXCLAMATION_MARK:u,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:h,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:f,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:v,CHAR_RIGHT_SQUARE_BRACKET:y}=e.r(53487),_=e=>e===c||e===s,x=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let n,b,S=t||{},M=e.length-1,w=!0===S.parts||!0===S.scanToEnd,E=[],T=[],A=[],C=e,R=-1,P=0,I=0,L=!1,N=!1,D=!1,U=!1,O=!1,F=!1,k=!1,z=!1,B=!1,H=!1,V=0,G={value:"",depth:0,isGlob:!1},W=()=>R>=M,j=()=>C.charCodeAt(R+1),X=()=>(n=b,C.charCodeAt(++R));for(;R0&&(Y=C.slice(0,P),C=C.slice(P),I-=P),q&&!0===D&&I>0?(q=C.slice(0,I),J=C.slice(I)):!0===D?(q="",J=C):q=C,q&&""!==q&&"/"!==q&&q!==C&&_(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),!0===S.unescape&&(J&&(J=r.removeBackslashes(J)),q&&!0===k&&(q=r.removeBackslashes(q)));let Z={prefix:Y,input:e,start:P,base:q,glob:J,isBrace:L,isBracket:N,isGlob:D,isExtglob:U,isGlobstar:O,negated:z,negatedExtglob:B};if(!0===S.tokens&&(Z.maxDepth=0,_(b)||T.push(G),Z.tokens=T),!0===S.parts||!0===S.tokens){let t;for(let n=0;n{"use strict";let r=e.r(53487),i=e.r(19241),{MAX_LENGTH:a,POSIX_REGEX_SOURCE:s,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:l,REPLACEMENTS:u}=r,c=(e,t)=>{if("function"==typeof t.expandRange)return t.expandRange(...e,t);e.sort();let n="[".concat(e.join("-"),"]");try{new RegExp(n)}catch(t){return e.map(e=>i.escapeRegex(e)).join("..")}return n},h=(e,t)=>"Missing ".concat(e,': "').concat(t,'" - use "\\\\').concat(t,'" to match literal characters'),d=(e,t)=>{let n;if("string"!=typeof e)throw TypeError("Expected a string");e=u[e]||e;let p={...t},f="number"==typeof p.maxLength?Math.min(a,p.maxLength):a,m=e.length;if(m>f)throw SyntaxError("Input length: ".concat(m,", exceeds maximum allowed length: ").concat(f));let g={type:"bos",value:"",output:p.prepend||""},v=[g],y=p.capture?"":"?:",_=r.globChars(p.windows),x=r.extglobChars(_),{DOT_LITERAL:b,PLUS_LITERAL:S,SLASH_LITERAL:M,ONE_CHAR:w,DOTS_SLASH:E,NO_DOT:T,NO_DOT_SLASH:A,NO_DOTS_SLASH:C,QMARK:R,QMARK_NO_DOT:P,STAR:I,START_ANCHOR:L}=_,N=e=>"(".concat(y,"(?:(?!").concat(L).concat(e.dot?E:b,").)*?)"),D=p.dot?"":T,U=p.dot?R:P,O=!0===p.bash?N(p):I;p.capture&&(O="(".concat(O,")")),"boolean"==typeof p.noext&&(p.noextglob=p.noext);let F={input:e,index:-1,start:0,dot:!0===p.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:v};m=(e=i.removePrefix(e,F)).length;let k=[],z=[],B=[],H=g,V=()=>F.index===m-1,G=F.peek=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e[F.index+t]},W=F.advance=()=>e[++F.index]||"",j=()=>e.slice(F.index+1),X=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;F.consumed+=e,F.index+=t},q=e=>{F.output+=null!=e.output?e.output:e.value,X(e.value)},Y=()=>{let e=1;for(;"!"===G()&&("("!==G(2)||"?"===G(3));)W(),F.start++,e++;return e%2!=0&&(F.negated=!0,F.start++,!0)},J=e=>{F[e]++,B.push(e)},Z=e=>{F[e]--,B.pop()},K=e=>{if("globstar"===H.type){let t=F.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||k.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(F.output=F.output.slice(0,-H.output.length),H.type="star",H.value="*",H.output=O,F.output+=H.output)}if(k.length&&"paren"!==e.type&&(k[k.length-1].inner+=e.value),(e.value||e.output)&&q(e),H&&"text"===H.type&&"text"===e.type){H.output=(H.output||H.value)+e.value,H.value+=e.value;return}e.prev=H,v.push(e),H=e},$=(e,t)=>{let n={...x[t],conditions:1,inner:""};n.prev=H,n.parens=F.parens,n.output=F.output;let r=(p.capture?"(":"")+n.open;J("parens"),K({type:e,value:t,output:F.output?"":w}),K({type:"paren",extglob:!0,value:W(),output:r}),k.push(n)},Q=e=>{let r,i=e.close+(p.capture?")":"");if("negate"===e.type){let n=O;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(n=N(p)),(n!==O||V()||/^\)+$/.test(j()))&&(i=e.close=")$))".concat(n)),e.inner.includes("*")&&(r=j())&&/^\.[^\\/.]+$/.test(r)){let a=d(r,{...t,fastpaths:!1}).output;i=e.close=")".concat(a,")").concat(n,")")}"bos"===e.prev.type&&(F.negatedExtglob=!0)}K({type:"paren",extglob:!0,value:n,output:i}),Z("parens")};if(!1!==p.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,r=e.replace(l,(e,t,r,i,a,s)=>"\\"===i?(n=!0,e):"?"===i?t?t+i+(a?R.repeat(a.length):""):0===s?U+(a?R.repeat(a.length):""):R.repeat(r.length):"."===i?b.repeat(r.length):"*"===i?t?t+i+(a?O:""):O:t?e:"\\".concat(e));return(!0===n&&(r=!0===p.unescape?r.replace(/\\/g,""):r.replace(/\\+/g,e=>e.length%2==0?"\\\\":e?"\\":"")),r===e&&!0===p.contains)?F.output=e:F.output=i.wrapOutput(r,F,t),F}for(;!V();){if("\0"===(n=W()))continue;if("\\"===n){let e=G();if("/"===e&&!0!==p.bash||"."===e||";"===e)continue;if(!e){K({type:"text",value:n+="\\"});continue}let t=/^\\+/.exec(j()),r=0;if(t&&t[0].length>2&&(r=t[0].length,F.index+=r,r%2!=0&&(n+="\\")),!0===p.unescape?n=W():n+=W(),0===F.brackets){K({type:"text",value:n});continue}}if(F.brackets>0&&("]"!==n||"["===H.value||"[^"===H.value)){if(!1!==p.posix&&":"===n){let e=H.value.slice(1);if(e.includes("[")&&(H.posix=!0,e.includes(":"))){let e=H.value.lastIndexOf("["),t=H.value.slice(0,e),n=s[H.value.slice(e+2)];if(n){H.value=t+n,F.backtrack=!0,W(),g.output||1!==v.indexOf(H)||(g.output=w);continue}}}("["===n&&":"!==G()||"-"===n&&"]"===G())&&(n="\\".concat(n)),"]"===n&&("["===H.value||"[^"===H.value)&&(n="\\".concat(n)),!0===p.posix&&"!"===n&&"["===H.value&&(n="^"),H.value+=n,q({value:n});continue}if(1===F.quotes&&'"'!==n){n=i.escapeRegex(n),H.value+=n,q({value:n});continue}if('"'===n){F.quotes=+(1!==F.quotes),!0===p.keepQuotes&&K({type:"text",value:n});continue}if("("===n){J("parens"),K({type:"paren",value:n});continue}if(")"===n){if(0===F.parens&&!0===p.strictBrackets)throw SyntaxError(h("opening","("));let e=k[k.length-1];if(e&&F.parens===e.parens+1){Q(k.pop());continue}K({type:"paren",value:n,output:F.parens?")":"\\)"}),Z("parens");continue}if("["===n){if(!0!==p.nobracket&&j().includes("]"))J("brackets");else{if(!0!==p.nobracket&&!0===p.strictBrackets)throw SyntaxError(h("closing","]"));n="\\".concat(n)}K({type:"bracket",value:n});continue}if("]"===n){if(!0===p.nobracket||H&&"bracket"===H.type&&1===H.value.length){K({type:"text",value:n,output:"\\".concat(n)});continue}if(0===F.brackets){if(!0===p.strictBrackets)throw SyntaxError(h("opening","["));K({type:"text",value:n,output:"\\".concat(n)});continue}Z("brackets");let e=H.value.slice(1);if(!0===H.posix||"^"!==e[0]||e.includes("/")||(n="/".concat(n)),H.value+=n,q({value:n}),!1===p.literalBrackets||i.hasRegexChars(e))continue;let t=i.escapeRegex(H.value);if(F.output=F.output.slice(0,-H.value.length),!0===p.literalBrackets){F.output+=t,H.value=t;continue}H.value="(".concat(y).concat(t,"|").concat(H.value,")"),F.output+=H.value;continue}if("{"===n&&!0!==p.nobrace){J("braces");let e={type:"brace",value:n,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};z.push(e),K(e);continue}if("}"===n){let e=z[z.length-1];if(!0===p.nobrace||!e){K({type:"text",value:n,output:n});continue}let t=")";if(!0===e.dots){let e=v.slice(),n=[];for(let t=e.length-1;t>=0&&(v.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=c(n,p),F.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){let r=F.output.slice(0,e.outputIndex),i=F.tokens.slice(e.tokensIndex);for(let a of(e.value=e.output="\\{",n=t="\\}",F.output=r,i))F.output+=a.output||a.value}K({type:"brace",value:n,output:t}),Z("braces"),z.pop();continue}if("|"===n){k.length>0&&k[k.length-1].conditions++,K({type:"text",value:n});continue}if(","===n){let e=n,t=z[z.length-1];t&&"braces"===B[B.length-1]&&(t.comma=!0,e="|"),K({type:"comma",value:n,output:e});continue}if("/"===n){if("dot"===H.type&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",v.pop(),H=g;continue}K({type:"slash",value:n,output:M});continue}if("."===n){if(F.braces>0&&"dot"===H.type){"."===H.value&&(H.output=b);let e=z[z.length-1];H.type="dots",H.output+=n,H.value+=n,e.dots=!0;continue}if(F.braces+F.parens===0&&"bos"!==H.type&&"slash"!==H.type){K({type:"text",value:n,output:b});continue}K({type:"dot",value:n,output:b});continue}if("?"===n){if(!(H&&"("===H.value)&&!0!==p.noextglob&&"("===G()&&"?"!==G(2)){$("qmark",n);continue}if(H&&"paren"===H.type){let e=G(),t=n;("("!==H.value||/[!=<:]/.test(e))&&("<"!==e||/<([!=]|\w+>)/.test(j()))||(t="\\".concat(n)),K({type:"text",value:n,output:t});continue}if(!0!==p.dot&&("slash"===H.type||"bos"===H.type)){K({type:"qmark",value:n,output:P});continue}K({type:"qmark",value:n,output:R});continue}if("!"===n){if(!0!==p.noextglob&&"("===G()&&("?"!==G(2)||!/[!=<:]/.test(G(3)))){$("negate",n);continue}if(!0!==p.nonegate&&0===F.index){Y();continue}}if("+"===n){if(!0!==p.noextglob&&"("===G()&&"?"!==G(2)){$("plus",n);continue}if(H&&"("===H.value||!1===p.regex){K({type:"plus",value:n,output:S});continue}if(H&&("bracket"===H.type||"paren"===H.type||"brace"===H.type)||F.parens>0){K({type:"plus",value:n});continue}K({type:"plus",value:S});continue}if("@"===n){if(!0!==p.noextglob&&"("===G()&&"?"!==G(2)){K({type:"at",extglob:!0,value:n,output:""});continue}K({type:"text",value:n});continue}if("*"!==n){("$"===n||"^"===n)&&(n="\\".concat(n));let e=o.exec(j());e&&(n+=e[0],F.index+=e[0].length),K({type:"text",value:n});continue}if(H&&("globstar"===H.type||!0===H.star)){H.type="star",H.star=!0,H.value+=n,H.output=O,F.backtrack=!0,F.globstar=!0,X(n);continue}let t=j();if(!0!==p.noextglob&&/^\([^?]/.test(t)){$("star",n);continue}if("star"===H.type){if(!0===p.noglobstar){X(n);continue}let r=H.prev,i=r.prev,a="slash"===r.type||"bos"===r.type,s=i&&("star"===i.type||"globstar"===i.type);if(!0===p.bash&&(!a||t[0]&&"/"!==t[0])){K({type:"star",value:n,output:""});continue}let o=F.braces>0&&("comma"===r.type||"brace"===r.type),l=k.length&&("pipe"===r.type||"paren"===r.type);if(!a&&"paren"!==r.type&&!o&&!l){K({type:"star",value:n,output:""});continue}for(;"/**"===t.slice(0,3);){let n=e[F.index+4];if(n&&"/"!==n)break;t=t.slice(3),X("/**",3)}if("bos"===r.type&&V()){H.type="globstar",H.value+=n,H.output=N(p),F.output=H.output,F.globstar=!0,X(n);continue}if("slash"===r.type&&"bos"!==r.prev.type&&!s&&V()){F.output=F.output.slice(0,-(r.output+H.output).length),r.output="(?:".concat(r.output),H.type="globstar",H.output=N(p)+(p.strictSlashes?")":"|$)"),H.value+=n,F.globstar=!0,F.output+=r.output+H.output,X(n);continue}if("slash"===r.type&&"bos"!==r.prev.type&&"/"===t[0]){let e=void 0!==t[1]?"|$":"";F.output=F.output.slice(0,-(r.output+H.output).length),r.output="(?:".concat(r.output),H.type="globstar",H.output="".concat(N(p)).concat(M,"|").concat(M).concat(e,")"),H.value+=n,F.output+=r.output+H.output,F.globstar=!0,X(n+W()),K({type:"slash",value:"/",output:""});continue}if("bos"===r.type&&"/"===t[0]){H.type="globstar",H.value+=n,H.output="(?:^|".concat(M,"|").concat(N(p)).concat(M,")"),F.output=H.output,F.globstar=!0,X(n+W()),K({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-H.output.length),H.type="globstar",H.output=N(p),H.value+=n,F.output+=H.output,F.globstar=!0,X(n);continue}let r={type:"star",value:n,output:O};if(!0===p.bash){r.output=".*?",("bos"===H.type||"slash"===H.type)&&(r.output=D+r.output),K(r);continue}if(H&&("bracket"===H.type||"paren"===H.type)&&!0===p.regex){r.output=n,K(r);continue}(F.index===F.start||"slash"===H.type||"dot"===H.type)&&("dot"===H.type?(F.output+=A,H.output+=A):!0===p.dot?(F.output+=C,H.output+=C):(F.output+=D,H.output+=D),"*"!==G()&&(F.output+=w,H.output+=w)),K(r)}for(;F.brackets>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing","]"));F.output=i.escapeLast(F.output,"["),Z("brackets")}for(;F.parens>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing",")"));F.output=i.escapeLast(F.output,"("),Z("parens")}for(;F.braces>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing","}"));F.output=i.escapeLast(F.output,"{"),Z("braces")}if(!0!==p.strictSlashes&&("star"===H.type||"bracket"===H.type)&&K({type:"maybe_slash",value:"",output:"".concat(M,"?")}),!0===F.backtrack)for(let e of(F.output="",F.tokens))F.output+=null!=e.output?e.output:e.value,e.suffix&&(F.output+=e.suffix);return F};d.fastpaths=(e,t)=>{let n={...t},s="number"==typeof n.maxLength?Math.min(a,n.maxLength):a,o=e.length;if(o>s)throw SyntaxError("Input length: ".concat(o,", exceeds maximum allowed length: ").concat(s));e=u[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:h,DOTS_SLASH:d,NO_DOT:p,NO_DOTS:f,NO_DOTS_SLASH:m,STAR:g,START_ANCHOR:v}=r.globChars(n.windows),y=n.dot?f:p,_=n.dot?m:p,x=n.capture?"":"?:",b=!0===n.bash?".*?":g;n.capture&&(b="(".concat(b,")"));let S=e=>!0===e.noglobstar?b:"(".concat(x,"(?:(?!").concat(v).concat(e.dot?d:l,").)*?)"),M=e=>{switch(e){case"*":return"".concat(y).concat(h).concat(b);case".*":return"".concat(l).concat(h).concat(b);case"*.*":return"".concat(y).concat(b).concat(l).concat(h).concat(b);case"*/*":return"".concat(y).concat(b).concat(c).concat(h).concat(_).concat(b);case"**":return y+S(n);case"**/*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(_).concat(h).concat(b);case"**/*.*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(_).concat(b).concat(l).concat(h).concat(b);case"**/.*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(l).concat(h).concat(b);default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=M(t[1]);if(!n)return;return n+l+t[2]}}},w=M(i.removePrefix(e,{negated:!1,prefix:""}));return w&&!0!==n.strictSlashes&&(w+="".concat(c,"?")),w},t.exports=d},53174,(e,t,n)=>{"use strict";let r=e.r(26094),i=e.r(17932),a=e.r(19241),s=e.r(53487),o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(e)){let r=e.map(e=>o(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=e&&"object"==typeof e&&!Array.isArray(e)&&e.tokens&&e.input;if(""===e||"string"!=typeof e&&!r)throw TypeError("Expected pattern to be a non-empty string");let i=t||{},a=i.windows,s=r?o.compileRe(e,t):o.makeRe(e,t,!1,!0),l=s.state;delete s.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=o(i.ignore,e,n)}let c=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{isMatch:c,match:h,output:d}=o.test(n,s,t,{glob:e,posix:a}),p={glob:e,state:l,regex:s,posix:a,input:n,output:d,match:h,isMatch:c};return("function"==typeof i.onResult&&i.onResult(p),!1===c)?(p.isMatch=!1,!!r&&p):u(n)?("function"==typeof i.onIgnore&&i.onIgnore(p),p.isMatch=!1,!!r&&p):("function"==typeof i.onMatch&&i.onMatch(p),!r||p)};return n&&(c.state=l),c};o.test=function(e,t,n){let{glob:r,posix:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("string"!=typeof e)throw TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};let s=n||{},l=s.format||(i?a.toPosixSlashes:null),u=e===r,c=u&&l?l(e):e;return!1===u&&(u=(c=l?l(e):e)===r),(!1===u||!0===s.capture)&&(u=!0===s.matchBase||!0===s.basename?o.matchBase(e,t,n,i):t.exec(c)),{isMatch:!!u,match:u,output:c}},o.matchBase=(e,t,n)=>(t instanceof RegExp?t:o.makeRe(t,n)).test(a.basename(e)),o.isMatch=(e,t,n)=>o(t,n)(e),o.parse=(e,t)=>Array.isArray(e)?e.map(e=>o.parse(e,t)):i(e,{...t,fastpaths:!1}),o.scan=(e,t)=>r(e,t),o.compileRe=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!0===n)return e.output;let i=t||{},a=i.contains?"":"^",s=i.contains?"":"$",l="".concat(a,"(?:").concat(e.output,")").concat(s);e&&!0===e.negated&&(l="^(?!".concat(l,").*$"));let u=o.toRegex(l,t);return!0===r&&(u.state=e),u},o.makeRe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e||"string"!=typeof e)throw TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1!==t.fastpaths&&("."===e[0]||"*"===e[0])&&(a.output=i.fastpaths(e,t)),a.output||(a=i(e,t)),o.compileRe(a,t,n,r)},o.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},o.constants=s,t.exports=o},54970,(e,t,n)=>{"use strict";let r=e.r(53174),i=e.r(19241);function a(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&(null===t.windows||void 0===t.windows)&&(t={...t,windows:i.isWindows()}),r(e,t,n)}Object.assign(a,r),t.exports=a},98223,71726,91996,e=>{"use strict";function t(e){return e.split(/(?:\r\n|\r|\n)/g).map(e=>e.trim()).filter(Boolean).filter(e=>!e.startsWith(";")).map(e=>{let t=e.match(/^(.+)\s(\d+)$/);if(!t)return{name:e,frameCount:1};{let e=parseInt(t[2],10);return{name:t[1],frameCount:e}}})}e.s(["parseImageFileList",()=>t],98223),e.s(["getActualResourceKey",()=>l,"getMissionInfo",()=>d,"getMissionList",()=>p,"getResourceKey",()=>a,"getResourceList",()=>u,"getResourceMap",()=>s,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>h],91996);var n=e.i(63738);function r(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}e.s(["normalizePath",()=>r],71726);let i=n.default;function a(e){return r(e).toLowerCase()}function s(){return i.resources}function o(e){let[t,...n]=i.resources[e],[r,a]=n[n.length-1];return[r,null!=a?a:t]}function l(e){let t=a(e);if(i.resources[t])return t;let n=t.replace(/\d+(\.(png))$/i,"$1");if(i.resources[n])return n;throw Error("Resource not found in manifest: ".concat(e))}function u(){return Object.keys(i.resources)}let c=["",".jpg",".png",".gif",".bmp"];function h(e){let t=a(e);for(let e of c){let n="".concat(t).concat(e);if(i.resources[n])return n}return t}function d(e){let t=i.missions[e];if(!t)throw Error("Mission not found: ".concat(e));return t}function p(){return Object.keys(i.missions)}},92552,(e,t,n)=>{"use strict";let r,i;function a(e,t){return t.reduce((e,t)=>{let[n,r]=t;return{type:"BinaryExpression",operator:n,left:e,right:r}},e)}function s(e,t){return{type:"UnaryExpression",operator:e,argument:t}}class o extends SyntaxError{format(e){let t="Error: "+this.message;if(this.location){let n=null,r=e.find(e=>e.source===this.location.source);r&&(n=r.text.split(/\r\n|\n|\r/g));let i=this.location.start,a=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(i):i,s=this.location.source+":"+a.line+":"+a.column;if(n){let e=this.location.end,r="".padEnd(a.line.toString().length," "),o=n[i.line-1],l=(i.line===e.line?e.column:o.length+1)-i.column||1;t+="\n --> "+s+"\n"+r+" |\n"+a.line+" | "+o+"\n"+r+" | "+"".padEnd(i.column-1," ")+"".padEnd(l,"^")}else t+="\n at "+s}return t}static buildMessage(e,t){function n(e){return e.codePointAt(0).toString(16).toUpperCase()}let r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function i(e){return r?e.replace(r,e=>"\\u{"+n(e)+"}"):e}function a(e){return i(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+n(e)))}function s(e){return i(e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+n(e)))}let o={literal:e=>'"'+a(e.text)+'"',class(e){let t=e.parts.map(e=>Array.isArray(e)?s(e[0])+"-"+s(e[1]):s(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function l(e){return o[e.type](e)}return"Expected "+function(e){let t=e.map(l);if(t.sort(),t.length>0){let e=1;for(let n=1;n]/,C=/^[+\-]/,R=/^[%*\/]/,P=/^[!\-~]/,I=/^[a-zA-Z_]/,L=/^[a-zA-Z0-9_]/,N=/^[ \t]/,D=/^[^"\\\n\r]/,U=/^[^'\\\n\r]/,O=/^[0-9a-fA-F]/,F=/^[0-9]/,k=/^[xX]/,z=/^[^\n\r]/,B=/^[\n\r]/,H=/^[ \t\n\r]/,V=tT(";",!1),G=tT("package",!1),W=tT("{",!1),j=tT("}",!1),X=tT("function",!1),q=tT("(",!1),Y=tT(")",!1),J=tT("::",!1),Z=tT(",",!1),K=tT("datablock",!1),$=tT(":",!1),Q=tT("new",!1),ee=tT("[",!1),et=tT("]",!1),en=tT("=",!1),er=tT(".",!1),ei=tT("if",!1),ea=tT("else",!1),es=tT("for",!1),eo=tT("while",!1),el=tT("do",!1),eu=tT("switch$",!1),ec=tT("switch",!1),eh=tT("case",!1),ed=tT("default",!1),ep=tT("or",!1),ef=tT("return",!1),em=tT("break",!1),eg=tT("continue",!1),ev=tT("+=",!1),ey=tT("-=",!1),e_=tT("*=",!1),ex=tT("/=",!1),eb=tT("%=",!1),eS=tT("<<=",!1),eM=tT(">>=",!1),ew=tT("&=",!1),eE=tT("|=",!1),eT=tT("^=",!1),eA=tT("?",!1),eC=tT("||",!1),eR=tT("&&",!1),eP=tT("|",!1),eI=tT("^",!1),eL=tT("&",!1),eN=tT("==",!1),eD=tT("!=",!1),eU=tT("<=",!1),eO=tT(">=",!1),eF=tA(["<",">"],!1,!1,!1),ek=tT("$=",!1),ez=tT("!$=",!1),eB=tT("@",!1),eH=tT("NL",!1),eV=tT("TAB",!1),eG=tT("SPC",!1),eW=tT("<<",!1),ej=tT(">>",!1),eX=tA(["+","-"],!1,!1,!1),eq=tA(["%","*","/"],!1,!1,!1),eY=tA(["!","-","~"],!1,!1,!1),eJ=tT("++",!1),eZ=tT("--",!1),eK=tT("*",!1),e$=tT("%",!1),eQ=tA([["a","z"],["A","Z"],"_"],!1,!1,!1),e0=tA([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),e1=tT("$",!1),e2=tT("parent",!1),e3=tA([" "," "],!1,!1,!1),e4=tT('"',!1),e5=tT("'",!1),e6=tT("\\",!1),e8=tA(['"',"\\","\n","\r"],!0,!1,!1),e9=tA(["'","\\","\n","\r"],!0,!1,!1),e7=tT("n",!1),te=tT("r",!1),tt=tT("t",!1),tn=tT("x",!1),tr=tA([["0","9"],["a","f"],["A","F"]],!1,!1,!1),ti=tT("cr",!1),ta=tT("cp",!1),ts=tT("co",!1),to=tT("c",!1),tl=tA([["0","9"]],!1,!1,!1),tu={type:"any"},tc=tT("0",!1),th=tA(["x","X"],!1,!1,!1),td=tT("-",!1),tp=tT("true",!1),tf=tT("false",!1),tm=tT("//",!1),tg=tA(["\n","\r"],!0,!1,!1),tv=tA(["\n","\r"],!1,!1,!1),ty=tT("/*",!1),t_=tT("*/",!1),tx=tA([" "," ","\n","\r"],!1,!1,!1),tb=0|t.peg$currPos,tS=[{line:1,column:1}],tM=tb,tw=t.peg$maxFailExpected||[],tE=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in c))throw Error("Can't start parsing from rule \""+t.startRule+'".');h=c[t.startRule]}function tT(e,t){return{type:"literal",text:e,ignoreCase:t}}function tA(e,t,n,r){return{type:"class",parts:e,inverted:t,ignoreCase:n,unicode:r}}function tC(t){let n,r=tS[t];if(r)return r;if(t>=tS.length)n=tS.length-1;else for(n=t;!tS[--n];);for(r={line:(r=tS[n]).line,column:r.column};ntM&&(tM=tb,tw=[]),tw.push(e))}function tI(){let e,t,n;for(nh(),e=[],t=tb,(n=nl())===l&&(n=tL()),n!==l?t=n=[n,nh()]:(tb=t,t=l);t!==l;)e.push(t),t=tb,(n=nl())===l&&(n=tL()),n!==l?t=n=[n,nh()]:(tb=t,t=l);return{type:"Program",body:e.map(e=>{let[t]=e;return t}).filter(Boolean),execScriptPaths:Array.from(r),hasDynamicExec:i}}function tL(){let t,n,r,i,a,s,o,u,c,h,f,_,x,w,E,T,A;return(t=function(){let t,n,r,i,a,s,o,u;if(t=tb,e.substr(tb,7)===d?(n=d,tb+=7):(n=l,0===tE&&tP(G)),n!==l)if(nc()!==l)if((r=nr())!==l)if(nu(),123===e.charCodeAt(tb)?(i="{",tb++):(i=l,0===tE&&tP(W)),i!==l){for(nh(),a=[],s=tb,(o=nl())===l&&(o=tL()),o!==l?s=o=[o,u=nh()]:(tb=s,s=l);s!==l;)a.push(s),s=tb,(o=nl())===l&&(o=tL()),o!==l?s=o=[o,u=nh()]:(tb=s,s=l);(125===e.charCodeAt(tb)?(s="}",tb++):(s=l,0===tE&&tP(j)),s!==l)?(o=nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),t={type:"PackageDeclaration",name:r,body:a.map(e=>{let[t]=e;return t}).filter(Boolean)}):(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o;if(t=tb,e.substr(tb,8)===p?(n=p,tb+=8):(n=l,0===tE&&tP(X)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i;if(t=tb,(n=nr())!==l)if("::"===e.substr(tb,2)?(r="::",tb+=2):(r=l,0===tE&&tP(J)),r!==l)if((i=nr())!==l)t={type:"MethodName",namespace:n,method:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=nr()),t}())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=function(){let t,n,r,i,a,s,o,u;if(t=tb,(n=nr())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=nr())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=nr())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=[n,...r.map(e=>{let[,,,t]=e;return t})]}else tb=t,t=l;return t}())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l)if(nu(),(o=tH())!==l)t={type:"FunctionDeclaration",name:r,params:a||[],body:o};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&((r=tb,(i=tN())!==l)?(nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a===l&&(a=null),nu(),r=i):(tb=r,r=l),(t=r)===l&&((s=tb,(o=tD())!==l)?(nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),nu(),s=o):(tb=s,s=l),(t=s)===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h,d;if(t=tb,"if"===e.substr(tb,2)?(n="if",tb+=2):(n=l,0===tE&&tP(ei)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),(s=tL())!==l){var p;o=tb,u=nu(),e.substr(tb,4)===m?(c=m,tb+=4):(c=l,0===tE&&tP(ea)),c!==l?(h=nu(),(d=tL())!==l?o=u=[u,c,h,d]:(tb=o,o=l)):(tb=o,o=l),o===l&&(o=null),t={type:"IfStatement",test:i,consequent:s,alternate:(p=o)?p[3]:null}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h;if(t=tb,"for"===e.substr(tb,3)?(n="for",tb+=3):(n=l,0===tE&&tP(es)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())===l&&(i=null),nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a!==l)if(nu(),(s=tV())===l&&(s=null),nu(),59===e.charCodeAt(tb)?(o=";",tb++):(o=l,0===tE&&tP(V)),o!==l)if(nu(),(u=tV())===l&&(u=null),nu(),41===e.charCodeAt(tb)?(c=")",tb++):(c=l,0===tE&&tP(Y)),c!==l)if(nu(),(h=tL())!==l){var d,p;d=i,p=s,t={type:"ForStatement",init:d,test:p,update:u,body:h}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u;if(t=tb,"do"===e.substr(tb,2)?(n="do",tb+=2):(n=l,0===tE&&tP(el)),n!==l)if(nu(),(r=tL())!==l)if(nu(),e.substr(tb,5)===g?(i=g,tb+=5):(i=l,0===tE&&tP(eo)),i!==l)if(nu(),40===e.charCodeAt(tb)?(a="(",tb++):(a=l,0===tE&&tP(q)),a!==l)if(nu(),(s=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(o=")",tb++):(o=l,0===tE&&tP(Y)),o!==l)nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),t={type:"DoWhileStatement",test:s,body:r};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s;if(t=tb,e.substr(tb,5)===g?(n=g,tb+=5):(n=l,0===tE&&tP(eo)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),(s=tL())!==l)t={type:"WhileStatement",test:i,body:s};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h;if(t=tb,e.substr(tb,7)===v?(n=v,tb+=7):(n=l,0===tE&&tP(eu)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),123===e.charCodeAt(tb)?(s="{",tb++):(s=l,0===tE&&tP(W)),s!==l){for(nh(),o=[],u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);u!==l;)o.push(u),u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);(125===e.charCodeAt(tb)?(u="}",tb++):(u=l,0===tE&&tP(j)),u!==l)?t={type:"SwitchStatement",stringMode:!0,discriminant:i,cases:o.map(e=>{let[t]=e;return t}).filter(e=>e&&"SwitchCase"===e.type)}:(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;if(t===l)if(t=tb,e.substr(tb,6)===y?(n=y,tb+=6):(n=l,0===tE&&tP(ec)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),123===e.charCodeAt(tb)?(s="{",tb++):(s=l,0===tE&&tP(W)),s!==l){for(nh(),o=[],u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);u!==l;)o.push(u),u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);(125===e.charCodeAt(tb)?(u="}",tb++):(u=l,0===tE&&tP(j)),u!==l)?t={type:"SwitchStatement",stringMode:!1,discriminant:i,cases:o.map(e=>{let[t]=e;return t}).filter(e=>e&&"SwitchCase"===e.type)}:(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a;if(t=tb,e.substr(tb,6)===b?(n=b,tb+=6):(n=l,0===tE&&tP(ef)),n!==l)if(r=tb,(i=nc())!==l&&(a=tV())!==l?r=i=[i,a]:(tb=r,r=l),r===l&&(r=null),i=nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a!==l){var s;t={type:"ReturnStatement",value:(s=r)?s[1]:null}}else tb=t,t=l;else tb=t,t=l;return t}())===l&&(c=tb,e.substr(tb,5)===S?(h=S,tb+=5):(h=l,0===tE&&tP(em)),h!==l?(nu(),59===e.charCodeAt(tb)?(f=";",tb++):(f=l,0===tE&&tP(V)),f!==l?c={type:"BreakStatement"}:(tb=c,c=l)):(tb=c,c=l),(t=c)===l&&(_=tb,e.substr(tb,8)===M?(x=M,tb+=8):(x=l,0===tE&&tP(eg)),x!==l?(nu(),59===e.charCodeAt(tb)?(w=";",tb++):(w=l,0===tE&&tP(V)),w!==l?_={type:"ContinueStatement"}:(tb=_,_=l)):(tb=_,_=l),(t=_)===l&&((E=tb,(T=tV())!==l&&(nu(),59===e.charCodeAt(tb)?(A=";",tb++):(A=l,0===tE&&tP(V)),A!==l))?E={type:"ExpressionStatement",expression:T}:(tb=E,E=l),(t=E)===l&&(t=tH())===l&&(t=nl())===l)))))&&(t=tb,nu(),59===e.charCodeAt(tb)?(n=";",tb++):(n=l,0===tE&&tP(V)),n!==l?(nu(),t=null):(tb=t,t=l)),t}function tN(){let t,n,r,i,a,s,o,u,c,h,d,p,m,g;if(t=tb,e.substr(tb,9)===f?(n=f,tb+=9):(n=l,0===tE&&tP(K)),n!==l)if(nc()!==l)if((r=nr())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=tO())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l){var v,y,_;if(nu(),o=tb,58===e.charCodeAt(tb)?(u=":",tb++):(u=l,0===tE&&tP($)),u!==l?(c=nu(),(h=nr())!==l?o=u=[u,c,h]:(tb=o,o=l)):(tb=o,o=l),o===l&&(o=null),u=nu(),c=tb,123===e.charCodeAt(tb)?(h="{",tb++):(h=l,0===tE&&tP(W)),h!==l){for(d=nu(),p=[],m=tU();m!==l;)p.push(m),m=tU();m=nu(),125===e.charCodeAt(tb)?(g="}",tb++):(g=l,0===tE&&tP(j)),g!==l?c=h=[h,d,p,m,g,nu()]:(tb=c,c=l)}else tb=c,c=l;c===l&&(c=null),v=a,y=o,_=c,t={type:"DatablockDeclaration",className:r,instanceName:v,parent:y?y[2]:null,body:_?_[2].filter(Boolean):[]}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}function tD(){let t,n,r,i,a,s,o,u,c,h,d,p;if(t=tb,"new"===e.substr(tb,3)?(n="new",tb+=3):(n=l,0===tE&&tP(Q)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i,a,s,o,u,c,h;if((t=tb,40===e.charCodeAt(tb)?(n="(",tb++):(n=l,0===tE&&tP(q)),n!==l&&(r=nu(),(i=tV())!==l&&(a=nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l)))?t=i:(tb=t,t=l),t===l)if(t=tb,(n=nr())!==l){var d;for(r=[],i=tb,a=nu(),91===e.charCodeAt(tb)?(s="[",tb++):(s=l,0===tE&&tP(ee)),s!==l?(o=nu(),(u=tz())!==l?(c=nu(),93===e.charCodeAt(tb)?(h="]",tb++):(h=l,0===tE&&tP(et)),h!==l?i=a=[a,s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),91===e.charCodeAt(tb)?(s="[",tb++):(s=l,0===tE&&tP(ee)),s!==l?(o=nu(),(u=tz())!==l?(c=nu(),93===e.charCodeAt(tb)?(h="]",tb++):(h=l,0===tE&&tP(et)),h!==l?i=a=[a,s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);d=n,t=r.reduce((e,t)=>{let[,,,n]=t;return{type:"IndexExpression",object:e,index:n}},d)}else tb=t,t=l;return t}())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=tO())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l){var f;if(nu(),o=tb,123===e.charCodeAt(tb)?(u="{",tb++):(u=l,0===tE&&tP(W)),u!==l){for(c=nu(),h=[],d=tU();d!==l;)h.push(d),d=tU();d=nu(),125===e.charCodeAt(tb)?(p="}",tb++):(p=l,0===tE&&tP(j)),p!==l?o=u=[u,c,h,d,p,nu()]:(tb=o,o=l)}else tb=o,o=l;o===l&&(o=null),t={type:"ObjectDeclaration",className:r,instanceName:a,body:(f=o)?f[2].filter(Boolean):[]}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}function tU(){let t,n,r;return(t=tb,(n=tD())!==l)?(nu(),59===e.charCodeAt(tb)?(r=";",tb++):(r=l,0===tE&&tP(V)),r===l&&(r=null),nu(),t=n):(tb=t,t=l),t===l&&((t=tb,(n=tN())!==l)?(nu(),59===e.charCodeAt(tb)?(r=";",tb++):(r=l,0===tE&&tP(V)),r===l&&(r=null),nu(),t=n):(tb=t,t=l),t===l&&(t=function(){let t,n,r,i,a;if(t=tb,nu(),(n=tF())!==l)if(nu(),61===e.charCodeAt(tb)?(r="=",tb++):(r=l,0===tE&&tP(en)),r!==l)if(nu(),(i=tV())!==l)nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a===l&&(a=null),nu(),t={type:"Assignment",target:n,value:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=nl())===l&&(t=function(){let t,n;if(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n!==l)for(;n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));else t=l;return t!==l&&(t=null),t}())),t}function tO(){let e;return(e=tQ())===l&&(e=nr())===l&&(e=no()),e}function tF(){let e,t,n,r;if(e=tb,(t=t9())!==l){for(n=[],r=tk();r!==l;)n.push(r),r=tk();e=n.reduce((e,t)=>"property"===t.type?{type:"MemberExpression",object:e,property:t.value}:{type:"IndexExpression",object:e,index:t.value},t)}else tb=e,e=l;return e}function tk(){let t,n,r,i;return(t=tb,46===e.charCodeAt(tb)?(n=".",tb++):(n=l,0===tE&&tP(er)),n!==l&&(nu(),(r=nr())!==l))?t={type:"property",value:r}:(tb=t,t=l),t===l&&((t=tb,91===e.charCodeAt(tb)?(n="[",tb++):(n=l,0===tE&&tP(ee)),n!==l&&(nu(),(r=tz())!==l&&(nu(),93===e.charCodeAt(tb)?(i="]",tb++):(i=l,0===tE&&tP(et)),i!==l)))?t={type:"index",value:r}:(tb=t,t=l)),t}function tz(){let t,n,r,i,a,s,o,u;if(t=tb,(n=tV())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=r.length>0?[n,...r.map(e=>{let[,,,t]=e;return t})]:n}else tb=t,t=l;return t}function tB(){let t,n,r,i,a,s,o,u,c;if(t=tb,e.substr(tb,4)===_?(n=_,tb+=4):(n=l,0===tE&&tP(eh)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i,a,s,o,u;if(t=tb,(n=t4())!==l){for(r=[],i=tb,a=nu(),"or"===e.substr(tb,2)?(s="or",tb+=2):(s=l,0===tE&&tP(ep)),s!==l&&(o=nc())!==l&&(u=t4())!==l?i=a=[a,s,o,u]:(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),"or"===e.substr(tb,2)?(s="or",tb+=2):(s=l,0===tE&&tP(ep)),s!==l&&(o=nc())!==l&&(u=t4())!==l?i=a=[a,s,o,u]:(tb=i,i=l);t=r.length>0?[n,...r.map(e=>{let[,,,t]=e;return t})]:n}else tb=t,t=l;return t}())!==l)if(nu(),58===e.charCodeAt(tb)?(i=":",tb++):(i=l,0===tE&&tP($)),i!==l){for(a=nh(),s=[],o=tb,(u=nl())===l&&(u=tL()),u!==l?o=u=[u,c=nh()]:(tb=o,o=l);o!==l;)s.push(o),o=tb,(u=nl())===l&&(u=tL()),u!==l?o=u=[u,c=nh()]:(tb=o,o=l);t={type:"SwitchCase",test:r,consequent:s.map(e=>{let[t]=e;return t}).filter(Boolean)}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;if(t===l)if(t=tb,e.substr(tb,7)===x?(n=x,tb+=7):(n=l,0===tE&&tP(ed)),n!==l)if(nu(),58===e.charCodeAt(tb)?(r=":",tb++):(r=l,0===tE&&tP($)),r!==l){for(nh(),i=[],a=tb,(s=nl())===l&&(s=tL()),s!==l?a=s=[s,o=nh()]:(tb=a,a=l);a!==l;)i.push(a),a=tb,(s=nl())===l&&(s=tL()),s!==l?a=s=[s,o=nh()]:(tb=a,a=l);t={type:"SwitchCase",test:null,consequent:i.map(e=>{let[t]=e;return t}).filter(Boolean)}}else tb=t,t=l;else tb=t,t=l;return t}function tH(){let t,n,r,i,a,s;if(t=tb,123===e.charCodeAt(tb)?(n="{",tb++):(n=l,0===tE&&tP(W)),n!==l){for(nh(),r=[],i=tb,(a=nl())===l&&(a=tL()),a!==l?i=a=[a,s=nh()]:(tb=i,i=l);i!==l;)r.push(i),i=tb,(a=nl())===l&&(a=tL()),a!==l?i=a=[a,s=nh()]:(tb=i,i=l);(125===e.charCodeAt(tb)?(i="}",tb++):(i=l,0===tE&&tP(j)),i!==l)?t={type:"BlockStatement",body:r.map(e=>{let[t]=e;return t}).filter(Boolean)}:(tb=t,t=l)}else tb=t,t=l;return t}function tV(){let t,n,r,i;if(t=tb,(n=tF())!==l)if(nu(),(r=tG())!==l)if(nu(),(i=tV())!==l)t={type:"AssignmentExpression",operator:r,target:n,value:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=function(){let t,n,r,i,a,s;if(t=tb,(n=tW())!==l)if(nu(),63===e.charCodeAt(tb)?(r="?",tb++):(r=l,0===tE&&tP(eA)),r!==l)if(nu(),(i=tV())!==l)if(nu(),58===e.charCodeAt(tb)?(a=":",tb++):(a=l,0===tE&&tP($)),a!==l)if(nu(),(s=tV())!==l)t={type:"ConditionalExpression",test:n,consequent:i,alternate:s};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=tW()),t}()),t}function tG(){let t;return 61===e.charCodeAt(tb)?(t="=",tb++):(t=l,0===tE&&tP(en)),t===l&&("+="===e.substr(tb,2)?(t="+=",tb+=2):(t=l,0===tE&&tP(ev)),t===l&&("-="===e.substr(tb,2)?(t="-=",tb+=2):(t=l,0===tE&&tP(ey)),t===l&&("*="===e.substr(tb,2)?(t="*=",tb+=2):(t=l,0===tE&&tP(e_)),t===l&&("/="===e.substr(tb,2)?(t="/=",tb+=2):(t=l,0===tE&&tP(ex)),t===l&&("%="===e.substr(tb,2)?(t="%=",tb+=2):(t=l,0===tE&&tP(eb)),t===l&&("<<="===e.substr(tb,3)?(t="<<=",tb+=3):(t=l,0===tE&&tP(eS)),t===l&&(">>="===e.substr(tb,3)?(t=">>=",tb+=3):(t=l,0===tE&&tP(eM)),t===l&&("&="===e.substr(tb,2)?(t="&=",tb+=2):(t=l,0===tE&&tP(ew)),t===l&&("|="===e.substr(tb,2)?(t="|=",tb+=2):(t=l,0===tE&&tP(eE)),t===l&&("^="===e.substr(tb,2)?(t="^=",tb+=2):(t=l,0===tE&&tP(eT)))))))))))),t}function tW(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tj())!==l){for(r=[],i=tb,s=nu(),"||"===e.substr(tb,2)?(o="||",tb+=2):(o=l,0===tE&&tP(eC)),o!==l?(u=nu(),(c=tj())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),"||"===e.substr(tb,2)?(o="||",tb+=2):(o=l,0===tE&&tP(eC)),o!==l?(u=nu(),(c=tj())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tj(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tX())!==l){for(r=[],i=tb,s=nu(),"&&"===e.substr(tb,2)?(o="&&",tb+=2):(o=l,0===tE&&tP(eR)),o!==l?(u=nu(),(c=tX())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),"&&"===e.substr(tb,2)?(o="&&",tb+=2):(o=l,0===tE&&tP(eR)),o!==l?(u=nu(),(c=tX())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tX(){let t,n,r,i,s,o,u,c,h;if(t=tb,(n=tq())!==l){for(r=[],i=tb,s=nu(),124===e.charCodeAt(tb)?(o="|",tb++):(o=l,0===tE&&tP(eP)),o!==l?(u=tb,tE++,124===e.charCodeAt(tb)?(c="|",tb++):(c=l,0===tE&&tP(eP)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tq())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),124===e.charCodeAt(tb)?(o="|",tb++):(o=l,0===tE&&tP(eP)),o!==l?(u=tb,tE++,124===e.charCodeAt(tb)?(c="|",tb++):(c=l,0===tE&&tP(eP)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tq())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tq(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tY())!==l){for(r=[],i=tb,s=nu(),94===e.charCodeAt(tb)?(o="^",tb++):(o=l,0===tE&&tP(eI)),o!==l?(u=nu(),(c=tY())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),94===e.charCodeAt(tb)?(o="^",tb++):(o=l,0===tE&&tP(eI)),o!==l?(u=nu(),(c=tY())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tY(){let t,n,r,i,s,o,u,c,h;if(t=tb,(n=tJ())!==l){for(r=[],i=tb,s=nu(),38===e.charCodeAt(tb)?(o="&",tb++):(o=l,0===tE&&tP(eL)),o!==l?(u=tb,tE++,38===e.charCodeAt(tb)?(c="&",tb++):(c=l,0===tE&&tP(eL)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tJ())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),38===e.charCodeAt(tb)?(o="&",tb++):(o=l,0===tE&&tP(eL)),o!==l?(u=tb,tE++,38===e.charCodeAt(tb)?(c="&",tb++):(c=l,0===tE&&tP(eL)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tJ())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tJ(){let e,t,n,r,i,s,o,u;if(e=tb,(t=tK())!==l){for(n=[],r=tb,i=nu(),(s=tZ())!==l?(o=nu(),(u=tK())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=tZ())!==l?(o=nu(),(u=tK())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function tZ(){let t;return"=="===e.substr(tb,2)?(t="==",tb+=2):(t=l,0===tE&&tP(eN)),t===l&&("!="===e.substr(tb,2)?(t="!=",tb+=2):(t=l,0===tE&&tP(eD))),t}function tK(){let e,t,n,r,i,s,o,u;if(e=tb,(t=tQ())!==l){for(n=[],r=tb,i=nu(),(s=t$())!==l?(o=nu(),(u=tQ())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t$())!==l?(o=nu(),(u=tQ())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t$(){let t;return"<="===e.substr(tb,2)?(t="<=",tb+=2):(t=l,0===tE&&tP(eU)),t===l&&(">="===e.substr(tb,2)?(t=">=",tb+=2):(t=l,0===tE&&tP(eO)),t===l&&(t=e.charAt(tb),A.test(t)?tb++:(t=l,0===tE&&tP(eF)))),t}function tQ(){let e,t,n,r,i,s,o,u;if(e=tb,(t=t2())!==l){for(n=[],r=tb,i=nu(),(s=t1())!==l?(o=nu(),(u=t0())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t1())!==l?(o=nu(),(u=t0())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t0(){let e,t,n,r;if(e=tb,(t=tF())!==l)if(nu(),(n=tG())!==l)if(nu(),(r=tV())!==l)e={type:"AssignmentExpression",operator:n,target:t,value:r};else tb=e,e=l;else tb=e,e=l;else tb=e,e=l;return e===l&&(e=t2()),e}function t1(){let t;return"$="===e.substr(tb,2)?(t="$=",tb+=2):(t=l,0===tE&&tP(ek)),t===l&&("!$="===e.substr(tb,3)?(t="!$=",tb+=3):(t=l,0===tE&&tP(ez)),t===l&&(64===e.charCodeAt(tb)?(t="@",tb++):(t=l,0===tE&&tP(eB)),t===l&&("NL"===e.substr(tb,2)?(t="NL",tb+=2):(t=l,0===tE&&tP(eH)),t===l&&("TAB"===e.substr(tb,3)?(t="TAB",tb+=3):(t=l,0===tE&&tP(eV)),t===l&&("SPC"===e.substr(tb,3)?(t="SPC",tb+=3):(t=l,0===tE&&tP(eG))))))),t}function t2(){let e,t,n,r,i,s,o,u;if(e=tb,(t=t4())!==l){for(n=[],r=tb,i=nu(),(s=t3())!==l?(o=nu(),(u=t4())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t3())!==l?(o=nu(),(u=t4())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t3(){let t;return"<<"===e.substr(tb,2)?(t="<<",tb+=2):(t=l,0===tE&&tP(eW)),t===l&&(">>"===e.substr(tb,2)?(t=">>",tb+=2):(t=l,0===tE&&tP(ej))),t}function t4(){let t,n,r,i,s,o,u,c;if(t=tb,(n=t5())!==l){for(r=[],i=tb,s=nu(),o=e.charAt(tb),C.test(o)?tb++:(o=l,0===tE&&tP(eX)),o!==l?(u=nu(),(c=t5())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),o=e.charAt(tb),C.test(o)?tb++:(o=l,0===tE&&tP(eX)),o!==l?(u=nu(),(c=t5())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function t5(){let t,n,r,i,s,o,u,c;if(t=tb,(n=t6())!==l){for(r=[],i=tb,s=nu(),o=e.charAt(tb),R.test(o)?tb++:(o=l,0===tE&&tP(eq)),o!==l?(u=nu(),(c=t6())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),o=e.charAt(tb),R.test(o)?tb++:(o=l,0===tE&&tP(eq)),o!==l?(u=nu(),(c=t6())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function t6(){let t,n,r;return(t=tb,n=e.charAt(tb),P.test(n)?tb++:(n=l,0===tE&&tP(eY)),n!==l&&(nu(),(r=t8())!==l))?t=s(n,r):(tb=t,t=l),t===l&&((t=tb,"++"===e.substr(tb,2)?(n="++",tb+=2):(n=l,0===tE&&tP(eJ)),n===l&&("--"===e.substr(tb,2)?(n="--",tb+=2):(n=l,0===tE&&tP(eZ))),n!==l&&(nu(),(r=t8())!==l))?t=s(n,r):(tb=t,t=l),t===l&&((t=tb,42===e.charCodeAt(tb)?(n="*",tb++):(n=l,0===tE&&tP(eK)),n!==l&&(nu(),(r=t8())!==l))?t={type:"TagDereferenceExpression",argument:r}:(tb=t,t=l),t===l&&(t=function(){let t,n,r;if(t=tb,(n=t9())!==l)if(nu(),"++"===e.substr(tb,2)?(r="++",tb+=2):(r=l,0===tE&&tP(eJ)),r===l&&("--"===e.substr(tb,2)?(r="--",tb+=2):(r=l,0===tE&&tP(eZ))),r!==l)t={type:"PostfixExpression",operator:r,argument:n};else tb=t,t=l;else tb=t,t=l;return t===l&&(t=t9()),t}()))),t}function t8(){let e,t,n,r;if(e=tb,(t=tF())!==l)if(nu(),(n=tG())!==l)if(nu(),(r=tV())!==l)e={type:"AssignmentExpression",operator:n,target:t,value:r};else tb=e,e=l;else tb=e,e=l;else tb=e,e=l;return e===l&&(e=t6()),e}function t9(){let t,n,a,s,o,u,c,h,d,p;if(t=tb,(n=function(){let t,n,r,i,a,s,o,u,c,h,d,p,f,m,g,v;if(t=tb,(o=tD())===l&&(o=tN())===l&&(o=function(){let t,n,r,i;if(t=tb,34===e.charCodeAt(tb)?(n='"',tb++):(n=l,0===tE&&tP(e4)),n!==l){for(r=[],i=ni();i!==l;)r.push(i),i=ni();(34===e.charCodeAt(tb)?(i='"',tb++):(i=l,0===tE&&tP(e4)),i!==l)?t={type:"StringLiteral",value:r.join("")}:(tb=t,t=l)}else tb=t,t=l;if(t===l)if(t=tb,39===e.charCodeAt(tb)?(n="'",tb++):(n=l,0===tE&&tP(e5)),n!==l){for(r=[],i=na();i!==l;)r.push(i),i=na();(39===e.charCodeAt(tb)?(i="'",tb++):(i=l,0===tE&&tP(e5)),i!==l)?t={type:"StringLiteral",value:r.join(""),tagged:!0}:(tb=t,t=l)}else tb=t,t=l;return t}())===l&&(o=no())===l&&((u=tb,e.substr(tb,4)===E?(c=E,tb+=4):(c=l,0===tE&&tP(tp)),c===l&&(e.substr(tb,5)===T?(c=T,tb+=5):(c=l,0===tE&&tP(tf))),c!==l&&(h=tb,tE++,d=np(),tE--,d===l?h=void 0:(tb=h,h=l),h!==l))?u={type:"BooleanLiteral",value:"true"===c}:(tb=u,u=l),(o=u)===l&&((p=ne())===l&&(p=nt())===l&&(p=nn()),(o=p)===l))&&((f=tb,40===e.charCodeAt(tb)?(m="(",tb++):(m=l,0===tE&&tP(q)),m!==l&&(nu(),(g=tV())!==l&&(nu(),41===e.charCodeAt(tb)?(v=")",tb++):(v=l,0===tE&&tP(Y)),v!==l)))?f=g:(tb=f,f=l),o=f),(n=o)!==l){for(r=[],i=tb,a=nu(),(s=tk())!==l?i=a=[a,s]:(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),(s=tk())!==l?i=a=[a,s]:(tb=i,i=l);t=r.reduce((e,t)=>{let[,n]=t;return"property"===n.type?{type:"MemberExpression",object:e,property:n.value}:{type:"IndexExpression",object:e,index:n.value}},n)}else tb=t,t=l;return t}())!==l){for(a=[],s=tb,o=nu(),40===e.charCodeAt(tb)?(u="(",tb++):(u=l,0===tE&&tP(q)),u!==l?(c=nu(),(h=t7())===l&&(h=null),d=nu(),41===e.charCodeAt(tb)?(p=")",tb++):(p=l,0===tE&&tP(Y)),p!==l?s=o=[o,u,c,h,d,p]:(tb=s,s=l)):(tb=s,s=l),s===l&&(s=tb,o=nu(),(u=tk())!==l?s=o=[o,u]:(tb=s,s=l));s!==l;)a.push(s),s=tb,o=nu(),40===e.charCodeAt(tb)?(u="(",tb++):(u=l,0===tE&&tP(q)),u!==l?(c=nu(),(h=t7())===l&&(h=null),d=nu(),41===e.charCodeAt(tb)?(p=")",tb++):(p=l,0===tE&&tP(Y)),p!==l?s=o=[o,u,c,h,d,p]:(tb=s,s=l)):(tb=s,s=l),s===l&&(s=tb,o=nu(),(u=tk())!==l?s=o=[o,u]:(tb=s,s=l));t=a.reduce((e,t)=>{if("("===t[1]){var n;let[,,,a]=t;return n=a||[],"Identifier"===e.type&&"exec"===e.name.toLowerCase()&&(n.length>0&&"StringLiteral"===n[0].type?r.add(n[0].value):i=!0),{type:"CallExpression",callee:e,arguments:n}}let a=t[1];return"property"===a.type?{type:"MemberExpression",object:e,property:a.value}:{type:"IndexExpression",object:e,index:a.value}},n)}else tb=t,t=l;return t}function t7(){let t,n,r,i,a,s,o,u;if(t=tb,(n=tV())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=[n,...r.map(e=>{let[,,,t]=e;return t})]}else tb=t,t=l;return t}function ne(){let t,n,r,i,a,s,o;if(t=tb,37===e.charCodeAt(tb)?(n="%",tb++):(n=l,0===tE&&tP(e$)),n!==l){if(r=tb,i=tb,a=e.charAt(tb),I.test(a)?tb++:(a=l,0===tE&&tP(eQ)),a!==l){for(s=[],o=e.charAt(tb),L.test(o)?tb++:(o=l,0===tE&&tP(e0));o!==l;)s.push(o),o=e.charAt(tb),L.test(o)?tb++:(o=l,0===tE&&tP(e0));i=a=[a,s]}else tb=i,i=l;(r=i!==l?e.substring(r,tb):i)!==l?t={type:"Variable",scope:"local",name:r}:(tb=t,t=l)}else tb=t,t=l;return t}function nt(){let t,n,r,i,a,s,o,u,c,h,d,p,f;if(t=tb,36===e.charCodeAt(tb)?(n="$",tb++):(n=l,0===tE&&tP(e1)),n!==l){if(r=tb,i=tb,"::"===e.substr(tb,2)?(a="::",tb+=2):(a=l,0===tE&&tP(J)),a===l&&(a=null),s=e.charAt(tb),I.test(s)?tb++:(s=l,0===tE&&tP(eQ)),s!==l){for(o=[],u=e.charAt(tb),L.test(u)?tb++:(u=l,0===tE&&tP(e0));u!==l;)o.push(u),u=e.charAt(tb),L.test(u)?tb++:(u=l,0===tE&&tP(e0));if(u=[],c=tb,"::"===e.substr(tb,2)?(h="::",tb+=2):(h=l,0===tE&&tP(J)),h!==l)if(d=e.charAt(tb),I.test(d)?tb++:(d=l,0===tE&&tP(eQ)),d!==l){for(p=[],f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));f!==l;)p.push(f),f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));c=h=[h,d,p]}else tb=c,c=l;else tb=c,c=l;for(;c!==l;)if(u.push(c),c=tb,"::"===e.substr(tb,2)?(h="::",tb+=2):(h=l,0===tE&&tP(J)),h!==l)if(d=e.charAt(tb),I.test(d)?tb++:(d=l,0===tE&&tP(eQ)),d!==l){for(p=[],f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));f!==l;)p.push(f),f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));c=h=[h,d,p]}else tb=c,c=l;else tb=c,c=l;i=a=[a,s,o,u]}else tb=i,i=l;(r=i!==l?e.substring(r,tb):i)!==l?t={type:"Variable",scope:"global",name:r}:(tb=t,t=l)}else tb=t,t=l;return t}function nn(){let t,n,r,i,a,s,o,u,c,h,d;if(t=tb,n=tb,r=tb,e.substr(tb,6)===w?(i=w,tb+=6):(i=l,0===tE&&tP(e2)),i!==l){for(a=[],s=e.charAt(tb),N.test(s)?tb++:(s=l,0===tE&&tP(e3));s!==l;)a.push(s),s=e.charAt(tb),N.test(s)?tb++:(s=l,0===tE&&tP(e3));if("::"===e.substr(tb,2)?(s="::",tb+=2):(s=l,0===tE&&tP(J)),s!==l){for(o=[],u=e.charAt(tb),N.test(u)?tb++:(u=l,0===tE&&tP(e3));u!==l;)o.push(u),u=e.charAt(tb),N.test(u)?tb++:(u=l,0===tE&&tP(e3));if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));r=i=[i,a,s,o,u,c]}else tb=r,r=l}else tb=r,r=l}else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n.replace(/\s+/g,"")}),(t=n)===l){if(t=tb,n=tb,r=tb,e.substr(tb,6)===w?(i=w,tb+=6):(i=l,0===tE&&tP(e2)),i!==l){if(a=[],s=tb,"::"===e.substr(tb,2)?(o="::",tb+=2):(o=l,0===tE&&tP(J)),o!==l)if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));s=o=[o,u,c]}else tb=s,s=l;else tb=s,s=l;if(s!==l)for(;s!==l;)if(a.push(s),s=tb,"::"===e.substr(tb,2)?(o="::",tb+=2):(o=l,0===tE&&tP(J)),o!==l)if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));s=o=[o,u,c]}else tb=s,s=l;else tb=s,s=l;else a=l;a!==l?r=i=[i,a]:(tb=r,r=l)}else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n}),(t=n)===l){if(t=tb,n=tb,r=tb,i=e.charAt(tb),I.test(i)?tb++:(i=l,0===tE&&tP(eQ)),i!==l){for(a=[],s=e.charAt(tb),L.test(s)?tb++:(s=l,0===tE&&tP(e0));s!==l;)a.push(s),s=e.charAt(tb),L.test(s)?tb++:(s=l,0===tE&&tP(e0));if(s=[],o=tb,"::"===e.substr(tb,2)?(u="::",tb+=2):(u=l,0===tE&&tP(J)),u!==l)if(c=e.charAt(tb),I.test(c)?tb++:(c=l,0===tE&&tP(eQ)),c!==l){for(h=[],d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));d!==l;)h.push(d),d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));o=u=[u,c,h]}else tb=o,o=l;else tb=o,o=l;for(;o!==l;)if(s.push(o),o=tb,"::"===e.substr(tb,2)?(u="::",tb+=2):(u=l,0===tE&&tP(J)),u!==l)if(c=e.charAt(tb),I.test(c)?tb++:(c=l,0===tE&&tP(eQ)),c!==l){for(h=[],d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));d!==l;)h.push(d),d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));o=u=[u,c,h]}else tb=o,o=l;else tb=o,o=l;r=i=[i,a,s]}else tb=r,r=l;(n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n}),t=n}}return t}function nr(){let e;return(e=ne())===l&&(e=nt())===l&&(e=nn()),e}function ni(){let t,n,r;return(t=tb,92===e.charCodeAt(tb)?(n="\\",tb++):(n=l,0===tE&&tP(e6)),n!==l&&(r=ns())!==l)?t=r:(tb=t,t=l),t===l&&(t=e.charAt(tb),D.test(t)?tb++:(t=l,0===tE&&tP(e8))),t}function na(){let t,n,r;return(t=tb,92===e.charCodeAt(tb)?(n="\\",tb++):(n=l,0===tE&&tP(e6)),n!==l&&(r=ns())!==l)?t=r:(tb=t,t=l),t===l&&(t=e.charAt(tb),U.test(t)?tb++:(t=l,0===tE&&tP(e9))),t}function ns(){let t,n,r,i,a,s;return t=tb,110===e.charCodeAt(tb)?(n="n",tb++):(n=l,0===tE&&tP(e7)),n!==l&&(n="\n"),(t=n)===l&&(t=tb,114===e.charCodeAt(tb)?(n="r",tb++):(n=l,0===tE&&tP(te)),n!==l&&(n="\r"),(t=n)===l)&&(t=tb,116===e.charCodeAt(tb)?(n="t",tb++):(n=l,0===tE&&tP(tt)),n!==l&&(n=" "),(t=n)===l)&&((t=tb,120===e.charCodeAt(tb)?(n="x",tb++):(n=l,0===tE&&tP(tn)),n!==l&&(r=tb,i=tb,a=e.charAt(tb),O.test(a)?tb++:(a=l,0===tE&&tP(tr)),a!==l?(s=e.charAt(tb),O.test(s)?tb++:(s=l,0===tE&&tP(tr)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l),(r=i!==l?e.substring(r,tb):i)!==l))?t=String.fromCharCode(parseInt(r,16)):(tb=t,t=l),t===l&&(t=tb,"cr"===e.substr(tb,2)?(n="cr",tb+=2):(n=l,0===tE&&tP(ti)),n!==l&&(n="\x0f"),(t=n)===l&&(t=tb,"cp"===e.substr(tb,2)?(n="cp",tb+=2):(n=l,0===tE&&tP(ta)),n!==l&&(n="\x10"),(t=n)===l))&&(t=tb,"co"===e.substr(tb,2)?(n="co",tb+=2):(n=l,0===tE&&tP(ts)),n!==l&&(n="\x11"),(t=n)===l)&&((t=tb,99===e.charCodeAt(tb)?(n="c",tb++):(n=l,0===tE&&tP(to)),n!==l&&(r=e.charAt(tb),F.test(r)?tb++:(r=l,0===tE&&tP(tl)),r!==l))?t=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(r,10)]):(tb=t,t=l),t===l&&(t=tb,e.length>tb?(n=e.charAt(tb),tb++):(n=l,0===tE&&tP(tu)),t=n))),t}function no(){let t,n,r,i,a,s,o,u,c;if(t=tb,n=tb,r=tb,48===e.charCodeAt(tb)?(i="0",tb++):(i=l,0===tE&&tP(tc)),i!==l)if(a=e.charAt(tb),k.test(a)?tb++:(a=l,0===tE&&tP(th)),a!==l){if(s=[],o=e.charAt(tb),O.test(o)?tb++:(o=l,0===tE&&tP(tr)),o!==l)for(;o!==l;)s.push(o),o=e.charAt(tb),O.test(o)?tb++:(o=l,0===tE&&tP(tr));else s=l;s!==l?r=i=[i,a,s]:(tb=r,r=l)}else tb=r,r=l;else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(r=tb,tE++,i=np(),tE--,i===l?r=void 0:(tb=r,r=l),r!==l)?t={type:"NumberLiteral",value:parseInt(n,16)}:(tb=t,t=l),t===l){if(t=tb,n=tb,r=tb,45===e.charCodeAt(tb)?(i="-",tb++):(i=l,0===tE&&tP(td)),i===l&&(i=null),a=[],s=e.charAt(tb),F.test(s)?tb++:(s=l,0===tE&&tP(tl)),s!==l)for(;s!==l;)a.push(s),s=e.charAt(tb),F.test(s)?tb++:(s=l,0===tE&&tP(tl));else a=l;if(a!==l){if(s=tb,46===e.charCodeAt(tb)?(o=".",tb++):(o=l,0===tE&&tP(er)),o!==l){if(u=[],c=e.charAt(tb),F.test(c)?tb++:(c=l,0===tE&&tP(tl)),c!==l)for(;c!==l;)u.push(c),c=e.charAt(tb),F.test(c)?tb++:(c=l,0===tE&&tP(tl));else u=l;u!==l?s=o=[o,u]:(tb=s,s=l)}else tb=s,s=l;s===l&&(s=null),r=i=[i,a,s]}else tb=r,r=l;if(r===l)if(r=tb,45===e.charCodeAt(tb)?(i="-",tb++):(i=l,0===tE&&tP(td)),i===l&&(i=null),46===e.charCodeAt(tb)?(a=".",tb++):(a=l,0===tE&&tP(er)),a!==l){if(s=[],o=e.charAt(tb),F.test(o)?tb++:(o=l,0===tE&&tP(tl)),o!==l)for(;o!==l;)s.push(o),o=e.charAt(tb),F.test(o)?tb++:(o=l,0===tE&&tP(tl));else s=l;s!==l?r=i=[i,a,s]:(tb=r,r=l)}else tb=r,r=l;(n=r!==l?e.substring(n,tb):r)!==l&&(r=tb,tE++,i=np(),tE--,i===l?r=void 0:(tb=r,r=l),r!==l)?t={type:"NumberLiteral",value:parseFloat(n)}:(tb=t,t=l)}return t}function nl(){let t;return(t=function(){let t,n,r,i,a;if(t=tb,"//"===e.substr(tb,2)?(n="//",tb+=2):(n=l,0===tE&&tP(tm)),n!==l){for(r=tb,i=[],a=e.charAt(tb),z.test(a)?tb++:(a=l,0===tE&&tP(tg));a!==l;)i.push(a),a=e.charAt(tb),z.test(a)?tb++:(a=l,0===tE&&tP(tg));r=e.substring(r,tb),i=e.charAt(tb),B.test(i)?tb++:(i=l,0===tE&&tP(tv)),i===l&&(i=null),t={type:"Comment",value:r}}else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o;if(t=tb,"/*"===e.substr(tb,2)?(n="/*",tb+=2):(n=l,0===tE&&tP(ty)),n!==l){for(r=tb,i=[],a=tb,s=tb,tE++,"*/"===e.substr(tb,2)?(o="*/",tb+=2):(o=l,0===tE&&tP(t_)),tE--,o===l?s=void 0:(tb=s,s=l),s!==l?(e.length>tb?(o=e.charAt(tb),tb++):(o=l,0===tE&&tP(tu)),o!==l?a=s=[s,o]:(tb=a,a=l)):(tb=a,a=l);a!==l;)i.push(a),a=tb,s=tb,tE++,"*/"===e.substr(tb,2)?(o="*/",tb+=2):(o=l,0===tE&&tP(t_)),tE--,o===l?s=void 0:(tb=s,s=l),s!==l?(e.length>tb?(o=e.charAt(tb),tb++):(o=l,0===tE&&tP(tu)),o!==l?a=s=[s,o]:(tb=a,a=l)):(tb=a,a=l);(r=e.substring(r,tb),"*/"===e.substr(tb,2)?(i="*/",tb+=2):(i=l,0===tE&&tP(t_)),i!==l)?t={type:"Comment",value:r}:(tb=t,t=l)}else tb=t,t=l;return t}()),t}function nu(){let t,n;for(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n===l&&(n=nd());n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n===l&&(n=nd());return t}function nc(){let t,n,r,i;if(t=tb,n=[],r=e.charAt(tb),H.test(r)?tb++:(r=l,0===tE&&tP(tx)),r!==l)for(;r!==l;)n.push(r),r=e.charAt(tb),H.test(r)?tb++:(r=l,0===tE&&tP(tx));else n=l;if(n!==l){for(r=[],i=e.charAt(tb),H.test(i)?tb++:(i=l,0===tE&&tP(tx)),i===l&&(i=nd());i!==l;)r.push(i),i=e.charAt(tb),H.test(i)?tb++:(i=l,0===tE&&tP(tx)),i===l&&(i=nd());t=n=[n,r]}else tb=t,t=l;return t}function nh(){let t,n;for(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));return t}function nd(){let t,n,r,i,a,s;if(t=tb,"//"===e.substr(tb,2)?(n="//",tb+=2):(n=l,0===tE&&tP(tm)),n!==l){for(r=[],i=e.charAt(tb),z.test(i)?tb++:(i=l,0===tE&&tP(tg));i!==l;)r.push(i),i=e.charAt(tb),z.test(i)?tb++:(i=l,0===tE&&tP(tg));i=e.charAt(tb),B.test(i)?tb++:(i=l,0===tE&&tP(tv)),i===l&&(i=null),t=n=[n,r,i]}else tb=t,t=l;if(t===l)if(t=tb,"/*"===e.substr(tb,2)?(n="/*",tb+=2):(n=l,0===tE&&tP(ty)),n!==l){for(r=[],i=tb,a=tb,tE++,"*/"===e.substr(tb,2)?(s="*/",tb+=2):(s=l,0===tE&&tP(t_)),tE--,s===l?a=void 0:(tb=a,a=l),a!==l?(e.length>tb?(s=e.charAt(tb),tb++):(s=l,0===tE&&tP(tu)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=tb,tE++,"*/"===e.substr(tb,2)?(s="*/",tb+=2):(s=l,0===tE&&tP(t_)),tE--,s===l?a=void 0:(tb=a,a=l),a!==l?(e.length>tb?(s=e.charAt(tb),tb++):(s=l,0===tE&&tP(tu)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l);"*/"===e.substr(tb,2)?(i="*/",tb+=2):(i=l,0===tE&&tP(t_)),i!==l?t=n=[n,r,i]:(tb=t,t=l)}else tb=t,t=l;return t}function np(){let t;return t=e.charAt(tb),L.test(t)?tb++:(t=l,0===tE&&tP(e0)),t}r=new Set,i=!1;let nf=(n=h())!==l&&tb===e.length;function nm(){var t,r,i;throw n!==l&&tb0&&void 0!==arguments[0]?arguments[0]:tb,n=e.codePointAt(t);return void 0===n?"":String.fromCodePoint(n)}(tM):null,i=tM{"use strict";e.s(["getFloat",()=>D,"getInt",()=>U,"getPosition",()=>O,"getProperty",()=>N,"getRotation",()=>k,"getScale",()=>F,"parseMissionScript",()=>L],62395);var t=e.i(90072);e.s(["parse",()=>A,"runServer",()=>C],86608);var n=e.i(92552),r=e.i(99749);function i(e){let t=e.indexOf("::");return -1===t?null:{namespace:e.slice(0,t),method:e.slice(t+2)}}let a={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class s{getAccessInfo(e){if("Variable"===e.type){let t=JSON.stringify(e.name),n="global"===e.scope?this.globals:this.locals;return{getter:"".concat(n,".get(").concat(t,")"),setter:e=>"".concat(n,".set(").concat(t,", ").concat(e,")"),postIncHelper:"".concat(n,".postInc(").concat(t,")"),postDecHelper:"".concat(n,".postDec(").concat(t,")")}}if("MemberExpression"===e.type){let t=this.expression(e.object),n="Identifier"===e.property.type?JSON.stringify(e.property.name):this.expression(e.property);return{getter:"".concat(this.runtime,".prop(").concat(t,", ").concat(n,")"),setter:e=>"".concat(this.runtime,".setProp(").concat(t,", ").concat(n,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".propPostInc(").concat(t,", ").concat(n,")"),postDecHelper:"".concat(this.runtime,".propPostDec(").concat(t,", ").concat(n,")")}}if("IndexExpression"===e.type){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Variable"===e.object.type){let n=JSON.stringify(e.object.name),r="global"===e.object.scope?this.globals:this.locals,i=t.join(", ");return{getter:"".concat(r,".get(").concat(n,", ").concat(i,")"),setter:e=>"".concat(r,".set(").concat(n,", ").concat(i,", ").concat(e,")"),postIncHelper:"".concat(r,".postInc(").concat(n,", ").concat(i,")"),postDecHelper:"".concat(r,".postDec(").concat(n,", ").concat(i,")")}}if("MemberExpression"===e.object.type){let n=e.object,r=this.expression(n.object),i="Identifier"===n.property.type?JSON.stringify(n.property.name):this.expression(n.property),a="".concat(this.runtime,".key(").concat(i,", ").concat(t.join(", "),")");return{getter:"".concat(this.runtime,".prop(").concat(r,", ").concat(a,")"),setter:e=>"".concat(this.runtime,".setProp(").concat(r,", ").concat(a,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".propPostInc(").concat(r,", ").concat(a,")"),postDecHelper:"".concat(this.runtime,".propPostDec(").concat(r,", ").concat(a,")")}}let n=this.expression(e.object),r=1===t.length?t[0]:"".concat(this.runtime,".key(").concat(t.join(", "),")");return{getter:"".concat(this.runtime,".getIndex(").concat(n,", ").concat(r,")"),setter:e=>"".concat(this.runtime,".setIndex(").concat(n,", ").concat(r,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".indexPostInc(").concat(n,", ").concat(r,")"),postDecHelper:"".concat(this.runtime,".indexPostDec(").concat(n,", ").concat(r,")")}}return null}generate(e){let t=[];for(let n of e.body){let e=this.statement(n);e&&t.push(e)}return t.join("\n\n")}statement(e){switch(e.type){case"Comment":return"";case"ExpressionStatement":return this.line("".concat(this.expression(e.expression),";"));case"FunctionDeclaration":return this.functionDeclaration(e);case"PackageDeclaration":return this.packageDeclaration(e);case"DatablockDeclaration":return this.datablockDeclaration(e);case"ObjectDeclaration":return this.line("".concat(this.objectDeclaration(e),";"));case"IfStatement":return this.ifStatement(e);case"ForStatement":return this.forStatement(e);case"WhileStatement":return this.whileStatement(e);case"DoWhileStatement":return this.doWhileStatement(e);case"SwitchStatement":return this.switchStatement(e);case"ReturnStatement":return this.returnStatement(e);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(e);default:throw Error("Unknown statement type: ".concat(e.type))}}functionDeclaration(e){let t=i(e.name.name);if(t){let n=t.namespace,r=t.method;this.currentClass=n.toLowerCase(),this.currentFunction=r.toLowerCase();let i=this.functionBody(e.body,e.params);return this.currentClass=null,this.currentFunction=null,"".concat(this.line("".concat(this.runtime,".registerMethod(").concat(JSON.stringify(n),", ").concat(JSON.stringify(r),", function() {")),"\n").concat(i,"\n").concat(this.line("});"))}{let t=e.name.name;this.currentFunction=t.toLowerCase();let n=this.functionBody(e.body,e.params);return this.currentFunction=null,"".concat(this.line("".concat(this.runtime,".registerFunction(").concat(JSON.stringify(t),", function() {")),"\n").concat(n,"\n").concat(this.line("});"))}}functionBody(e,t){this.indentLevel++;let n=[];n.push(this.line("const ".concat(this.locals," = ").concat(this.runtime,".locals();")));for(let e=0;ethis.statement(e)).join("\n\n");return this.indentLevel--,"".concat(this.line("".concat(this.runtime,".package(").concat(t,", function() {")),"\n").concat(n,"\n").concat(this.line("});"))}datablockDeclaration(e){let t=JSON.stringify(e.className.name),n=e.instanceName?JSON.stringify(e.instanceName.name):"null",r=e.parent?JSON.stringify(e.parent.name):"null",i=this.objectBody(e.body);return this.line("".concat(this.runtime,".datablock(").concat(t,", ").concat(n,", ").concat(r,", ").concat(i,");"))}objectDeclaration(e){let t="Identifier"===e.className.type?JSON.stringify(e.className.name):this.expression(e.className),n=null===e.instanceName?"null":"Identifier"===e.instanceName.type?JSON.stringify(e.instanceName.name):this.expression(e.instanceName),r=[],i=[];for(let t of e.body)"Assignment"===t.type?r.push(t):i.push(t);let a=this.objectBody(r);if(i.length>0){let e=i.map(e=>this.objectDeclaration(e)).join(",\n");return"".concat(this.runtime,".create(").concat(t,", ").concat(n,", ").concat(a,", [\n").concat(e,"\n])")}return"".concat(this.runtime,".create(").concat(t,", ").concat(n,", ").concat(a,")")}objectBody(e){if(0===e.length)return"{}";let t=[];for(let n of e)if("Assignment"===n.type){let e=this.expression(n.value);if("Identifier"===n.target.type){let r=n.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?t.push("".concat(r,": ").concat(e)):t.push("[".concat(JSON.stringify(r),"]: ").concat(e))}else if("IndexExpression"===n.target.type){let r=this.objectPropertyKey(n.target);t.push("[".concat(r,"]: ").concat(e))}else{let r=this.expression(n.target);t.push("[".concat(r,"]: ").concat(e))}}if(t.length<=1)return"{ ".concat(t.join(", ")," }");let n=this.indent.repeat(this.indentLevel+1),r=this.indent.repeat(this.indentLevel);return"{\n".concat(n).concat(t.join(",\n"+n),"\n").concat(r,"}")}objectPropertyKey(e){let t="Identifier"===e.object.type?JSON.stringify(e.object.name):this.expression(e.object),n=Array.isArray(e.index)?e.index.map(e=>this.expression(e)).join(", "):this.expression(e.index);return"".concat(this.runtime,".key(").concat(t,", ").concat(n,")")}ifStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.consequent);if(e.alternate)if("IfStatement"===e.alternate.type){let r=this.ifStatement(e.alternate).replace(/^\s*/,"");return this.line("if (".concat(t,") ").concat(n," else ").concat(r))}else{let r=this.statementAsBlock(e.alternate);return this.line("if (".concat(t,") ").concat(n," else ").concat(r))}return this.line("if (".concat(t,") ").concat(n))}forStatement(e){let t=e.init?this.expression(e.init):"",n=e.test?this.expression(e.test):"",r=e.update?this.expression(e.update):"",i=this.statementAsBlock(e.body);return this.line("for (".concat(t,"; ").concat(n,"; ").concat(r,") ").concat(i))}whileStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.body);return this.line("while (".concat(t,") ").concat(n))}doWhileStatement(e){let t=this.statementAsBlock(e.body),n=this.expression(e.test);return this.line("do ".concat(t," while (").concat(n,");"))}switchStatement(e){if(e.stringMode)return this.switchStringStatement(e);let t=this.expression(e.discriminant);this.indentLevel++;let n=[];for(let t of e.cases)n.push(this.switchCase(t));return this.indentLevel--,"".concat(this.line("switch (".concat(t,") {")),"\n").concat(n.join("\n"),"\n").concat(this.line("}"))}switchCase(e){let t=[];if(null===e.test)t.push(this.line("default:"));else if(Array.isArray(e.test))for(let n of e.test)t.push(this.line("case ".concat(this.expression(n),":")));else t.push(this.line("case ".concat(this.expression(e.test),":")));for(let n of(this.indentLevel++,e.consequent))t.push(this.statement(n));return t.push(this.line("break;")),this.indentLevel--,t.join("\n")}switchStringStatement(e){let t=this.expression(e.discriminant),n=[];for(let t of e.cases)if(null===t.test)n.push("default: () => { ".concat(this.blockContent(t.consequent)," }"));else if(Array.isArray(t.test))for(let e of t.test)n.push("".concat(this.expression(e),": () => { ").concat(this.blockContent(t.consequent)," }"));else n.push("".concat(this.expression(t.test),": () => { ").concat(this.blockContent(t.consequent)," }"));return this.line("".concat(this.runtime,".switchStr(").concat(t,", { ").concat(n.join(", ")," });"))}returnStatement(e){return e.value?this.line("return ".concat(this.expression(e.value),";")):this.line("return;")}blockStatement(e){this.indentLevel++;let t=e.body.map(e=>this.statement(e)).join("\n");return this.indentLevel--,"{\n".concat(t,"\n").concat(this.line("}"))}statementAsBlock(e){if("BlockStatement"===e.type)return this.blockStatement(e);this.indentLevel++;let t=this.statement(e);return this.indentLevel--,"{\n".concat(t,"\n").concat(this.line("}"))}blockContent(e){return e.map(e=>this.statement(e).trim()).join(" ")}expression(e){switch(e.type){case"Identifier":return this.identifier(e);case"Variable":return this.variable(e);case"NumberLiteral":case"BooleanLiteral":return String(e.value);case"StringLiteral":return JSON.stringify(e.value);case"BinaryExpression":return this.binaryExpression(e);case"UnaryExpression":return this.unaryExpression(e);case"PostfixExpression":return this.postfixExpression(e);case"AssignmentExpression":return this.assignmentExpression(e);case"ConditionalExpression":return"(".concat(this.expression(e.test)," ? ").concat(this.expression(e.consequent)," : ").concat(this.expression(e.alternate),")");case"CallExpression":return this.callExpression(e);case"MemberExpression":return this.memberExpression(e);case"IndexExpression":return this.indexExpression(e);case"TagDereferenceExpression":return"".concat(this.runtime,".deref(").concat(this.expression(e.argument),")");case"ObjectDeclaration":return this.objectDeclaration(e);case"DatablockDeclaration":return"".concat(this.runtime,".datablock(").concat(JSON.stringify(e.className.name),", ").concat(e.instanceName?JSON.stringify(e.instanceName.name):"null",", ").concat(e.parent?JSON.stringify(e.parent.name):"null",", ").concat(this.objectBody(e.body),")");default:throw Error("Unknown expression type: ".concat(e.type))}}identifier(e){let t=i(e.name);return t&&"parent"===t.namespace.toLowerCase()?e.name:t?"".concat(this.runtime,".nsRef(").concat(JSON.stringify(t.namespace),", ").concat(JSON.stringify(t.method),")"):JSON.stringify(e.name)}variable(e){return"global"===e.scope?"".concat(this.globals,".get(").concat(JSON.stringify(e.name),")"):"".concat(this.locals,".get(").concat(JSON.stringify(e.name),")")}binaryExpression(e){let t=this.expression(e.left),n=this.expression(e.right),r=e.operator,i=this.concatExpression(t,r,n);if(i)return i;if("$="===r)return"".concat(this.runtime,".streq(").concat(t,", ").concat(n,")");if("!$="===r)return"!".concat(this.runtime,".streq(").concat(t,", ").concat(n,")");if("&&"===r||"||"===r)return"(".concat(t," ").concat(r," ").concat(n,")");let s=a[r];return s?"".concat(s,"(").concat(t,", ").concat(n,")"):"(".concat(t," ").concat(r," ").concat(n,")")}unaryExpression(e){if("++"===e.operator||"--"===e.operator){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?1:-1;return t.setter("".concat(this.runtime,".add(").concat(t.getter,", ").concat(n,")"))}}let t=this.expression(e.argument);return"~"===e.operator?"".concat(this.runtime,".bitnot(").concat(t,")"):"-"===e.operator?"".concat(this.runtime,".neg(").concat(t,")"):"".concat(e.operator).concat(t)}postfixExpression(e){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?t.postIncHelper:t.postDecHelper;if(n)return n}return"".concat(this.expression(e.argument)).concat(e.operator)}assignmentExpression(e){let t=this.expression(e.value),n=e.operator,r=this.getAccessInfo(e.target);if(!r)throw Error("Unhandled assignment target type: ".concat(e.target.type));if("="===n)return r.setter(t);{let e=n.slice(0,-1),i=this.compoundAssignmentValue(r.getter,e,t);return r.setter(i)}}callExpression(e){let t=e.arguments.map(e=>this.expression(e)).join(", ");if("Identifier"===e.callee.type){let n=e.callee.name,r=i(n);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return"".concat(this.runtime,".parent(").concat(JSON.stringify(this.currentClass),", ").concat(JSON.stringify(r.method),", arguments[0]").concat(t?", "+t:"",")");else if(this.currentFunction)return"".concat(this.runtime,".parentFunc(").concat(JSON.stringify(this.currentFunction)).concat(t?", "+t:"",")");else throw Error("Parent:: call outside of function context");return r?"".concat(this.runtime,".nsCall(").concat(JSON.stringify(r.namespace),", ").concat(JSON.stringify(r.method)).concat(t?", "+t:"",")"):"".concat(this.functions,".call(").concat(JSON.stringify(n)).concat(t?", "+t:"",")")}if("MemberExpression"===e.callee.type){let n=this.expression(e.callee.object),r="Identifier"===e.callee.property.type?JSON.stringify(e.callee.property.name):this.expression(e.callee.property);return"".concat(this.runtime,".call(").concat(n,", ").concat(r).concat(t?", "+t:"",")")}let n=this.expression(e.callee);return"".concat(n,"(").concat(t,")")}memberExpression(e){let t=this.expression(e.object);return e.computed||"Identifier"!==e.property.type?"".concat(this.runtime,".prop(").concat(t,", ").concat(this.expression(e.property),")"):"".concat(this.runtime,".prop(").concat(t,", ").concat(JSON.stringify(e.property.name),")")}indexExpression(e){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Variable"===e.object.type){let n=JSON.stringify(e.object.name),r="global"===e.object.scope?this.globals:this.locals;return"".concat(r,".get(").concat(n,", ").concat(t.join(", "),")")}if("MemberExpression"===e.object.type){let n=e.object,r=this.expression(n.object),i="Identifier"===n.property.type?JSON.stringify(n.property.name):this.expression(n.property),a="".concat(this.runtime,".key(").concat(i,", ").concat(t.join(", "),")");return"".concat(this.runtime,".prop(").concat(r,", ").concat(a,")")}let n=this.expression(e.object);return 1===t.length?"".concat(this.runtime,".getIndex(").concat(n,", ").concat(t[0],")"):"".concat(this.runtime,".getIndex(").concat(n,", ").concat(this.runtime,".key(").concat(t.join(", "),"))")}line(e){return this.indent.repeat(this.indentLevel)+e}concatExpression(e,t,n){switch(t){case"@":return"".concat(this.runtime,".concat(").concat(e,", ").concat(n,")");case"SPC":return"".concat(this.runtime,".concat(").concat(e,', " ", ').concat(n,")");case"TAB":return"".concat(this.runtime,".concat(").concat(e,', "\\t", ').concat(n,")");case"NL":return"".concat(this.runtime,".concat(").concat(e,', "\\n", ').concat(n,")");default:return null}}compoundAssignmentValue(e,t,n){let r=this.concatExpression(e,t,n);if(r)return r;let i=a[t];return i?"".concat(i,"(").concat(e,", ").concat(n,")"):"(".concat(e," ").concat(t," ").concat(n,")")}constructor(e={}){var t,n,i,a,s;(0,r._)(this,"indent",void 0),(0,r._)(this,"runtime",void 0),(0,r._)(this,"functions",void 0),(0,r._)(this,"globals",void 0),(0,r._)(this,"locals",void 0),(0,r._)(this,"indentLevel",0),(0,r._)(this,"currentClass",null),(0,r._)(this,"currentFunction",null),this.indent=null!=(t=e.indent)?t:" ",this.runtime=null!=(n=e.runtime)?n:"$",this.functions=null!=(i=e.functions)?i:"$f",this.globals=null!=(a=e.globals)?a:"$g",this.locals=null!=(s=e.locals)?s:"$l"}}e.s(["createRuntime",()=>E,"createScriptCache",()=>b],33870);var o=e.i(54970);class l{get size(){return this.map.size}get(e){let t=this.keyLookup.get(e.toLowerCase());return void 0!==t?this.map.get(t):void 0}set(e,t){let n=e.toLowerCase(),r=this.keyLookup.get(n);return void 0!==r?this.map.set(r,t):(this.keyLookup.set(n,e),this.map.set(e,t)),this}has(e){return this.keyLookup.has(e.toLowerCase())}delete(e){let t=e.toLowerCase(),n=this.keyLookup.get(t);return void 0!==n&&(this.keyLookup.delete(t),this.map.delete(n))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(e){for(let[t,n]of this.map)e(n,t,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(e){return this.keyLookup.get(e.toLowerCase())}constructor(e){if((0,r._)(this,"map",new Map),(0,r._)(this,"keyLookup",new Map),e)for(let[t,n]of e)this.set(t,n)}}class u{get size(){return this.set.size}add(e){return this.set.add(e.toLowerCase()),this}has(e){return this.set.has(e.toLowerCase())}delete(e){return this.set.delete(e.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}constructor(e){if((0,r._)(this,"set",new Set),e)for(let t of e)this.add(t)}}function c(e){return e.replace(/\\/g,"/").toLowerCase()}function h(e){return String(null!=e?e:"")}function d(e){return Number(e)||0}function p(e){let t=h(e||"0 0 0").split(" ").map(Number);return[t[0]||0,t[1]||0,t[2]||0]}function f(e,t,n){let r=0;for(;t+r0;){if(r>=e.length)return"";let i=f(e,r,n);if(r+i>=e.length)return"";r+=i+1,t--}let i=f(e,r,n);return 0===i?"":e.substring(r,r+i)}function g(e,t,n,r){let i=0,a=t;for(;a>0;){if(i>=e.length)return"";let t=f(e,i,r);if(i+t>=e.length)return"";i+=t+1,a--}let s=i,o=n-t+1;for(;o>0;){let t=f(e,i,r);if((i+=t)>=e.length)break;i++,o--}let l=i;return l>s&&r.includes(e[l-1])&&l--,e.substring(s,l)}function v(e,t){if(""===e)return 0;let n=0;for(let r=0;rt&&s>=e.length)break}return a.join(i)}function _(e,t,n,r){let i=[],a=0,s=0;for(;a1?n-1:0),i=1;ih(e).replace(/\\([ntr\\])/g,(e,t)=>"n"===t?"\n":"t"===t?" ":"r"===t?"\r":"\\"),expandescape:e=>h(e).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(e,t,n){console.warn("export(".concat(e,"): not implemented"))},quit(){console.warn("quit(): not implemented in browser")},trace(e){},isobject:e=>t().$.isObject(e),nametoid:e=>t().$.nameToId(e),strlen:e=>h(e).length,strchr(e,t){var n;let r=h(e),i=null!=(n=h(t)[0])?n:"",a=r.indexOf(i);return a>=0?r.substring(a):""},strpos:(e,t,n)=>h(e).indexOf(h(t),d(n)),strcmp(e,t){let n=h(e),r=h(t);return nr)},stricmp(e,t){let n=h(e).toLowerCase(),r=h(t).toLowerCase();return nr)},strstr:(e,t)=>h(e).indexOf(h(t)),getsubstr(e,t,n){let r=h(e),i=d(t);return void 0===n?r.substring(i):r.substring(i,i+d(n))},getword:(e,t)=>m(h(e),d(t)," \n"),getwordcount:e=>v(h(e)," \n"),getfield:(e,t)=>m(h(e),d(t)," \n"),getfieldcount:e=>v(h(e)," \n"),setword:(e,t,n)=>y(h(e),d(t),h(n)," \n"," "),setfield:(e,t,n)=>y(h(e),d(t),h(n)," \n"," "),firstword:e=>m(h(e),0," \n"),restwords:e=>g(h(e),1,1e6," \n"),trim:e=>h(e).trim(),ltrim:e=>h(e).replace(/^\s+/,""),rtrim:e=>h(e).replace(/\s+$/,""),strupr:e=>h(e).toUpperCase(),strlwr:e=>h(e).toLowerCase(),strreplace:(e,t,n)=>h(e).split(h(t)).join(h(n)),filterstring:(e,t)=>h(e),stripchars(e,t){let n=h(e),r=new Set(h(t).split(""));return n.split("").filter(e=>!r.has(e)).join("")},getfields(e,t,n){let r=void 0!==n?Number(n):1e6;return g(h(e),d(t),r," \n")},getwords(e,t,n){let r=void 0!==n?Number(n):1e6;return g(h(e),d(t),r," \n")},removeword:(e,t)=>_(h(e),d(t)," \n"," "),removefield:(e,t)=>_(h(e),d(t)," \n"," "),getrecord:(e,t)=>m(h(e),d(t),"\n"),getrecordcount:e=>v(h(e),"\n"),setrecord:(e,t,n)=>y(h(e),d(t),h(n),"\n","\n"),removerecord:(e,t)=>_(h(e),d(t),"\n","\n"),nexttoken(e,t,n){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:e=>h(e).replace(/[^\w\s-]/g,"").trim(),mabs:e=>Math.abs(d(e)),mfloor:e=>Math.floor(d(e)),mceil:e=>Math.ceil(d(e)),msqrt:e=>Math.sqrt(d(e)),mpow:(e,t)=>Math.pow(d(e),d(t)),msin:e=>Math.sin(d(e)),mcos:e=>Math.cos(d(e)),mtan:e=>Math.tan(d(e)),masin:e=>Math.asin(d(e)),macos:e=>Math.acos(d(e)),matan:(e,t)=>Math.atan2(d(e),d(t)),mlog:e=>Math.log(d(e)),getrandom(e,t){if(void 0===e)return Math.random();if(void 0===t)return Math.floor(Math.random()*(d(e)+1));let n=d(e);return Math.floor(Math.random()*(d(t)-n+1))+n},mdegtorad:e=>d(e)*(Math.PI/180),mradtodeg:e=>d(e)*(180/Math.PI),mfloatlength:(e,t)=>d(e).toFixed(d(t)),getboxcenter(e){let t=h(e).split(" ").map(Number),n=t[0]||0,r=t[1]||0,i=t[2]||0,a=t[3]||0,s=t[4]||0,o=t[5]||0;return"".concat((n+a)/2," ").concat((r+s)/2," ").concat((i+o)/2)},vectoradd(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(n+a," ").concat(r+s," ").concat(i+o)},vectorsub(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(n-a," ").concat(r-s," ").concat(i-o)},vectorscale(e,t){let[n,r,i]=p(e),a=d(t);return"".concat(n*a," ").concat(r*a," ").concat(i*a)},vectordot(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return n*a+r*s+i*o},vectorcross(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(r*o-i*s," ").concat(i*a-n*o," ").concat(n*s-r*a)},vectorlen(e){let[t,n,r]=p(e);return Math.sqrt(t*t+n*n+r*r)},vectornormalize(e){let[t,n,r]=p(e),i=Math.sqrt(t*t+n*n+r*r);return 0===i?"0 0 0":"".concat(t/i," ").concat(n/i," ").concat(r/i)},vectordist(e,t){let[n,r,i]=p(e),[a,s,o]=p(t),l=n-a,u=r-s,c=i-o;return Math.sqrt(l*l+u*u+c*c)},matrixcreate(e,t){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(e){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(e,t){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(e,t){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(e,t){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-t().state.startTime,getrealtime:()=>Date.now(),schedule(e,n,r){for(var i=arguments.length,a=Array(i>3?i-3:0),s=3;s{l.state.pendingTimeouts.delete(u);try{l.$f.call(String(r),...a)}catch(e){throw console.error("schedule: error calling ".concat(r,":"),e),e}},o);return l.state.pendingTimeouts.add(u),u},cancel(e){clearTimeout(e),t().state.pendingTimeouts.delete(e)},iseventpending:e=>t().state.pendingTimeouts.has(e),exec(e){let n=String(null!=e?e:"");if(console.debug("exec(".concat(JSON.stringify(n),"): preparing to execute…")),!n.includes("."))return console.error("exec: invalid script file name ".concat(JSON.stringify(n),".")),!1;let r=c(n),i=t(),{executedScripts:a,scripts:s}=i.state;if(a.has(r))return console.debug("exec(".concat(JSON.stringify(n),"): skipping (already executed)")),!0;let o=s.get(r);return null==o?(console.warn("exec(".concat(JSON.stringify(n),"): script not found")),!1):(a.add(r),console.debug("exec(".concat(JSON.stringify(n),"): executing!")),i.executeAST(o),!0)},compile(e){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:e=>n?n.isFile(h(e)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(e){let t=h(e),n=t.lastIndexOf(".");return n>=0?t.substring(n):""},filebase(e){let t=h(e),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),r=t.lastIndexOf("."),i=n>=0?n+1:0,a=r>i?r:t.length;return t.substring(i,a)},filepath(e){let t=h(e),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n>=0?t.substring(0,n):""},expandfilename(e){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile(e){var t;return n?(a=h(e),r=n.findFiles(a),i=0,null!=(t=r[i++])?t:""):(console.warn("findFirstFile(): no fileSystem handler configured"),"")},findnextfile(e){var t;let s=h(e);if(s!==a){if(!n)return"";a=s,r=n.findFiles(s)}return null!=(t=r[i++])?t:""},getfilecrc:e=>h(e),iswriteablefilename:e=>!1,activatepackage(e){t().$.activatePackage(h(e))},deactivatepackage(e){t().$.deactivatePackage(h(e))},ispackage:e=>t().$.isPackage(h(e)),isactivepackage:e=>t().$.isActivePackage(h(e)),getpackagelist:()=>t().$.getPackageList(),addmessagecallback(e,t){},alxcreatesource(){for(var e=arguments.length,t=Array(e),n=0;n0,alxlistenerf(e,t){},alxplay(){for(var e=arguments.length,t=Array(e),n=0;n!1,lockmouse(e){},addmaterialmapping(e,t){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:e=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:e=>!1,isfullscreen:()=>!1,screenshot(e){},setdisplaydevice:e=>!0,setfov(e){},setinteriorrendermode(e){},setopenglanisotropy(e){},setopenglmipreduction(e){},setopenglskymipreduction(e){},setopengltexturecompressionhint(e){},setscreenmode(e,t,n,r){},setverticalsync(e){},setzoomspeed(e){},togglefullscreen(){},videosetgammacorrection(e){},snaptoggle(){},addtaggedstring:e=>0,buildtaggedstring(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;rh(e),gettag:e=>0,gettaggedstring:e=>"",removetaggedstring(e){},commandtoclient(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i1?t-1:0),r=1;r!0,allowconnections(e){},startheartbeat(){},stopheartbeat(){},gotowebpage(e){},deletedatablocks(){},preloaddatablock:e=>!0,containerboxempty(){for(var e=arguments.length,t=Array(e),n=0;n0,containersearchnext:()=>0,initcontainerradiussearch(){for(var e=arguments.length,t=Array(e),n=0;n0,getcontrolobjectspeed:()=>0,getterrainheight:e=>0,lightscene(){for(var e=arguments.length,t=Array(e),n=0;n>>0}function w(e){if(null==e)return null;if("string"==typeof e)return e||null;if("number"==typeof e)return String(e);throw Error("Invalid instance name type: ".concat(typeof e))}function E(){var e,t,n;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=new l,a=new l,h=new l,d=[],p=new u,f=3,m=1027,g=new Map,v=new l,y=new l,_=new l,E=new l,T=new l;if(r.globals)for(let[e,t]of Object.entries(r.globals)){if(!e.startsWith("$"))throw Error('Global variable "'.concat(e,'" must start with $, e.g. "$').concat(e,'"'));_.set(e.slice(1),t)}let C=new Set,R=new Set,P=r.ignoreScripts&&r.ignoreScripts.length>0?(0,o.default)(r.ignoreScripts,{nocase:!0}):null,I=null!=(e=r.cache)?e:b(),L=I.scripts,N=I.generatedCode,D=new Map;function U(e){let t=D.get(e);return t&&t.length>0?t[t.length-1]:void 0}function O(e,t,n){let r;(r=D.get(e))||(r=[],D.set(e,r)),r.push(t);try{return n()}finally{let t=D.get(e);t&&t.pop()}}function F(e,t){return"".concat(e.toLowerCase(),"::").concat(t.toLowerCase())}function k(e,t){var n,r;return null!=(r=null==(n=i.get(e))?void 0:n.get(t))?r:null}let z=new Set,B=null,H=null,V=(null!=(t=r.builtins)?t:x)({runtime:()=>H,fileSystem:null!=(n=r.fileSystem)?n:null});function G(e){let t=h.get(e);if(!t)return void p.add(e);if(!t.active){for(let[e,n]of(t.active=!0,d.push(t.name),t.methods)){i.has(e)||i.set(e,new l);let t=i.get(e);for(let[e,r]of n)t.has(e)||t.set(e,[]),t.get(e).push(r)}for(let[e,n]of t.functions)a.has(e)||a.set(e,[]),a.get(e).push(n)}}function W(e){var t,n;return null==e||""===e?null:"object"==typeof e&&null!=e._id?e:"string"==typeof e?null!=(t=v.get(e))?t:null:"number"==typeof e&&null!=(n=g.get(e))?n:null}function j(e,t,n){let r=W(e);if(null==r)return 0;let i=J(r[t]);return r[t]=i+n,i}function X(e,t){let n=k(e,t);return n&&n.length>0?n[n.length-1]:null}function q(e,t,n,r){let i=k(e,t);return i&&0!==i.length?{found:!0,result:O(F(e,t),i.length-1,()=>i[i.length-1](n,...r))}:{found:!1}}function Y(e,t,n,r){let i=E.get(e);if(i){let e=i.get(t);if(e)for(let t of e)t(n,...r)}}function J(e){if(null==e||""===e)return 0;let t=Number(e);return isNaN(t)?0:t}function Z(e){if(!e||""===e)return null;e.startsWith("/")&&(e=e.slice(1));let t=e.split("/"),n=null;for(let e=0;e{var n;return(null==(n=t._name)?void 0:n.toLowerCase())===e});n=null!=t?t:null}if(!n)return null}}return n}function K(e){return null==e||""===e?null:Z(String(e))}function $(e){function t(e,t){return e+t.join("_")}return{get(n){for(var r,i=arguments.length,a=Array(i>1?i-1:0),s=1;s1?r-1:0),a=1;a1?r-1:0),a=1;a1?r-1:0),a=1;at.toLowerCase()===e.toLowerCase());for(let[e,r]of(-1!==n&&d.splice(n,1),t.methods)){let t=i.get(e);if(t)for(let[e,n]of r){let r=t.get(e);if(r){let e=r.indexOf(n);-1!==e&&r.splice(e,1)}}}for(let[e,n]of t.functions){let t=a.get(e);if(t){let e=t.indexOf(n);-1!==e&&t.splice(e,1)}}},create:function(e,t,n,r){let i=S(e),a=m++,s={_class:i,_className:e,_id:a};for(let[e,t]of Object.entries(n))s[S(e)]=t;s.superclass&&(s._superClass=S(String(s.superclass)),s.class&&T.set(S(String(s.class)),s._superClass)),g.set(a,s);let o=w(t);if(o&&(s._name=o,v.set(o,s)),r){for(let e of r)e._parent=s;s._children=r}let l=X(e,"onAdd");return l&&l(s),s},datablock:function(e,t,n,r){let i=S(e),a=f++,s={_class:i,_className:e,_id:a,_isDatablock:!0},o=w(n);if(o){let e=y.get(o);if(e){for(let[t,n]of Object.entries(e))t.startsWith("_")||(s[t]=n);s._parent=e}}for(let[e,t]of Object.entries(r))s[S(e)]=t;g.set(a,s);let l=w(t);return l&&(s._name=l,v.set(l,s),y.set(l,s)),s},deleteObject:function e(t){let n;if(null==t||("number"==typeof t?n=g.get(t):"string"==typeof t?n=v.get(t):"object"==typeof t&&t._id&&(n=t),!n))return!1;let r=X(n._className,"onRemove");if(r&&r(n),g.delete(n._id),n._name&&v.delete(n._name),n._isDatablock&&n._name&&y.delete(n._name),n._parent&&n._parent._children){let e=n._parent._children.indexOf(n);-1!==e&&n._parent._children.splice(e,1)}if(n._children)for(let t of[...n._children])e(t);return!0},prop:function(e,t){var n;let r=W(e);return null==r?"":null!=(n=r[S(t)])?n:""},setProp:function(e,t,n){let r=W(e);return null==r||(r[S(t)]=n),n},getIndex:function(e,t){var n;let r=W(e);return null==r?"":null!=(n=r[String(t)])?n:""},setIndex:function(e,t,n){let r=W(e);return null==r||(r[String(t)]=n),n},propPostInc:function(e,t){return j(e,S(t),1)},propPostDec:function(e,t){return j(e,S(t),-1)},indexPostInc:function(e,t){return j(e,String(t),1)},indexPostDec:function(e,t){return j(e,String(t),-1)},key:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r2?n-2:0),i=2;i2?n-2:0),i=2;io(...r)),u=r[0];return u&&"object"==typeof u&&Y(e,t,u,r.slice(1)),l},nsRef:function(e,t){let n=k(e,t);if(!n||0===n.length)return null;let r=F(e,t),i=n[n.length-1];return function(){for(var e=arguments.length,t=Array(e),a=0;ai(...t))}},parent:function(e,t,n){for(var r=arguments.length,i=Array(r>3?r-3:0),a=3;a=1){let r=l-1,a=O(o,r,()=>s[r](n,...i));return n&&"object"==typeof n&&Y(e,t,n,i),a}let u=T.get(e);for(;u;){let e=k(u,t);if(e&&e.length>0){let r=O(F(u,t),e.length-1,()=>e[e.length-1](n,...i));return n&&"object"==typeof n&&Y(u,t,n,i),r}u=T.get(u)}return""},parentFunc:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;ri[l](...n))},add:function(e,t){return J(e)+J(t)},sub:function(e,t){return J(e)-J(t)},mul:function(e,t){return J(e)*J(t)},div:function(e,t){return J(e)/J(t)},neg:function(e){return-J(e)},lt:function(e,t){return J(e)J(t)},ge:function(e,t){return J(e)>=J(t)},eq:function(e,t){return J(e)===J(t)},ne:function(e,t){return J(e)!==J(t)},mod:function(e,t){let n=0|Number(t);return 0===n?0:(0|Number(e))%n},bitand:function(e,t){return M(e)&M(t)},bitor:function(e,t){return M(e)|M(t)},bitxor:function(e,t){return M(e)^M(t)},shl:function(e,t){return M(M(e)<<(31&M(t)))},shr:function(e,t){return M(e)>>>(31&M(t))},bitnot:function(e){return~M(e)>>>0},concat:function(){for(var e=arguments.length,t=Array(e),n=0;nString(null!=e?e:"")).join("")},streq:function(e,t){return String(null!=e?e:"").toLowerCase()===String(null!=t?t:"").toLowerCase()},switchStr:function(e,t){let n=String(null!=e?e:"").toLowerCase();for(let[e,r]of Object.entries(t))if("default"!==e&&S(e)===n)return void r();t.default&&t.default()},deref:K,nameToId:function(e){let t=Z(e);return t?t._id:-1},isObject:function(e){return null!=e&&("object"==typeof e&&!!e._id||("number"==typeof e?g.has(e):"string"==typeof e&&v.has(e)))},isFunction:function(e){return a.has(e)||e.toLowerCase()in V},isPackage:function(e){return h.has(e)},isActivePackage:function(e){var t;let n=h.get(e);return null!=(t=null==n?void 0:n.active)&&t},getPackageList:function(){return d.join(" ")},locals:Q,onMethodCalled(e,t,n){let r=E.get(e);r||(r=new l,E.set(e,r));let i=r.get(t);i||(i=[],r.set(t,i)),i.push(n)}},et={call(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r0)return O(e.toLowerCase(),i.length-1,()=>i[i.length-1](...n));let s=V[e.toLowerCase()];return s?s(...n):(console.warn("Unknown function: ".concat(e,"(").concat(n.map(e=>JSON.stringify(e)).join(", "),")")),"")}},en=$(_),er={methods:i,functions:a,packages:h,activePackages:d,objectsById:g,objectsByName:v,datablocks:y,globals:_,executedScripts:C,failedScripts:R,scripts:L,generatedCode:N,pendingTimeouts:z,startTime:Date.now()};function ei(e){let t=function(e){let t=N.get(e);null==t&&(t=new s(void 0).generate(e),N.set(e,t));return t}(e),n=Q();Function("$","$f","$g","$l",t)(ee,et,en,n)}function ea(e,t){return{execute(){if(t){let e=c(t);er.executedScripts.add(e)}ei(e)}}}async function es(e,t,n){let i=r.loadScript;if(!i){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function a(e){var a,s;null==(a=r.signal)||a.throwIfAborted();let o=c(e);if(er.scripts.has(o)||er.failedScripts.has(o))return;if(P&&P(o)){console.warn("Ignoring script: ".concat(e)),er.failedScripts.add(o);return}if(n.has(o))return;let l=t.get(o);if(l)return void await l;null==(s=r.progress)||s.addItem(e);let u=(async()=>{var a,s,l;let u,c=await i(e);if(null==c){console.warn("Script not found: ".concat(e)),er.failedScripts.add(o),null==(s=r.progress)||s.completeItem();return}try{u=A(c,{filename:e})}catch(t){console.warn("Failed to parse script: ".concat(e),t),er.failedScripts.add(o),null==(l=r.progress)||l.completeItem();return}let h=new Set(n);h.add(o),await es(u.execScriptPaths,t,h),er.scripts.set(o,u),null==(a=r.progress)||a.completeItem()})();t.set(o,u),await u}await Promise.all(e.map(a))}async function eo(e){var t,n,i;let a=r.loadScript;if(!a)throw Error("loadFromPath requires loadScript option to be set");let s=c(e);if(er.scripts.has(s))return ea(er.scripts.get(s),e);null==(t=r.progress)||t.addItem(e);let o=await a(e);if(null==o)throw null==(i=r.progress)||i.completeItem(),Error("Script not found: ".concat(e));let l=await el(o,{path:e});return null==(n=r.progress)||n.completeItem(),l}async function el(e,t){if(null==t?void 0:t.path){let e=c(t.path);if(er.scripts.has(e))return ea(er.scripts.get(e),t.path)}return eu(A(e,{filename:null==t?void 0:t.path}),t)}async function eu(e,t){var n;let i=new Map,a=new Set;if(null==t?void 0:t.path){let n=c(t.path);er.scripts.set(n,e),a.add(n)}let s=[...e.execScriptPaths,...null!=(n=r.preloadScripts)?n:[]];return await es(s,i,a),ea(e,null==t?void 0:t.path)}return H={$:ee,$f:et,$g:en,state:er,destroy:function(){for(let e of er.pendingTimeouts)clearTimeout(e);er.pendingTimeouts.clear()},executeAST:ei,loadFromPath:eo,loadFromSource:el,loadFromAST:eu,call:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;rv.get(e)}}function T(){let e=new Set,t=0,n=0,r=null;function i(){for(let t of e)t()}return{get total(){return t},get loaded(){return n},get current(){return r},get progress(){return 0===t?0:n/t},on(t,n){e.add(n)},off(t,n){e.delete(n)},addItem(e){t++,r=e,i()},completeItem(){n++,r=null,i()},setCurrent(e){r=e,i()}}}function A(e,t){try{return n.default.parse(e)}catch(e){if((null==t?void 0:t.filename)&&e.location)throw Error("".concat(t.filename,":").concat(e.location.start.line,":").concat(e.location.start.column,": ").concat(e.message),{cause:e});throw e}}function C(e){let{missionName:t,missionType:n,runtimeOptions:r,onMissionLoadDone:i}=e,{signal:a,fileSystem:s}=null!=r?r:{},o=E({...r,globals:{...null==r?void 0:r.globals,"$Host::Map":t,"$Host::MissionType":n}}),l="".concat(n,"Game"),u="scripts/".concat(l,".cs"),c=async function(){try{let e=await o.loadFromPath("scripts/server.cs");null==a||a.throwIfAborted(),await o.loadFromPath("scripts/DefaultGame.cs"),null==a||a.throwIfAborted();try{await o.loadFromPath(u)}catch(e){}null==a||a.throwIfAborted(),await o.loadFromPath("missions/".concat(t,".mis")),null==a||a.throwIfAborted(),e.execute(),i&&o.$.onMethodCalled("DefaultGame","missionLoadDone",i);let n=await o.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");null==a||a.throwIfAborted(),n.execute()}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;throw e}}();return{runtime:o,ready:c}}e.s(["createProgressTracker",()=>T],38433);let R=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,P=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,I=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i;function L(e){var t,n,r,i,a,s;let o=A(e),{pragma:l,sections:u}=function(e){let t={},n=[],r={name:null,comments:[]};for(let i of e.body)if("Comment"===i.type){let e=function(e){let t;return(t=e.match(P))?{type:"sectionBegin",name:t[1]}:(t=e.match(I))?{type:"sectionEnd",name:t[1]}:(t=e.match(R))?{type:"definition",identifier:t[1],value:t[2]}:null}(i.value);if(e)switch(e.type){case"definition":null===r.name?t[e.identifier.toLowerCase()]=e.value:r.comments.push(i.value);break;case"sectionBegin":(null!==r.name||r.comments.length>0)&&n.push(r),r={name:e.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==r.name&&n.push(r),r={name:null,comments:[]}}else r.comments.push(i.value)}return(null!==r.name||r.comments.length>0)&&n.push(r),{pragma:t,sections:n}}(o);function c(e){var t,n;return null!=(n=null==(t=u.find(t=>t.name===e))?void 0:t.comments.map(e=>e.trimStart()).join("\n"))?n:null}return{displayName:null!=(n=l.displayname)?n:null,missionTypes:null!=(r=null==(t=l.missiontypes)?void 0:t.split(/\s+/).filter(Boolean))?r:[],missionBriefing:c("MISSION BRIEFING"),briefingWav:null!=(i=l.briefingwav)?i:null,bitmap:null!=(a=l.bitmap)?a:null,planetName:null!=(s=l.planetname)?s:null,missionBlurb:c("MISSION BLURB"),missionQuote:c("MISSION QUOTE"),missionString:c("MISSION STRING"),execScriptPaths:o.execScriptPaths,hasDynamicExec:o.hasDynamicExec,ast:o}}function N(e,t){if(e)return e[t.toLowerCase()]}function D(e,t){let n=e[t.toLowerCase()];return null==n?n:parseFloat(n)}function U(e,t){let n=e[t.toLowerCase()];return null==n?n:parseInt(n,10)}function O(e){var t;let[n,r,i]=(null!=(t=e.position)?t:"0 0 0").split(" ").map(e=>parseFloat(e));return[r||0,i||0,n||0]}function F(e){var t;let[n,r,i]=(null!=(t=e.scale)?t:"1 1 1").split(" ").map(e=>parseFloat(e));return[r||0,i||0,n||0]}function k(e){var n;let[r,i,a,s]=(null!=(n=e.rotation)?n:"1 0 0 0").split(" ").map(e=>parseFloat(e)),o=new t.Vector3(i,a,r).normalize(),l=-(Math.PI/180*s);return new t.Quaternion().setFromAxisAngle(o,l)}},12979,79123,e=>{"use strict";e.s(["BASE_URL",()=>a,"FALLBACK_TEXTURE_URL",()=>o,"audioToUrl",()=>f,"getUrlForPath",()=>l,"iflTextureToUrl",()=>d,"interiorToUrl",()=>u,"loadDetailMapList",()=>m,"loadImageFrameList",()=>y,"loadMission",()=>g,"loadTerrain",()=>v,"shapeToUrl",()=>c,"terrainTextureToUrl",()=>h,"textureToUrl",()=>p],12979);var t=e.i(98223),n=e.i(91996),r=e.i(62395),i=e.i(71726);let a="/t2-mapper",s="".concat(a,"/base/"),o="".concat(a,"/magenta.png");function l(e,t){let r;try{r=(0,n.getActualResourceKey)(e)}catch(n){if(t)return console.warn('Resource "'.concat(e,'" not found - rendering fallback.')),t;throw n}let[i,a]=(0,n.getSourceAndPath)(r);return i?"".concat(s,"@vl2/").concat(i,"/").concat(a):"".concat(s).concat(a)}function u(e){return l("interiors/".concat(e)).replace(/\.dif$/i,".glb")}function c(e){return l("shapes/".concat(e)).replace(/\.dts$/i,".glb")}function h(e){return e=e.replace(/^terrain\./,""),l((0,n.getStandardTextureResourceKey)("textures/terrain/".concat(e)),o)}function d(e,t){let r=(0,i.normalizePath)(t).split("/"),a=r.length>1?r.slice(0,-1).join("/")+"/":"",s="".concat(a).concat(e);return l((0,n.getStandardTextureResourceKey)(s),o)}function p(e){return l((0,n.getStandardTextureResourceKey)("textures/".concat(e)),o)}function f(e){return l("audio/".concat(e))}async function m(e){let t=l("textures/".concat(e)),n=await fetch(t);return(await n.text()).split(/(?:\r\n|\r|\n)/).map(e=>{if(!(e=e.trim()).startsWith(";"))return e}).filter(Boolean)}async function g(e){let t=(0,n.getMissionInfo)(e),i=await fetch(l(t.resourcePath)),a=await i.text();return(0,r.parseMissionScript)(a)}async function v(e){let t=await fetch(l("terrains/".concat(e)));return function(e){let t=new DataView(e),n=0,r=t.getUint8(n++),i=new Uint16Array(65536),a=[],s=e=>{let r="";for(let i=0;i0&&a.push(i)}let o=[];for(let e of a){let e=new Uint8Array(65536);for(let r=0;r<65536;r++){var l=t.getUint8(n++);e[r]=l}o.push(e)}return{version:r,textureNames:a,heightMap:i,alphaMaps:o}}(await t.arrayBuffer())}async function y(e){let n=l(e),r=await fetch(n),i=await r.text();return(0,t.parseImageFileList)(i)}e.s(["SettingsProvider",()=>A,"useControls",()=>T,"useDebug",()=>E,"useSettings",()=>w],79123);var _=e.i(43476),x=e.i(71645);let b=(0,x.createContext)(null),S=(0,x.createContext)(null),M=(0,x.createContext)(null);function w(){return(0,x.useContext)(b)}function E(){return(0,x.useContext)(S)}function T(){return(0,x.useContext)(M)}function A(e){let{children:t}=e,[n,r]=(0,x.useState)(!0),[i,a]=(0,x.useState)(1),[s,o]=(0,x.useState)(90),[l,u]=(0,x.useState)(!1),[c,h]=(0,x.useState)(!0),[d,p]=(0,x.useState)(!1),f=(0,x.useMemo)(()=>({fogEnabled:n,setFogEnabled:r,fov:s,setFov:o,audioEnabled:l,setAudioEnabled:u,animationEnabled:c,setAnimationEnabled:h}),[n,i,s,l,c]),m=(0,x.useMemo)(()=>({debugMode:d,setDebugMode:p}),[d,p]),g=(0,x.useMemo)(()=>({speedMultiplier:i,setSpeedMultiplier:a}),[i,a]);(0,x.useEffect)(()=>{let e={};try{e=JSON.parse(localStorage.getItem("settings"))||{}}catch(e){}null!=e.debugMode&&p(e.debugMode),null!=e.audioEnabled&&u(e.audioEnabled),null!=e.animationEnabled&&h(e.animationEnabled),null!=e.fogEnabled&&r(e.fogEnabled),null!=e.speedMultiplier&&a(e.speedMultiplier),null!=e.fov&&o(e.fov)},[]);let v=(0,x.useRef)(null);return(0,x.useEffect)(()=>(v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{try{localStorage.setItem("settings",JSON.stringify({fogEnabled:n,speedMultiplier:i,fov:s,audioEnabled:l,animationEnabled:c,debugMode:d}))}catch(e){}},500),()=>{v.current&&clearTimeout(v.current)}),[n,i,s,l,c,d]),(0,_.jsx)(b.Provider,{value:f,children:(0,_.jsx)(S.Provider,{value:m,children:(0,_.jsx)(M.Provider,{value:g,children:t})})})}}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24478,(e,t,n)=>{"use strict";n.ConcurrentRoot=1,n.ContinuousEventPriority=8,n.DefaultEventPriority=32,n.DiscreteEventPriority=2,n.IdleEventPriority=0x10000000,n.LegacyRoot=0,n.NoEventPriority=0},39695,(e,t,n)=>{"use strict";t.exports=e.r(24478)},55838,(e,t,n)=>{"use strict";var r=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,l=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,c=r[1];return o(function(){i.value=n,i.getSnapshot=t,u(i)&&c({inst:i})},[e,n,t]),s(function(){return u(i)&&c({inst:i}),e(function(){u(i)&&c({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,t,n)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var r=e.r(71645),i=e.r(2239),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,o=r.useRef,l=r.useEffect,u=r.useMemo,c=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var p=s(e,(h=u(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&d.hasValue){var t=d.value;if(i(t,e))return o=t}return o=e}if(t=o,a(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,o=n)}var s,o,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,r,i]))[0],h[1]);return l(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},30224,(e,t,n)=>{"use strict";t.exports=e.r(52822)},29779,(e,t,n)=>{"use strict";function r(e,t){var n=e.length;for(e.push(t);0>>1,i=e[r];if(0>>1;rs(l,n))us(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[o]=n,r=o);else if(us(c,n))e[r]=c,e[u]=n,r=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,y=!1,_="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=i(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,r(h,t);else break;t=i(d)}}function M(e){if(y=!1,S(e),!v)if(null!==i(h))v=!0,L();else{var t=i(d);null!==t&&N(M,t.startTime-e)}}var w=!1,E=-1,T=5,A=-1;function C(){return!(n.unstable_now()-Ae&&C());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,S(e),t=!0;break t}f===i(h)&&a(h),S(e)}else a(h);f=i(h)}if(null!==f)t=!0;else{var u=i(d);null!==u&&N(M,u.startTime-e),t=!1}}break e}finally{f=null,m=r,g=!1}}}finally{t?o():w=!1}}}if("function"==typeof b)o=function(){b(R)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=R,o=function(){I.postMessage(null)}}else o=function(){_(R,0)};function L(){w||(w=!0,o())}function N(e,t){E=_(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_continueExecution=function(){v||g||(v=!0,L())},n.unstable_forceFrameRate=function(e){0>e||125s?(e.sortIndex=a,r(d,e),null===i(h)&&e===i(d)&&(y?(x(E),E=-1):y=!0,N(M,a-s))):(e.sortIndex=o,r(h,e),v||g||(v=!0,L())),e},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},51849,(e,t,n)=>{"use strict";t.exports=e.r(29779)},40336,(e,t,n)=>{"use strict";var r=e.i(47167);t.exports=function(t){function n(e,t,n,r){return new rP(e,t,n,r)}function i(){}function a(e){var t="https://react.dev/errors/"+e;if(1)":-1i||u[r]!==c[i]){var h="\n"+u[r].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=r&&0<=i)break}}}finally{io=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?l(n):""}function c(e){try{var t="";do t+=function(e){switch(e.tag){case 26:case 27:case 5:return l(e.type);case 16:return l("Lazy");case 13:return l("Suspense");case 19:return l("SuspenseList");case 0:case 15:return u(e.type,!1);case 11:return u(e.type.render,!1);case 1:return u(e.type,!0);default:return""}}(e),e=e.return;while(e)return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function h(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do 0!=(4098&(t=e).flags)&&(n=t.return),e=t.return;while(e)}return 3===t.tag?n:null}function d(e){if(h(e)!==e)throw Error(a(188))}function p(e){var t=e.alternate;if(!t){if(null===(t=h(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var s=i.alternate;if(null===s){if(null!==(r=i.return)){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return d(i),e;if(s===r)return d(i),t;s=s.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){return{current:e}}function m(e){0>a4||(e.current=a3[a4],a3[a4]=null,a4--)}function g(e,t){a3[++a4]=e.current,e.current=t}function v(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194176&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function y(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,s=e.warmLanes;e=0!==e.finishedLanes;var o=0x7ffffff&n;return 0!==o?0!=(n=o&~i)?r=v(n):0!=(a&=o)?r=v(a):e||0!=(s=o&~s)&&(r=v(s)):0!=(o=n&~i)?r=v(o):0!==a?r=v(a):e||0!=(s=n&~s)&&(r=v(s)),0===r?0:0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(s=t&-t)||32===i&&0!=(4194176&s))?t:r}function _(e,t){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function x(){var e=a7;return 0==(4194176&(a7<<=1))&&(a7=128),e}function b(){var e=se;return 0==(0x3c00000&(se<<=1))&&(se=4194304),e}function S(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function M(e,t){e.pendingLanes|=t,0x10000000!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function w(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-a6(t);e.entangledLanes|=t,e.entanglements[r]=0x40000000|e.entanglements[r]|4194218&n}function E(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-a6(n),i=1<>=s,i-=s,sb=1<<32-a6(t)+i|n<d?(p=h,h=null):p=h.sibling;var v=m(n,h,s[d],o);if(null===v){null===h&&(h=p);break}e&&h&&null===v.alternate&&t(n,h),a=l(v,a,d),null===c?u=v:c.sibling=v,c=v,h=p}if(d===s.length)return r(n,h),sR&&C(n,d),u;if(null===h){for(;dp?(v=d,d=null):v=d.sibling;var _=m(n,d,y.value,u);if(null===_){null===d&&(d=v);break}e&&d&&null===_.alternate&&t(n,d),s=l(_,s,p),null===h?c=_:h.sibling=_,h=_,d=v}if(y.done)return r(n,d),sR&&C(n,p),c;if(null===d){for(;!y.done;p++,y=o.next())null!==(y=f(n,y.value,u))&&(s=l(y,s,p),null===h?c=y:h.sibling=y,h=y);return sR&&C(n,p),c}for(d=i(d);!y.done;p++,y=o.next())null!==(y=g(d,n,p,y.value,u))&&(e&&null!==y.alternate&&d.delete(null===y.key?p:y.key),s=l(y,s,p),null===h?c=y:h.sibling=y,h=y);return e&&d.forEach(function(e){return t(n,e)}),sR&&C(n,p),c}(c,h,d=v.call(d),p)}if("function"==typeof d.then)return n(c,h,ev(d),p);if(d.$$typeof===r3)return n(c,h,nl(c,d),p);e_(c,d)}return"string"==typeof d&&""!==d||"number"==typeof d||"bigint"==typeof d?(d=""+d,null!==h&&6===h.tag?(r(c,h.sibling),(p=o(h,d)).return=c):(r(c,h),(p=rF(d,c.mode,p)).return=c),u(c=p)):r(c,h)}(c,h,d,p);return sQ=null,v}catch(e){if(e===sJ)throw e;var y=n(29,e,null,c.mode);return y.lanes=p,y.return=c,y}finally{}}}function eS(e,t){g(s4,e=o1),g(s3,t),o1=e|t.baseLanes}function eM(){g(s4,o1),g(s3,s3.current)}function ew(){o1=s4.current,m(s3),m(s4)}function eE(e){var t=e.alternate;g(s8,1&s8.current),g(s5,e),null===s6&&(null===t||null!==s3.current?s6=e:null!==t.memoizedState&&(s6=e))}function eT(e){if(22===e.tag){if(g(s8,s8.current),g(s5,e),null===s6){var t=e.alternate;null!==t&&null!==t.memoizedState&&(s6=e)}}else eA(e)}function eA(){g(s8,s8.current),g(s5,s5.current)}function eC(e){m(s5),s6===e&&(s6=null),m(s8)}function eR(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||ap(n)||af(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function eP(){throw Error(a(321))}function eI(e,t){if(null===t)return!1;for(var n=0;na?a:8);var s=is.T,o={};is.T=o,tC(e,!1,t,n);try{var l=i(),u=is.S;if(null!==u&&u(o,l),null!==l&&"object"==typeof l&&"function"==typeof l.then){var c,h,d=(c=[],h={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},l.then(function(){h.status="fulfilled",h.value=r;for(var e=0;e";case oB:return":has("+(n6(e)||"")+")";case oH:return'[role="'+e.value+'"]';case oG:return'"'+e.value+'"';case oV:return'[data-testname="'+e.value+'"]';default:throw Error(a(365))}}function n8(e,t){var n=[];e=[e,0];for(var r=0;rln&&(t.flags|=128,r=!0,nM(i,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=eR(s))){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,nS(t,e),nM(i,!0),null===i.tail&&"hidden"===i.tailMode&&!s.alternate&&!sR)return nw(t),null}else 2*sa()-i.renderingStartTime>ln&&0x20000000!==n&&(t.flags|=128,r=!0,nM(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(null!==(e=i.last)?e.sibling=s:t.child=s,i.last=s)}if(null!==i.tail)return t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=sa(),t.sibling=null,e=s8.current,g(s8,r?1&e|2:1&e),t;return nw(t),null;case 22:case 23:return eC(t),ew(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?0!=(0x20000000&n)&&0==(128&t.flags)&&(nw(t),6&t.subtreeFlags&&(t.flags|=8192)):nw(t),null!==(n=t.updateQueue)&&nS(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&m(oA),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),nt(oE),nw(t),null;case 25:return null}throw Error(a(156,t.tag))}(t.alternate,t,o1);if(null!==n){oY=n;return}if(null!==(t=t.sibling)){oY=t;return}oY=t=e}while(null!==t)0===o2&&(o2=5)}function r_(e,t){do{var n=function(e,t){switch(I(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return nt(oE),N(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return U(t),null;case 13:if(eC(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));B()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return m(s8),null;case 4:return N(),null;case 10:return nt(t.type),null;case 22:case 23:return eC(t),ew(),null!==e&&m(oA),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return nt(oE),null;default:return null}}(e.alternate,e);if(null!==n){n.flags&=32767,oY=n;return}if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling)){oY=e;return}oY=e=n}while(null!==e)o2=6,oY=null}function rx(e,t,n,r,i,s,o,l,u,c){var h=is.T,d=iN();try{iL(2),is.T=null,function(e,t,n,r,i,s,o,l){do rS();while(null!==ls)if(0!=(6&oX))throw Error(a(327));var u,c,h=e.finishedWork;if(r=e.finishedLanes,null!==h){if(e.finishedWork=null,e.finishedLanes=0,h===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var d=h.lanes|h.childLanes;!function(e,t,n,r,i,a){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=s&~n;0n?32:n;n=is.T;var i=iN();try{if(iL(r),is.T=null,null===ls)var s=!1;else{r=lu,lu=null;var o=ls,l=lo;if(ls=null,lo=0,0!=(6&oX))throw Error(a(331));var u=oX;if(oX|=4,n2(o.current),nZ(o,o.current,l,r),oX=u,J(0,!1),sh&&"function"==typeof sh.onPostCommitFiberRoot)try{sh.onPostCommitFiberRoot(sc,o)}catch(e){}s=!0}return s}finally{iL(i),is.T=n,rb(e,t)}}return!1}function rM(e,t,n){t=A(n,t),t=tk(e.stateNode,t,2),null!==(e=ea(e,t,2))&&(M(e,2),Y(e))}function rw(e,t,n){if(3===e.tag)rM(e,e,n);else for(;null!==t;){if(3===t.tag){rM(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===li||!li.has(r))){e=A(n,e),null!==(r=ea(t,n=tz(2),2))&&(tB(n,r,t,e),M(r,2),Y(r));break}}t=t.return}}function rE(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new oj;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(o0=!0,i.add(n),e=rT.bind(null,e,t,n),t.then(e,e))}function rT(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,oq===e&&(oJ&n)===n&&(4===o2||3===o2&&(0x3c00000&oJ)===oJ&&300>sa()-lt?0==(2&oX)&&rl(e,0):o5|=n,o8===oJ&&(o8=0)),Y(e)}function rA(e,t){0===t&&(t=b()),null!==(e=j(e,t))&&(M(e,t),Y(e))}function rC(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),rA(e,n)}function rR(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}null!==r&&r.delete(t),rA(e,n)}function rP(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rI(e){return!(!(e=e.prototype)||!e.isReactComponent)}function rL(e,t){var r=e.alternate;return null===r?((r=n(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x1e00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function rN(e,t){e.flags&=0x1e00002;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,e.dependencies=null===(t=n.dependencies)?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function rD(e,t,r,i,s,o){var l=0;if(i=e,"function"==typeof e)rI(e)&&(l=1);else if("string"==typeof e)l=aF&&aK?ak(e,r,sM.current)?26:a2(e)?27:5:aF?ak(e,r,sM.current)?26:5:aK&&a2(e)?27:5;else e:switch(e){case r$:return rU(r.children,s,o,t);case rQ:l=8,s|=24;break;case r0:return(e=n(12,r,t,2|s)).elementType=r0,e.lanes=o,e;case r5:return(e=n(13,r,t,s)).elementType=r5,e.lanes=o,e;case r6:return(e=n(19,r,t,s)).elementType=r6,e.lanes=o,e;case r7:return rO(r,s,o,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case r1:case r3:l=10;break e;case r2:l=9;break e;case r4:l=11;break e;case r8:l=14;break e;case r9:l=16,i=null;break e}l=29,r=Error(a(130,null===e?"null":typeof e,"")),i=null}return(t=n(l,r,t,s)).elementType=e,t.type=i,t.lanes=o,t}function rU(e,t,r,i){return(e=n(7,e,i,t)).lanes=r,e}function rO(e,t,r,i){(e=n(22,e,i,t)).elementType=r7,e.lanes=r;var s={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var e=s._current;if(null===e)throw Error(a(456));if(0==(2&s._pendingVisibility)){var t=j(e,2);null!==t&&(s._pendingVisibility|=2,rt(t,e,2))}},attach:function(){var e=s._current;if(null===e)throw Error(a(456));if(0!=(2&s._pendingVisibility)){var t=j(e,2);null!==t&&(s._pendingVisibility&=-3,rt(t,e,2))}}};return e.stateNode=s,e}function rF(e,t,r){return(e=n(6,e,null,t)).lanes=r,e}function rk(e,t,r){return(t=n(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function rz(e,t,n,r,i,a,s,o){this.tag=1,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=iE,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=S(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=S(0),this.hiddenUpdates=S(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function rB(e,t,r,i,a,s,o,l,u,c,h,d){return e=new rz(e,t,r,o,l,u,c,d),t=1,!0===s&&(t|=24),s=n(3,null,null,t),e.current=s,s.stateNode=e,t=nc(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:i,isDehydrated:r,cache:t},en(s),e}function rH(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw Error(a(268,e=Object.keys(e).join(",")))}return null===(e=null!==(e=p(t))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:id(e.stateNode)}function rV(e,t,n,r,i,a){i=i?a5:a5,null===r.context?r.context=i:r.pendingContext=i,(r=ei(t)).payload={element:n},null!==(a=void 0===a?null:a)&&(r.callback=a),null!==(n=ea(e,r,t))&&(rt(n,e,t),es(n,e,t))}function rG(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n>>=0)?32:31-(a8(e)/a9|0)|0},a8=Math.log,a9=Math.LN2,a7=128,se=4194304,st=rq.unstable_scheduleCallback,sn=rq.unstable_cancelCallback,sr=rq.unstable_shouldYield,si=rq.unstable_requestPaint,sa=rq.unstable_now,ss=rq.unstable_ImmediatePriority,so=rq.unstable_UserBlockingPriority,sl=rq.unstable_NormalPriority,su=rq.unstable_IdlePriority,sc=(rq.log,rq.unstable_setDisableYieldValue,null),sh=null,sd="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},sp=new WeakMap,sf=[],sm=0,sg=null,sv=0,sy=[],s_=0,sx=null,sb=1,sS="",sM=f(null),sw=f(null),sE=f(null),sT=f(null),sA=null,sC=null,sR=!1,sP=null,sI=!1,sL=Error(a(519)),sN=[],sD=0,sU=0,sO=null,sF=null,sk=!1,sz=!1,sB=!1,sH=0,sV=null,sG=0,sW=0,sj=null,sX=!1,sq=!1,sY=Object.prototype.hasOwnProperty,sJ=Error(a(460)),sZ=Error(a(474)),sK={then:function(){}},s$=null,sQ=null,s0=0,s1=eb(!0),s2=eb(!1),s3=f(null),s4=f(0),s5=f(null),s6=null,s8=f(0),s9=0,s7=null,oe=null,ot=null,on=!1,or=!1,oi=!1,oa=0,os=0,oo=null,ol=0,ou=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},oc={readContext:no,use:eV,useCallback:eP,useContext:eP,useEffect:eP,useImperativeHandle:eP,useLayoutEffect:eP,useInsertionEffect:eP,useMemo:eP,useReducer:eP,useRef:eP,useState:eP,useDebugValue:eP,useDeferredValue:eP,useTransition:eP,useSyncExternalStore:eP,useId:eP};oc.useCacheRefresh=eP,oc.useMemoCache=eP,oc.useHostTransitionStatus=eP,oc.useFormState=eP,oc.useActionState=eP,oc.useOptimistic=eP;var oh={readContext:no,use:eV,useCallback:function(e,t){return ez().memoizedState=[e,void 0===t?null:t],e},useContext:no,useEffect:tl,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,ts(4194308,4,td.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){ts(4,2,e,t)},useMemo:function(e,t){var n=ez();t=void 0===t?null:t;var r=e();return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ez();if(void 0!==n)var i=n(t);else i=t;return r.memoizedState=r.baseState=i,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},e=e.dispatch=tE.bind(null,s7,e),[r.memoizedState,e]},useRef:function(e){return ez().memoizedState={current:e}},useState:function(e){var t=(e=e0(e)).queue,n=tT.bind(null,s7,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tf,useDeferredValue:function(e,t){return tv(ez(),e,t)},useTransition:function(){var e=e0(!1);return e=t_.bind(null,s7,e.queue,!0,!1),ez().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=s7,i=ez();if(sR){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===oq)throw Error(a(349));0!=(60&oJ)||eJ(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,tl(eK.bind(null,r,s,e),[e]),r.flags|=2048,ti(9,eZ.bind(null,r,s,n,t),{destroy:void 0},null),n},useId:function(){var e=ez(),t=oq.identifierPrefix;if(sR){var n=sS,r=sb;t=":"+t+"R"+(n=(r&~(1<<32-a6(r)-1)).toString(32)+n),0<(n=oa++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=ol++).toString(32)+":";return e.memoizedState=t},useCacheRefresh:function(){return ez().memoizedState=tw.bind(null,s7)}};oh.useMemoCache=eG,oh.useHostTransitionStatus=tb,oh.useFormState=e7,oh.useActionState=e7,oh.useOptimistic=function(e){var t=ez();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=tC.bind(null,s7,!0,n),n.dispatch=t,[e,t]};var od={readContext:no,use:eV,useCallback:tm,useContext:no,useEffect:tu,useImperativeHandle:tp,useInsertionEffect:tc,useLayoutEffect:th,useMemo:tg,useReducer:ej,useRef:ta,useState:function(){return ej(eW)},useDebugValue:tf,useDeferredValue:function(e,t){return ty(eB(),oe.memoizedState,e,t)},useTransition:function(){var e=ej(eW)[0],t=eB().memoizedState;return["boolean"==typeof e?e:eH(e),t]},useSyncExternalStore:eY,useId:tS};od.useCacheRefresh=tM,od.useMemoCache=eG,od.useHostTransitionStatus=tb,od.useFormState=te,od.useActionState=te,od.useOptimistic=function(e,t){return e1(eB(),oe,e,t)};var op={readContext:no,use:eV,useCallback:tm,useContext:no,useEffect:tu,useImperativeHandle:tp,useInsertionEffect:tc,useLayoutEffect:th,useMemo:tg,useReducer:eq,useRef:ta,useState:function(){return eq(eW)},useDebugValue:tf,useDeferredValue:function(e,t){var n=eB();return null===oe?tv(n,e,t):ty(n,oe.memoizedState,e,t)},useTransition:function(){var e=eq(eW)[0],t=eB().memoizedState;return["boolean"==typeof e?e:eH(e),t]},useSyncExternalStore:eY,useId:tS};op.useCacheRefresh=tM,op.useMemoCache=eG,op.useHostTransitionStatus=tb,op.useFormState=tr,op.useActionState=tr,op.useOptimistic=function(e,t){var n=eB();return null!==oe?e1(n,oe,e,t):(n.baseState=e,[e,n.queue.dispatch])};var of={isMounted:function(e){return!!(e=e._reactInternals)&&h(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=n7(),i=ei(r);i.payload=t,null!=n&&(i.callback=n),null!==(t=ea(e,i,r))&&(rt(t,e,r),es(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=n7(),i=ei(r);i.tag=1,i.payload=t,null!=n&&(i.callback=n),null!==(t=ea(e,i,r))&&(rt(t,e,r),es(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=n7(),r=ei(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=ea(e,r,n))&&(rt(t,e,n),es(t,e,n))}},om="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof r.default&&"function"==typeof r.default.emit)return void r.default.emit("uncaughtException",e);console.error(e)},og=Error(a(461)),ov=!1,oy={dehydrated:null,treeContext:null,retryLane:0},o_=f(null),ox=null,ob=null,oS="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},oM=rq.unstable_scheduleCallback,ow=rq.unstable_NormalPriority,oE={$$typeof:r3,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},oT=is.S;is.S=function(e,t){"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===sV){var n=sV=[];sG=0,sW=ee(),sj={status:"pending",value:void 0,then:function(e){n.push(e)}}}sG++,t.then(et,et)}(0,t),null!==oT&&oT(e,t)};var oA=f(null),oC=!1,oR=!1,oP=!1,oI="function"==typeof WeakSet?WeakSet:Set,oL=null,oN=!1,oD=null,oU=!1,oO=null,oF=8192,ok={getCacheForType:function(e){var t=no(oE),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n}},oz=0,oB=1,oH=2,oV=3,oG=4;if("function"==typeof Symbol&&Symbol.for){var oW=Symbol.for;oz=oW("selector.component"),oB=oW("selector.has_pseudo_class"),oH=oW("selector.role"),oV=oW("selector.test_id"),oG=oW("selector.text")}var oj="function"==typeof WeakMap?WeakMap:Map,oX=0,oq=null,oY=null,oJ=0,oZ=0,oK=null,o$=!1,oQ=!1,o0=!1,o1=0,o2=0,o3=0,o4=0,o5=0,o6=0,o8=0,o9=null,o7=null,le=!1,lt=0,ln=1/0,lr=null,li=null,la=!1,ls=null,lo=0,ll=0,lu=null,lc=0,lh=null;return rj.attemptContinuousHydration=function(e){if(13===e.tag){var t=j(e,0x4000000);null!==t&&rt(t,e,0x4000000),rW(e,0x4000000)}},rj.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=n7(),n=j(e,t);null!==n&&rt(n,e,t),rW(e,t)}},rj.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var t=v(e.pendingLanes);if(0!==t){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-a6(t);e.entanglements[1]|=n,t&=~n}Y(e),0==(6&oX)&&(ln=sa()+500,J(0,!1))}}break;case 13:null!==(t=j(e,2))&&rt(t,e,2),rs(),rW(e,2)}},rj.batchedUpdates=function(e,t){return e(t)},rj.createComponentSelector=function(e){return{$$typeof:oz,value:e}},rj.createContainer=function(e,t,n,r,i,a,s,o,l,u){return rB(e,t,!1,null,n,r,a,s,o,l,u,null)},rj.createHasPseudoClassSelector=function(e){return{$$typeof:oB,value:e}},rj.createHydrationContainer=function(e,t,n,r,i,a,s,o,l,u,c,h,d){var p;return(e=rB(n,r,!0,e,i,a,o,l,u,c,h,d)).context=(p=null,a5),n=e.current,(i=ei(r=n7())).callback=null!=t?t:null,ea(n,i,r),e.current.lanes=r,M(e,r),Y(e),e},rj.createPortal=function(e,t,n){var r=3=c&&s>=d&&i<=h&&o<=p){e.splice(t,1);break}if(r!==c||n.width!==u.width||po){if(!(s!==d||n.height!==u.height||hi)){c>r&&(u.width+=c-r,u.x=r),hs&&(u.height+=d-s,u.y=s),pn&&(n=l)),l ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},rj.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return id(e.child.stateNode);default:return e.child.stateNode}},rj.injectIntoDevTools=function(){var e={bundleType:0,version:iu,rendererPackageName:ic,currentDispatcherRef:is,findFiberByHostInstance:iP,reconcilerVersion:"19.0.0"};if(null!==ih&&(e.rendererConfig=ih),"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{sc=t.inject(e),sh=t}catch(e){}e=!!t.checkDCE}}return e},rj.isAlreadyRendering=function(){return!1},rj.observeVisibleRects=function(e,t,n,r){if(!iq)throw Error(a(363));var i=i0(e=n9(e,t),n,r).disconnect;return{disconnect:function(){i()}}},rj.shouldError=function(){return null},rj.shouldSuspend=function(){return!1},rj.startHostTransition=function(e,t,n,r){if(5!==e.tag)throw Error(a(476));var s=tx(e).queue;t_(e,s,t,iV,null===n?i:function(){var t=tx(e).next.queue;return tA(e,t,{},n7()),n(r)})},rj.updateContainer=function(e,t,n,r){var i=t.current,a=n7();return rV(i,a,e,t,n,r),a},rj.updateContainerSync=function(e,t,n,r){return 0===t.tag&&rS(),rV(t.current,2,e,t,n,r),2},rj},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})},98133,(e,t,n)=>{"use strict";t.exports=e.r(40336)},45015,(e,t,n)=>{"use strict";function r(e,t){var n=e.length;for(e.push(t);0>>1,i=e[r];if(0>>1;rs(l,n))us(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[o]=n,r=o);else if(us(c,n))e[r]=c,e[u]=n,r=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,y=!1,_="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=i(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,r(h,t);else break;t=i(d)}}function M(e){if(y=!1,S(e),!v)if(null!==i(h))v=!0,L();else{var t=i(d);null!==t&&N(M,t.startTime-e)}}var w=!1,E=-1,T=5,A=-1;function C(){return!(n.unstable_now()-Ae&&C());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,S(e),t=!0;break t}f===i(h)&&a(h),S(e)}else a(h);f=i(h)}if(null!==f)t=!0;else{var u=i(d);null!==u&&N(M,u.startTime-e),t=!1}}break e}finally{f=null,m=r,g=!1}}}finally{t?o():w=!1}}}if("function"==typeof b)o=function(){b(R)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=R,o=function(){I.postMessage(null)}}else o=function(){_(R,0)};function L(){w||(w=!0,o())}function N(e,t){E=_(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_continueExecution=function(){v||g||(v=!0,L())},n.unstable_forceFrameRate=function(e){0>e||125s?(e.sortIndex=a,r(d,e),null===i(h)&&e===i(d)&&(y?(x(E),E=-1):y=!0,N(M,a-s))):(e.sortIndex=o,r(h,e),v||g||(v=!0,L())),e},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},95087,(e,t,n)=>{"use strict";t.exports=e.r(45015)},46712,90072,8560,8155,46791,e=>{"use strict";let t,n,r,i,a,s,o,l,u,c;e.s(["B",()=>px,"C",()=>pG,"D",()=>pW,"E",()=>pb,"G",()=>pq,"a",()=>py,"b",()=>pv,"c",()=>fr,"d",()=>fa,"e",()=>p$,"f",()=>fb,"i",()=>pm,"j",()=>fc,"k",()=>fh,"u",()=>p_],46712),e.i(47167);var h=e.i(71645),d=e.i(39695);e.s(["ACESFilmicToneMapping",()=>ef,"AddEquation",()=>N,"AddOperation",()=>eu,"AdditiveAnimationBlendMode",()=>tH,"AdditiveBlending",()=>R,"AgXToneMapping",()=>eg,"AlphaFormat",()=>e$,"AlwaysCompare",()=>nm,"AlwaysDepth",()=>ee,"AlwaysStencilFunc",()=>no,"AmbientLight",()=>un,"AnimationAction",()=>uY,"AnimationClip",()=>lU,"AnimationLoader",()=>lG,"AnimationMixer",()=>uZ,"AnimationObjectGroup",()=>uq,"AnimationUtils",()=>lS,"ArcCurve",()=>od,"ArrayCamera",()=>uS,"ArrowHelper",()=>ck,"AttachedBindMode",()=>ey,"Audio",()=>uP,"AudioAnalyser",()=>uO,"AudioContext",()=>ug,"AudioListener",()=>uR,"AudioLoader",()=>uv,"AxesHelper",()=>cz,"BackSide",()=>E,"BasicDepthPacking",()=>tj,"BasicShadowMap",()=>x,"BatchedMesh",()=>sL,"Bone",()=>a1,"BooleanKeyframeTrack",()=>lC,"Box2",()=>cr,"Box3",()=>rf,"Box3Helper",()=>cU,"BoxGeometry",()=>ai,"BoxHelper",()=>cD,"BufferAttribute",()=>iF,"BufferGeometry",()=>i0,"BufferGeometryLoader",()=>uu,"ByteType",()=>eB,"Cache",()=>lO,"Camera",()=>ac,"CameraHelper",()=>cI,"CanvasTexture",()=>s6,"CapsuleGeometry",()=>s7,"CatmullRomCurve3",()=>oy,"CineonToneMapping",()=>ep,"CircleGeometry",()=>oe,"ClampToEdgeWrapping",()=>eA,"Clock",()=>uM,"Color",()=>iE,"ColorKeyframeTrack",()=>lR,"ColorManagement",()=>n8,"CompressedArrayTexture",()=>s4,"CompressedCubeTexture",()=>s5,"CompressedTexture",()=>s3,"CompressedTextureLoader",()=>lW,"ConeGeometry",()=>on,"ConstantAlphaFactor",()=>K,"ConstantColorFactor",()=>J,"Controls",()=>cH,"CubeCamera",()=>am,"CubeReflectionMapping",()=>eb,"CubeRefractionMapping",()=>eS,"CubeTexture",()=>ag,"CubeTextureLoader",()=>lq,"CubeUVReflectionMapping",()=>eE,"CubicBezierCurve",()=>oS,"CubicBezierCurve3",()=>oM,"CubicInterpolant",()=>lw,"CullFaceBack",()=>v,"CullFaceFront",()=>y,"CullFaceFrontBack",()=>_,"CullFaceNone",()=>g,"Curve",()=>oc,"CurvePath",()=>oP,"CustomBlending",()=>L,"CustomToneMapping",()=>em,"CylinderGeometry",()=>ot,"Cylindrical",()=>ce,"Data3DTexture",()=>rd,"DataArrayTexture",()=>rc,"DataTexture",()=>a2,"DataTextureLoader",()=>lY,"DataUtils",()=>iN,"DecrementStencilOp",()=>t6,"DecrementWrapStencilOp",()=>t9,"DefaultLoadingManager",()=>lk,"DepthFormat",()=>e1,"DepthStencilFormat",()=>e2,"DepthTexture",()=>s8,"DetachedBindMode",()=>e_,"DirectionalLight",()=>ut,"DirectionalLightHelper",()=>cC,"DiscreteInterpolant",()=>lT,"DodecahedronGeometry",()=>oi,"DoubleSide",()=>T,"DstAlphaFactor",()=>W,"DstColorFactor",()=>X,"DynamicCopyUsage",()=>nM,"DynamicDrawUsage",()=>nv,"DynamicReadUsage",()=>nx,"EdgesGeometry",()=>ou,"EllipseCurve",()=>oh,"EqualCompare",()=>nc,"EqualDepth",()=>er,"EqualStencilFunc",()=>nn,"EquirectangularReflectionMapping",()=>eM,"EquirectangularRefractionMapping",()=>ew,"Euler",()=>rK,"EventDispatcher",()=>nL,"ExternalTexture",()=>s9,"ExtrudeGeometry",()=>oQ,"FileLoader",()=>lV,"Float16BufferAttribute",()=>ij,"Float32BufferAttribute",()=>iX,"FloatType",()=>ej,"Fog",()=>aS,"FogExp2",()=>ab,"FramebufferTexture",()=>s2,"FrontSide",()=>w,"Frustum",()=>sd,"FrustumArray",()=>sm,"GLBufferAttribute",()=>u2,"GLSL1",()=>nE,"GLSL3",()=>nT,"GreaterCompare",()=>nd,"GreaterDepth",()=>ea,"GreaterEqualCompare",()=>nf,"GreaterEqualDepth",()=>ei,"GreaterEqualStencilFunc",()=>ns,"GreaterStencilFunc",()=>ni,"GridHelper",()=>cM,"Group",()=>ay,"HalfFloatType",()=>eX,"HemisphereLight",()=>lK,"HemisphereLightHelper",()=>cS,"IcosahedronGeometry",()=>o1,"ImageBitmapLoader",()=>um,"ImageLoader",()=>lX,"ImageUtils",()=>re,"IncrementStencilOp",()=>t5,"IncrementWrapStencilOp",()=>t8,"InstancedBufferAttribute",()=>a6,"InstancedBufferGeometry",()=>ul,"InstancedInterleavedBuffer",()=>u1,"InstancedMesh",()=>si,"Int16BufferAttribute",()=>iH,"Int32BufferAttribute",()=>iG,"Int8BufferAttribute",()=>ik,"IntType",()=>eG,"InterleavedBuffer",()=>aw,"InterleavedBufferAttribute",()=>aT,"Interpolant",()=>lM,"InterpolateDiscrete",()=>tD,"InterpolateLinear",()=>tU,"InterpolateSmooth",()=>tO,"InterpolationSamplingMode",()=>nI,"InterpolationSamplingType",()=>nP,"InvertStencilOp",()=>t7,"KeepStencilOp",()=>t3,"KeyframeTrack",()=>lA,"LOD",()=>aW,"LatheGeometry",()=>o2,"Layers",()=>r$,"LessCompare",()=>nu,"LessDepth",()=>et,"LessEqualCompare",()=>nh,"LessEqualDepth",()=>en,"LessEqualStencilFunc",()=>nr,"LessStencilFunc",()=>nt,"Light",()=>lZ,"LightProbe",()=>ua,"Line",()=>sH,"Line3",()=>ch,"LineBasicMaterial",()=>sN,"LineCurve",()=>ow,"LineCurve3",()=>oE,"LineDashedMaterial",()=>lg,"LineLoop",()=>sX,"LineSegments",()=>sj,"LinearFilter",()=>eD,"LinearInterpolant",()=>lE,"LinearMipMapLinearFilter",()=>ek,"LinearMipMapNearestFilter",()=>eO,"LinearMipmapLinearFilter",()=>eF,"LinearMipmapNearestFilter",()=>eU,"LinearSRGBColorSpace",()=>tQ,"LinearToneMapping",()=>eh,"LinearTransfer",()=>t0,"Loader",()=>lz,"LoaderUtils",()=>uo,"LoadingManager",()=>lF,"LoopOnce",()=>tI,"LoopPingPong",()=>tN,"LoopRepeat",()=>tL,"MOUSE",()=>f,"Material",()=>iC,"MaterialLoader",()=>us,"MathUtils",()=>nG,"Matrix2",()=>ct,"Matrix3",()=>nJ,"Matrix4",()=>rH,"MaxEquation",()=>F,"Mesh",()=>an,"MeshBasicMaterial",()=>iR,"MeshDepthMaterial",()=>lp,"MeshDistanceMaterial",()=>lf,"MeshLambertMaterial",()=>ld,"MeshMatcapMaterial",()=>lm,"MeshNormalMaterial",()=>lh,"MeshPhongMaterial",()=>lu,"MeshPhysicalMaterial",()=>ll,"MeshStandardMaterial",()=>lo,"MeshToonMaterial",()=>lc,"MinEquation",()=>O,"MirroredRepeatWrapping",()=>eC,"MixOperation",()=>el,"MultiplyBlending",()=>I,"MultiplyOperation",()=>eo,"NearestFilter",()=>eR,"NearestMipMapLinearFilter",()=>eN,"NearestMipMapNearestFilter",()=>eI,"NearestMipmapLinearFilter",()=>eL,"NearestMipmapNearestFilter",()=>eP,"NeutralToneMapping",()=>ev,"NeverCompare",()=>nl,"NeverDepth",()=>Q,"NeverStencilFunc",()=>ne,"NoBlending",()=>A,"NoColorSpace",()=>tK,"NoToneMapping",()=>ec,"NormalAnimationBlendMode",()=>tB,"NormalBlending",()=>C,"NotEqualCompare",()=>np,"NotEqualDepth",()=>es,"NotEqualStencilFunc",()=>na,"NumberKeyframeTrack",()=>lP,"Object3D",()=>ia,"ObjectLoader",()=>uc,"ObjectSpaceNormalMap",()=>tZ,"OctahedronGeometry",()=>o3,"OneFactor",()=>z,"OneMinusConstantAlphaFactor",()=>$,"OneMinusConstantColorFactor",()=>Z,"OneMinusDstAlphaFactor",()=>j,"OneMinusDstColorFactor",()=>q,"OneMinusSrcAlphaFactor",()=>G,"OneMinusSrcColorFactor",()=>H,"OrthographicCamera",()=>l7,"PCFShadowMap",()=>b,"PCFSoftShadowMap",()=>S,"Path",()=>oI,"PerspectiveCamera",()=>af,"Plane",()=>sl,"PlaneGeometry",()=>o4,"PlaneHelper",()=>cO,"PointLight",()=>l9,"PointLightHelper",()=>cy,"Points",()=>s$,"PointsMaterial",()=>sq,"PolarGridHelper",()=>cw,"PolyhedronGeometry",()=>or,"PositionalAudio",()=>uU,"PropertyBinding",()=>uX,"PropertyMixer",()=>uF,"QuadraticBezierCurve",()=>oT,"QuadraticBezierCurve3",()=>oA,"Quaternion",()=>nj,"QuaternionKeyframeTrack",()=>lL,"QuaternionLinearInterpolant",()=>lI,"RAD2DEG",()=>nO,"RED_GREEN_RGTC2_Format",()=>tR,"RED_RGTC1_Format",()=>tA,"REVISION",()=>p,"RGBADepthPacking",()=>tX,"RGBAFormat",()=>e0,"RGBAIntegerFormat",()=>e9,"RGBA_ASTC_10x10_Format",()=>tb,"RGBA_ASTC_10x5_Format",()=>ty,"RGBA_ASTC_10x6_Format",()=>t_,"RGBA_ASTC_10x8_Format",()=>tx,"RGBA_ASTC_12x10_Format",()=>tS,"RGBA_ASTC_12x12_Format",()=>tM,"RGBA_ASTC_4x4_Format",()=>tc,"RGBA_ASTC_5x4_Format",()=>th,"RGBA_ASTC_5x5_Format",()=>td,"RGBA_ASTC_6x5_Format",()=>tp,"RGBA_ASTC_6x6_Format",()=>tf,"RGBA_ASTC_8x5_Format",()=>tm,"RGBA_ASTC_8x6_Format",()=>tg,"RGBA_ASTC_8x8_Format",()=>tv,"RGBA_BPTC_Format",()=>tw,"RGBA_ETC2_EAC_Format",()=>tu,"RGBA_PVRTC_2BPPV1_Format",()=>ts,"RGBA_PVRTC_4BPPV1_Format",()=>ta,"RGBA_S3TC_DXT1_Format",()=>te,"RGBA_S3TC_DXT3_Format",()=>tt,"RGBA_S3TC_DXT5_Format",()=>tn,"RGBDepthPacking",()=>tq,"RGBFormat",()=>eQ,"RGBIntegerFormat",()=>e8,"RGB_BPTC_SIGNED_Format",()=>tE,"RGB_BPTC_UNSIGNED_Format",()=>tT,"RGB_ETC1_Format",()=>to,"RGB_ETC2_Format",()=>tl,"RGB_PVRTC_2BPPV1_Format",()=>ti,"RGB_PVRTC_4BPPV1_Format",()=>tr,"RGB_S3TC_DXT1_Format",()=>e7,"RGDepthPacking",()=>tY,"RGFormat",()=>e5,"RGIntegerFormat",()=>e6,"RawShaderMaterial",()=>ls,"Ray",()=>rB,"Raycaster",()=>u4,"RectAreaLight",()=>ur,"RedFormat",()=>e3,"RedIntegerFormat",()=>e4,"ReinhardToneMapping",()=>ed,"RenderTarget",()=>rl,"RenderTarget3D",()=>uK,"RepeatWrapping",()=>eT,"ReplaceStencilOp",()=>t4,"ReverseSubtractEquation",()=>U,"RingGeometry",()=>o5,"SIGNED_RED_GREEN_RGTC2_Format",()=>tP,"SIGNED_RED_RGTC1_Format",()=>tC,"SRGBColorSpace",()=>t$,"SRGBTransfer",()=>t1,"Scene",()=>aM,"ShaderMaterial",()=>au,"ShadowMaterial",()=>la,"Shape",()=>oL,"ShapeGeometry",()=>o6,"ShapePath",()=>cB,"ShapeUtils",()=>oZ,"ShortType",()=>eH,"Skeleton",()=>a5,"SkeletonHelper",()=>cv,"SkinnedMesh",()=>a0,"Source",()=>rn,"Sphere",()=>rL,"SphereGeometry",()=>o8,"Spherical",()=>u7,"SphericalHarmonics3",()=>ui,"SplineCurve",()=>oC,"SpotLight",()=>l3,"SpotLightHelper",()=>cp,"Sprite",()=>aB,"SpriteMaterial",()=>aA,"SrcAlphaFactor",()=>V,"SrcAlphaSaturateFactor",()=>Y,"SrcColorFactor",()=>B,"StaticCopyUsage",()=>nS,"StaticDrawUsage",()=>ng,"StaticReadUsage",()=>n_,"StereoCamera",()=>ub,"StreamCopyUsage",()=>nw,"StreamDrawUsage",()=>ny,"StreamReadUsage",()=>nb,"StringKeyframeTrack",()=>lN,"SubtractEquation",()=>D,"SubtractiveBlending",()=>P,"TOUCH",()=>m,"TangentSpaceNormalMap",()=>tJ,"TetrahedronGeometry",()=>o9,"Texture",()=>rs,"TextureLoader",()=>lJ,"TextureUtils",()=>cG,"Timer",()=>u8,"TimestampQuery",()=>nR,"TorusGeometry",()=>o7,"TorusKnotGeometry",()=>le,"Triangle",()=>ix,"TriangleFanDrawMode",()=>tW,"TriangleStripDrawMode",()=>tG,"TrianglesDrawMode",()=>tV,"TubeGeometry",()=>lt,"UVMapping",()=>ex,"Uint16BufferAttribute",()=>iV,"Uint32BufferAttribute",()=>iW,"Uint8BufferAttribute",()=>iz,"Uint8ClampedBufferAttribute",()=>iB,"Uniform",()=>u$,"UniformsGroup",()=>u0,"UniformsUtils",()=>al,"UnsignedByteType",()=>ez,"UnsignedInt101111Type",()=>eK,"UnsignedInt248Type",()=>eJ,"UnsignedInt5999Type",()=>eZ,"UnsignedIntType",()=>eW,"UnsignedShort4444Type",()=>eq,"UnsignedShort5551Type",()=>eY,"UnsignedShortType",()=>eV,"VSMShadowMap",()=>M,"Vector2",()=>nW,"Vector3",()=>nX,"Vector4",()=>ro,"VectorKeyframeTrack",()=>lD,"VideoFrameTexture",()=>s1,"VideoTexture",()=>s0,"WebGL3DRenderTarget",()=>rp,"WebGLArrayRenderTarget",()=>rh,"WebGLCoordinateSystem",()=>nA,"WebGLCubeRenderTarget",()=>av,"WebGLRenderTarget",()=>ru,"WebGPUCoordinateSystem",()=>nC,"WebXRController",()=>ax,"WireframeGeometry",()=>ln,"WrapAroundEnding",()=>tz,"ZeroCurvatureEnding",()=>tF,"ZeroFactor",()=>k,"ZeroSlopeEnding",()=>tk,"ZeroStencilOp",()=>t2,"arrayNeedsUint32",()=>nK,"cloneUniforms",()=>aa,"createCanvasElement",()=>n1,"createElementNS",()=>n0,"getByteLength",()=>cV,"getUnlitUniformColorSpace",()=>ao,"mergeUniforms",()=>as,"probeAsync",()=>n4,"warnOnce",()=>n3],90072);let p="180",f={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},m={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},g=0,v=1,y=2,_=3,x=0,b=1,S=2,M=3,w=0,E=1,T=2,A=0,C=1,R=2,P=3,I=4,L=5,N=100,D=101,U=102,O=103,F=104,k=200,z=201,B=202,H=203,V=204,G=205,W=206,j=207,X=208,q=209,Y=210,J=211,Z=212,K=213,$=214,Q=0,ee=1,et=2,en=3,er=4,ei=5,ea=6,es=7,eo=0,el=1,eu=2,ec=0,eh=1,ed=2,ep=3,ef=4,em=5,eg=6,ev=7,ey="attached",e_="detached",ex=300,eb=301,eS=302,eM=303,ew=304,eE=306,eT=1e3,eA=1001,eC=1002,eR=1003,eP=1004,eI=1004,eL=1005,eN=1005,eD=1006,eU=1007,eO=1007,eF=1008,ek=1008,ez=1009,eB=1010,eH=1011,eV=1012,eG=1013,eW=1014,ej=1015,eX=1016,eq=1017,eY=1018,eJ=1020,eZ=35902,eK=35899,e$=1021,eQ=1022,e0=1023,e1=1026,e2=1027,e3=1028,e4=1029,e5=1030,e6=1031,e8=1032,e9=1033,e7=33776,te=33777,tt=33778,tn=33779,tr=35840,ti=35841,ta=35842,ts=35843,to=36196,tl=37492,tu=37496,tc=37808,th=37809,td=37810,tp=37811,tf=37812,tm=37813,tg=37814,tv=37815,ty=37816,t_=37817,tx=37818,tb=37819,tS=37820,tM=37821,tw=36492,tE=36494,tT=36495,tA=36283,tC=36284,tR=36285,tP=36286,tI=2200,tL=2201,tN=2202,tD=2300,tU=2301,tO=2302,tF=2400,tk=2401,tz=2402,tB=2500,tH=2501,tV=0,tG=1,tW=2,tj=3200,tX=3201,tq=3202,tY=3203,tJ=0,tZ=1,tK="",t$="srgb",tQ="srgb-linear",t0="linear",t1="srgb",t2=0,t3=7680,t4=7681,t5=7682,t6=7683,t8=34055,t9=34056,t7=5386,ne=512,nt=513,nn=514,nr=515,ni=516,na=517,ns=518,no=519,nl=512,nu=513,nc=514,nh=515,nd=516,np=517,nf=518,nm=519,ng=35044,nv=35048,ny=35040,n_=35045,nx=35049,nb=35041,nS=35046,nM=35050,nw=35042,nE="100",nT="300 es",nA=2e3,nC=2001,nR={COMPUTE:"compute",RENDER:"render"},nP={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},nI={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};class nL{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return void 0!==n&&void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){let n=this._listeners;if(void 0===n)return;let r=n[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+nN[e>>16&255]+nN[e>>24&255]+"-"+nN[255&t]+nN[t>>8&255]+"-"+nN[t>>16&15|64]+nN[t>>24&255]+"-"+nN[63&n|128]+nN[n>>8&255]+"-"+nN[n>>16&255]+nN[n>>24&255]+nN[255&r]+nN[r>>8&255]+nN[r>>16&255]+nN[r>>24&255]).toLowerCase()}function nk(e,t,n){return Math.max(t,Math.min(n,e))}function nz(e,t){return(e%t+t)%t}function nB(e,t,n){return(1-n)*e+n*t}function nH(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function nV(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let nG={DEG2RAD:nU,RAD2DEG:nO,generateUUID:nF,clamp:nk,euclideanModulo:nz,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:nB,damp:function(e,t,n,r){return nB(e,t,1-Math.exp(-n*r))},pingpong:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(nz(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(nD=e);let t=nD+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*nU},radToDeg:function(e){return e*nO},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+r)/2),c=s((t+r)/2),h=a((t-r)/2),d=s((t-r)/2),p=a((r-t)/2),f=s((r-t)/2);switch(i){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:nV,denormalize:nH};class nW{get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(nk(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}constructor(e=0,t=0){nW.prototype.isVector2=!0,this.x=e,this.y=t}}class nj{static slerpFlat(e,t,n,r,i,a,s){let o=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(1===s){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==h||l!==d||u!==p){let e=1-s,t=o*h+l*d+u*p+c*f,n=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,s=Math.sin(s*a)/i}let i=s*n;if(o=o*e+h*i,l=l*e+d*i,u=u*e+p*i,c=c*e+f*i,e===1-s){let e=1/Math.sqrt(o*o+l*l+u*u+c*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,a){let s=n[r],o=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=e._x,r=e._y,i=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(r/2),c=s(i/2),h=o(n/2),d=o(r/2),p=o(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(i-l)*e,this._z=(a-r)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(i-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-r)/e,this._x=(i+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(nk(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+r*l-i*o,this._y=r*u+a*o+i*s-n*l,this._z=i*u+a*l+n*o-r*s,this._w=a*u-n*s-r*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,s=a*e._w+n*e._x+r*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let l=Math.sqrt(o),u=Math.atan2(l,s),c=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=a*c+this._w*h,this._x=n*c+this._x*h,this._y=r*c+this._y*h,this._z=i*c+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}}class nX{set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(nY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(nY.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*r-s*n),u=2*(s*t-i*r),c=2*(i*n-a*t);return this.x=t+o*l+a*c-s*u,this.y=n+o*u+s*l-i*c,this.z=r+o*c+i*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this.z=nk(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this.z=nk(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,s=t.y,o=t.z;return this.x=r*o-i*s,this.y=i*a-n*o,this.z=n*s-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return nq.copy(this).projectOnVector(e),this.sub(nq)}reflect(e){return this.sub(nq.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(nk(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}constructor(e=0,t=0,n=0){nX.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}}let nq=new nX,nY=new nj;class nJ{set(e,t,n,r,i,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=r,u[2]=s,u[3]=t,u[4]=i,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],_=r[7],x=r[2],b=r[5],S=r[8];return i[0]=a*f+s*v+o*x,i[3]=a*m+s*y+o*b,i[6]=a*g+s*_+o*S,i[1]=l*f+u*v+c*x,i[4]=l*m+u*y+c*b,i[7]=l*g+u*_+c*S,i[2]=h*f+d*v+p*x,i[5]=h*m+d*y+p*b,i[8]=h*g+d*_+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*i*u+n*s*o+r*i*l-r*a*o}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*i,d=l*i-a*o,p=t*c+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(r*l-u*n)*f,e[2]=(s*n-r*a)*f,e[3]=h*f,e[4]=(u*t-r*o)*f,e[5]=(r*i-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*i)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,s){let o=Math.cos(i),l=Math.sin(i);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-r*l,r*o,-r*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(nZ.makeScale(e,t)),this}rotate(e){return this.premultiply(nZ.makeRotation(-e)),this}translate(e,t){return this.premultiply(nZ.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}constructor(e,t,n,r,i,a,s,o,l){nJ.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,a,s,o,l)}}let nZ=new nJ;function nK(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let n$={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function nQ(e,t){return new n$[e](t)}function n0(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function n1(){let e=n0("canvas");return e.style.display="block",e}let n2={};function n3(e){e in n2||(n2[e]=!0,console.warn(e))}function n4(e,t,n){return new Promise(function(r,i){setTimeout(function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}},n)})}let n5=new nJ().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),n6=new nJ().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),n8=function(){let e={enabled:!0,workingColorSpace:tQ,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n&&(this.spaces[t].transfer===t1&&(e.r=n9(e.r),e.g=n9(e.g),e.b=n9(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===t1&&(e.r=n7(e.r),e.g=n7(e.g),e.b=n7(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===tK?t0:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.workingColorSpace;return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.workingColorSpace;return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return n3("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return n3("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[tQ]:{primaries:t,whitePoint:r,transfer:t0,toXYZ:n5,fromXYZ:n6,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:t$},outputColorSpaceConfig:{drawingBufferColorSpace:t$}},[t$]:{primaries:t,whitePoint:r,transfer:t1,toXYZ:n5,fromXYZ:n6,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:t$}}}),e}();function n9(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function n7(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class re{static getDataURL(e){let n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/png";if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)n=e;else{void 0===t&&(t=n0("canvas")),t.width=e.width,t.height=e.height;let r=t.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=t}return n.toDataURL(r)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=n0("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ex)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case eT:e.x=e.x-Math.floor(e.x);break;case eA:e.x=e.x<0?0:1;break;case eC:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case eT:e.y=e.y-Math.floor(e.y);break;case eA:e.y=e.y<0?0:1;break;case eC:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}constructor(e=rs.DEFAULT_IMAGE,t=rs.DEFAULT_MAPPING,n=eA,r=eA,i=eD,a=eF,s=e0,o=ez,l=rs.DEFAULT_ANISOTROPY,u=tK){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ri++}),this.uuid=nF(),this.name="",this.source=new rn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new nW(0,0),this.repeat=new nW(1,1),this.center=new nW(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nJ,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}}rs.DEFAULT_IMAGE=null,rs.DEFAULT_MAPPING=ex,rs.DEFAULT_ANISOTROPY=1;class ro{get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=e.elements,s=a[0],o=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-u)&&.01>Math.abs(l-d)&&.01>Math.abs(h-p)){if(.1>Math.abs(o+u)&&.1>Math.abs(l+d)&&.1>Math.abs(h+p)&&.1>Math.abs(s+c+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+u)/4,v=(l+d)/4,y=(h+p)/4;return e>a&&e>m?e<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(e)),i=v/n):a>m?a<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(a)),i=y/r):m<.01?(n=.707106781,r=.707106781,i=0):(n=v/(i=Math.sqrt(m)),r=y/i),this.set(n,r,i,t),this}let m=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-o)*(u-o));return .001>Math.abs(m)&&(m=1),this.x=(p-h)/m,this.y=(l-d)/m,this.z=(u-o)/m,this.w=Math.acos((s+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this.z=nk(this.z,e.z,t.z),this.w=nk(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this.z=nk(this.z,e,t),this.w=nk(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}constructor(e=0,t=0,n=0,r=1){ro.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}}class rl extends nL{_setTextureOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={minFilter:eD,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);let n=e.geometry;if(void 0!==n){let r=n.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,n=r.count;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,rg),rg.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(rw),rE.subVectors(this.max,rw),ry.subVectors(e.a,rw),r_.subVectors(e.b,rw),rx.subVectors(e.c,rw),rb.subVectors(r_,ry),rS.subVectors(rx,r_),rM.subVectors(ry,rx);let t=[0,-rb.z,rb.y,0,-rS.z,rS.y,0,-rM.z,rM.y,rb.z,0,-rb.x,rS.z,0,-rS.x,rM.z,0,-rM.x,-rb.y,rb.x,0,-rS.y,rS.x,0,-rM.y,rM.x,0];return!!rC(t,ry,r_,rx,rE)&&!!rC(t=[1,0,0,0,1,0,0,0,1],ry,r_,rx,rE)&&(rT.crossVectors(rb,rS),rC(t=[rT.x,rT.y,rT.z],ry,r_,rx,rE))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,rg).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(rg).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(rm[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rm[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rm[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rm[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rm[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rm[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rm[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rm[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rm)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}constructor(e=new nX(Infinity,Infinity,Infinity),t=new nX(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}}let rm=[new nX,new nX,new nX,new nX,new nX,new nX,new nX,new nX],rg=new nX,rv=new rf,ry=new nX,r_=new nX,rx=new nX,rb=new nX,rS=new nX,rM=new nX,rw=new nX,rE=new nX,rT=new nX,rA=new nX;function rC(e,t,n,r,i){for(let a=0,s=e.length-3;a<=s;a+=3){rA.fromArray(e,a);let s=i.x*Math.abs(rA.x)+i.y*Math.abs(rA.y)+i.z*Math.abs(rA.z),o=t.dot(rA),l=n.dot(rA),u=r.dot(rA);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let rR=new rf,rP=new nX,rI=new nX;class rL{set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):rR.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;rP.subVectors(e,this.center);let t=rP.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(rP,n/e),this.radius+=n}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(rI.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(rP.copy(e.center).add(rI)),this.expandByPoint(rP.copy(e.center).sub(rI)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}constructor(e=new nX,t=-1){this.isSphere=!0,this.center=e,this.radius=t}}let rN=new nX,rD=new nX,rU=new nX,rO=new nX,rF=new nX,rk=new nX,rz=new nX;class rB{set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,rN)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=rN.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(rN.copy(this.origin).addScaledVector(this.direction,t),rN.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){let i,a,s,o;rD.copy(e).add(t).multiplyScalar(.5),rU.copy(t).sub(e).normalize(),rO.copy(this.origin).sub(rD);let l=.5*e.distanceTo(t),u=-this.direction.dot(rU),c=rO.dot(this.direction),h=-rO.dot(rU),d=rO.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(i=u*h-c,a=u*c-h,o=l*p,i>=0)if(a>=-o)if(a<=o){let e=1/p;i*=e,a*=e,s=i*(i+u*a+2*c)+a*(u*i+a+2*h)+d}else s=-(i=Math.max(0,-(u*(a=l)+c)))*i+a*(a+2*h)+d;else s=-(i=Math.max(0,-(u*(a=-l)+c)))*i+a*(a+2*h)+d;else a<=-o?(a=(i=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d):a<=o?(i=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(i=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d);else a=u>0?-l:l,s=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,i),r&&r.copy(rD).addScaledVector(rU,a),s}intersectSphere(e,t){rN.subVectors(e.center,this.origin);let n=rN.dot(this.direction),r=rN.dot(rN)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let n,r,i,a,s,o,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return(l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>r||((s>n||n!=n)&&(n=s),(o=0?n:r,t)}intersectsBox(e){return null!==this.intersectBox(e,rN)}intersectTriangle(e,t,n,r,i){let a;rF.subVectors(t,e),rk.subVectors(n,e),rz.crossVectors(rF,rk);let s=this.direction.dot(rz);if(s>0){if(r)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}rO.subVectors(this.origin,e);let o=a*this.direction.dot(rk.crossVectors(rO,rk));if(o<0)return null;let l=a*this.direction.dot(rF.cross(rO));if(l<0||o+l>s)return null;let u=-a*rO.dot(rz);return u<0?null:this.at(u/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}constructor(e=new nX,t=new nX(0,0,-1)){this.origin=e,this.direction=t}}class rH{set(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new rH().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/rV.setFromMatrixColumn(e,0).length(),i=1/rV.setFromMatrixColumn(e,1).length(),a=1/rV.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-s*o,t[2]=i-e*l,t[6]=r+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e+i*s,t[4]=r*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-r,t[6]=i+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e-i*s,t[4]=-a*c,t[8]=r+n*s,t[1]=n+r*s,t[5]=a*u,t[9]=i-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=r*l-n,t[8]=e*l+i,t[1]=o*c,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+i,t[5]=a*u,t[9]=n*c-r,t[2]=r*c-n,t[6]=s*u,t[10]=i*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rW,e,rj)}lookAt(e,t,n){let r=this.elements;return rY.subVectors(e,t),0===rY.lengthSq()&&(rY.z=1),rY.normalize(),rX.crossVectors(n,rY),0===rX.lengthSq()&&(1===Math.abs(n.z)?rY.x+=1e-4:rY.z+=1e-4,rY.normalize(),rX.crossVectors(n,rY)),rX.normalize(),rq.crossVectors(rY,rX),r[0]=rX.x,r[4]=rq.x,r[8]=rY.x,r[1]=rX.y,r[5]=rq.y,r[9]=rY.y,r[2]=rX.z,r[6]=rq.z,r[10]=rY.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],_=n[11],x=n[15],b=r[0],S=r[4],M=r[8],w=r[12],E=r[1],T=r[5],A=r[9],C=r[13],R=r[2],P=r[6],I=r[10],L=r[14],N=r[3],D=r[7],U=r[11],O=r[15];return i[0]=a*b+s*E+o*R+l*N,i[4]=a*S+s*T+o*P+l*D,i[8]=a*M+s*A+o*I+l*U,i[12]=a*w+s*C+o*L+l*O,i[1]=u*b+c*E+h*R+d*N,i[5]=u*S+c*T+h*P+d*D,i[9]=u*M+c*A+h*I+d*U,i[13]=u*w+c*C+h*L+d*O,i[2]=p*b+f*E+m*R+g*N,i[6]=p*S+f*T+m*P+g*D,i[10]=p*M+f*A+m*I+g*U,i[14]=p*w+f*C+m*L+g*O,i[3]=v*b+y*E+_*R+x*N,i[7]=v*S+y*T+_*P+x*D,i[11]=v*M+y*A+_*I+x*U,i[15]=v*w+y*C+_*L+x*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7];return p*(i*o*c-r*l*c-i*s*h+n*l*h+r*s*d-n*o*d)+f*(t*o*d-t*l*h+i*a*h-r*a*d+r*l*u-i*o*u)+e[11]*(t*l*c-t*s*d-i*a*c+n*a*d+i*s*u-n*l*u)+e[15]*(-r*s*u-t*o*c+t*s*h+r*a*c-n*a*h+n*o*u)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*h*l+f*o*d-s*m*d-c*o*g+s*h*g,y=p*h*l-u*m*l-p*o*d+a*m*d+u*o*g-a*h*g,_=u*f*l-p*c*l+p*s*d-a*f*d-u*s*g+a*c*g,x=p*c*o-u*f*o-p*s*h+a*f*h+u*s*m-a*c*m,b=t*v+n*y+r*_+i*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/b;return e[0]=v*S,e[1]=(f*h*i-c*m*i-f*r*d+n*m*d+c*r*g-n*h*g)*S,e[2]=(s*m*i-f*o*i+f*r*l-n*m*l-s*r*g+n*o*g)*S,e[3]=(c*o*i-s*h*i-c*r*l+n*h*l+s*r*d-n*o*d)*S,e[4]=y*S,e[5]=(u*m*i-p*h*i+p*r*d-t*m*d-u*r*g+t*h*g)*S,e[6]=(p*o*i-a*m*i-p*r*l+t*m*l+a*r*g-t*o*g)*S,e[7]=(a*h*i-u*o*i+u*r*l-t*h*l-a*r*d+t*o*d)*S,e[8]=_*S,e[9]=(p*c*i-u*f*i-p*n*d+t*f*d+u*n*g-t*c*g)*S,e[10]=(a*f*i-p*s*i+p*n*l-t*f*l-a*n*g+t*s*g)*S,e[11]=(u*s*i-a*c*i-u*n*l+t*c*l+a*n*d-t*s*d)*S,e[12]=x*S,e[13]=(u*f*r-p*c*r+p*n*h-t*f*h-u*n*m+t*c*m)*S,e[14]=(p*s*r-a*f*r-p*n*o+t*f*o+a*n*m-t*s*m)*S,e[15]=(a*c*r-u*s*r+u*n*o-t*c*o-a*n*h+t*s*h)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];return Math.sqrt(Math.max(t,e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,s=e.y,o=e.z,l=i*a,u=i*s;return this.set(l*a+n,l*s-r*o,l*o+r*s,0,l*s+r*o,u*s+n,u*o-r*a,0,l*o-r*s,u*o+r*a,i*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,s=t._z,o=t._w,l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,p=i*c,f=a*u,m=a*c,g=s*c,v=o*l,y=o*u,_=o*c,x=n.x,b=n.y,S=n.z;return r[0]=(1-(f+g))*x,r[1]=(d+_)*x,r[2]=(p-y)*x,r[3]=0,r[4]=(d-_)*b,r[5]=(1-(h+g))*b,r[6]=(m+v)*b,r[7]=0,r[8]=(p+y)*S,r[9]=(m-v)*S,r[10]=(1-(h+f))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=rV.set(r[0],r[1],r[2]).length(),a=rV.set(r[4],r[5],r[6]).length(),s=rV.set(r[8],r[9],r[10]).length();0>this.determinant()&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],rG.copy(this);let o=1/i,l=1/a,u=1/s;return rG.elements[0]*=o,rG.elements[1]*=o,rG.elements[2]*=o,rG.elements[4]*=l,rG.elements[5]*=l,rG.elements[6]*=l,rG.elements[8]*=u,rG.elements[9]*=u,rG.elements[10]*=u,t.setFromRotationMatrix(rG),n.x=i,n.y=a,n.z=s,this}makePerspective(e,t,n,r,i,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:nA,u=arguments.length>7&&void 0!==arguments[7]&&arguments[7],c=this.elements;if(u)s=i/(a-i),o=a*i/(a-i);else if(l===nA)s=-(a+i)/(a-i),o=-2*a*i/(a-i);else if(l===nC)s=-a/(a-i),o=-a*i/(a-i);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return c[0]=2*i/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*i/(n-r),c[9]=(n+r)/(n-r),c[13]=0,c[2]=0,c[6]=0,c[10]=s,c[14]=o,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:nA,u=arguments.length>7&&void 0!==arguments[7]&&arguments[7],c=this.elements;if(u)s=1/(a-i),o=a/(a-i);else if(l===nA)s=-2/(a-i),o=-(a+i)/(a-i);else if(l===nC)s=-1/(a-i),o=-i/(a-i);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(n-r),c[9]=0,c[13]=-(n+r)/(n-r),c[2]=0,c[6]=0,c[10]=s,c[14]=o,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}constructor(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m){rH.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m)}}let rV=new nX,rG=new rH,rW=new nX(0,0,0),rj=new nX(1,1,1),rX=new nX,rq=new nX,rY=new nX,rJ=new rH,rZ=new nj;class rK{get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=e.elements,i=r[0],a=r[4],s=r[8],o=r[1],l=r[5],u=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(nk(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-nk(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(nk(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,i));break;case"ZYX":this._y=Math.asin(-nk(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(nk(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-nk(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,i)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return rJ.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rJ,t,n)}setFromVector3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return rZ.setFromEuler(this),this.setFromQuaternion(rZ,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}constructor(e=0,t=0,n=0,r=rK.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}}rK.DEFAULT_ORDER="XYZ";class r${set(e){this.mask=1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:[];this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(r.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){is.subVectors(r,t),io.subVectors(n,t),il.subVectors(e,t);let a=is.dot(is),s=is.dot(io),o=is.dot(il),l=io.dot(io),u=io.dot(il),c=a*l-s*s;if(0===c)return i.set(0,0,0),null;let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return i.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return null!==this.getBarycoord(e,t,n,r,iu)&&iu.x>=0&&iu.y>=0&&iu.x+iu.y<=1}static getInterpolation(e,t,n,r,i,a,s,o){return null===this.getBarycoord(e,t,n,r,iu)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(i,iu.x),o.addScaledVector(a,iu.y),o.addScaledVector(s,iu.z),o)}static getInterpolatedAttribute(e,t,n,r,i,a){return iv.setScalar(0),iy.setScalar(0),i_.setScalar(0),iv.fromBufferAttribute(e,t),iy.fromBufferAttribute(e,n),i_.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(iv,i.x),a.addScaledVector(iy,i.y),a.addScaledVector(i_,i.z),a}static isFrontFacing(e,t,n,r){return is.subVectors(n,t),io.subVectors(e,t),0>is.cross(io).dot(r)}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return is.subVectors(this.c,this.b),io.subVectors(this.a,this.b),.5*is.cross(io).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ix.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ix.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,i){return ix.getInterpolation(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return ix.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ix.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,r,i=this.a,a=this.b,s=this.c;ic.subVectors(a,i),ih.subVectors(s,i),ip.subVectors(e,i);let o=ic.dot(ip),l=ih.dot(ip);if(o<=0&&l<=0)return t.copy(i);im.subVectors(e,a);let u=ic.dot(im),c=ih.dot(im);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(i).addScaledVector(ic,n);ig.subVectors(e,s);let d=ic.dot(ig),p=ih.dot(ig);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(ih,r);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return id.subVectors(s,a),r=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(id,r);let g=1/(m+f+h);return n=f*g,r=h*g,t.copy(i).addScaledVector(ic,n).addScaledVector(ih,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}constructor(e=new nX,t=new nX,n=new nX){this.a=e,this.b=t,this.c=n}}let ib={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},iS={h:0,s:0,l:0},iM={h:0,s:0,l:0};function iw(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}class iE{set(e,t,n){return void 0===t&&void 0===n?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,n),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,n8.colorSpaceToWorking(this,t),this}setRGB(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n8.workingColorSpace;return this.r=e,this.g=t,this.b=n,n8.colorSpaceToWorking(this,r),this}setHSL(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n8.workingColorSpace;if(e=nz(e,1),t=nk(t,0,1),n=nk(n,0,1),0===t)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=iw(i,r,e+1/3),this.g=iw(i,r,e),this.b=iw(i,r,e-1/3)}return n8.colorSpaceToWorking(this,r),this}setStyle(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$;function r(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=t[1],s=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,n);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,n);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=t[1],i=r.length;if(3===i)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,n);if(6===i)return this.setHex(parseInt(r,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$,n=ib[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=n9(e.r),this.g=n9(e.g),this.b=n9(e.b),this}copyLinearToSRGB(e){return this.r=n7(e.r),this.g=n7(e.g),this.b=n7(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;return n8.workingToColorSpace(iT.copy(this),e),65536*Math.round(nk(255*iT.r,0,255))+256*Math.round(nk(255*iT.g,0,255))+Math.round(nk(255*iT.b,0,255))}getHexString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n8.workingColorSpace;n8.workingToColorSpace(iT.copy(this),r);let i=iT.r,a=iT.g,s=iT.b,o=Math.max(i,a,s),l=Math.min(i,a,s),u=(l+o)/2;if(l===o)t=0,n=0;else{let e=o-l;switch(n=u<=.5?e/(o+l):e/(2-o-l),o){case i:t=(a-s)/e+6*(a1&&void 0!==arguments[1]?arguments[1]:n8.workingColorSpace;return n8.workingToColorSpace(iT.copy(this),t),e.r=iT.r,e.g=iT.g,e.b=iT.b,e}getStyle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;n8.workingToColorSpace(iT.copy(this),e);let t=iT.r,n=iT.g,r=iT.b;return e!==t$?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*r),")")}offsetHSL(e,t,n){return this.getHSL(iS),this.setHSL(iS.h+e,iS.s+t,iS.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(iS),e.getHSL(iM);let n=nB(iS.h,iM.h,t),r=nB(iS.s,iM.s,t),i=nB(iS.l,iM.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}}let iT=new iE;iE.NAMES=ib;let iA=0;class iC extends nL{get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."));continue}let r=this[t];if(void 0===r){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."));continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==C&&(n.blending=this.blending),this.side!==w&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==V&&(n.blendSrc=this.blendSrc),this.blendDst!==G&&(n.blendDst=this.blendDst),this.blendEquation!==N&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==en&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==no&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==t3&&(n.stencilFail=this.stencilFail),this.stencilZFail!==t3&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==t3&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:iA++}),this.uuid=nF(),this.name="",this.type="Material",this.blending=C,this.side=w,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=V,this.blendDst=G,this.blendEquation=N,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new iE(0,0,0),this.blendAlpha=0,this.depthFunc=en,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=no,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=t3,this.stencilZFail=t3,this.stencilZPass=t3,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}}class iR extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new iE(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}}let iP=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[256|e]=32768,i[e]=24,i[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,i[e]=-t-1,i[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,i[e]=13,i[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,i[e]=24,i[256|e]=24):(r[e]=31744,r[256|e]=64512,i[e]=13,i[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;(8388608&t)==0;)t<<=1,n-=8388608;t&=-8388609,n+=0x38800000,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:s,offsetTable:o}}();function iI(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=nk(e,-65504,65504),iP.floatView[0]=e;let t=iP.uint32View[0],n=t>>23&511;return iP.baseTable[n]+((8388607&t)>>iP.shiftTable[n])}function iL(e){let t=e>>10;return iP.uint32View[0]=iP.mantissaTable[iP.offsetTable[t]+(1023&e)]+iP.exponentTable[t],iP.floatView[0]}class iN{static toHalfFloat(e){return iI(e)}static fromHalfFloat(e){return iL(e)}}let iD=new nX,iU=new nW,iO=0;class iF{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=nH(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=nV(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=nH(t,this.array)),t}setX(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=nH(t,this.array)),t}setY(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=nH(t,this.array)),t}setZ(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=nH(t,this.array)),t}setW(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array),i=nV(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==ng&&(e.usage=this.usage),e}constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iO++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=ng,this.updateRanges=[],this.gpuType=ej,this.version=0}}class ik extends iF{constructor(e,t,n){super(new Int8Array(e),t,n)}}class iz extends iF{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class iB extends iF{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class iH extends iF{constructor(e,t,n){super(new Int16Array(e),t,n)}}class iV extends iF{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class iG extends iF{constructor(e,t,n){super(new Int32Array(e),t,n)}}class iW extends iF{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class ij extends iF{getX(e){let t=iL(this.array[e*this.itemSize]);return this.normalized&&(t=nH(t,this.array)),t}setX(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize]=iI(t),this}getY(e){let t=iL(this.array[e*this.itemSize+1]);return this.normalized&&(t=nH(t,this.array)),t}setY(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+1]=iI(t),this}getZ(e){let t=iL(this.array[e*this.itemSize+2]);return this.normalized&&(t=nH(t,this.array)),t}setZ(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+2]=iI(t),this}getW(e){let t=iL(this.array[e*this.itemSize+3]);return this.normalized&&(t=nH(t,this.array)),t}setW(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+3]=iI(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this.array[e+2]=iI(r),this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array),i=nV(i,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this.array[e+2]=iI(r),this.array[e+3]=iI(i),this}constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}}class iX extends iF{constructor(e,t,n){super(new Float32Array(e),t,n)}}let iq=0,iY=new rH,iJ=new ia,iZ=new nX,iK=new rf,i$=new rf,iQ=new nX;class i0 extends nL{getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(nK(e)?iW:iV)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(void 0!==n){let t=new nJ().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return iY.makeRotationFromQuaternion(e),this.applyMatrix4(iY),this}rotateX(e){return iY.makeRotationX(e),this.applyMatrix4(iY),this}rotateY(e){return iY.makeRotationY(e),this.applyMatrix4(iY),this}rotateZ(e){return iY.makeRotationZ(e),this.applyMatrix4(iY),this}translate(e,t,n){return iY.makeTranslation(e,t,n),this.applyMatrix4(iY),this}scale(e,t,n){return iY.makeScale(e,t,n),this.applyMatrix4(iY),this}lookAt(e){return iJ.lookAt(e),iJ.updateMatrix(),this.applyMatrix4(iJ.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(iZ).negate(),this.translate(iZ.x,iZ.y,iZ.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let n=0,r=e.length;nt.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new rf);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new nX(-1/0,-1/0,-1/0),new nX(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2)||(i1.copy(i).invert(),i2.copy(e.ray).applyMatrix4(i1),(null===n.boundingBox||!1!==i2.intersectsBox(n.boundingBox))&&this._computeIntersections(e,t,i2))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,s=i.index,o=i.attributes.position,l=i.attributes.uv,u=i.attributes.uv1,c=i.attributes.normal,h=i.groups,d=i.drawRange;if(null!==s)if(Array.isArray(a))for(let i=0,o=h.length;in.far?null:{distance:l,point:at.clone(),object:e}}(e,t,n,r,i5,i6,i8,ae);if(c){let e=new nX;ix.getBarycoord(ae,i5,i6,i8,e),i&&(c.uv=ix.getInterpolatedAttribute(i,o,l,u,e,new nW)),a&&(c.uv1=ix.getInterpolatedAttribute(a,o,l,u,e,new nW)),s&&(c.normal=ix.getInterpolatedAttribute(s,o,l,u,e,new nX),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:u,normal:new nX,materialIndex:0};ix.getNormal(i5,i6,i8,t.normal),c.face=t,c.barycoord=e}return c}class ai extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ai(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let s=this;r=Math.floor(r),i=Math.floor(i);let o=[],l=[],u=[],c=[],h=0,d=0;function p(e,t,n,r,i,a,p,f,m,g,v){let y=a/m,_=p/g,x=a/2,b=p/2,S=f/2,M=m+1,w=g+1,E=0,T=0,A=new nX;for(let a=0;a0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),E+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}}class ac extends ia{get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rH,this.projectionMatrix=new rH,this.projectionMatrixInverse=new rH,this.coordinateSystem=nA,this._reversedDepth=!1}}let ah=new nX,ad=new nW,ap=new nW;class af extends ac{copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*nO*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*nU*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*nO*Math.atan(Math.tan(.5*nU*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ah.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ah.x,ah.y).multiplyScalar(-e/ah.z),ah.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ah.x,ah.y).multiplyScalar(-e/ah.z)}getViewSize(e,t){return this.getViewBounds(e,ad,ap),t.subVectors(ap,ad)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*nU*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/s,r*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(i+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}}class am extends ia{updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,s,o]=t;for(let e of t)this.remove(e);if(e===nA)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(e===nC)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,s,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,s),e.setRenderTarget(n,3,r),e.render(t,o),e.setRenderTarget(n,4,r),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(c,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new af(-90,1,e,t);r.layers=this.layers,this.add(r);let i=new af(-90,1,e,t);i.layers=this.layers,this.add(i);let a=new af(-90,1,e,t);a.layers=this.layers,this.add(a);let s=new af(-90,1,e,t);s.layers=this.layers,this.add(s);let o=new af(-90,1,e,t);o.layers=this.layers,this.add(o);let l=new af(-90,1,e,t);l.layers=this.layers,this.add(l)}}class ag extends rs{get images(){return this.image}set images(e){this.image=e}constructor(e=[],t=eb,n,r,i,a,s,o,l,u){super(e,t,n,r,i,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}}class av extends ru{fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n=new ai(5,5,5),r=new au({name:"CubemapFromEquirect",uniforms:aa({tEquirect:{value:null}}),vertexShader:"\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include \n #include \n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include \n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n ",side:E,blending:A});r.uniforms.tEquirect.value=t;let i=new an(n,r),a=t.minFilter;return t.minFilter===eF&&(t.minFilter=eD),new am(1,10,this).update(e,i),t.minFilter=a,i.geometry.dispose(),i.material.dispose(),this}clear(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1};this.texture=new ag([n,n,n,n,n,n]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}}class ay extends ia{constructor(){super(),this.isGroup=!0,this.type="Group"}}let a_={type:"move"};class ax{getHandSpace(){return null===this._hand&&(this._hand=new ay,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ay,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new nX,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new nX),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ay,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new nX,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new nX),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let r of(a=!0,e.hand.values())){let e=t.getJointPose(r,n),i=this._getHandJoint(l,r);null!==e&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=null!==e}let r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],s=r.position.distanceTo(i.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(a_)))}return null!==s&&(s.visible=null!==r),null!==o&&(o.visible=null!==i),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let n=new ay;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}constructor(){this._targetRay=null,this._grip=null,this._hand=null}}class ab{clone(){return new ab(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new iE(e),this.density=t}}class aS{clone(){return new aS(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new iE(e),this.near=t,this.far=n}}class aM extends ia{copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new rK,this.environmentIntensity=1,this.environmentRotation=new rK,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class aw{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=nF()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=nF()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=ng,this.updateRanges=[],this.version=0,this.uuid=nF()}}let aE=new nX;class aT{get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;te.far||t.push({distance:o,point:aC.clone(),uv:ix.getInterpolation(aC,aD,aU,aO,aF,ak,az,new nW),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}constructor(e=new aA){if(super(),this.isSprite=!0,this.type="Sprite",void 0===n){n=new i0;let e=new aw(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);n.setIndex([0,1,2,0,2,3]),n.setAttribute("position",new aT(e,3,0,!1)),n.setAttribute("uv",new aT(e,2,3,!1))}this.geometry=n,this.material=e,this.center=new nW(.5,.5),this.count=1}}function aH(e,t,n,r,i,a){aI.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(aL.x=a*aI.x-i*aI.y,aL.y=i*aI.x+a*aI.y):aL.copy(aI),e.copy(t),e.x+=aL.x,e.y+=aL.y,e.applyMatrix4(aN)}let aV=new nX,aG=new nX;class aW extends ia{copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;n=Math.abs(n);let i=this.levels;for(t=0;t0){let n,r;for(n=1,r=t.length;n0){aV.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo(aV);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){let n,r;aV.setFromMatrixPosition(e.matrixWorld),aG.setFromMatrixPosition(this.matrixWorld);let i=aV.distanceTo(aG)/e.zoom;for(n=1,t[0].object.visible=!0,r=t.length;n=e)t[n-1].object.visible=!1,t[n].object.visible=!0;else break}for(this._currentLevel=n-1;n1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||so.getNormalMatrix(e),r=this.coplanarPoint(sa).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}constructor(e=new nX(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}}let su=new rL,sc=new nW(.5,.5),sh=new nX;class sd{set(e,t,n,r,i,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nA,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.planes,i=e.elements,a=i[0],s=i[1],o=i[2],l=i[3],u=i[4],c=i[5],h=i[6],d=i[7],p=i[8],f=i[9],m=i[10],g=i[11],v=i[12],y=i[13],_=i[14],x=i[15];if(r[0].setComponents(l-a,d-u,g-p,x-v).normalize(),r[1].setComponents(l+a,d+u,g+p,x+v).normalize(),r[2].setComponents(l+s,d+c,g+f,x+y).normalize(),r[3].setComponents(l-s,d-c,g-f,x-y).normalize(),n)r[4].setComponents(o,h,m,_).normalize(),r[5].setComponents(l-o,d-h,g-m,x-_).normalize();else if(r[4].setComponents(l-o,d-h,g-m,x-_).normalize(),t===nA)r[5].setComponents(l+o,d+h,g+m,x+_).normalize();else if(t===nC)r[5].setComponents(o,h,m,_).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),su.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),su.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(su)}intersectsSprite(e){return su.center.set(0,0,0),su.radius=.7071067811865476+sc.distanceTo(e.center),su.applyMatrix4(e.matrixWorld),this.intersectsSphere(su)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,sh.y=r.normal.y>0?e.max.y:e.min.y,sh.z=r.normal.z>0?e.max.z:e.min.z,0>r.distanceToPoint(sh))return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(0>t[n].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}constructor(e=new sl,t=new sl,n=new sl,r=new sl,i=new sl,a=new sl){this.planes=[e,t,n,r,i,a]}}let sp=new rH,sf=new sd;class sm{intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let n=0;n=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let s=i[this.index];a.push(s),this.index++,s.start=e,s.count=t,s.z=n,s.index=r}reset(){this.list.length=0,this.index=0}constructor(){this.index=0,this.pool=[],this.list=[]}},sR=new an,sP=[];function sI(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let r=0;r65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new iF(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let n in t.attributes){if(!e.hasAttribute(n))throw Error('THREE.BatchedMesh: Added geometry missing "'.concat(n,'". All geometries must have consistent attributes.'));let r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error("THREE.BatchedMesh: Invalid instanceId ".concat(e,". Instance is either out of range or has been deleted."))}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error("THREE.BatchedMesh: Invalid geometryId ".concat(e,". Geometry is either out of range or has been deleted."))}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new rf);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sg),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let r=this._matricesTexture;s_.identity().toArray(r.image.data,16*n),r.needsUpdate=!0;let i=this._colorsTexture;return i&&(sx.toArray(i.image.data,4*n),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this._initializeGeometry(e),this._validateGeometry(e);let i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},a=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===n?e.getAttribute("position").count:n;let s=e.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===r?s.count:r),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sg),a[t=this._availableGeometryIds.shift()]=i):(t=this._geometryCount,this._geometryCount++,a.push(i)),this.setGeometryAt(t,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,t}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);let n=this.geometry,r=null!==n.getIndex(),i=n.getIndex(),a=t.getIndex(),s=this._geometryInfo[e];if(r&&a.count>s.reservedIndexCount||t.attributes.position.count>s.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=s.vertexStart,l=s.reservedVertexCount;for(let e in s.vertexCount=t.getAttribute("position").count,n.attributes){let r=t.getAttribute(e),i=n.getAttribute(e);!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let i=e.count;for(let a=0;a=t.length||!1===t[e].active)return this;let n=this._instanceInfo;for(let t=0,r=n.length;tt).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let a=0,s=n.length;a=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(null===r.boundingBox){let e=new rf,t=n.index,i=n.attributes.position;for(let n=r.start,a=r.start+r.count;n=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(null===r.boundingSphere){let t=new rL;this.getBoundingBoxAt(e,sM),sM.getCenter(t.center);let i=n.index,a=n.attributes.position,s=0;for(let e=r.start,n=r.start+r.count;e1&&void 0!==arguments[1]?arguments[1]:{};this.validateGeometryId(e);let n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){let t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(sg);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(ee.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error("BatchedMesh: Geometry vertex values are being used outside the range ".concat(t,". Cannot shrink further."));if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error("BatchedMesh: Geometry index values are being used outside the range ".concat(t,". Cannot shrink further."));let r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new i0,this._initializeGeometry(r));let i=this.geometry;for(let e in r.index&&sI(r.index.array,i.index.array),r.attributes)sI(r.attributes[e].array,i.attributes[e].array)}raycast(e,t){let n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,a=this.geometry;sR.material=this.material,sR.geometry.index=a.index,sR.geometry.attributes=a.attributes,null===sR.geometry.boundingBox&&(sR.geometry.boundingBox=new rf),null===sR.geometry.boundingSphere&&(sR.geometry.boundingSphere=new rL);for(let a=0,s=n.length;a({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,i){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=r.getIndex(),s=null===a?1:a.array.BYTES_PER_ELEMENT,o=this._instanceInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,c=this._geometryInfo,h=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data,f=n.isArrayCamera?sS:sb;h&&!n.isArrayCamera&&(s_.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),sb.setFromProjectionMatrix(s_,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sE.setFromMatrixPosition(n.matrixWorld).applyMatrix4(s_),sT.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(s_);for(let e=0,t=o.length;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;sz.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(sz);if(!(lt.far))return{distance:l,point:sB.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let sG=new nX,sW=new nX;class sj extends sH{computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class s0 extends rs{clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}constructor(e,t,n,r,i=eD,a=eD,s,o,l){super(e,t,n,r,i,a,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let u=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}}class s1 extends s0{update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}constructor(e,t,n,r,i,a,s,o){super({},e,t,n,r,i,a,s,o),this.isVideoFrameTexture=!0}}class s2 extends rs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=eR,this.minFilter=eR,this.generateMipmaps=!1,this.needsUpdate=!0}}class s3 extends rs{constructor(e,t,n,r,i,a,s,o,l,u,c,h){super(null,a,s,o,l,u,r,i,c,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class s4 extends s3{addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}constructor(e,t,n,r,i,a){super(e,t,n,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=eA,this.layerUpdates=new Set}}class s5 extends s3{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,eb),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class s6 extends rs{constructor(e,t,n,r,i,a,s,o,l){super(e,t,n,r,i,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class s8 extends rs{copy(e){return super.copy(e),this.source=new rn(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}constructor(e,t,n=eW,r,i,a,s=eR,o=eR,l,u=e1,c=1){if(u!==e1&&u!==e2)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},r,i,a,s,o,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}}class s9 extends rs{copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}}class s7 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s7(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r));let a=[],s=[],o=[],l=[],u=t/2,c=Math.PI/2*e,h=t,d=2*c+h,p=2*n+(i=Math.max(1,Math.floor(i))),f=r+1,m=new nX,g=new nX;for(let v=0;v<=p;v++){let y=0,_=0,x=0,b=0;if(v<=n){let t=v/n,r=t*Math.PI/2;_=-u-e*Math.cos(r),x=e*Math.sin(r),b=-e*Math.cos(r),y=t*c}else if(v<=n+i){let r=(v-n)/i;_=-u+r*t,x=e,b=0,y=c+r*h}else{let t=(v-n-i)/n,r=t*Math.PI/2;_=u+e*Math.sin(r),x=e*Math.cos(r),b=e*Math.sin(r),y=c+h+t*c}let S=Math.max(0,Math.min(1,y/d)),M=0;0===v?M=.5/r:v===p&&(M=-.5/r);for(let e=0;e<=r;e++){let t=e/r,n=t*Math.PI*2,i=Math.sin(n),a=Math.cos(n);g.x=-x*a,g.y=_,g.z=x*i,s.push(g.x,g.y,g.z),m.set(-x*a,b,x*i),m.normalize(),o.push(m.x,m.y,m.z),l.push(t+M,S)}if(v>0){let e=(v-1)*f;for(let t=0;t0||0!==r)&&(u.push(a,s,l),y+=3),(t>0||r!==i-1)&&(u.push(s,o,l),y+=3)}l.addGroup(g,y,0),g+=y})(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new iX(c,3)),this.setAttribute("normal",new iX(h,3)),this.setAttribute("uv",new iX(d,2))}}class on extends ot{static fromJSON(e){return new on(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}constructor(e=1,t=1,n=32,r=1,i=!1,a=0,s=2*Math.PI){super(0,e,t,n,r,i,a,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:s}}}class or extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new or(e.vertices,e.indices,e.radius,e.details)}constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};let i=[],a=[];function s(e){i.push(e.x,e.y,e.z)}function o(t,n){let r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function l(e,t,n,r){r<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}(function(e){let n=new nX,r=new nX,i=new nX;for(let a=0;a.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new iX(i,3)),this.setAttribute("normal",new iX(i.slice(),3)),this.setAttribute("uv",new iX(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}class oi extends or{static fromJSON(e){return new oi(e.radius,e.detail)}constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}}let oa=new nX,os=new nX,oo=new nX,ol=new ix;class ou extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){let n=Math.cos(nU*t),r=e.getIndex(),i=e.getAttribute("position"),a=r?r.count:i.count,s=[0,0,0],o=["a","b","c"],l=[,,,],u={},c=[];for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)t.push(i+=(n=this.getPoint(a/e)).distanceTo(r)),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.getLengths(),i=0,a=r.length;t=n||e*r[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=r[i=Math.floor(s+(o-s)/2)]-t)<0)s=i+1;else if(l>0)o=i-1;else{o=i;break}if(r[i=o]===t)return i/(a-1);let u=r[i],c=r[i+1];return(i+(t-u)/(c-u))/(a-1)}getTangent(e,t){let n=e-1e-4,r=e+1e-4;n<0&&(n=0),r>1&&(r=1);let i=this.getPoint(n),a=this.getPoint(r),s=t||(i.isVector2?new nW:new nX);return s.copy(a).sub(i).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new nX,r=[],i=[],a=[],s=new nX,o=new rH;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new nX)}i[0]=new nX,a[0]=new nX;let l=Number.MAX_VALUE,u=Math.abs(r[0].x),c=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=l&&(l=u,n.set(1,0,0)),c<=l&&(l=c,n.set(0,1,0)),h<=l&&n.set(0,0,1),s.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],s),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(r[t-1],r[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(nk(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(r[t],i[t])}if(!0===t){let t=Math.acos(nk(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(s.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(o.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}}class oh extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,i=Math.abs(r)n;)r-=n;r1&&void 0!==arguments[1]?arguments[1]:new nX,i=this.points,a=i.length,s=(a-!this.closed)*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?t=i[(o-1)%a]:(of.subVectors(i[0],i[1]).add(i[0]),t=of);let u=i[o%a],c=i[(o+1)%a];if(this.closed||o+21&&void 0!==arguments[1]?arguments[1]:new nW,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(ob(e,n.x,r.x,i.x,a.x),ob(e,n.y,r.y,i.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new nW,t=new nW,n=new nW,r=new nW){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}}class oM extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(ob(e,n.x,r.x,i.x,a.x),ob(e,n.y,r.y,i.y,a.y),ob(e,n.z,r.z,i.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new nX,t=new nX,n=new nX,r=new nX){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}}class ow extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nW,t=new nW){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}}class oE extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nX,t=new nX){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}}class oT extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=this.v0,r=this.v1,i=this.v2;return t.set(ox(e,n.x,r.x,i.x),ox(e,n.y,r.y,i.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nW,t=new nW,n=new nW){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}}class oA extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX,n=this.v0,r=this.v1,i=this.v2;return t.set(ox(e,n.x,r.x,i.x),ox(e,n.y,r.y,i.y),ox(e,n.z,r.z,i.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nX,t=new nX,n=new nX){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}}class oC extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=this.points,r=(n.length-1)*e,i=Math.floor(r),a=r-i,s=n[0===i?i:i-1],o=n[i],l=n[i>n.length-2?n.length-1:i+1],u=n[i>n.length-3?n.length-1:i+2];return t.set(o_(a,s.x,o.x,l.x,u.x),o_(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){let e=r[i]-n,a=this.curves[i],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n0&&void 0!==arguments[0]?arguments[0]:40,t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[];for(let r=0,i=this.curves;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}constructor(e){super(),this.type="Path",this.currentPoint=new nW,e&&this.setFromPoints(e)}}class oL extends oI{getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n0)for(let i=t;i=t;i-=r)a=oX(i/r|0,e[i],e[i+1],a);return a&&oB(a,a.next)&&(oq(a),a=a.next),a}function oD(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(oB(n,n.next)||0===oz(n.prev,n,n.next))){if(oq(n),(n=t=n.prev)===n.next)break;r=!0}else n=n.next;while(r||n!==t)return t}function oU(e,t){let n=e.x-t.x;return 0===n&&0==(n=e.y-t.y)&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function oO(e,t,n,r,i){return(e=((e=((e=((e=((e=(e-n)*i|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-r)*i|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function oF(e,t,n,r,i,a,s,o){return(i-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(r-o)>=(n-s)*(t-o)&&(n-s)*(a-o)>=(i-s)*(r-o)}function ok(e,t,n,r,i,a,s,o){return(e!==s||t!==o)&&oF(e,t,n,r,i,a,s,o)}function oz(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function oB(e,t){return e.x===t.x&&e.y===t.y}function oH(e,t,n,r){let i=oG(oz(e,t,n)),a=oG(oz(e,t,r)),s=oG(oz(n,r,e)),o=oG(oz(n,r,t));return!!(i!==a&&s!==o||0===i&&oV(e,n,t)||0===a&&oV(e,r,t)||0===s&&oV(n,e,r)||0===o&&oV(n,t,r))}function oV(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function oG(e){return e>0?1:e<0?-1:0}function oW(e,t){return 0>oz(e.prev,e,e.next)?oz(e,t,e.next)>=0&&oz(e,e.prev,t)>=0:0>oz(e,t,e.prev)||0>oz(e,e.next,t)}function oj(e,t){let n=oY(e.i,e.x,e.y),r=oY(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function oX(e,t,n,r){let i=oY(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function oq(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function oY(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class oJ{static triangulate(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;return function(e,t){let n,r,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,s=t&&t.length,o=s?t[0]*a:e.length,l=oN(e,0,o,a,!0),u=[];if(!l||l.next===l.prev)return u;if(s&&(l=function(e,t,n,r){let i=[];for(let n=0,a=t.length;n=r.next.y&&r.next.y!==r.y){let e=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=i&&e>s&&(s=e,n=r.x=r.x&&r.x>=l&&i!==r.x&&oF(an.x||r.x===n.x&&(h=n,d=r,0>oz(h.prev,h,d.prev)&&0>oz(d.next,h,h.next))))&&(n=r,c=t)}r=r.next}while(r!==o)return n}(e,t);if(!n)return t;let r=oj(n,e);return oD(r,r.next),oD(n,n.next)}(i[e],n);return n}(e,t,l,a)),e.length>80*a){n=1/0,r=1/0;let t=-1/0,s=-1/0;for(let i=a;it&&(t=a),o>s&&(s=o)}i=0!==(i=Math.max(t-n,s-r))?32767/i:0}return function e(t,n,r,i,a,s,o){if(!t)return;!o&&s&&function(e,t,n,r){let i=e;do 0===i.z&&(i.z=oO(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e)i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let a=null;for(t=0;i;){t++;let s=i,o=0;for(let e=0;e0||l>0&&s;)0!==o&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,o--):(r=s,s=s.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=s}a.nextZ=null,n*=2}while(t>1)}(i)}(t,i,a,s);let l=t;for(;t.prev!==t.next;){let u=t.prev,c=t.next;if(s?function(e,t,n,r){let i=e.prev,a=e.next;if(oz(i,e,a)>=0)return!1;let s=i.x,o=e.x,l=a.x,u=i.y,c=e.y,h=a.y,d=Math.min(s,o,l),p=Math.min(u,c,h),f=Math.max(s,o,l),m=Math.max(u,c,h),g=oO(d,p,t,n,r),v=oO(f,m,t,n,r),y=e.prevZ,_=e.nextZ;for(;y&&y.z>=g&&_&&_.z<=v;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&ok(s,u,o,c,l,h,y.x,y.y)&&oz(y.prev,y,y.next)>=0||(y=y.prevZ,_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&ok(s,u,o,c,l,h,_.x,_.y)&&oz(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;y&&y.z>=g;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&ok(s,u,o,c,l,h,y.x,y.y)&&oz(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&ok(s,u,o,c,l,h,_.x,_.y)&&oz(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}(t,i,a,s):function(e){let t=e.prev,n=e.next;if(oz(t,e,n)>=0)return!1;let r=t.x,i=e.x,a=n.x,s=t.y,o=e.y,l=n.y,u=Math.min(r,i,a),c=Math.min(s,o,l),h=Math.max(r,i,a),d=Math.max(s,o,l),p=n.next;for(;p!==t;){if(p.x>=u&&p.x<=h&&p.y>=c&&p.y<=d&&ok(r,s,i,o,a,l,p.x,p.y)&&oz(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){n.push(u.i,t.i,c.i),oq(t),t=c.next,l=c.next;continue}if((t=c)===l){o?1===o?e(t=function(e,t){let n=e;do{let r=n.prev,i=n.next.next;!oB(r,i)&&oH(r,n,n.next,i)&&oW(r,i)&&oW(i,r)&&(t.push(r.i,n.i,i.i),oq(n),oq(n.next),n=e=i),n=n.next}while(n!==e)return oD(n)}(oD(t),n),n,r,i,a,s,2):2===o&&function(t,n,r,i,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,u;if(o.i!==t.i&&(l=o,u=t,l.next.i!==u.i&&l.prev.i!==u.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&oH(n,n.next,e,t))return!0;n=n.next}while(n!==e)return!1}(l,u)&&(oW(l,u)&&oW(u,l)&&function(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e)return r}(l,u)&&(oz(l.prev,l,u.prev)||oz(l,u.prev,u))||oB(l,u)&&oz(l.prev,l,l.next)>0&&oz(u.prev,u,u.next)>0))){let l=oj(o,t);o=oD(o,o.next),l=oD(l,l.next),e(o,n,r,i,a,s,0),e(l,n,r,i,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,n,r,i,a,s):e(oD(t),n,r,i,a,s,1);break}}}(l,u,a,n,r,i,0),u}(e,t,n)}}class oZ{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;ioZ.area(e)}static triangulateShape(e,t){let n=[],r=[],i=[];oK(e),o$(n,e);let a=e.length;t.forEach(oK);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function o$(e,t){for(let n=0;nNumber.EPSILON){let h=Math.sqrt(c),d=Math.sqrt(l*l+u*u),p=t.x-o/h,f=t.y+s/h,m=((n.x-u/d-p)*u-(n.y+l/d-f)*l)/(s*u-o*l),g=(r=p+s*m-e.x)*r+(i=f+o*m-e.y)*i;if(g<=2)return new nW(r,i);a=Math.sqrt(g/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(r=-o,i=s,a=Math.sqrt(c)):(r=s,i=o,a=Math.sqrt(c/2))}return new nW(r/a,i/a)}let L=[];for(let e=0,t=C.length,n=t-1,r=e+1;e=0;e--){let t=e/y,n=m*Math.cos(t*Math.PI/2),r=g*Math.sin(t*Math.PI/2)+v;for(let e=0,t=C.length;e=0;){let a=i,s=i-1;s<0&&(s=e.length-1);for(let e=0,i=d+2*y;e0)&&d.push(t,i,l),(e!==n-1||o0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new nW(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return nk(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new iE(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new iE(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new iE(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}}class lu extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new iE(0xffffff),this.specular=new iE(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lc extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new iE(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}}class lh extends iC{copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}}class ld extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new iE(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lp extends iC{copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=tj,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}}class lf extends iC{copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}}class lm extends iC{copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new iE(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lg extends sN{copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}}function lv(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function ly(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function l_(e){let t=e.length,n=Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function lx(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,s=0;s!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[s++]=e[r+n]}return i}function lb(e,t,n,r){let i=1,a=e[0];for(;void 0!==a&&void 0===a[r];)a=e[i++];if(void 0===a)return;let s=a[r];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[r])&&(t.push(a.time),n.push(...s)),a=e[i++];while(void 0!==a)else if(void 0!==s.toArray)do void 0!==(s=a[r])&&(t.push(a.time),s.toArray(n,n.length)),a=e[i++];while(void 0!==a)else do void 0!==(s=a[r])&&(t.push(a.time),n.push(s)),a=e[i++];while(void 0!==a)}class lS{static convertArray(e,t){return lv(e,t)}static isTypedArray(e){return ly(e)}static getKeyframeOrder(e){return l_(e)}static sortedArray(e,t,n){return lx(e,t,n)}static flattenJSON(e,t,n,r){lb(e,t,n,r)}static subclip(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30;return function(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;let s=[];for(let e=0;e=r)){l.push(t.times[e]);for(let n=0;na.tracks[e].times[0]&&(o=a.tracks[e].times[0]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);let i=n.tracks.length,a=t/r;for(let t=0;t=i.times[d]){let e=d*u+l,t=e+u-l;r=i.values.slice(e,t)}else{let e=i.createInterpolant(),t=l,n=u-l;e.evaluate(a),r=e.resultBuffer.slice(t,n)}"quaternion"===s&&new nj().fromArray(r).normalize().conjugate().toArray(r);let p=o.times.length;for(let e=0;e=i)){let s=t[1];e=(i=t[--n-1]))break r}a=n,n=0;break i}break n}for(;n>>1;et;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==a&&a>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,a),e=!1;break}a=r}if(void 0!==r&&ly(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===tO,i=e.length-1,a=1;for(let s=1;s0){e[a]=e[i];for(let e=i*n,r=a*n,s=0;s!==n;++s)t[r+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}constructor(e,t,n,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=lv(t,this.TimeBufferType),this.values=lv(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}}lA.prototype.ValueTypeName="",lA.prototype.TimeBufferType=Float32Array,lA.prototype.ValueBufferType=Float32Array,lA.prototype.DefaultInterpolation=tU;class lC extends lA{constructor(e,t,n){super(e,t,n)}}lC.prototype.ValueTypeName="bool",lC.prototype.ValueBufferType=Array,lC.prototype.DefaultInterpolation=tD,lC.prototype.InterpolantFactoryMethodLinear=void 0,lC.prototype.InterpolantFactoryMethodSmooth=void 0;class lR extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lR.prototype.ValueTypeName="color";class lP extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lP.prototype.ValueTypeName="number";class lI extends lM{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(r-t),l=e*s;for(let e=l+s;l!==e;l+=4)nj.slerpFlat(i,0,a,l-s,a,l,o);return i}constructor(e,t,n,r){super(e,t,n,r)}}class lL extends lA{InterpolantFactoryMethodLinear(e){return new lI(this.times,this.values,this.getValueSize(),e)}constructor(e,t,n,r){super(e,t,n,r)}}lL.prototype.ValueTypeName="quaternion",lL.prototype.InterpolantFactoryMethodSmooth=void 0;class lN extends lA{constructor(e,t,n){super(e,t,n)}}lN.prototype.ValueTypeName="string",lN.prototype.ValueBufferType=Array,lN.prototype.DefaultInterpolation=tD,lN.prototype.InterpolantFactoryMethodLinear=void 0,lN.prototype.InterpolantFactoryMethodSmooth=void 0;class lD extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lD.prototype.ValueTypeName="vector";class lU{static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return lP;case"vector":case"vector2":case"vector3":case"vector4":return lD;case"color":return lR;case"quaternion":return lL;case"bool":case"boolean":return lC;case"string":return lN}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],n=[];lb(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i.userData=JSON.parse(e.userData||"{}"),i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=n.length;e!==r;++e)t.push(lA.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(e,t,n,r,i){if(0!==n.length){let a=[],s=[];lb(n,a,s,r),0!==a.length&&i.push(new e(t,a,s))}},r=[],i=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(void 0!==lB[e])return void lB[e].push({onLoad:t,onProgress:n,onError:r});lB[e]=[],lB[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let n=lB[e],r=t.body.getReader(),i=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=i?parseInt(i):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){r.read().then(r=>{let{done:i,value:l}=r;if(i)e.close();else{let r=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=l.byteLength,total:a});for(let e=0,t=n.length;e{e.error(t)})}()}}))}throw new lH('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),n=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{lO.add("file:".concat(e),t);let n=lB[e];delete lB[e];for(let e=0,r=n.length;e{let n=lB[e];if(void 0===n)throw this.manager.itemError(e),t;delete lB[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}}class lG extends lz{load(e,t,n,r){let i=this,a=new lV(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=[];for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),l5.setFromMatrixPosition(e.matrixWorld),n.position.copy(l5),l6.copy(n.position),l6.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(l6),n.updateMatrixWorld(),r.makeTranslation(-l5.x,-l5.y,-l5.z),l4.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(l4,n.coordinateSystem,n.reversedDepth)}constructor(){super(new af(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new nW(4,2),this._viewportCount=6,this._viewports=[new ro(2,1,1,1),new ro(0,1,1,1),new ro(3,1,1,1),new ro(1,1,1,1),new ro(3,0,1,1),new ro(1,0,1,1)],this._cubeDirections=[new nX(1,0,0),new nX(-1,0,0),new nX(0,0,1),new nX(0,0,-1),new nX(0,1,0),new nX(0,-1,0)],this._cubeUps=[new nX(0,1,0),new nX(0,1,0),new nX(0,1,0),new nX(0,1,0),new nX(0,0,1),new nX(0,0,-1)]}}class l9 extends lZ{get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new l8}}class l7 extends ac{copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,s=r+t,o=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}}class ue extends l1{constructor(){super(new l7(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ut extends lZ{dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.target=new ia,this.shadow=new ue}}class un extends lZ{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class ur extends lZ{get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}}class ui{set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){let n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new nX)}}class ua extends lZ{copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}constructor(e=new ui,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}}class us extends lz{load(e,t,n,r){let i=this,a=new lV(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}let r=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=e.sheen),void 0!==e.sheenColor&&(r.sheenColor=new iE().setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(r.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.specularIntensity&&(r.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(r.dispersion=e.dispersion),void 0!==e.iridescence&&(r.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(r.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.thickness&&(r.thickness=e.thickness),void 0!==e.attenuationDistance&&(r.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(r.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(r.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.shadowSide&&(r.shadowSide=e.shadowSide),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(r.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(r.depthFunc=e.depthFunc),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(r.blendSrc=e.blendSrc),void 0!==e.blendDst&&(r.blendDst=e.blendDst),void 0!==e.blendEquation&&(r.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(r.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(r.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(r.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==r.blendColor&&r.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(r.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),void 0!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.alphaToCoverage&&(r.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(r.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(r.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(let t in e.uniforms){let i=e.uniforms[t];switch(r.uniforms[t]={},i.type){case"t":r.uniforms[t].value=n(i.value);break;case"c":r.uniforms[t].value=new iE().setHex(i.value);break;case"v2":r.uniforms[t].value=new nW().fromArray(i.value);break;case"v3":r.uniforms[t].value=new nX().fromArray(i.value);break;case"v4":r.uniforms[t].value=new ro().fromArray(i.value);break;case"m3":r.uniforms[t].value=new nJ().fromArray(i.value);break;case"m4":r.uniforms[t].value=new rH().fromArray(i.value);break;default:r.uniforms[t].value=i.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(r.glslVersion=e.glslVersion),void 0!==e.extensions)for(let t in e.extensions)r.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(r.lights=e.lights),void 0!==e.clipping&&(r.clipping=e.clipping),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),r.normalScale=new nW().fromArray(t)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(r.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(r.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapRotation&&r.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=new nW().fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(r.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(r.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(r.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(r.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(r.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return us.createMaterialFromType(e)}static createMaterialFromType(e){return new({ShadowMaterial:la,SpriteMaterial:aA,RawShaderMaterial:ls,ShaderMaterial:au,PointsMaterial:sq,MeshPhysicalMaterial:ll,MeshStandardMaterial:lo,MeshPhongMaterial:lu,MeshToonMaterial:lc,MeshNormalMaterial:lh,MeshLambertMaterial:ld,MeshDepthMaterial:lp,MeshDistanceMaterial:lf,MeshBasicMaterial:iR,MeshMatcapMaterial:lm,LineDashedMaterial:lg,LineBasicMaterial:sN,Material:iC})[e]}constructor(e){super(e),this.textures={}}}class uo{static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}}class ul extends i0{copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}}class uu extends lz{load(e,t,n,r){let i=this,a=new lV(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t={},n={};function r(e,r){if(void 0!==t[r])return t[r];let i=e.interleavedBuffers[r],a=function(e,t){if(void 0!==n[t])return n[t];let r=new Uint32Array(e.arrayBuffers[t]).buffer;return n[t]=r,r}(e,i.buffer),s=new aw(nQ(i.type,a),i.stride);return s.uuid=i.uuid,t[r]=s,s}let i=e.isInstancedBufferGeometry?new ul:new i0,a=e.data.index;if(void 0!==a){let e=nQ(a.type,a.array);i.setIndex(new iF(e,1))}let s=e.data.attributes;for(let t in s){let n,a=s[t];if(a.isInterleavedBufferAttribute)n=new aT(r(e.data,a.data),a.itemSize,a.offset,a.normalized);else{let e=nQ(a.type,a.array);n=new(a.isInstancedBufferAttribute?a6:iF)(e,a.itemSize,a.normalized)}void 0!==a.name&&(n.name=a.name),void 0!==a.usage&&n.setUsage(a.usage),i.setAttribute(t,n)}let o=e.data.morphAttributes;if(o)for(let t in o){let n=o[t],a=[];for(let t=0,i=n.length;t0){(n=new lX(new lF(t))).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){(t=new lX(this.manager)).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t{let t=null,n=null;return void 0!==e.boundingBox&&(t=new rf().fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(n=new rL().fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(a._colorsTexture=c(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(a.boundingSphere=new rL().fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&(a.boundingBox=new rf().fromJSON(e.boundingBox));break;case"LOD":a=new aW;break;case"Line":a=new sH(l(e.geometry),u(e.material));break;case"LineLoop":a=new sX(l(e.geometry),u(e.material));break;case"LineSegments":a=new sj(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new s$(l(e.geometry),u(e.material));break;case"Sprite":a=new aB(u(e.material));break;case"Group":a=new ay;break;case"Bone":a=new a1;break;default:a=new ia}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.up&&a.up.fromArray(e.up),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(a.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children){let s=e.children;for(let e=0;e{if(!0!==uf.has(a))return t&&t(n),i.manager.itemEnd(e),n;r&&r(uf.get(a)),i.manager.itemError(e),i.manager.itemEnd(e)}):(setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(n){return lO.add("image-bitmap:".concat(e),n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),uf.set(o,t),lO.remove("image-bitmap:".concat(e)),i.manager.itemError(e),i.manager.itemEnd(e)});lO.add("image-bitmap:".concat(e),o),i.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}}class ug{static getContext(){return void 0===r&&(r=new(window.AudioContext||window.webkitAudioContext)),r}static setContext(e){r=e}}class uv extends lz{load(e,t,n,r){let i=this,a=new lV(this.manager);function s(t){r?r(t):console.error(t),i.manager.itemError(e)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(e){try{let n=e.slice(0);ug.getContext().decodeAudioData(n,function(e){t(e)}).catch(s)}catch(e){s(e)}},n,r)}constructor(e){super(e)}}let uy=new rH,u_=new rH,ux=new rH;class ub{update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){let n,r;t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,ux.copy(e.projectionMatrix);let i=t.eyeSep/2,a=i*t.near/t.focus,s=t.near*Math.tan(nU*t.fov*.5)/t.zoom;u_.elements[12]=-i,uy.elements[12]=i,n=-s*t.aspect+a,r=s*t.aspect+a,ux.elements[0]=2*t.near/(r-n),ux.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(ux),n=-s*t.aspect-a,r=s*t.aspect-a,ux.elements[0]=2*t.near/(r-n),ux.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(ux)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(u_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(uy)}constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new af,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new af,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}}class uS extends af{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class uM{start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}}let uw=new nX,uE=new nj,uT=new nX,uA=new nX,uC=new nX;class uR extends ia{getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(uw,uE,uT),uA.set(0,0,-1).applyQuaternion(uE),uC.set(0,1,0).applyQuaternion(uE),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(uw.x,e),t.positionY.linearRampToValueAtTime(uw.y,e),t.positionZ.linearRampToValueAtTime(uw.z,e),t.forwardX.linearRampToValueAtTime(uA.x,e),t.forwardY.linearRampToValueAtTime(uA.y,e),t.forwardZ.linearRampToValueAtTime(uA.z,e),t.upX.linearRampToValueAtTime(uC.x,e),t.upY.linearRampToValueAtTime(uC.y,e),t.upZ.linearRampToValueAtTime(uC.z,e)}else t.setPosition(uw.x,uw.y,uw.z),t.setOrientation(uA.x,uA.y,uA.z,uC.x,uC.y,uC.z)}constructor(){super(),this.type="AudioListener",this.context=ug.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uM}}class uP extends ia{getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){s.setValue(n,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n;e!==r;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]}_slerp(e,t,n,r){nj.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,i){let a=this._workIndex*i;nj.multiplyQuaternionsFlat(e,a,e,t,e,n),nj.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,i){let a=1-r;for(let s=0;s!==i;++s){let i=t+s;e[i]=e[i]*a+e[n+s]*r}}_lerpAdditive(e,t,n,r,i){for(let a=0;a!==i;++a){let i=t+a;e[i]=e[i]+e[n+a]*r}}constructor(e,t,n){let r,i,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}}let uk="\\[\\]\\.:\\/",uz=RegExp("["+uk+"]","g"),uB="[^"+uk+"]",uH="[^"+uk.replace("\\.","")+"]",uV=/((?:WC+[\/:])*)/.source.replace("WC",uB),uG=/(WCOD+)?/.source.replace("WCOD",uH),uW=RegExp("^"+uV+uG+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uB)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uB)+"$"),uj=["material","materials","bones","map"];class uX{static create(e,t,n){return e&&e.isAnimationObjectGroup?new uX.Composite(e,t,n):new uX(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uz,"")}static parseTrackName(e){let t=uW.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){let e=n.nodeName.substring(r+1);-1!==uj.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){let n=function(e){for(let r=0;r=i){let a=i++,u=e[a];t[u.uuid]=l,e[l]=u,t[o]=a,e[a]=s;for(let e=0;e!==r;++e){let t=n[e],r=t[a],i=t[l];t[l]=r,t[a]=i}}}this.nCachedObjects_=i}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){let o=arguments[s],l=o.uuid,u=t[l];if(void 0!==u)if(delete t[l],u0&&(t[s.uuid]=u),e[u]=s,e.pop();for(let e=0;e!==r;++e){let t=n[e];t[u]=t[i],t.pop()}}}this.nCachedObjects_=i}subscribe_(e,t){let n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];let a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,c=Array(l);r=i.length,n[e]=r,a.push(e),s.push(t),i.push(c);for(let n=u,r=o.length;n!==r;++n){let r=o[n];c[n]=new uX(r,e,t)}return c}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){let r=this._paths,i=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=n,a[n]=o,a.pop(),i[n]=i[s],i.pop(),r[n]=r[s],r.pop()}}constructor(){this.isAnimationObjectGroup=!0,this.uuid=nF(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}}class uY{play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.fadeOut(t),this.fadeIn(t),!0===n){let n=this._clip.duration,r=e._clip.duration;e.warp(1,r/n,t),this.warp(n/r,1,t)}return this}crossFadeTo(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let r=this._mixer,i=r.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=i,o[1]=i+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled)return void this._updateWeight(e);let i=this._startTime;if(null!==i){let r=(e-i)*n;r<0||0===n?t=0:(this._startTime=null,t=n*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(this.blendMode===tH)for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulateAdditive(s);else for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulate(r,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(null!==n){let r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===tN;if(0===e)return -1===i?r:a&&(1&i)==1?t-r:r;if(n===tI){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));s:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break s}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){let n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);let s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(a&&(1&i)==1)return t-r}return r}_setEndings(e,t,n){let r=this._interpolantSettings;n?(r.endingStart=tk,r.endingEnd=tk):(e?r.endingStart=this.zeroSlopeAtStart?tk:tF:r.endingStart=tz,t?r.endingEnd=this.zeroSlopeAtEnd?tk:tF:r.endingEnd=tz)}_scheduleFading(e,t,n){let r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=i,o[0]=t,s[1]=i+e,o[1]=n,this}constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;let i=t.tracks,a=i.length,s=Array(a),o={endingStart:tF,endingEnd:tF};for(let e=0;e!==a;++e){let t=i[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=tL,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}}let uJ=new Float32Array(1);class uZ extends nL{_bindAction(e,t){let n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,s=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName,u=l[o];void 0===u&&(u={},l[o]=u);for(let e=0;e!==i;++e){let i=r[e],l=i.name,c=u[l];if(void 0!==c)++c.referenceCount,a[e]=c;else{if(void 0!==(c=a[e])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;c=new uF(uX.create(n,l,r),i.ValueTypeName,i.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[e]=c}s[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==n;++s)t[s]._update(r,e,i,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e1)||void 0===arguments[1]||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return u6(e,this,n,t),n.sort(u5),n}intersectObjects(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let r=0,i=e.length;r1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}constructor(e,t,n,r){ct.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,r)}}let cn=new nW;class cr{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,cn).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}constructor(e=new nW(Infinity,Infinity),t=new nW(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}}let ci=new nX,ca=new nX,cs=new nX,co=new nX,cl=new nX,cu=new nX,cc=new nX;class ch{set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ci.subVectors(e,this.start),ca.subVectors(this.end,this.start);let n=ca.dot(ca),r=ca.dot(ci)/n;return t&&(r=nk(r,0,1)),r}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cu,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:cc,a=1e-8*1e-8,s=this.start,o=e.start,l=this.end,u=e.end;cs.subVectors(l,s),co.subVectors(u,o),cl.subVectors(s,o);let c=cs.dot(cs),h=co.dot(co),d=co.dot(cl);if(c<=a&&h<=a)return r.copy(s),i.copy(o),r.sub(i),r.dot(r);if(c<=a)t=0,n=nk(n=d/h,0,1);else{let e=cs.dot(cl);if(h<=a)n=0,t=nk(-e/c,0,1);else{let r=cs.dot(co),i=c*h-r*r;t=0!==i?nk((r*d-e*h)/i,0,1):0,(n=(r*t+d)/h)<0?(n=0,t=nk(-e/c,0,1)):n>1&&(n=1,t=nk((r-e)/c,0,1))}}return r.copy(s).add(cs.multiplyScalar(t)),i.copy(o).add(co.multiplyScalar(n)),r.sub(i),r.dot(r)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}constructor(e=new nX,t=new nX){this.start=e,this.end=t}}let cd=new nX;class cp extends ia{dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),cd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(cd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let n=new i0,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){let n=e/32*Math.PI*2,i=t/32*Math.PI*2;r.push(Math.cos(n),Math.sin(n),1,Math.cos(i),Math.sin(i),1)}n.setAttribute("position",new iX(r,3));let i=new sN({fog:!1,toneMapped:!1});this.cone=new sj(n,i),this.add(this.cone),this.update()}}let cf=new nX,cm=new rH,cg=new rH;class cv extends sj{updateMatrixWorld(e){let t=this.bones,n=this.geometry,r=n.getAttribute("position");cg.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e1)for(let n=0;n.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{cF.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(cF,t)}}setLength(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}constructor(e=new nX(0,0,1),t=new nX(0,0,0),n=1,r=0xffff00,s=.2*n,o=.2*s){super(),this.type="ArrowHelper",void 0===i&&((i=new i0).setAttribute("position",new iX([0,0,0,0,1,0],3)),(a=new on(.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new sH(i,new sN({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new an(a,new iR({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}}class cz extends sj{setColors(e,t,n){let r=new iE,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=1){let t=new i0;t.setAttribute("position",new iX([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],3)),t.setAttribute("color",new iX([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(t,new sN({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}class cB{moveTo(e,t){return this.currentPath=new oI,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){let t,n,r,i,a,s=oZ.isClockWise,o=this.subPaths;if(0===o.length)return[];let l=[];if(1===o.length)return n=o[0],(r=new oL).curves=n.curves,l.push(r),l;let u=!s(o[0].getPoints());u=e?!u:u;let c=[],h=[],d=[],p=0;h[0]=void 0,d[p]=[];for(let r=0,a=o.length;r1){let e=!1,t=0;for(let e=0,t=h.length;eNumber.EPSILON){if(l<0&&(n=t[a],o=-o,s=t[i],l=-l),e.ys.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{let t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(s.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=s.x)return!0}}return r})(a.p,h[r].p)&&(n!==r&&t++,s?(s=!1,c[r].push(a)):e=!0);s&&c[n].push(a)}}t>0&&!1===e&&(d=c)}for(let e=0,t=h.length;et?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}static cover(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}static fill(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}static getByteLength(e,t,n,r){return cV(e,t,n,r)}}function cW(){let e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function cj(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){let e=t.get(n);(!e||e.versione.start-t.start);let t=0;for(let e=1;eha,"ShaderChunk",()=>cX,"ShaderLib",()=>cY,"UniformsLib",()=>cq,"WebGLRenderer",()=>d2,"WebGLUtils",()=>dJ],8560);let cX={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n float depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n #ifdef USE_REVERSED_DEPTH_BUFFER\n return step( depth, compare );\n #else\n return step( compare, depth );\n #endif\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( distribution.x, compare );\n #else\n float hard_shadow = step( compare, distribution.x );\n #endif\n if ( hard_shadow != 1.0 ) {\n float distance = compare - distribution.x;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n shadow = (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},cq={common:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new nJ},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new nJ}},envmap:{envMap:{value:null},envMapRotation:{value:new nJ},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new nJ}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new nJ}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new nJ},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new nJ},normalScale:{value:new nW(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new nJ},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new nJ}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new nJ}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new nJ}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new iE(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0},uvTransform:{value:new nJ}},sprite:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},center:{value:new nW(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new nJ},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0}}},cY={basic:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.fog]),vertexShader:cX.meshbasic_vert,fragmentShader:cX.meshbasic_frag},lambert:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,cq.lights,{emissive:{value:new iE(0)}}]),vertexShader:cX.meshlambert_vert,fragmentShader:cX.meshlambert_frag},phong:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,cq.lights,{emissive:{value:new iE(0)},specular:{value:new iE(1118481)},shininess:{value:30}}]),vertexShader:cX.meshphong_vert,fragmentShader:cX.meshphong_frag},standard:{uniforms:as([cq.common,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.roughnessmap,cq.metalnessmap,cq.fog,cq.lights,{emissive:{value:new iE(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:cX.meshphysical_vert,fragmentShader:cX.meshphysical_frag},toon:{uniforms:as([cq.common,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.gradientmap,cq.fog,cq.lights,{emissive:{value:new iE(0)}}]),vertexShader:cX.meshtoon_vert,fragmentShader:cX.meshtoon_frag},matcap:{uniforms:as([cq.common,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,{matcap:{value:null}}]),vertexShader:cX.meshmatcap_vert,fragmentShader:cX.meshmatcap_frag},points:{uniforms:as([cq.points,cq.fog]),vertexShader:cX.points_vert,fragmentShader:cX.points_frag},dashed:{uniforms:as([cq.common,cq.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:cX.linedashed_vert,fragmentShader:cX.linedashed_frag},depth:{uniforms:as([cq.common,cq.displacementmap]),vertexShader:cX.depth_vert,fragmentShader:cX.depth_frag},normal:{uniforms:as([cq.common,cq.bumpmap,cq.normalmap,cq.displacementmap,{opacity:{value:1}}]),vertexShader:cX.meshnormal_vert,fragmentShader:cX.meshnormal_frag},sprite:{uniforms:as([cq.sprite,cq.fog]),vertexShader:cX.sprite_vert,fragmentShader:cX.sprite_frag},background:{uniforms:{uvTransform:{value:new nJ},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:cX.background_vert,fragmentShader:cX.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new nJ}},vertexShader:cX.backgroundCube_vert,fragmentShader:cX.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:cX.cube_vert,fragmentShader:cX.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:cX.equirect_vert,fragmentShader:cX.equirect_frag},distanceRGBA:{uniforms:as([cq.common,cq.displacementmap,{referencePosition:{value:new nX},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:cX.distanceRGBA_vert,fragmentShader:cX.distanceRGBA_frag},shadow:{uniforms:as([cq.lights,cq.fog,{color:{value:new iE(0)},opacity:{value:1}}]),vertexShader:cX.shadow_vert,fragmentShader:cX.shadow_frag}};cY.physical={uniforms:as([cY.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new nJ},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new nJ},clearcoatNormalScale:{value:new nW(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new nJ},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new nJ},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new nJ},sheen:{value:0},sheenColor:{value:new iE(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new nJ},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new nJ},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new nJ},transmissionSamplerSize:{value:new nW},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new nJ},attenuationDistance:{value:0},attenuationColor:{value:new iE(0)},specularColor:{value:new iE(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new nJ},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new nJ},anisotropyVector:{value:new nW},anisotropyMap:{value:null},anisotropyMapTransform:{value:new nJ}}]),vertexShader:cX.meshphysical_vert,fragmentShader:cX.meshphysical_frag};let cJ={r:0,b:0,g:0},cZ=new rK,cK=new rH;function c$(e,t,n,r,i,a,s){let o,l,u=new iE(0),c=+(!0!==a),h=null,d=0,p=null;function f(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function m(t,n){t.getRGB(cJ,ao(e)),r.buffers.color.setClear(cJ.r,cJ.g,cJ.b,n,s)}return{getClearColor:function(){return u},setClearColor:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;u.set(e),m(u,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){m(u,c=e)},render:function(t){let n=!1,i=f(t);null===i?m(u,c):i&&i.isColor&&(m(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?r.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&r.buffers.color.setClear(0,0,0,0,s),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){let r=f(n);r&&(r.isCubeTexture||r.mapping===eE)?(void 0===l&&((l=new an(new ai(1,1,1),new au({name:"BackgroundCubeMaterial",uniforms:aa(cY.backgroundCube.uniforms),vertexShader:cY.backgroundCube.vertexShader,fragmentShader:cY.backgroundCube.fragmentShader,side:E,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),cZ.copy(n.backgroundRotation),cZ.x*=-1,cZ.y*=-1,cZ.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(cZ.y*=-1,cZ.z*=-1),l.material.uniforms.envMap.value=r,l.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(cK.makeRotationFromEuler(cZ)),l.material.toneMapped=n8.getTransfer(r.colorSpace)!==t1,(h!==r||d!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,h=r,d=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):r&&r.isTexture&&(void 0===o&&((o=new an(new o4(2,2),new au({name:"BackgroundMaterial",uniforms:aa(cY.background.uniforms),vertexShader:cY.background.vertexShader,fragmentShader:cY.background.fragmentShader,side:w,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=r,o.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,o.material.toneMapped=n8.getTransfer(r.colorSpace)!==t1,!0===r.matrixAutoUpdate&&r.updateMatrix(),o.material.uniforms.uvTransform.value.copy(r.matrix),(h!==r||d!==r.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,h=r,d=r.version,p=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))},dispose:function(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0)}}}function cQ(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=u(null),a=i,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=s[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===n||n.attribute!==r||r&&n.data!==r.data)return!0;o++}return a.attributesNum!==o||a.index!==r}(n,m,l,g))&&function(e,t,n,r){let i={},s=t.attributes,o=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,o++}a.attributes=i,a.attributesNum=o,a.index=r}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||s)&&(s=!1,function(n,r,i,a){c();let s=a.attributes,o=i.getAttributes(),l=r.defaultAttributeValues;for(let r in o){let i=o[r];if(i.location>=0){let o=s[r];if(void 0===o&&("instanceMatrix"===r&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===r&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){let r=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let u=l.buffer,c=l.type,p=l.bytesPerElement,m=c===e.INT||c===e.UNSIGNED_INT||o.gpuType===eG;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp",o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);let l=!0===n.logarithmicDepthBuffer,u=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control"),c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),f=e.getParameter(e.MAX_VERTEX_ATTRIBS),m=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){let n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:a,textureFormatReadable:function(t){return t===e0||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){let i=n===eX&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return n===ez||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||n===ej||!!i},precision:s,logarithmicDepthBuffer:l,reversedDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function c2(e){let t=this,n=null,r=0,i=!1,a=!1,s=new sl,o=new nJ,l={value:null,needsUpdate:!1};function u(e,n,r,i){let a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){let t=r+4*a,i=n.matrixWorldInverse;o.getNormalMatrix(i),(null===u||u.length0),t.numPlanes=r,t.numIntersection=0)}}function c3(e){let t=new WeakMap;function n(e,t){return t===eM?e.mapping=eb:t===ew&&(e.mapping=eS),e}function r(e){let n=e.target;n.removeEventListener("dispose",r);let i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){let a=i.mapping;if(a===eM||a===ew)if(t.has(i))return n(t.get(i).texture,i.mapping);else{let a=i.image;if(!a||!(a.height>0))return null;{let s=new av(a.height);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}}}return i},dispose:function(){t=new WeakMap}}}let c4=[.125,.215,.35,.446,.526,.582],c5=new l7,c6=new iE,c8=null,c9=0,c7=0,he=!1,ht=(1+Math.sqrt(5))/2,hn=1/ht,hr=[new nX(-ht,hn,0),new nX(ht,hn,0),new nX(-hn,0,ht),new nX(hn,0,ht),new nX(0,ht,-hn),new nX(0,ht,hn),new nX(-1,1,-1),new nX(1,1,-1),new nX(-1,1,1),new nX(1,1,1)],hi=new nX;class ha{fromScene(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},{size:a=256,position:s=hi}=i;c8=this._renderer.getRenderTarget(),c9=this._renderer.getActiveCubeFace(),c7=this._renderer.getActiveMipmapLevel(),he=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,r,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}fromCubemap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=hu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=hl(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=c4[s-e+4-1]:0===s&&(o=0),r.push(o);let l=1/(a-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];d.set(r,18*e),p.set(h,12*e);let i=[e,e,e,e,e,e];f.set(i,6*e)}let m=new i0;m.setAttribute("position",new iF(d,3)),m.setAttribute("uv",new iF(p,2)),m.setAttribute("faceIndex",new iF(f,1)),t.push(m),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(r)),this._blurMaterial=function(e,t,n){let r=new Float32Array(20),i=new nX(0,1,0);return new au({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include \n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}(r,e,t)}return r}_compileMaterial(e){let t=new an(this._lodPlanes[0],e);this._renderer.compile(t,c5)}_sceneToCubeUV(e,t,n,r,i){let a=new af(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(c6),l.toneMapping=ec,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(r),l.clearDepth(),l.setRenderTarget(null));let h=new iR({name:"PMREM.Background",side:E,depthWrite:!1,depthTest:!1}),d=new an(new ai,h),p=!1,f=e.background;f?f.isColor&&(h.color.copy(f),e.background=null,p=!0):(h.color.copy(c6),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(a.up.set(0,s[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+o[t],i.y,i.z)):1===n?(a.up.set(0,0,s[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+o[t],i.z)):(a.up.set(0,s[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+o[t]));let u=this._cubeSize;ho(r,n*u,t>2?u:0,u,u),l.setRenderTarget(r),p&&l.render(d,a),l.render(e,a)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=c,l.autoClear=u,e.background=f}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===eb||e.mapping===eS;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=hu()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=hl());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new an(this._lodPlanes[0],i);i.uniforms.envMap.value=e;let s=this._cubeSize;ho(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,c5)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;t20&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(20));let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ev-4?r-v+4:0),_,3*y,2*y),o.setRenderTarget(t),o.render(u,c5)}constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}}function hs(e,t,n){let r=new ru(e,t,n);return r.texture.mapping=eE,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function ho(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function hl(){return new au({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include \n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}function hu(){return new au({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}function hc(){return"\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n "}function hh(e){let t=new WeakMap,n=null;function r(e){let n=e.target;n.removeEventListener("dispose",r);let i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){let a=i.mapping,s=a===eM||a===ew,o=a===eb||a===eS;if(s||o){let a=t.get(i),l=void 0!==a?a.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==l)return null===n&&(n=new ha(e)),(a=s?n.fromEquirectangular(i,a):n.fromCubemap(i,a)).texture.pmremVersion=i.pmremVersion,t.set(i,a),a.texture;{if(void 0!==a)return a.texture;let l=i.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new ha(e)),(a=s?n.fromEquirectangular(i):n.fromCubemap(i)).texture.pmremVersion=i.pmremVersion,t.set(i,a),i.addEventListener("dispose",r),a.texture):null}}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function hd(e){let t={};function n(n){let r;if(void 0!==t[n])return t[n];switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){let t=n(e);return null===t&&n3("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function hp(e,t,n,r){let i={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete i[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),r.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){let n=[],r=e.index,i=e.attributes.position,s=0;if(null!==r){let e=r.array;s=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*c),g=new rc(m,p,f,c);g.type=ej,g.needsUpdate=!0;let v=4*d;for(let t=0;t0)return e;let i=t*n,a=hM[i];if(void 0===a&&(a=new Float32Array(i),hM[i]=a),0!==t){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function hR(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n":" "," ").concat(i,": ").concat(n[e]))}return r.join("\n")}(e.getShaderSource(t),r)}}let dv=new nX;function dy(e){return""!==e}function d_(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function dx(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let db=/^[ \t]*#include +<([\w\d./]+)>/gm;function dS(e){return e.replace(db,dw)}let dM=new Map;function dw(e,t){let n=cX[t];if(void 0===n){let e=dM.get(t);if(void 0!==e)n=cX[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return dS(n)}let dE=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function dT(e){return e.replace(dE,dA)}function dA(e,t,n,r){let i="";for(let e=parseInt(t);e0&&(i+="\n"),(a=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(dy).join("\n")).length>0&&(a+="\n")):(i=[dC(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+g:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(dy).join("\n"),a=[dC(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+m:"",n.envMap?"#define "+g:"",n.envMap?"#define "+v:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ec?"#define TONE_MAPPING":"",n.toneMapping!==ec?cX.tonemapping_pars_fragment:"",n.toneMapping!==ec?function(e,t){let n;switch(t){case eh:n="Linear";break;case ed:n="Reinhard";break;case ep:n="Cineon";break;case ef:n="ACESFilmic";break;case eg:n="AgX";break;case ev:n="Neutral";break;case em:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",cX.colorspace_pars_fragment,function(e,t){let n=function(e){n8._getMatrix(dm,n8.workingColorSpace,e);let t="mat3( ".concat(dm.elements.map(e=>e.toFixed(4))," )");switch(n8.getTransfer(e)){case t0:return[t,"LinearTransferOETF"];case t1:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return["vec4 ".concat(e,"( vec4 value ) {")," return ".concat(n[1],"( vec4( value.rgb * ").concat(n[0],", value.a ) );"),"}"].join("\n")}("linearToOutputTexel",n.outputColorSpace),function(){n8.getLuminanceCoefficients(dv);let e=dv.x.toFixed(4),t=dv.y.toFixed(4),n=dv.z.toFixed(4);return["float luminance( const in vec3 rgb ) {"," const vec3 weights = vec3( ".concat(e,", ").concat(t,", ").concat(n," );")," return dot( weights, rgb );\n}"].join("\n")}(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(dy).join("\n")),d=dx(d=d_(d=dS(d),n),n),p=dx(p=d_(p=dS(p),n),n),d=dT(d),p=dT(p),!0!==n.isRawShaderMaterial&&(E="#version 300 es\n",i=[_,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===nT?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===nT?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);let T=E+i+d,A=E+a+p,C=dp(c,c.VERTEX_SHADER,T),R=dp(c,c.FRAGMENT_SHADER,A);function P(t){if(e.debug.checkShaderErrors){let n=c.getProgramInfoLog(w)||"",r=c.getShaderInfoLog(C)||"",s=c.getShaderInfoLog(R)||"",o=n.trim(),l=r.trim(),u=s.trim(),h=!0,d=!0;if(!1===c.getProgramParameter(w,c.LINK_STATUS))if(h=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,w,C,R);else{let e=dg(c,C,"vertex"),n=dg(c,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(w,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+o+"\n"+e+"\n"+n)}else""!==o?console.warn("THREE.WebGLProgram: Program Info Log:",o):(""===l||""===u)&&(d=!1);d&&(t.diagnostics={runnable:h,programLog:o,vertexShader:{log:l,prefix:i},fragmentShader:{log:u,prefix:a}})}c.deleteShader(C),c.deleteShader(R),s=new dd(c,w),o=function(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i0,Z=a.clearcoat>0,K=a.dispersion>0,$=a.iridescence>0,Q=a.sheen>0,ee=a.transmission>0,et=J&&!!a.anisotropyMap,en=Z&&!!a.clearcoatMap,er=Z&&!!a.clearcoatNormalMap,ei=Z&&!!a.clearcoatRoughnessMap,ea=$&&!!a.iridescenceMap,es=$&&!!a.iridescenceThicknessMap,eo=Q&&!!a.sheenColorMap,el=Q&&!!a.sheenRoughnessMap,eu=!!a.specularMap,eh=!!a.specularColorMap,ed=!!a.specularIntensityMap,ep=ee&&!!a.transmissionMap,ef=ee&&!!a.thicknessMap,em=!!a.gradientMap,eg=!!a.alphaMap,ev=a.alphaTest>0,ey=!!a.alphaHash,e_=!!a.extensions,ex=ec;a.toneMapped&&(null===D||!0===D.isXRRenderTarget)&&(ex=e.toneMapping);let eb={shaderID:P,shaderType:a.type,shaderName:a.name,vertexShader:y,fragmentShader:_,defines:a.defines,customVertexShaderID:x,customFragmentShaderID:b,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:F,batchingColor:F&&null!==v._colorsTexture,instancing:O,instancingColor:O&&null!==v.instanceColor,instancingMorph:O&&null!==v.morphTexture,supportsVertexTextures:d,outputColorSpace:null===D?e.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:tQ,alphaToCoverage:!!a.alphaToCoverage,map:k,matcap:z,envMap:B,envMapMode:B&&A.mapping,envMapCubeUVHeight:R,aoMap:H,lightMap:V,bumpMap:G,normalMap:W,displacementMap:d&&j,emissiveMap:X,normalMapObjectSpace:W&&a.normalMapType===tZ,normalMapTangentSpace:W&&a.normalMapType===tJ,metalnessMap:q,roughnessMap:Y,anisotropy:J,anisotropyMap:et,clearcoat:Z,clearcoatMap:en,clearcoatNormalMap:er,clearcoatRoughnessMap:ei,dispersion:K,iridescence:$,iridescenceMap:ea,iridescenceThicknessMap:es,sheen:Q,sheenColorMap:eo,sheenRoughnessMap:el,specularMap:eu,specularColorMap:eh,specularIntensityMap:ed,transmission:ee,transmissionMap:ep,thicknessMap:ef,gradientMap:em,opaque:!1===a.transparent&&a.blending===C&&!1===a.alphaToCoverage,alphaMap:eg,alphaTest:ev,alphaHash:ey,combine:a.combine,mapUv:k&&m(a.map.channel),aoMapUv:H&&m(a.aoMap.channel),lightMapUv:V&&m(a.lightMap.channel),bumpMapUv:G&&m(a.bumpMap.channel),normalMapUv:W&&m(a.normalMap.channel),displacementMapUv:j&&m(a.displacementMap.channel),emissiveMapUv:X&&m(a.emissiveMap.channel),metalnessMapUv:q&&m(a.metalnessMap.channel),roughnessMapUv:Y&&m(a.roughnessMap.channel),anisotropyMapUv:et&&m(a.anisotropyMap.channel),clearcoatMapUv:en&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:er&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ei&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ea&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:es&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:eo&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:el&&m(a.sheenRoughnessMap.channel),specularMapUv:eu&&m(a.specularMap.channel),specularColorMapUv:eh&&m(a.specularColorMap.channel),specularIntensityMapUv:ed&&m(a.specularIntensityMap.channel),transmissionMapUv:ep&&m(a.transmissionMap.channel),thicknessMapUv:ef&&m(a.thicknessMap.channel),alphaMapUv:eg&&m(a.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(W||J),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!M.attributes.uv&&(k||eg),fog:!!S,useFog:!0===a.fog,fogExp2:!!S&&S.isFogExp2,flatShading:!0===a.flatShading&&!1===a.wireframe,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:U,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:L,morphTextureStride:N,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ex,decodeVideoTexture:k&&!0===a.map.isVideoTexture&&n8.getTransfer(a.map.colorSpace)===t1,decodeVideoTextureEmissive:X&&!0===a.emissiveMap.isVideoTexture&&n8.getTransfer(a.emissiveMap.colorSpace)===t1,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===T,flipSided:a.side===E,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:e_&&!0===a.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(e_&&!0===a.extensions.multiDraw||F)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return eb.vertexUv1s=u.has(1),eb.vertexUv2s=u.has(2),eb.vertexUv3s=u.has(3),u.clear(),eb},getProgramCacheKey:function(t){var n,r,i,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(n=s,r=t,n.push(r.precision),n.push(r.outputColorSpace),n.push(r.envMapMode),n.push(r.envMapCubeUVHeight),n.push(r.mapUv),n.push(r.alphaMapUv),n.push(r.lightMapUv),n.push(r.aoMapUv),n.push(r.bumpMapUv),n.push(r.normalMapUv),n.push(r.displacementMapUv),n.push(r.emissiveMapUv),n.push(r.metalnessMapUv),n.push(r.roughnessMapUv),n.push(r.anisotropyMapUv),n.push(r.clearcoatMapUv),n.push(r.clearcoatNormalMapUv),n.push(r.clearcoatRoughnessMapUv),n.push(r.iridescenceMapUv),n.push(r.iridescenceThicknessMapUv),n.push(r.sheenColorMapUv),n.push(r.sheenRoughnessMapUv),n.push(r.specularMapUv),n.push(r.specularColorMapUv),n.push(r.specularIntensityMapUv),n.push(r.transmissionMapUv),n.push(r.thicknessMapUv),n.push(r.combine),n.push(r.fogExp2),n.push(r.sizeAttenuation),n.push(r.morphTargetsCount),n.push(r.morphAttributeCount),n.push(r.numDirLights),n.push(r.numPointLights),n.push(r.numSpotLights),n.push(r.numSpotLightMaps),n.push(r.numHemiLights),n.push(r.numRectAreaLights),n.push(r.numDirLightShadows),n.push(r.numPointLightShadows),n.push(r.numSpotLightShadows),n.push(r.numSpotLightShadowsWithMaps),n.push(r.numLightProbes),n.push(r.shadowMapType),n.push(r.toneMapping),n.push(r.numClippingPlanes),n.push(r.numClipIntersection),n.push(r.depthPacking),i=s,a=t,o.disableAll(),a.supportsVertexTextures&&o.enable(0),a.instancing&&o.enable(1),a.instancingColor&&o.enable(2),a.instancingMorph&&o.enable(3),a.matcap&&o.enable(4),a.envMap&&o.enable(5),a.normalMapObjectSpace&&o.enable(6),a.normalMapTangentSpace&&o.enable(7),a.clearcoat&&o.enable(8),a.iridescence&&o.enable(9),a.alphaTest&&o.enable(10),a.vertexColors&&o.enable(11),a.vertexAlphas&&o.enable(12),a.vertexUv1s&&o.enable(13),a.vertexUv2s&&o.enable(14),a.vertexUv3s&&o.enable(15),a.vertexTangents&&o.enable(16),a.anisotropy&&o.enable(17),a.alphaHash&&o.enable(18),a.batching&&o.enable(19),a.dispersion&&o.enable(20),a.batchingColor&&o.enable(21),a.gradientMap&&o.enable(22),i.push(o.mask),o.disableAll(),a.fog&&o.enable(0),a.useFog&&o.enable(1),a.flatShading&&o.enable(2),a.logarithmicDepthBuffer&&o.enable(3),a.reversedDepthBuffer&&o.enable(4),a.skinning&&o.enable(5),a.morphTargets&&o.enable(6),a.morphNormals&&o.enable(7),a.morphColors&&o.enable(8),a.premultipliedAlpha&&o.enable(9),a.shadowMapEnabled&&o.enable(10),a.doubleSided&&o.enable(11),a.flipSided&&o.enable(12),a.useDepthPacking&&o.enable(13),a.dithering&&o.enable(14),a.transmission&&o.enable(15),a.sheen&&o.enable(16),a.opaque&&o.enable(17),a.pointsUvs&&o.enable(18),a.decodeVideoTexture&&o.enable(19),a.decodeVideoTextureEmissive&&o.enable(20),a.alphaToCoverage&&o.enable(21),i.push(o.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,n=f[e.type];if(n){let e=cY[n];t=al.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){let r;for(let e=0,t=c.length;e0?r.push(c):!0===s.transparent?i.push(c):n.push(c)},unshift:function(e,t,s,o,l,u){let c=a(e,t,s,o,l,u);s.transmission>0?r.unshift(c):!0===s.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(let n=t,r=e.length;n1&&n.sort(e||dU),r.length>1&&r.sort(t||dO),i.length>1&&i.sort(t||dO)}}}function dk(){let e=new WeakMap;return{get:function(t,n){let r,i=e.get(t);return void 0===i?(r=new dF,e.set(t,[r])):n>=i.length?(r=new dF,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function dz(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":n={direction:new nX,color:new iE};break;case"SpotLight":n={position:new nX,direction:new nX,color:new iE,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new nX,color:new iE,distance:0,decay:0};break;case"HemisphereLight":n={direction:new nX,skyColor:new iE,groundColor:new iE};break;case"RectAreaLight":n={color:new iE,position:new nX,halfWidth:new nX,halfHeight:new nX}}return e[t.id]=n,n}}}let dB=0;function dH(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function dV(e){let t=new dz,n=function(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nW};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nW,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new nX);let i=new nX,a=new rH,s=new rH;return{setup:function(i){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,u=0,c=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0,y=0;i.sort(dH);for(let e=0,_=i.length;e<_;e++){let _=i[e],x=_.color,b=_.intensity,S=_.distance,M=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)a+=x.r*b,s+=x.g*b,o+=x.b*b;else if(_.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(_.sh.coefficients[e],b);y++}else if(_.isDirectionalLight){let e=t.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),_.castShadow){let e=_.shadow,t=n.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=M,r.directionalShadowMatrix[l]=_.shadow.matrix,p++}r.directional[l]=e,l++}else if(_.isSpotLight){let e=t.get(_);e.position.setFromMatrixPosition(_.matrixWorld),e.color.copy(x).multiplyScalar(b),e.distance=S,e.coneCos=Math.cos(_.angle),e.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),e.decay=_.decay,r.spot[c]=e;let i=_.shadow;if(_.map&&(r.spotLightMap[g]=_.map,g++,i.updateMatrices(_),_.castShadow&&v++),r.spotLightMatrix[c]=i.matrix,_.castShadow){let e=n.get(_);e.shadowIntensity=i.intensity,e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,r.spotShadow[c]=e,r.spotShadowMap[c]=M,m++}c++}else if(_.isRectAreaLight){let e=t.get(_);e.color.copy(x).multiplyScalar(b),e.halfWidth.set(.5*_.width,0,0),e.halfHeight.set(0,.5*_.height,0),r.rectArea[h]=e,h++}else if(_.isPointLight){let e=t.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),e.distance=_.distance,e.decay=_.decay,_.castShadow){let e=_.shadow,t=n.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[u]=t,r.pointShadowMap[u]=M,r.pointShadowMatrix[u]=_.shadow.matrix,f++}r.point[u]=e,u++}else if(_.isHemisphereLight){let e=t.get(_);e.skyColor.copy(_.color).multiplyScalar(b),e.groundColor.copy(_.groundColor).multiplyScalar(b),r.hemi[d]=e,d++}}h>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=cq.LTC_FLOAT_1,r.rectAreaLTC2=cq.LTC_FLOAT_2):(r.rectAreaLTC1=cq.LTC_HALF_1,r.rectAreaLTC2=cq.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let _=r.hash;(_.directionalLength!==l||_.pointLength!==u||_.spotLength!==c||_.rectAreaLength!==h||_.hemiLength!==d||_.numDirectionalShadows!==p||_.numPointShadows!==f||_.numSpotShadows!==m||_.numSpotMaps!==g||_.numLightProbes!==y)&&(r.directional.length=l,r.spot.length=c,r.rectArea.length=h,r.point.length=u,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-v,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=v,r.numLightProbes=y,_.directionalLength=l,_.pointLength=u,_.spotLength=c,_.rectAreaLength=h,_.hemiLength=d,_.numDirectionalShadows=p,_.numPointShadows=f,_.numSpotShadows=m,_.numSpotMaps=g,_.numLightProbes=y,r.version=dB++)},setupView:function(e,t){let n=0,o=0,l=0,u=0,c=0,h=t.matrixWorldInverse;for(let t=0,d=e.length;t1&&void 0!==arguments[1]?arguments[1]:0,a=t.get(n);return void 0===a?(r=new dG(e),t.set(n,[r])):i>=a.length?(r=new dG(e),a.push(r)):r=a[i],r},dispose:function(){t=new WeakMap}}}function dj(e,t,n){let r=new sd,i=new nW,a=new nW,s=new ro,o=new lp({depthPacking:tX}),l=new lf,u={},c=n.maxTextureSize,h={[w]:E,[E]:w,[T]:T},d=new au({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new nW},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new i0;f.setAttribute("position",new iF(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new an(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b;let v=this.type;function y(t,n,r,i){let a=null,s=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===r.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){let e=a.uuid,t=n.uuid,r=u[e];void 0===r&&(r={},u[e]=r);let i=r[t];void 0===i&&(i=a.clone(),r[t]=i,n.addEventListener("dispose",_)),a=i}return a.visible=n.visible,a.wireframe=n.wireframe,i===M?a.side=null!==n.shadowSide?n.shadowSide:n.side:a.side=null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=r),a}function _(e){for(let t in e.target.removeEventListener("dispose",_),u){let n=u[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}this.render=function(n,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===n.length)return;let u=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.state;_.setBlending(A),!0===_.buffers.depth.getReversed()?_.buffers.color.setClear(0,0,0,0):_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);let x=v!==M&&this.type===M,b=v===M&&this.type!==M;for(let u=0,h=n.length;uc||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/g.x),i.x=a.x*g.x,f.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/g.y),i.y=a.y*g.y,f.mapSize.y=a.y)),null===f.map||!0===x||!0===b){let e=this.type!==M?{minFilter:eR,magFilter:eR}:{};null!==f.map&&f.map.dispose(),f.map=new ru(i.x,i.y,e),f.map.texture.name=h.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let v=f.getViewportCount();for(let n=0;n=1:-1!==em.indexOf("OpenGL ES")&&(ef=parseFloat(/^OpenGL ES (\d)/.exec(em)[1])>=2);let eg=null,ev={},ey=e.getParameter(e.SCISSOR_BOX),e_=e.getParameter(e.VIEWPORT),ex=new ro().fromArray(ey),eb=new ro().fromArray(e_);function eS(t,n,r,i){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;sn||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);void 0===o&&(o=f(n,a));let s=t?f(n,a):o;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+i.width+"x"+i.height+") to ("+n+"x"+a+")."),s}else"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+i.width+"x"+i.height+").");return e}function g(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function y(n,r,i,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=r;if(r===e.RED&&(i===e.FLOAT&&(o=e.R32F),i===e.HALF_FLOAT&&(o=e.R16F),i===e.UNSIGNED_BYTE&&(o=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.R8UI),i===e.UNSIGNED_SHORT&&(o=e.R16UI),i===e.UNSIGNED_INT&&(o=e.R32UI),i===e.BYTE&&(o=e.R8I),i===e.SHORT&&(o=e.R16I),i===e.INT&&(o=e.R32I)),r===e.RG&&(i===e.FLOAT&&(o=e.RG32F),i===e.HALF_FLOAT&&(o=e.RG16F),i===e.UNSIGNED_BYTE&&(o=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RG8UI),i===e.UNSIGNED_SHORT&&(o=e.RG16UI),i===e.UNSIGNED_INT&&(o=e.RG32UI),i===e.BYTE&&(o=e.RG8I),i===e.SHORT&&(o=e.RG16I),i===e.INT&&(o=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RGB8UI),i===e.UNSIGNED_SHORT&&(o=e.RGB16UI),i===e.UNSIGNED_INT&&(o=e.RGB32UI),i===e.BYTE&&(o=e.RGB8I),i===e.SHORT&&(o=e.RGB16I),i===e.INT&&(o=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),i===e.UNSIGNED_INT&&(o=e.RGBA32UI),i===e.BYTE&&(o=e.RGBA8I),i===e.SHORT&&(o=e.RGBA16I),i===e.INT&&(o=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),r===e.RGBA){let t=s?t0:n8.getTransfer(a);i===e.FLOAT&&(o=e.RGBA32F),i===e.HALF_FLOAT&&(o=e.RGBA16F),i===e.UNSIGNED_BYTE&&(o=t===t1?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function _(t,n){let r;return t?null===n||n===eW||n===eJ?r=e.DEPTH24_STENCIL8:n===ej?r=e.DEPTH32F_STENCIL8:n===eV&&(r=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===eW||n===eJ?r=e.DEPTH_COMPONENT24:n===ej?r=e.DEPTH_COMPONENT32F:n===eV&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==eR&&e.minFilter!==eD?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function b(e){let t=e.target;t.removeEventListener("dispose",b),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let n=e.source,i=d.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&M(e),0===Object.keys(i).length&&d.delete(n)}r.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function S(t){let n=t.target;n.removeEventListener("dispose",S),function(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r0&&a.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(a,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}let T={[eT]:e.REPEAT,[eA]:e.CLAMP_TO_EDGE,[eC]:e.MIRRORED_REPEAT},A={[eR]:e.NEAREST,[eP]:e.NEAREST_MIPMAP_NEAREST,[eL]:e.NEAREST_MIPMAP_LINEAR,[eD]:e.LINEAR,[eU]:e.LINEAR_MIPMAP_NEAREST,[eF]:e.LINEAR_MIPMAP_LINEAR},C={[nl]:e.NEVER,[nm]:e.ALWAYS,[nu]:e.LESS,[nh]:e.LEQUAL,[nc]:e.EQUAL,[nf]:e.GEQUAL,[nd]:e.GREATER,[np]:e.NOTEQUAL};function R(n,a){if((a.type===ej&&!1===t.has("OES_texture_float_linear")&&(a.magFilter===eD||a.magFilter===eU||a.magFilter===eL||a.magFilter===eF||a.minFilter===eD||a.minFilter===eU||a.minFilter===eL||a.minFilter===eF)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,T[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,T[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,T[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,C[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&a.magFilter!==eR&&(a.minFilter===eL||a.minFilter===eF)&&(a.type!==ej||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||r.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}function P(t,n){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",b));let i=n.source,a=d.get(i);void 0===a&&(a={},d.set(i,a));let o=function(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),a[o].usedTimes++;let i=a[t.__cacheKey];void 0!==i&&(a[t.__cacheKey].usedTimes--,0===i.usedTimes&&M(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return r}function I(e,t,n){return Math.floor(Math.floor(e/n)/t)}function L(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let u=P(t,s),c=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let h=r.get(c);if(c.version!==h.__version||!0===u){let t;n.activeTexture(e.TEXTURE0+o);let r=n8.getPrimaries(n8.workingColorSpace),d=s.colorSpace===tK?null:n8.getPrimaries(s.colorSpace),p=s.colorSpace===tK||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=m(s.image,!1,i.maxTextureSize);f=H(s,f);let b=a.convert(s.format,s.colorSpace),S=a.convert(s.type),M=y(s.internalFormat,b,S,s.colorSpace,s.isVideoTexture);R(l,s);let w=s.mipmaps,E=!0!==s.isVideoTexture,T=void 0===h.__version||!0===u,A=c.dataReady,C=x(s,f);if(s.isDepthTexture)M=_(s.format===e2,s.type),T&&(E?n.texStorage2D(e.TEXTURE_2D,1,M,f.width,f.height):n.texImage2D(e.TEXTURE_2D,0,M,f.width,f.height,0,b,S,null));else if(s.isDataTexture)if(w.length>0){E&&T&&n.texStorage2D(e.TEXTURE_2D,C,M,w[0].width,w[0].height);for(let r=0,i=w.length;re.start-t.start);let o=0;for(let e=1;e0){let i=cV(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*i/t.data.BYTES_PER_ELEMENT,(a+1)*i/t.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,a,t.width,t.height,1,b,s)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,b,t.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,M,t.width,t.height,f.depth,0,t.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?A&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,b,S,t.data):n.texImage3D(e.TEXTURE_2D_ARRAY,r,M,t.width,t.height,f.depth,0,b,S,t.data)}else{E&&T&&n.texStorage2D(e.TEXTURE_2D,C,M,w[0].width,w[0].height);for(let r=0,i=w.length;r0){let t=cV(f.width,f.height,s.format,s.type);for(let r of s.layerUpdates){let i=f.data.subarray(r*t/f.data.BYTES_PER_ELEMENT,(r+1)*t/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,f.width,f.height,1,b,S,i)}s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,M,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isData3DTexture)E?(T&&n.texStorage3D(e.TEXTURE_3D,C,M,f.width,f.height,f.depth),A&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)):n.texImage3D(e.TEXTURE_3D,0,M,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isFramebufferTexture){if(T)if(E)n.texStorage2D(e.TEXTURE_2D,C,M,f.width,f.height);else{let t=f.width,r=f.height;for(let i=0;i>=1,r>>=1}}else if(w.length>0){if(E&&T){let t=V(w[0]);n.texStorage2D(e.TEXTURE_2D,C,M,t.width,t.height)}for(let r=0,i=w.length;r>c),r=Math.max(1,i.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,p,t,r,i.depth,0,h,d,null):n.texImage2D(u,c,p,t,r,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),B(i)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,u,m.__webglTexture,0,z(i)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,u,m.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function D(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,s=_(n.stencilBuffer,a),o=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=z(n);B(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,s,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");let e=t.texture.mipmaps;e&&e.length>0?U(i.__webglFramebuffer[0],t):U(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),void 0===i.__webglDepthbuffer[r])i.__webglDepthbuffer[r]=e.createRenderbuffer(),D(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),void 0===i.__webglDepthbuffer)i.__webglDepthbuffer=e.createRenderbuffer(),D(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}let F=[],k=[];function z(e){return Math.min(i.maxSamples,e.samples)}function B(e){let n=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function H(e,t){let n=e.colorSpace,r=e.format,i=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==tQ&&n!==tK&&(n8.getTransfer(n)===t1?(r!==e0||i!==ez)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function V(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=w;return e>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+i.maxTextures),w+=1,e},this.resetTextureUnits=function(){w=0},this.setTexture2D=E,this.setTexture2DArray=function(t,i){let a=r.get(t);if(!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version)return void L(a,t,i);n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)},this.setTexture3D=function(t,i){let a=r.get(t);if(!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version)return void L(a,t,i);n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,s){let o=r.get(t);if(t.version>0&&o.__version!==t.version)return void function(t,s,o){if(6!==s.image.length)return;let l=P(t,s),u=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let c=r.get(u);if(u.version!==c.__version||!0===l){let t;n.activeTexture(e.TEXTURE0+o);let r=n8.getPrimaries(n8.workingColorSpace),h=s.colorSpace===tK?null:n8.getPrimaries(s.colorSpace),d=s.colorSpace===tK||r===h?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,_=[];for(let e=0;e<6;e++)p||f?_[e]=f?s.image[e].image:s.image[e]:_[e]=m(s.image[e],!0,i.maxCubemapSize),_[e]=H(s,_[e]);let b=_[0],S=a.convert(s.format,s.colorSpace),M=a.convert(s.type),w=y(s.internalFormat,S,M,s.colorSpace),E=!0!==s.isVideoTexture,T=void 0===c.__version||!0===l,A=u.dataReady,C=x(s,b);if(R(e.TEXTURE_CUBE_MAP,s),p){E&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,w,b.width,b.height);for(let r=0;r<6;r++){t=_[r].mipmaps;for(let i=0;i0&&C++;let r=V(_[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,C,w,r.width,r.height)}for(let r=0;r<6;r++)if(f){E?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,_[r].width,_[r].height,S,M,_[r].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,w,_[r].width,_[r].height,0,S,M,_[r].data);for(let i=0;i1;if(!h&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=i.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n0){o.__webglFramebuffer=[];for(let t=0;t0&&!1===B(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(!1===B(t)){let i=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),h=i.length>1;if(h)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:tK,a=n8.getTransfer(i);if(n===ez)return e.UNSIGNED_BYTE;if(n===eq)return e.UNSIGNED_SHORT_4_4_4_4;if(n===eY)return e.UNSIGNED_SHORT_5_5_5_1;if(n===eZ)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===eK)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===eB)return e.BYTE;if(n===eH)return e.SHORT;if(n===eV)return e.UNSIGNED_SHORT;if(n===eG)return e.INT;if(n===eW)return e.UNSIGNED_INT;if(n===ej)return e.FLOAT;if(n===eX)return e.HALF_FLOAT;if(n===e$)return e.ALPHA;if(n===eQ)return e.RGB;if(n===e0)return e.RGBA;if(n===e1)return e.DEPTH_COMPONENT;if(n===e2)return e.DEPTH_STENCIL;if(n===e3)return e.RED;if(n===e4)return e.RED_INTEGER;if(n===e5)return e.RG;if(n===e6)return e.RG_INTEGER;if(n===e9)return e.RGBA_INTEGER;if(n===e7||n===te||n===tt||n===tn)if(a===t1){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===e7)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===te)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===tt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===tn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===e7)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===te)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===tt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===tn)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===tr||n===ti||n===ta||n===ts){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===tr)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ti)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ta)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ts)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===to||n===tl||n===tu){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(n===to||n===tl)return a===t1?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===tu)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===tc||n===th||n===td||n===tp||n===tf||n===tm||n===tg||n===tv||n===ty||n===t_||n===tx||n===tb||n===tS||n===tM){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(n===tc)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===th)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===td)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===tp)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===tf)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===tm)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===tg)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===tv)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ty)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===t_)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===tx)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===tb)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===tS)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===tM)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===tw||n===tE||n===tT){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(n===tw)return a===t1?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===tE)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===tT)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===tA||n===tC||n===tR||n===tP){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(n===tA)return r.COMPRESSED_RED_RGTC1_EXT;if(n===tC)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===tR)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===tP)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===eJ?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class dZ{init(e,t){if(null===this.texture){let n=new s9(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,n=new au({vertexShader:"\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n if ( coord.x >= 1.0 ) {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n } else {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n }\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new an(new o4(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}}class dK extends nL{constructor(e,t){super();let n=this,r=null,i=1,a=null,s="local-floor",o=1,l=null,u=null,c=null,h=null,d=null,p=null,f="undefined"!=typeof XRWebGLBinding,m=new dZ,g={},v=t.getContextAttributes(),y=null,_=null,x=[],b=[],S=new nW,M=null,w=new af;w.viewport=new ro;let E=new af;E.viewport=new ro;let T=[w,E],A=new uS,C=null,R=null;function P(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function I(){r.removeEventListener("select",P),r.removeEventListener("selectstart",P),r.removeEventListener("selectend",P),r.removeEventListener("squeeze",P),r.removeEventListener("squeezestart",P),r.removeEventListener("squeezeend",P),r.removeEventListener("end",I),r.removeEventListener("inputsourceschange",L);for(let e=0;e=0&&(b[r]=null,x[r].disconnect(n))}for(let t=0;t=b.length){b.push(n),r=e;break}else if(null===b[e]){b[e]=n,r=e;break}if(-1===r)break}let i=x[r];i&&i.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return null===c&&f&&(c=new XRWebGLBinding(r,t)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(y=e.getRenderTarget(),r.addEventListener("select",P),r.addEventListener("selectstart",P),r.addEventListener("selectend",P),r.addEventListener("squeeze",P),r.addEventListener("squeezestart",P),r.addEventListener("squeezeend",P),r.addEventListener("end",I),r.addEventListener("inputsourceschange",L),!0!==v.xrCompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(S),f&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,a=null,s=null;v.depth&&(s=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?e2:e1,a=v.stencil?eJ:eW);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:i};h=(c=this.getBinding()).createProjectionLayer(o),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),_=new ru(h.textureWidth,h.textureHeight,{format:e0,type:ez,depthTexture:new s8(h.textureWidth,h.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:4*!!v.antialias,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{let n={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:i};d=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),_=new ru(d.framebufferWidth,d.framebufferHeight,{format:e0,type:ez,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await r.requestReferenceSpace(s),F.setContext(r),F.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};let N=new nX,D=new nX;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,n,i;if(null===r)return;let a=e.near,s=e.far;null!==m.texture&&(m.depthNear>0&&(a=m.depthNear),m.depthFar>0&&(s=m.depthFar)),A.near=E.near=w.near=a,A.far=E.far=w.far=s,(C!==A.near||R!==A.far)&&(r.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,R=A.far),A.layers.mask=6|e.layers.mask,w.layers.mask=3&A.layers.mask,E.layers.mask=5&A.layers.mask;let o=e.parent,l=A.cameras;U(A,o);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,s=i.envMapRotation;a&&(e.envMap.value=a,d$.copy(s),d$.x*=-1,d$.y*=-1,d$.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(d$.y*=-1,d$.z*=-1),e.envMapRotation.value.setFromMatrix4(dQ.makeRotationFromEuler(d$)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,ao(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,a,s,o){var l,u,c,h,d,p,f,m,g,v,y,_,x,b,S,M,w,T,A,C,R;i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),l=e,(u=i).gradientMap&&(l.gradientMap.value=u.gradientMap)):i.isMeshPhongMaterial?(r(e,i),c=e,h=i,c.specular.value.copy(h.specular),c.shininess.value=Math.max(h.shininess,1e-4)):i.isMeshStandardMaterial?(r(e,i),d=e,p=i,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),i.isMeshPhysicalMaterial&&(f=e,m=i,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===E&&f.clearcoatNormalScale.value.negate())),m.dispersion>0&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,f.specularIntensityMapTransform)))):i.isMeshMatcapMaterial?(r(e,i),v=e,(y=i).matcap&&(v.matcap.value=y.matcap)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(_=e,x=i,_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,x.map&&(_.map.value=x.map,n(x.map,_.mapTransform)),i.isLineDashedMaterial&&(b=e,S=i,b.dashSize.value=S.dashSize,b.totalSize.value=S.dashSize+S.gapSize,b.scale.value=S.scale)):i.isPointsMaterial?(M=e,w=i,T=a,A=s,M.diffuse.value.copy(w.color),M.opacity.value=w.opacity,M.size.value=w.size*T,M.scale.value=.5*A,w.map&&(M.map.value=w.map,n(w.map,M.uvTransform)),w.alphaMap&&(M.alphaMap.value=w.alphaMap,n(w.alphaMap,M.alphaMapTransform)),w.alphaTest>0&&(M.alphaTest.value=w.alphaTest)):i.isSpriteMaterial?(C=e,R=i,C.diffuse.value.copy(R.color),C.opacity.value=R.opacity,C.rotation.value=R.rotation,R.map&&(C.map.value=R.map,n(R.map,C.mapTransform)),R.alphaMap&&(C.alphaMap.value=R.alphaMap,n(R.alphaMap,C.alphaMapTransform)),R.alphaTest>0&&(C.alphaTest.value=R.alphaTest)):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function d1(e,t,n,r){let i={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function u(t){let n=t.target;n.removeEventListener("dispose",u);let r=s.indexOf(n.__bindingPointIndex);s.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(e,t){let n=t.program;r.uniformBlockBinding(e,n)},update:function(n,c){let h=i[n.id];void 0===h&&(function(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e0&&(n+=16-r),e.__size=n,e.__cache={}}(n),h=function(t){let n=function(){for(let e=0;e2)||void 0===arguments[2]||arguments[2];if(eT.isPresenting)return void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");ea=e,es=t,P.width=Math.floor(e*eo),P.height=Math.floor(t*eo),!0===n&&(P.style.width=e+"px",P.style.height=t+"px"),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(ea*eo,es*eo).floor()},this.setDrawingBufferSize=function(e,t,n){ea=e,es=t,eo=n,P.width=Math.floor(e*n),P.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(ee)},this.getViewport=function(e){return e.copy(eh)},this.setViewport=function(e,t,n,r){e.isVector4?eh.set(e.x,e.y,e.z,e.w):eh.set(e,t,n,r),i.viewport(ee.copy(eh).multiplyScalar(eo).round())},this.getScissor=function(e){return e.copy(ed)},this.setScissor=function(e,t,n,r){e.isVector4?ed.set(e.x,e.y,e.z,e.w):ed.set(e,t,n,r),i.scissor(et.copy(ed).multiplyScalar(eo).round())},this.getScissorTest=function(){return ep},this.setScissorTest=function(e){i.setScissorTest(ep=e)},this.setOpaqueSort=function(e){el=e},this.setTransparentSort=function(e){eu=e},this.getClearColor=function(e){return e.copy(x.getClearColor())},this.setClearColor=function(){x.setClearColor(...arguments)},this.getClearAlpha=function(){return x.getClearAlpha()},this.setClearAlpha=function(){x.setClearAlpha(...arguments)},this.clear=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=0;if(e){let e=!1;if(null!==K){let t=K.texture.format;e=t===e9||t===e6||t===e4}if(e){let e=K.texture.type,t=e===ez||e===eW||e===eV||e===eJ||e===eq||e===eY,n=x.getClearColor(),r=x.getClearAlpha(),i=n.r,a=n.g,s=n.b;t?(H[0]=i,H[1]=a,H[2]=s,H[3]=r,eM.clearBufferuiv(eM.COLOR,0,H)):(V[0]=i,V[1]=a,V[2]=s,V[3]=r,eM.clearBufferiv(eM.COLOR,0,V))}else r|=eM.COLOR_BUFFER_BIT}t&&(r|=eM.DEPTH_BUFFER_BIT),n&&(r|=eM.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),eM.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){P.removeEventListener("webglcontextlost",eA,!1),P.removeEventListener("webglcontextrestored",eC,!1),P.removeEventListener("webglcontextcreationerror",eR,!1),x.dispose(),g.dispose(),v.dispose(),s.dispose(),l.dispose(),u.dispose(),d.dispose(),C.dispose(),R.dispose(),f.dispose(),eT.dispose(),eT.removeEventListener("sessionstart",eN),eT.removeEventListener("sessionend",eD),eU.stop()},this.renderBufferDirect=function(e,t,a,d,p,f){let g;null===t&&(t=ex);let v=p.isMesh&&0>p.matrixWorld.determinant(),_=function(e,t,n,a,c){var h,d;!0!==t.isScene&&(t=ex),o.resetTextureUnits();let p=t.fog,f=a.isMeshStandardMaterial?t.environment:null,g=null===K?q.outputColorSpace:!0===K.isXRRenderTarget?K.texture.colorSpace:tQ,v=(a.isMeshStandardMaterial?u:l).get(a.envMap||f),_=!0===a.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,x=!!n.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),S=!!n.morphAttributes.position,M=!!n.morphAttributes.normal,w=!!n.morphAttributes.color,E=ec;a.toneMapped&&(null===K||!0===K.isXRRenderTarget)&&(E=q.toneMapping);let T=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,A=void 0!==T?T.length:0,C=s.get(a),P=W.state.lights;if(!0===em&&(!0===eg||e!==Q)){let t=e===Q&&a.id===$;y.setState(a,e,t)}let I=!1;a.version===C.__version?C.needsLights&&C.lightsStateVersion!==P.state.version||C.outputColorSpace!==g||c.isBatchedMesh&&!1===C.batching?I=!0:c.isBatchedMesh||!0!==C.batching?c.isBatchedMesh&&!0===C.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===C.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===C.instancing?I=!0:c.isInstancedMesh||!0!==C.instancing?c.isSkinnedMesh&&!1===C.skinning?I=!0:c.isSkinnedMesh||!0!==C.skinning?c.isInstancedMesh&&!0===C.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===C.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===C.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===C.instancingMorph&&null!==c.morphTexture||C.envMap!==v||!0===a.fog&&C.fog!==p||void 0!==C.numClippingPlanes&&(C.numClippingPlanes!==y.numPlanes||C.numIntersection!==y.numIntersection)||C.vertexAlphas!==_||C.vertexTangents!==x||C.morphTargets!==S||C.morphNormals!==M||C.morphColors!==w||C.toneMapping!==E?I=!0:C.morphTargetsCount!==A&&(I=!0):I=!0:I=!0:I=!0:(I=!0,C.__version=a.version);let L=C.currentProgram;!0===I&&(L=ej(a,t,c));let N=!1,D=!1,U=!1,O=L.getUniforms(),F=C.uniforms;if(i.useProgram(L.program)&&(N=!0,D=!0,U=!0),a.id!==$&&($=a.id,D=!0),N||Q!==e){i.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eM,"projectionMatrix",e.projectionMatrix),O.setValue(eM,"viewMatrix",e.matrixWorldInverse);let t=O.map.cameraPosition;void 0!==t&&t.setValue(eM,ey.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&O.setValue(eM,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&O.setValue(eM,"isOrthographic",!0===e.isOrthographicCamera),Q!==e&&(Q=e,D=!0,U=!0)}if(c.isSkinnedMesh){O.setOptional(eM,c,"bindMatrix"),O.setOptional(eM,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eM,"boneTexture",e.boneTexture,o))}c.isBatchedMesh&&(O.setOptional(eM,c,"batchingTexture"),O.setValue(eM,"batchingTexture",c._matricesTexture,o),O.setOptional(eM,c,"batchingIdTexture"),O.setValue(eM,"batchingIdTexture",c._indirectTexture,o),O.setOptional(eM,c,"batchingColorTexture"),null!==c._colorsTexture&&O.setValue(eM,"batchingColorTexture",c._colorsTexture,o));let k=n.morphAttributes;if((void 0!==k.position||void 0!==k.normal||void 0!==k.color)&&b.update(c,n,L),(D||C.receiveShadow!==c.receiveShadow)&&(C.receiveShadow=c.receiveShadow,O.setValue(eM,"receiveShadow",c.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(F.envMap.value=v,F.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(F.envMapIntensity.value=t.environmentIntensity),D&&(O.setValue(eM,"toneMappingExposure",q.toneMappingExposure),C.needsLights&&(h=F,d=U,h.ambientLightColor.needsUpdate=d,h.lightProbe.needsUpdate=d,h.directionalLights.needsUpdate=d,h.directionalLightShadows.needsUpdate=d,h.pointLights.needsUpdate=d,h.pointLightShadows.needsUpdate=d,h.spotLights.needsUpdate=d,h.spotLightShadows.needsUpdate=d,h.rectAreaLights.needsUpdate=d,h.hemisphereLights.needsUpdate=d),p&&!0===a.fog&&m.refreshFogUniforms(F,p),m.refreshMaterialUniforms(F,a,eo,es,W.state.transmissionRenderTarget[e.id]),dd.upload(eM,eZ(C),F,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(dd.upload(eM,eZ(C),F,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&O.setValue(eM,"center",c.center),O.setValue(eM,"modelViewMatrix",c.modelViewMatrix),O.setValue(eM,"normalMatrix",c.normalMatrix),O.setValue(eM,"modelMatrix",c.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,n=e.length;t2&&void 0!==arguments[2]?arguments[2]:null;null===n&&(n=e),(W=v.get(n)).init(t),X.push(W),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),W.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:null,i=this.compile(e,t,r);return new Promise(t=>{function r(){if(i.forEach(function(e){s.get(e).currentProgram.isReady()&&i.delete(e)}),0===i.size)return void t(e);setTimeout(r,10)}null!==n.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eL=null;function eN(){eU.stop()}function eD(){eU.start()}let eU=new cW;function eO(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)W.pushLight(e),e.castShadow&&W.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ef.intersectsSprite(e)){r&&e_.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ev);let t=d.update(e),i=e.material;i.visible&&G.push(e,t,i,n,e_.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ef.intersectsObject(e))){let t=d.update(e),i=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),e_.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),e_.copy(t.boundingSphere.center)),e_.applyMatrix4(e.matrixWorld).applyMatrix4(ev)),Array.isArray(i)){let r=t.groups;for(let a=0,s=r.length;a0&&eH(a,t,n),s.length>0&&eH(s,t,n),o.length>0&&eH(o,t,n),i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),i.setPolygonOffset(!1)}function eB(e,t,r,i){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;void 0===W.state.transmissionRenderTarget[i.id]&&(W.state.transmissionRenderTarget[i.id]=new ru(1,1,{generateMipmaps:!0,type:n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float")?eX:ez,minFilter:eF,samples:4,stencilBuffer:N,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:n8.workingColorSpace}));let a=W.state.transmissionRenderTarget[i.id],s=i.viewport||ee;a.setSize(s.z*q.transmissionResolutionScale,s.w*q.transmissionResolutionScale);let l=q.getRenderTarget(),u=q.getActiveCubeFace(),c=q.getActiveMipmapLevel();q.setRenderTarget(a),q.getClearColor(er),(ei=q.getClearAlpha())<1&&q.setClearColor(0xffffff,.5),q.clear(),eb&&x.render(r);let h=q.toneMapping;q.toneMapping=ec;let d=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),W.setupLightsView(i),!0===em&&y.setGlobalState(q.clippingPlanes,i),eH(e,r,i),o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a),!1===n.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let n=0,a=t.length;n0)for(let t=0,a=n.length;t0&&eB(r,i,e,t),eb&&x.render(e),ek(G,e,t);null!==K&&0===Z&&(o.updateMultisampleRenderTarget(K),o.updateRenderTargetMipmap(K)),!0===e.isScene&&e.onAfterRender(q,e,t),C.resetDefaultState(),$=-1,Q=null,X.pop(),X.length>0?(W=X[X.length-1],!0===em&&y.setGlobalState(q.clippingPlanes,W.state.camera)):W=null,j.pop(),G=j.length>0?j[j.length-1]:null},this.getActiveCubeFace=function(){return J},this.getActiveMipmapLevel=function(){return Z},this.getRenderTarget=function(){return K},this.setRenderTargetTextures=function(e,t,n){let r=s.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=s.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};let e$=eM.createFramebuffer();this.setRenderTarget=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;K=e,J=t,Z=n;let r=!0,a=null,l=!1,u=!1;if(e){let c=s.get(e);if(void 0!==c.__useDefaultFramebuffer)i.bindFramebuffer(eM.FRAMEBUFFER,null),r=!1;else if(void 0===c.__webglFramebuffer)o.setupRenderTarget(e);else if(c.__hasExternalTextures)o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(c.__boundDepthTexture!==t){if(null!==t&&s.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");o.setupDepthRenderbuffer(e)}}let h=e.texture;(h.isData3DTexture||h.isDataArrayTexture||h.isCompressedArrayTexture)&&(u=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(d[t])?d[t][n]:d[t],l=!0):a=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[n]:d,ee.copy(e.viewport),et.copy(e.scissor),en=e.scissorTest}else ee.copy(eh).multiplyScalar(eo).floor(),et.copy(ed).multiplyScalar(eo).floor(),en=ep;if(0!==n&&(a=e$),i.bindFramebuffer(eM.FRAMEBUFFER,a)&&r&&i.drawBuffers(e,a),i.viewport(ee),i.scissor(et),i.setScissorTest(en),l){let r=s.get(e.texture);eM.framebufferTexture2D(eM.FRAMEBUFFER,eM.COLOR_ATTACHMENT0,eM.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(u)for(let r=0;r7&&void 0!==arguments[7]?arguments[7]:0;if(!(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h){i.bindFramebuffer(eM.FRAMEBUFFER,h);try{let i=e.textures[c],s=i.format,u=i.type;if(!r.textureFormatReadable(s))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o&&(e.textures.length>1&&eM.readBuffer(eM.COLOR_ATTACHMENT0+c),eM.readPixels(t,n,a,o,A.convert(s),A.convert(u),l))}finally{let e=null!==K?s.get(K).__webglFramebuffer:null;i.bindFramebuffer(eM.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,a,o,l,u){let c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h)if(t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o){i.bindFramebuffer(eM.FRAMEBUFFER,h);let u=e.textures[c],d=u.format,p=u.type;if(!r.textureFormatReadable(d))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let f=eM.createBuffer();eM.bindBuffer(eM.PIXEL_PACK_BUFFER,f),eM.bufferData(eM.PIXEL_PACK_BUFFER,l.byteLength,eM.STREAM_READ),e.textures.length>1&&eM.readBuffer(eM.COLOR_ATTACHMENT0+c),eM.readPixels(t,n,a,o,A.convert(d),A.convert(p),0);let m=null!==K?s.get(K).__webglFramebuffer:null;i.bindFramebuffer(eM.FRAMEBUFFER,m);let g=eM.fenceSync(eM.SYNC_GPU_COMMANDS_COMPLETE,0);return eM.flush(),await n4(eM,g,4),eM.bindBuffer(eM.PIXEL_PACK_BUFFER,f),eM.getBufferSubData(eM.PIXEL_PACK_BUFFER,0,l),eM.deleteBuffer(f),eM.deleteSync(g),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Math.pow(2,-n),a=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),l=null!==t?t.x:0,u=null!==t?t.y:0;o.setTexture2D(e,0),eM.copyTexSubImage2D(eM.TEXTURE_2D,n,0,0,l,u,a,s),i.unbindTexture()};let eQ=eM.createFramebuffer(),e0=eM.createFramebuffer();this.copyTextureToTexture=function(e,t){let n,r,a,l,u,c,h,d,p,f,m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,g=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,y=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;null===y&&(0!==v?(n3("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),y=v,v=0):y=0);let _=e.isCompressedTexture?e.mipmaps[y]:e.image;if(null!==m)n=m.max.x-m.min.x,r=m.max.y-m.min.y,a=m.isBox3?m.max.z-m.min.z:1,l=m.min.x,u=m.min.y,c=m.isBox3?m.min.z:0;else{let t=Math.pow(2,-v);n=Math.floor(_.width*t),r=Math.floor(_.height*t),a=e.isDataArrayTexture?_.depth:e.isData3DTexture?Math.floor(_.depth*t):1,l=0,u=0,c=0}null!==g?(h=g.x,d=g.y,p=g.z):(h=0,d=0,p=0);let x=A.convert(t.format),b=A.convert(t.type);t.isData3DTexture?(o.setTexture3D(t,0),f=eM.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(o.setTexture2DArray(t,0),f=eM.TEXTURE_2D_ARRAY):(o.setTexture2D(t,0),f=eM.TEXTURE_2D),eM.pixelStorei(eM.UNPACK_FLIP_Y_WEBGL,t.flipY),eM.pixelStorei(eM.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eM.pixelStorei(eM.UNPACK_ALIGNMENT,t.unpackAlignment);let S=eM.getParameter(eM.UNPACK_ROW_LENGTH),M=eM.getParameter(eM.UNPACK_IMAGE_HEIGHT),w=eM.getParameter(eM.UNPACK_SKIP_PIXELS),E=eM.getParameter(eM.UNPACK_SKIP_ROWS),T=eM.getParameter(eM.UNPACK_SKIP_IMAGES);eM.pixelStorei(eM.UNPACK_ROW_LENGTH,_.width),eM.pixelStorei(eM.UNPACK_IMAGE_HEIGHT,_.height),eM.pixelStorei(eM.UNPACK_SKIP_PIXELS,l),eM.pixelStorei(eM.UNPACK_SKIP_ROWS,u),eM.pixelStorei(eM.UNPACK_SKIP_IMAGES,c);let C=e.isDataArrayTexture||e.isData3DTexture,R=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let o=s.get(e),f=s.get(t),m=s.get(o.__renderTarget),g=s.get(f.__renderTarget);i.bindFramebuffer(eM.READ_FRAMEBUFFER,m.__webglFramebuffer),i.bindFramebuffer(eM.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let i=0;id5],8155);let d4=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,i,a);return a},d5=e=>e?d4(e):d4,{useSyncExternalStoreWithSelector:d6}=d3.default,d8=e=>e,d9=(e,t)=>{let n=d5(e),r=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d8,n=arguments.length>2?arguments[2]:void 0,r=d6(e.subscribe,e.getState,e.getInitialState,t,n);return h.default.useDebugValue(r),r}(n,e,r)};return Object.assign(r,n),r},d7=[];function pe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(e,t)=>e===t;if(e===t)return!0;if(!e||!t)return!1;let r=e.length;if(t.length!==r)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};for(let i of(null===t&&(t=[e]),d7))if(pe(t,i.keys,i.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(i,"error"))throw i.error;if(Object.prototype.hasOwnProperty.call(i,"response"))return r.lifespan&&r.lifespan>0&&(i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(i.remove,r.lifespan)),i.response;if(!n)throw i.promise}let i={keys:t,equal:r.equal,remove:()=>{let e=d7.indexOf(i);-1!==e&&d7.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...t)).then(e=>{i.response=e,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(e=>i.error=e)};if(d7.push(i),!n)throw i.promise}var pn=e.i(98133),pr=e.i(95087),pi=e.i(43476);e.s(["FiberProvider",()=>pu,"traverseFiber",()=>ps,"useContextBridge",()=>pp,"useFiber",()=>pc],46791);var pa=h;function ps(e,t,n){if(!e)return;if(!0===n(e))return e;let r=t?e.return:e.child;for(;r;){let e=ps(r,t,n);if(e)return e;r=t?null:r.sibling}}function po(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}(()=>{var e,t;return"undefined"!=typeof window&&((null==(e=window.document)?void 0:e.createElement)||(null==(t=window.navigator)?void 0:t.product)==="ReactNative")})()?pa.useLayoutEffect:pa.useEffect;let pl=po(pa.createContext(null));class pu extends pa.Component{render(){return pa.createElement(pl.Provider,{value:this._reactInternals},this.props.children)}}function pc(){let e=pa.useContext(pl);if(null===e)throw Error("its-fine: useFiber must be called within a !");let t=pa.useId();return pa.useMemo(()=>{for(let n of[e,null==e?void 0:e.alternate]){if(!n)continue;let e=ps(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}let ph=Symbol.for("react.context"),pd=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===ph;function pp(){let e=function(){let e=pc(),[t]=pa.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;pd(e)&&e!==pl&&!t.has(e)&&t.set(e,pa.use(po(e))),n=n.return}return t}();return pa.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>pa.createElement(t,null,pa.createElement(n.Provider,{...r,value:e.get(n)})),e=>pa.createElement(pu,{...e})),[e])}function pf(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}h.act;let pm=e=>e&&e.hasOwnProperty("current"),pg=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),pv=((e,t)=>"undefined"!=typeof window&&((null==(e=window.document)?void 0:e.createElement)||(null==(t=window.navigator)?void 0:t.product)==="ReactNative"))()?h.useLayoutEffect:h.useEffect;function py(e){let t=h.useRef(e);return pv(()=>void(t.current=e),[e]),t}function p_(){let e=pc(),t=pp();return h.useMemo(()=>n=>{let{children:r}=n,i=ps(e,!0,e=>e.type===h.StrictMode)?h.StrictMode:h.Fragment;return(0,pi.jsx)(i,{children:(0,pi.jsx)(t,{children:r})})},[e,t])}function px(e){let{set:t}=e;return pv(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}let pb=(e=>((e=class extends h.Component{componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}constructor(...e){super(...e),this.state={error:!1}}}).getDerivedStateFromError=()=>({error:!0}),e))();function pS(e){var t;let n="undefined"!=typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}function pM(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()}let pw={obj:e=>e===Object(e)&&!pw.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,t){let n,{arrays:r="shallow",objects:i="reference",strict:a=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(typeof e!=typeof t||!!e!=!!t)return!1;if(pw.str(e)||pw.num(e)||pw.boo(e))return e===t;let s=pw.obj(e);if(s&&"reference"===i)return e===t;let o=pw.arr(e);if(o&&"reference"===r)return e===t;if((o||s)&&e===t)return!0;for(n in e)if(!(n in t))return!1;if(s&&"shallow"===r&&"shallow"===i){for(n in a?t:e)if(!pw.equ(e[n],t[n],{strict:a,objects:"reference"}))return!1}else for(n in a?t:e)if(e[n]!==t[n])return!1;if(pw.und(n)){if(o&&0===e.length&&0===t.length||s&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}},pE=["children","key","ref"];function pT(e,t,n,r){let i=null==e?void 0:e.__r3f;return!i&&(i={root:t,type:n,parent:null,children:[],props:function(e){let t={};for(let n in e)pE.includes(n)||(t[n]=e[n]);return t}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=i)),i}function pA(e,t){let n=e[t];if(!t.includes("-"))return{root:e,key:t,target:n};for(let i of(n=e,t.split("-"))){var r;t=i,e=n,n=null==(r=n)?void 0:r[t]}return{root:e,key:t,target:n}}let pC=/-\d+$/;function pR(e,t){if(pw.str(t.props.attach)){if(pC.test(t.props.attach)){let n=t.props.attach.replace(pC,""),{root:r,key:i}=pA(e.object,n);Array.isArray(r[i])||(r[i]=[])}let{root:n,key:r}=pA(e.object,t.props.attach);t.previousAttach=n[r],n[r]=t.object}else pw.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function pP(e,t){if(pw.str(t.props.attach)){let{root:n,key:r}=pA(e.object,t.props.attach),i=t.previousAttach;void 0===i?delete n[r]:n[r]=i}else null==t.previousAttach||t.previousAttach(e.object,t.object);delete t.previousAttach}let pI=[...pE,"args","dispose","attach","object","onUpdate","dispose"],pL=new Map,pN=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],pD=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function pU(e,t){var n,r;let i=e.__r3f,a=i&&pf(i).getState(),s=null==i?void 0:i.eventCount;for(let n in t){let s=t[n];if(pI.includes(n))continue;if(i&&pD.test(n)){"function"==typeof s?i.handlers[n]=s:delete i.handlers[n],i.eventCount=Object.keys(i.handlers).length;continue}if(void 0===s)continue;let{root:o,key:l,target:u}=pA(e,n);u instanceof r$&&s instanceof r$?u.mask=s.mask:u instanceof iE&&pg(s)?u.set(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=s&&s.constructor&&u.constructor===s.constructor?u.copy(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(s)?"function"==typeof u.fromArray?u.fromArray(s):u.set(...s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof s?"function"==typeof u.setScalar?u.setScalar(s):u.set(s):(o[l]=s,a&&!a.linear&&pN.includes(l)&&null!=(r=o[l])&&r.isTexture&&o[l].format===e0&&o[l].type===ez&&(o[l].colorSpace=t$))}if(null!=i&&i.parent&&null!=a&&a.internal&&null!=(n=i.object)&&n.isObject3D&&s!==i.eventCount){let e=i.object,t=a.internal.interaction.indexOf(e);t>-1&&a.internal.interaction.splice(t,1),i.eventCount&&null!==e.raycast&&a.internal.interaction.push(e)}return i&&void 0===i.props.attach&&(i.object.isBufferGeometry?i.props.attach="geometry":i.object.isMaterial&&(i.props.attach="material")),i&&pO(i),e}function pO(e){var t;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let n=null==(t=e.root)||null==t.getState?void 0:t.getState();n&&0===n.internal.frames&&n.invalidate()}let pF=e=>null==e?void 0:e.isObject3D;function pk(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function pz(e,t,n,r){let i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}let pB=e=>!!(null!=e&&e.render),pH=h.createContext(null);function pV(){let e=h.useContext(pH);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function pG(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e=>e,t=arguments.length>1?arguments[1]:void 0;return pV()(e,t)}function pW(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=pV(),r=n.getState().internal.subscribe,i=py(e);return pv(()=>r(i,t,n),[t,r,n]),null}let pj=new WeakMap;function pX(e,t){return function(n){let r;for(var i,a=arguments.length,s=Array(a>1?a-1:0),o=1;onew Promise((n,i)=>r.load(e,e=>{pF(null==e?void 0:e.scene)&&Object.assign(e,function(e){let t={nodes:{},materials:{},meshes:{}};return e&&e.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material),e.isMesh&&!t.meshes[e.name]&&(t.meshes[e.name]=e)}),t}(e.scene)),n(e)},t,t=>i(Error("Could not load ".concat(e,": ").concat(null==t?void 0:t.message)))))))}}function pq(e,t,n,r){let i=Array.isArray(t)?t:[t],a=pt(pX(n,r),[e,...i],!1,{equal:pw.equ});return Array.isArray(t)?a:a[0]}pq.preload=function(e,t,n){let r,i=Array.isArray(t)?t:[t];pt(pX(n),[e,...i],!0,r)},pq.clear=function(e,t){var n=[e,...Array.isArray(t)?t:[t]];if(void 0===n||0===n.length)d7.splice(0,d7.length);else{let e=d7.find(e=>pe(n,e.keys,e.equal));e&&e.remove()}};let pY={},pJ=/^three(?=[A-Z])/,pZ=e=>"".concat(e[0].toUpperCase()).concat(e.slice(1)),pK=0;function p$(e){if("function"==typeof e){let t="".concat(pK++);return pY[t]=e,t}Object.assign(pY,e)}function pQ(e,t){let n=pZ(e),r=pY[n];if("primitive"!==e&&!r)throw Error("R3F: ".concat(n," is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively"));if("primitive"===e&&!t.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==t.args&&!Array.isArray(t.args))throw Error("R3F: The args prop must be an array!")}function p0(e){if(e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?pR(e.parent,e):pF(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,pO(e)}}function p1(e,t,n){let r=t.root.getState();if(e.parent||e.object===r.scene){if(!t.object){var i,a;let e=pY[pZ(t.type)];t.object=null!=(i=t.props.object)?i:new e(...null!=(a=t.props.args)?a:[]),t.object.__r3f=t}if(pU(t.object,t.props),t.props.attach)pR(e,t);else if(pF(t.object)&&pF(e.object)){let r=e.object.children.indexOf(null==n?void 0:n.object);if(n&&-1!==r){let n=e.object.children.indexOf(t.object);-1!==n?(e.object.children.splice(n,1),e.object.children.splice(n{try{e.dispose()}catch(e){}};"undefined"!=typeof IS_REACT_ACT_ENVIRONMENT?t():(0,pr.unstable_scheduleCallback)(pr.unstable_IdlePriority,t)}}function p5(e,t,n){if(!t)return;t.parent=null;let r=e.children.indexOf(t);-1!==r&&e.children.splice(r,1),t.props.attach?pP(e,t):pF(t.object)&&pF(e.object)&&(e.object.remove(t.object),function(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{pz(n.capturedMap,t,e,r)})}(pf(t),t.object));let i=null!==t.props.dispose&&!1!==n;for(let e=t.children.length-1;e>=0;e--){let n=t.children[e];p5(t,n,i)}t.children.length=0,delete t.object.__r3f,i&&"primitive"!==t.type&&"Scene"!==t.object.type&&p4(t.object),void 0===n&&pO(t)}let p6=[],p8=()=>{},p9={},p7=0,fe=function(e){let t=(0,pn.default)(e);return t.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:h.version}),t}({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,t,n){var r;return pQ(e=pZ(e)in pY?e:e.replace(pJ,""),t),"primitive"===e&&null!=(r=t.object)&&r.__r3f&&delete t.object.__r3f,pT(t.object,n,e,t)},removeChild:p5,appendChild:p2,appendInitialChild:p2,insertBefore:p3,appendChildToContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&p2(n,t)},removeChildFromContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&p5(n,t)},insertInContainerBefore(e,t,n){let r=e.getState().scene.__r3f;t&&n&&r&&p3(r,t,n)},getRootHostContext:()=>p9,getChildHostContext:()=>p9,commitUpdate(e,t,n,r,i){var a,s,o;pQ(t,r);let l=!1;if("primitive"===e.type&&n.object!==r.object||(null==(a=r.args)?void 0:a.length)!==(null==(s=n.args)?void 0:s.length)?l=!0:null!=(o=r.args)&&o.some((e,t)=>{var r;return e!==(null==(r=n.args)?void 0:r[t])})&&(l=!0),l)p6.push([e,{...r},i]);else{let t=function(e,t){let n={};for(let r in t)if(!pI.includes(r)&&!pw.equ(t[r],e.props[r]))for(let e in n[r]=t[r],t)e.startsWith("".concat(r,"-"))&&(n[e]=t[e]);for(let r in e.props){if(pI.includes(r)||t.hasOwnProperty(r))continue;let{root:i,key:a}=pA(e.object,r);if(i.constructor&&0===i.constructor.length){let e=function(e){let t=pL.get(e.constructor);try{t||(t=new e.constructor,pL.set(e.constructor,t))}catch(e){}return t}(i);pw.und(e)||(n[a]=e[a])}else n[a]=0}return n}(e,r);Object.keys(t).length&&(Object.assign(e.props,t),pU(e.object,t))}(null===i.sibling||(4&i.flags)==0)&&function(){for(let[e]of p6){let t=e.parent;if(t)for(let n of(e.props.attach?pP(t,e):pF(e.object)&&pF(t.object)&&t.object.remove(e.object),e.children))n.props.attach?pP(e,n):pF(n.object)&&pF(e.object)&&e.object.remove(n.object);e.isHidden&&p0(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&p4(e.object)}for(let[r,i,a]of p6){r.props=i;let s=r.parent;if(s){let i=pY[pZ(r.type)];r.object=null!=(e=r.props.object)?e:new i(...null!=(t=r.props.args)?t:[]),r.object.__r3f=r;var e,t,n=r.object;for(let e of[a,a.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let t=e.ref(n);"function"==typeof t&&(e.refCleanup=t)}else e.ref&&(e.ref.current=n);for(let e of(pU(r.object,r.props),r.props.attach?pR(s,r):pF(r.object)&&pF(s.object)&&s.object.add(r.object),r.children))e.props.attach?pR(r,e):pF(e.object)&&pF(r.object)&&r.object.add(e.object);pO(r)}}p6.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>pT(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?pP(e.parent,e):pF(e.object)&&(e.object.visible=!1),e.isHidden=!0,pO(e)}},unhideInstance:p0,createTextInstance:p8,hideTextInstance:p8,unhideTextInstance:p8,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:h.createContext(null),setCurrentUpdatePriority(e){p7=e},getCurrentUpdatePriority:()=>p7,resolveUpdatePriority(){var e;if(0!==p7)return p7;switch("undefined"!=typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return d.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return d.ContinuousEventPriority;default:return d.DefaultEventPriority}},resetFormInstance(){}}),ft=new Map,fn={objects:"shallow",strict:!1};function fr(e){let t,n,r=ft.get(e),i=null==r?void 0:r.fiber,a=null==r?void 0:r.store;r&&console.warn("R3F.createRoot should only be called once!");let s="function"==typeof reportError?reportError:console.error,o=a||((e,t)=>{let n,r,i=(n=(n,r)=>{let i,a=new nX,s=new nX,o=new nX;function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r().camera,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r().size,{width:i,height:l,top:u,left:c}=n,h=i/l;t.isVector3?o.copy(t):o.set(...t);let d=e.getWorldPosition(a).distanceTo(o);if(e&&e.isOrthographicCamera)return{width:i/e.zoom,height:l/e.zoom,top:u,left:c,factor:1,distance:d,aspect:h};{let t=2*Math.tan(e.fov*Math.PI/180/2)*d,n=i/l*t;return{width:n,height:t,top:u,left:c,factor:i/n,distance:d,aspect:h}}}let u=e=>n(t=>({performance:{...t.performance,current:e}})),c=new nW;return{set:n,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e(r(),t)},advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new uM,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();i&&clearTimeout(i),e.performance.current!==e.performance.min&&u(e.performance.min),i=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:l},setEvents:e=>n(t=>({...t,events:{...t.events,...e}})),setSize:function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=r().camera,u={width:e,height:t,top:i,left:a};n(e=>({size:u,viewport:{...e.viewport,...l(o,s,u)}}))},setDpr:e=>n(t=>{let n=pS(e);return{viewport:{...t.viewport,dpr:n,initialDpr:t.viewport.initialDpr||n}}}),setFrameloop:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",t=r().clock;t.stop(),t.elapsedTime=0,"never"!==e&&(t.start(),t.elapsedTime=0),n(()=>({frameloop:e}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:h.createRef(),active:!1,frames:0,priority:0,subscribe:(e,t,n)=>{let i=r().internal;return i.priority=i.priority+ +(t>0),i.subscribers.push({ref:e,priority:t,store:n}),i.subscribers=i.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let n=r().internal;null!=n&&n.subscribers&&(n.priority=n.priority-(t>0),n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}}})?d9(n,r):d9,a=i.getState(),s=a.size,o=a.viewport.dpr,l=a.camera;return i.subscribe(()=>{let{camera:e,size:t,viewport:n,gl:r,set:a}=i.getState();if(t.width!==s.width||t.height!==s.height||n.dpr!==o){s=t,o=n.dpr,function(e,t){!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(t.width/2),e.right=t.width/2,e.top=t.height/2,e.bottom=-(t.height/2)):e.aspect=t.width/t.height,e.updateProjectionMatrix())}(e,t),n.dpr>0&&r.setPixelRatio(n.dpr);let i="undefined"!=typeof HTMLCanvasElement&&r.domElement instanceof HTMLCanvasElement;r.setSize(t.width,t.height,i)}e!==l&&(l=e,a(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),i.subscribe(t=>e(t)),i})(fy,f_),l=i||fe.createContainer(o,d.ConcurrentRoot,null,!1,null,"",s,s,s,null);r||ft.set(e,{fiber:l,store:o});let u=!1,c=null;return{async configure(){var r,i;let a,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c=new Promise(e=>a=e);let{gl:l,size:h,scene:d,events:p,onCreated:f,shadows:m=!1,linear:g=!1,flat:v=!1,legacy:y=!1,orthographic:_=!1,frameloop:w="always",dpr:E=[1,2],performance:T,raycaster:A,camera:C,onPointerMissed:R}=s,P=o.getState(),I=P.gl;if(!P.gl){let t={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},n="function"==typeof l?await l(t):l;I=pB(n)?n:new d2({...t,...l}),P.set({gl:I})}let L=P.raycaster;L||P.set({raycaster:L=new u4});let{params:N,...D}=A||{};if(pw.equ(D,L,fn)||pU(L,{...D}),pw.equ(N,L.params,fn)||pU(L,{params:{...L.params,...N}}),!P.camera||P.camera===n&&!pw.equ(n,C,fn)){n=C;let e=null==C?void 0:C.isCamera,t=e?C:_?new l7(0,0,0,0,.1,1e3):new af(75,0,.1,1e3);!e&&(t.position.z=5,C&&(pU(t,C),!t.manual&&("aspect"in C||"left"in C||"right"in C||"bottom"in C||"top"in C)&&(t.manual=!0,t.updateProjectionMatrix())),P.camera||null!=C&&C.rotation||t.lookAt(0,0,0)),P.set({camera:t}),L.camera=t}if(!P.scene){let e;null!=d&&d.isScene?pT(e=d,o,"",{}):(pT(e=new aM,o,"",{}),d&&pU(e,d)),P.set({scene:e})}p&&!P.events.handlers&&P.set({events:p(o)});let U=function(e,t){if(!t&&"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:n,top:r,left:i}=e.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:i}}return!t&&"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...t}}(e,h);if(pw.equ(U,P.size,fn)||P.setSize(U.width,U.height,U.top,U.left),E&&P.viewport.dpr!==pS(E)&&P.setDpr(E),P.frameloop!==w&&P.setFrameloop(w),P.onPointerMissed||P.set({onPointerMissed:R}),T&&!pw.equ(T,P.performance,fn)&&P.set(e=>({performance:{...e.performance,...T}})),!P.xr){let e=(e,t)=>{let n=o.getState();"never"!==n.frameloop&&f_(e,!0,n,t)},t=()=>{let t=o.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||fy(t)},n={connect(){let e=o.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){let e=o.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};"function"==typeof(null==(r=I.xr)?void 0:r.addEventListener)&&n.connect(),P.set({xr:n})}if(I.shadowMap){let e=I.shadowMap.enabled,t=I.shadowMap.type;I.shadowMap.enabled=!!m,pw.boo(m)?I.shadowMap.type=S:pw.str(m)?I.shadowMap.type=null!=(i=({basic:x,percentage:b,soft:S,variance:M})[m])?i:S:pw.obj(m)&&Object.assign(I.shadowMap,m),(e!==I.shadowMap.enabled||t!==I.shadowMap.type)&&(I.shadowMap.needsUpdate=!0)}return n8.enabled=!y,u||(I.outputColorSpace=g?tQ:t$,I.toneMapping=v?ec:ef),P.legacy!==y&&P.set(()=>({legacy:y})),P.linear!==g&&P.set(()=>({linear:g})),P.flat!==v&&P.set(()=>({flat:v})),!l||pw.fun(l)||pB(l)||pw.equ(l,I,fn)||pU(I,l),t=f,u=!0,a(),this},render(n){return u||c||this.configure(),c.then(()=>{fe.updateContainer((0,pi.jsx)(fi,{store:o,children:n,onCreated:t,rootElement:e}),l,null,()=>void 0)}),o},unmount(){fa(e)}}}function fi(e){let{store:t,children:n,onCreated:r,rootElement:i}=e;return pv(()=>{let e=t.getState();e.set(e=>({internal:{...e.internal,active:!0}})),r&&r(e),t.getState().events.connected||null==e.events.connect||e.events.connect(i)},[]),(0,pi.jsx)(pH.Provider,{value:t,children:n})}function fa(e,t){let n=ft.get(e),r=null==n?void 0:n.fiber;if(r){let i=null==n?void 0:n.store.getState();i&&(i.internal.active=!1),fe.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{null==i.events.disconnect||i.events.disconnect(),null==(n=i.gl)||null==(r=n.renderLists)||null==r.dispose||r.dispose(),null==(a=i.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(s=i.gl)&&s.xr&&i.xr.disconnect();var n,r,a,s,o=i.scene;for(let e in"Scene"!==o.type&&(null==o.dispose||o.dispose()),o){let t=o[e];(null==t?void 0:t.type)!=="Scene"&&(null==t||null==t.dispose||t.dispose())}ft.delete(e),t&&t(e)}catch(e){}},500)})}}function fs(e,t){let n={callback:e};return t.add(n),()=>void t.delete(n)}let fo=new Set,fl=new Set,fu=new Set,fc=e=>fs(e,fo),fh=e=>fs(e,fl);function fd(e,t){if(e.size)for(let{callback:n}of e.values())n(t)}function fp(e,t){switch(e){case"before":return fd(fo,t);case"after":return fd(fl,t);case"tail":return fd(fu,t)}}function ff(e,t,n){let r=t.clock.getDelta();"never"===t.frameloop&&"number"==typeof e&&(r=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),s=t.internal.subscribers;for(let e=0;e0)&&!(null!=(t=c.gl.xr)&&t.isPresenting)&&(l+=ff(e,c))}if(fg=!1,fp("after",e),0===l)return fp("tail",e),fm=!1,cancelAnimationFrame(u)}function fy(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!e)return ft.forEach(e=>fy(e.store.getState(),n));(null==(t=e.gl.xr)||!t.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(n>1?e.internal.frames=Math.min(60,e.internal.frames+n):fg?e.internal.frames=2:e.internal.frames=1,fm||(fm=!0,requestAnimationFrame(fv)))}function f_(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(t&&fp("before",e),n)ff(e,n,r);else for(let t of ft.values())ff(e,t.store.getState());t&&fp("after",e)}let fx={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function fb(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(n.hovered.delete(pk(e)),null!=r&&r.eventCount){let n=r.handlers,i={...e,intersections:t};null==n.onPointerOut||n.onPointerOut(i),null==n.onPointerLeave||n.onPointerLeave(i)}}}function r(e,t){for(let n=0;nn([]);case"onLostPointerCapture":return t=>{let{internal:r}=e.getState();"pointerId"in t&&r.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(t.pointerId)&&(r.capturedMap.delete(t.pointerId),n([]))})}}return function(a){let{onPointerMissed:s,internal:o}=e.getState();o.lastEvent.current=a;let l="onPointerMove"===i,u="onClick"===i||"onContextMenu"===i||"onDoubleClick"===i,c=function(t,n){let r=e.getState(),i=new Set,a=[],s=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e{let n=pM(e.object),r=pM(t.object);return n&&r&&r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=pk(e);return!i.has(t)&&(i.add(t),!0)});for(let e of(r.events.filter&&(o=r.events.filter(o,r)),o)){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())i.has(pk(e.intersection))||a.push(e.intersection);return a}(a,l?t:void 0),h=u?function(t){let{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}(a):0;"onPointerDown"===i&&(o.initialClick=[a.offsetX,a.offsetY],o.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&h<=2&&(r(a,o.interaction),s&&s(a)),l&&n(c),!function(e,t,r,i){if(e.length){let a={stopped:!1};for(let s of e){let o=pM(s.object);if(o||s.object.traverseAncestors(e=>{let t=pM(e);if(t)return o=t,!1}),o){let{raycaster:l,pointer:u,camera:c,internal:h}=o,d=new nX(u.x,u.y,0).unproject(c),p=e=>{var t,n;return null!=(t=null==(n=h.capturedMap.get(e))?void 0:n.has(s.eventObject))&&t},f=e=>{let n={intersection:s,target:t.target};h.capturedMap.has(e)?h.capturedMap.get(e).set(s.eventObject,n):h.capturedMap.set(e,new Map([[s.eventObject,n]])),t.target.setPointerCapture(e)},m=e=>{let t=h.capturedMap.get(e);t&&pz(h.capturedMap,s.eventObject,t,e)},g={};for(let e in t){let n=t[e];"function"!=typeof n&&(g[e]=n)}let v={...s,...g,pointer:u,intersections:e,stopped:a.stopped,delta:r,unprojectedPoint:d,ray:l.ray,camera:c,stopPropagation(){let r="pointerId"in t&&h.capturedMap.get(t.pointerId);(!r||r.has(s.eventObject))&&(v.stopped=a.stopped=!0,h.hovered.size&&Array.from(h.hovered.values()).find(e=>e.eventObject===s.eventObject)&&n([...e.slice(0,e.indexOf(s)),s]))},target:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},currentTarget:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},nativeEvent:t};if(i(v),!0===a.stopped)break}}}}(c,a,h,function(e){let t=e.eventObject,n=t.__r3f;if(!(null!=n&&n.eventCount))return;let s=n.handlers;if(l){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){let t=pk(e),n=o.hovered.get(t);n?n.stopped&&e.stopPropagation():(o.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{let n=s[i];n?(!u||o.initialHits.includes(t))&&(r(a,o.interaction.filter(e=>!o.initialHits.includes(e))),n(e)):u&&o.initialHits.includes(t)&&r(a,o.interaction.filter(e=>!o.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(fx).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;let{events:n,internal:r}=e.getState();null!=(t=r.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{let{set:n,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),n(e=>({events:{...e.events,connected:t}})),r.handlers)for(let e in r.handlers){let n=r.handlers[e],[i,a]=fx[e];t.addEventListener(i,n,{passive:a})}},disconnect:()=>{let{set:t,events:n}=e.getState();if(n.connected){if(n.handlers)for(let e in n.handlers){let t=n.handlers[e],[r]=fx[e];n.connected.removeEventListener(r,t)}t(e=>({events:{...e.events,connected:void 0}}))}}}}},53487,(e,t,n)=>{"use strict";let r="[^".concat("\\\\/","]"),i="[^/]",a="(?:".concat("\\/","|$)"),s="(?:^|".concat("\\/",")"),o="".concat("\\.","{1,2}").concat(a),l="(?!".concat(s).concat(o,")"),u="(?!".concat("\\.","{0,1}").concat(a,")"),c="(?!".concat(o,")"),h={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:i,END_ANCHOR:a,DOTS_SLASH:o,NO_DOT:"(?!".concat("\\.",")"),NO_DOTS:l,NO_DOT_SLASH:u,NO_DOTS_SLASH:c,QMARK_NO_DOT:"[^.".concat("\\/","]"),STAR:"".concat(i,"*?"),START_ANCHOR:s,SEP:"/"},d={...h,SLASH_LITERAL:"[".concat("\\\\/","]"),QMARK:r,STAR:"".concat(r,"*?"),DOTS_SLASH:"".concat("\\.","{1,2}(?:[").concat("\\\\/","]|$)"),NO_DOT:"(?!".concat("\\.",")"),NO_DOTS:"(?!(?:^|[".concat("\\\\/","])").concat("\\.","{1,2}(?:[").concat("\\\\/","]|$))"),NO_DOT_SLASH:"(?!".concat("\\.","{0,1}(?:[").concat("\\\\/","]|$))"),NO_DOTS_SLASH:"(?!".concat("\\.","{1,2}(?:[").concat("\\\\/","]|$))"),QMARK_NO_DOT:"[^.".concat("\\\\/","]"),START_ANCHOR:"(?:^|[".concat("\\\\/","])"),END_ANCHOR:"(?:[".concat("\\\\/","]|$)"),SEP:"\\"};t.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:"))".concat(e.STAR,")")},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?d:h}},19241,(e,t,n)=>{"use strict";var r=e.i(47167);let{REGEX_BACKSLASH:i,REGEX_REMOVE_BACKSLASH:a,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:o}=e.r(53487);n.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n.hasRegexChars=e=>s.test(e),n.isRegexChar=e=>1===e.length&&n.hasRegexChars(e),n.escapeRegex=e=>e.replace(o,"\\$1"),n.toPosixSlashes=e=>e.replace(i,"/"),n.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){let e=navigator.platform.toLowerCase();return"win32"===e||"windows"===e}return void 0!==r.default&&!!r.default.platform&&"win32"===r.default.platform},n.removeBackslashes=e=>e.replace(a,e=>"\\"===e?"":e),n.escapeLast=(e,t,r)=>{let i=e.lastIndexOf(t,r);return -1===i?e:"\\"===e[i-1]?n.escapeLast(e,t,i-1):"".concat(e.slice(0,i),"\\").concat(e.slice(i))},n.removePrefix=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},n.wrapOutput=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.contains?"":"^",i=n.contains?"":"$",a="".concat(r,"(?:").concat(e,")").concat(i);return!0===t.negated&&(a="(?:^(?!".concat(a,").*$)")),a},n.basename=function(e){let{windows:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.split(t?/[\\/]/:"/"),r=n[n.length-1];return""===r?n[n.length-2]:r}},26094,(e,t,n)=>{"use strict";let r=e.r(19241),{CHAR_ASTERISK:i,CHAR_AT:a,CHAR_BACKWARD_SLASH:s,CHAR_COMMA:o,CHAR_DOT:l,CHAR_EXCLAMATION_MARK:u,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:h,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:f,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:v,CHAR_RIGHT_SQUARE_BRACKET:y}=e.r(53487),_=e=>e===c||e===s,x=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let n,b,S=t||{},M=e.length-1,w=!0===S.parts||!0===S.scanToEnd,E=[],T=[],A=[],C=e,R=-1,P=0,I=0,L=!1,N=!1,D=!1,U=!1,O=!1,F=!1,k=!1,z=!1,B=!1,H=!1,V=0,G={value:"",depth:0,isGlob:!1},W=()=>R>=M,j=()=>C.charCodeAt(R+1),X=()=>(n=b,C.charCodeAt(++R));for(;R0&&(Y=C.slice(0,P),C=C.slice(P),I-=P),q&&!0===D&&I>0?(q=C.slice(0,I),J=C.slice(I)):!0===D?(q="",J=C):q=C,q&&""!==q&&"/"!==q&&q!==C&&_(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),!0===S.unescape&&(J&&(J=r.removeBackslashes(J)),q&&!0===k&&(q=r.removeBackslashes(q)));let Z={prefix:Y,input:e,start:P,base:q,glob:J,isBrace:L,isBracket:N,isGlob:D,isExtglob:U,isGlobstar:O,negated:z,negatedExtglob:B};if(!0===S.tokens&&(Z.maxDepth=0,_(b)||T.push(G),Z.tokens=T),!0===S.parts||!0===S.tokens){let t;for(let n=0;n{"use strict";let r=e.r(53487),i=e.r(19241),{MAX_LENGTH:a,POSIX_REGEX_SOURCE:s,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:l,REPLACEMENTS:u}=r,c=(e,t)=>{if("function"==typeof t.expandRange)return t.expandRange(...e,t);e.sort();let n="[".concat(e.join("-"),"]");try{new RegExp(n)}catch(t){return e.map(e=>i.escapeRegex(e)).join("..")}return n},h=(e,t)=>"Missing ".concat(e,': "').concat(t,'" - use "\\\\').concat(t,'" to match literal characters'),d=(e,t)=>{let n;if("string"!=typeof e)throw TypeError("Expected a string");e=u[e]||e;let p={...t},f="number"==typeof p.maxLength?Math.min(a,p.maxLength):a,m=e.length;if(m>f)throw SyntaxError("Input length: ".concat(m,", exceeds maximum allowed length: ").concat(f));let g={type:"bos",value:"",output:p.prepend||""},v=[g],y=p.capture?"":"?:",_=r.globChars(p.windows),x=r.extglobChars(_),{DOT_LITERAL:b,PLUS_LITERAL:S,SLASH_LITERAL:M,ONE_CHAR:w,DOTS_SLASH:E,NO_DOT:T,NO_DOT_SLASH:A,NO_DOTS_SLASH:C,QMARK:R,QMARK_NO_DOT:P,STAR:I,START_ANCHOR:L}=_,N=e=>"(".concat(y,"(?:(?!").concat(L).concat(e.dot?E:b,").)*?)"),D=p.dot?"":T,U=p.dot?R:P,O=!0===p.bash?N(p):I;p.capture&&(O="(".concat(O,")")),"boolean"==typeof p.noext&&(p.noextglob=p.noext);let F={input:e,index:-1,start:0,dot:!0===p.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:v};m=(e=i.removePrefix(e,F)).length;let k=[],z=[],B=[],H=g,V=()=>F.index===m-1,G=F.peek=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e[F.index+t]},W=F.advance=()=>e[++F.index]||"",j=()=>e.slice(F.index+1),X=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;F.consumed+=e,F.index+=t},q=e=>{F.output+=null!=e.output?e.output:e.value,X(e.value)},Y=()=>{let e=1;for(;"!"===G()&&("("!==G(2)||"?"===G(3));)W(),F.start++,e++;return e%2!=0&&(F.negated=!0,F.start++,!0)},J=e=>{F[e]++,B.push(e)},Z=e=>{F[e]--,B.pop()},K=e=>{if("globstar"===H.type){let t=F.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||k.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(F.output=F.output.slice(0,-H.output.length),H.type="star",H.value="*",H.output=O,F.output+=H.output)}if(k.length&&"paren"!==e.type&&(k[k.length-1].inner+=e.value),(e.value||e.output)&&q(e),H&&"text"===H.type&&"text"===e.type){H.output=(H.output||H.value)+e.value,H.value+=e.value;return}e.prev=H,v.push(e),H=e},$=(e,t)=>{let n={...x[t],conditions:1,inner:""};n.prev=H,n.parens=F.parens,n.output=F.output;let r=(p.capture?"(":"")+n.open;J("parens"),K({type:e,value:t,output:F.output?"":w}),K({type:"paren",extglob:!0,value:W(),output:r}),k.push(n)},Q=e=>{let r,i=e.close+(p.capture?")":"");if("negate"===e.type){let n=O;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(n=N(p)),(n!==O||V()||/^\)+$/.test(j()))&&(i=e.close=")$))".concat(n)),e.inner.includes("*")&&(r=j())&&/^\.[^\\/.]+$/.test(r)){let a=d(r,{...t,fastpaths:!1}).output;i=e.close=")".concat(a,")").concat(n,")")}"bos"===e.prev.type&&(F.negatedExtglob=!0)}K({type:"paren",extglob:!0,value:n,output:i}),Z("parens")};if(!1!==p.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,r=e.replace(l,(e,t,r,i,a,s)=>"\\"===i?(n=!0,e):"?"===i?t?t+i+(a?R.repeat(a.length):""):0===s?U+(a?R.repeat(a.length):""):R.repeat(r.length):"."===i?b.repeat(r.length):"*"===i?t?t+i+(a?O:""):O:t?e:"\\".concat(e));return(!0===n&&(r=!0===p.unescape?r.replace(/\\/g,""):r.replace(/\\+/g,e=>e.length%2==0?"\\\\":e?"\\":"")),r===e&&!0===p.contains)?F.output=e:F.output=i.wrapOutput(r,F,t),F}for(;!V();){if("\0"===(n=W()))continue;if("\\"===n){let e=G();if("/"===e&&!0!==p.bash||"."===e||";"===e)continue;if(!e){K({type:"text",value:n+="\\"});continue}let t=/^\\+/.exec(j()),r=0;if(t&&t[0].length>2&&(r=t[0].length,F.index+=r,r%2!=0&&(n+="\\")),!0===p.unescape?n=W():n+=W(),0===F.brackets){K({type:"text",value:n});continue}}if(F.brackets>0&&("]"!==n||"["===H.value||"[^"===H.value)){if(!1!==p.posix&&":"===n){let e=H.value.slice(1);if(e.includes("[")&&(H.posix=!0,e.includes(":"))){let e=H.value.lastIndexOf("["),t=H.value.slice(0,e),n=s[H.value.slice(e+2)];if(n){H.value=t+n,F.backtrack=!0,W(),g.output||1!==v.indexOf(H)||(g.output=w);continue}}}("["===n&&":"!==G()||"-"===n&&"]"===G())&&(n="\\".concat(n)),"]"===n&&("["===H.value||"[^"===H.value)&&(n="\\".concat(n)),!0===p.posix&&"!"===n&&"["===H.value&&(n="^"),H.value+=n,q({value:n});continue}if(1===F.quotes&&'"'!==n){n=i.escapeRegex(n),H.value+=n,q({value:n});continue}if('"'===n){F.quotes=+(1!==F.quotes),!0===p.keepQuotes&&K({type:"text",value:n});continue}if("("===n){J("parens"),K({type:"paren",value:n});continue}if(")"===n){if(0===F.parens&&!0===p.strictBrackets)throw SyntaxError(h("opening","("));let e=k[k.length-1];if(e&&F.parens===e.parens+1){Q(k.pop());continue}K({type:"paren",value:n,output:F.parens?")":"\\)"}),Z("parens");continue}if("["===n){if(!0!==p.nobracket&&j().includes("]"))J("brackets");else{if(!0!==p.nobracket&&!0===p.strictBrackets)throw SyntaxError(h("closing","]"));n="\\".concat(n)}K({type:"bracket",value:n});continue}if("]"===n){if(!0===p.nobracket||H&&"bracket"===H.type&&1===H.value.length){K({type:"text",value:n,output:"\\".concat(n)});continue}if(0===F.brackets){if(!0===p.strictBrackets)throw SyntaxError(h("opening","["));K({type:"text",value:n,output:"\\".concat(n)});continue}Z("brackets");let e=H.value.slice(1);if(!0===H.posix||"^"!==e[0]||e.includes("/")||(n="/".concat(n)),H.value+=n,q({value:n}),!1===p.literalBrackets||i.hasRegexChars(e))continue;let t=i.escapeRegex(H.value);if(F.output=F.output.slice(0,-H.value.length),!0===p.literalBrackets){F.output+=t,H.value=t;continue}H.value="(".concat(y).concat(t,"|").concat(H.value,")"),F.output+=H.value;continue}if("{"===n&&!0!==p.nobrace){J("braces");let e={type:"brace",value:n,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};z.push(e),K(e);continue}if("}"===n){let e=z[z.length-1];if(!0===p.nobrace||!e){K({type:"text",value:n,output:n});continue}let t=")";if(!0===e.dots){let e=v.slice(),n=[];for(let t=e.length-1;t>=0&&(v.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=c(n,p),F.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){let r=F.output.slice(0,e.outputIndex),i=F.tokens.slice(e.tokensIndex);for(let a of(e.value=e.output="\\{",n=t="\\}",F.output=r,i))F.output+=a.output||a.value}K({type:"brace",value:n,output:t}),Z("braces"),z.pop();continue}if("|"===n){k.length>0&&k[k.length-1].conditions++,K({type:"text",value:n});continue}if(","===n){let e=n,t=z[z.length-1];t&&"braces"===B[B.length-1]&&(t.comma=!0,e="|"),K({type:"comma",value:n,output:e});continue}if("/"===n){if("dot"===H.type&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",v.pop(),H=g;continue}K({type:"slash",value:n,output:M});continue}if("."===n){if(F.braces>0&&"dot"===H.type){"."===H.value&&(H.output=b);let e=z[z.length-1];H.type="dots",H.output+=n,H.value+=n,e.dots=!0;continue}if(F.braces+F.parens===0&&"bos"!==H.type&&"slash"!==H.type){K({type:"text",value:n,output:b});continue}K({type:"dot",value:n,output:b});continue}if("?"===n){if(!(H&&"("===H.value)&&!0!==p.noextglob&&"("===G()&&"?"!==G(2)){$("qmark",n);continue}if(H&&"paren"===H.type){let e=G(),t=n;("("!==H.value||/[!=<:]/.test(e))&&("<"!==e||/<([!=]|\w+>)/.test(j()))||(t="\\".concat(n)),K({type:"text",value:n,output:t});continue}if(!0!==p.dot&&("slash"===H.type||"bos"===H.type)){K({type:"qmark",value:n,output:P});continue}K({type:"qmark",value:n,output:R});continue}if("!"===n){if(!0!==p.noextglob&&"("===G()&&("?"!==G(2)||!/[!=<:]/.test(G(3)))){$("negate",n);continue}if(!0!==p.nonegate&&0===F.index){Y();continue}}if("+"===n){if(!0!==p.noextglob&&"("===G()&&"?"!==G(2)){$("plus",n);continue}if(H&&"("===H.value||!1===p.regex){K({type:"plus",value:n,output:S});continue}if(H&&("bracket"===H.type||"paren"===H.type||"brace"===H.type)||F.parens>0){K({type:"plus",value:n});continue}K({type:"plus",value:S});continue}if("@"===n){if(!0!==p.noextglob&&"("===G()&&"?"!==G(2)){K({type:"at",extglob:!0,value:n,output:""});continue}K({type:"text",value:n});continue}if("*"!==n){("$"===n||"^"===n)&&(n="\\".concat(n));let e=o.exec(j());e&&(n+=e[0],F.index+=e[0].length),K({type:"text",value:n});continue}if(H&&("globstar"===H.type||!0===H.star)){H.type="star",H.star=!0,H.value+=n,H.output=O,F.backtrack=!0,F.globstar=!0,X(n);continue}let t=j();if(!0!==p.noextglob&&/^\([^?]/.test(t)){$("star",n);continue}if("star"===H.type){if(!0===p.noglobstar){X(n);continue}let r=H.prev,i=r.prev,a="slash"===r.type||"bos"===r.type,s=i&&("star"===i.type||"globstar"===i.type);if(!0===p.bash&&(!a||t[0]&&"/"!==t[0])){K({type:"star",value:n,output:""});continue}let o=F.braces>0&&("comma"===r.type||"brace"===r.type),l=k.length&&("pipe"===r.type||"paren"===r.type);if(!a&&"paren"!==r.type&&!o&&!l){K({type:"star",value:n,output:""});continue}for(;"/**"===t.slice(0,3);){let n=e[F.index+4];if(n&&"/"!==n)break;t=t.slice(3),X("/**",3)}if("bos"===r.type&&V()){H.type="globstar",H.value+=n,H.output=N(p),F.output=H.output,F.globstar=!0,X(n);continue}if("slash"===r.type&&"bos"!==r.prev.type&&!s&&V()){F.output=F.output.slice(0,-(r.output+H.output).length),r.output="(?:".concat(r.output),H.type="globstar",H.output=N(p)+(p.strictSlashes?")":"|$)"),H.value+=n,F.globstar=!0,F.output+=r.output+H.output,X(n);continue}if("slash"===r.type&&"bos"!==r.prev.type&&"/"===t[0]){let e=void 0!==t[1]?"|$":"";F.output=F.output.slice(0,-(r.output+H.output).length),r.output="(?:".concat(r.output),H.type="globstar",H.output="".concat(N(p)).concat(M,"|").concat(M).concat(e,")"),H.value+=n,F.output+=r.output+H.output,F.globstar=!0,X(n+W()),K({type:"slash",value:"/",output:""});continue}if("bos"===r.type&&"/"===t[0]){H.type="globstar",H.value+=n,H.output="(?:^|".concat(M,"|").concat(N(p)).concat(M,")"),F.output=H.output,F.globstar=!0,X(n+W()),K({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-H.output.length),H.type="globstar",H.output=N(p),H.value+=n,F.output+=H.output,F.globstar=!0,X(n);continue}let r={type:"star",value:n,output:O};if(!0===p.bash){r.output=".*?",("bos"===H.type||"slash"===H.type)&&(r.output=D+r.output),K(r);continue}if(H&&("bracket"===H.type||"paren"===H.type)&&!0===p.regex){r.output=n,K(r);continue}(F.index===F.start||"slash"===H.type||"dot"===H.type)&&("dot"===H.type?(F.output+=A,H.output+=A):!0===p.dot?(F.output+=C,H.output+=C):(F.output+=D,H.output+=D),"*"!==G()&&(F.output+=w,H.output+=w)),K(r)}for(;F.brackets>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing","]"));F.output=i.escapeLast(F.output,"["),Z("brackets")}for(;F.parens>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing",")"));F.output=i.escapeLast(F.output,"("),Z("parens")}for(;F.braces>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing","}"));F.output=i.escapeLast(F.output,"{"),Z("braces")}if(!0!==p.strictSlashes&&("star"===H.type||"bracket"===H.type)&&K({type:"maybe_slash",value:"",output:"".concat(M,"?")}),!0===F.backtrack)for(let e of(F.output="",F.tokens))F.output+=null!=e.output?e.output:e.value,e.suffix&&(F.output+=e.suffix);return F};d.fastpaths=(e,t)=>{let n={...t},s="number"==typeof n.maxLength?Math.min(a,n.maxLength):a,o=e.length;if(o>s)throw SyntaxError("Input length: ".concat(o,", exceeds maximum allowed length: ").concat(s));e=u[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:h,DOTS_SLASH:d,NO_DOT:p,NO_DOTS:f,NO_DOTS_SLASH:m,STAR:g,START_ANCHOR:v}=r.globChars(n.windows),y=n.dot?f:p,_=n.dot?m:p,x=n.capture?"":"?:",b=!0===n.bash?".*?":g;n.capture&&(b="(".concat(b,")"));let S=e=>!0===e.noglobstar?b:"(".concat(x,"(?:(?!").concat(v).concat(e.dot?d:l,").)*?)"),M=e=>{switch(e){case"*":return"".concat(y).concat(h).concat(b);case".*":return"".concat(l).concat(h).concat(b);case"*.*":return"".concat(y).concat(b).concat(l).concat(h).concat(b);case"*/*":return"".concat(y).concat(b).concat(c).concat(h).concat(_).concat(b);case"**":return y+S(n);case"**/*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(_).concat(h).concat(b);case"**/*.*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(_).concat(b).concat(l).concat(h).concat(b);case"**/.*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(l).concat(h).concat(b);default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=M(t[1]);if(!n)return;return n+l+t[2]}}},w=M(i.removePrefix(e,{negated:!1,prefix:""}));return w&&!0!==n.strictSlashes&&(w+="".concat(c,"?")),w},t.exports=d},53174,(e,t,n)=>{"use strict";let r=e.r(26094),i=e.r(17932),a=e.r(19241),s=e.r(53487),o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(e)){let r=e.map(e=>o(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=e&&"object"==typeof e&&!Array.isArray(e)&&e.tokens&&e.input;if(""===e||"string"!=typeof e&&!r)throw TypeError("Expected pattern to be a non-empty string");let i=t||{},a=i.windows,s=r?o.compileRe(e,t):o.makeRe(e,t,!1,!0),l=s.state;delete s.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=o(i.ignore,e,n)}let c=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{isMatch:c,match:h,output:d}=o.test(n,s,t,{glob:e,posix:a}),p={glob:e,state:l,regex:s,posix:a,input:n,output:d,match:h,isMatch:c};return("function"==typeof i.onResult&&i.onResult(p),!1===c)?(p.isMatch=!1,!!r&&p):u(n)?("function"==typeof i.onIgnore&&i.onIgnore(p),p.isMatch=!1,!!r&&p):("function"==typeof i.onMatch&&i.onMatch(p),!r||p)};return n&&(c.state=l),c};o.test=function(e,t,n){let{glob:r,posix:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("string"!=typeof e)throw TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};let s=n||{},l=s.format||(i?a.toPosixSlashes:null),u=e===r,c=u&&l?l(e):e;return!1===u&&(u=(c=l?l(e):e)===r),(!1===u||!0===s.capture)&&(u=!0===s.matchBase||!0===s.basename?o.matchBase(e,t,n,i):t.exec(c)),{isMatch:!!u,match:u,output:c}},o.matchBase=(e,t,n)=>(t instanceof RegExp?t:o.makeRe(t,n)).test(a.basename(e)),o.isMatch=(e,t,n)=>o(t,n)(e),o.parse=(e,t)=>Array.isArray(e)?e.map(e=>o.parse(e,t)):i(e,{...t,fastpaths:!1}),o.scan=(e,t)=>r(e,t),o.compileRe=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!0===n)return e.output;let i=t||{},a=i.contains?"":"^",s=i.contains?"":"$",l="".concat(a,"(?:").concat(e.output,")").concat(s);e&&!0===e.negated&&(l="^(?!".concat(l,").*$"));let u=o.toRegex(l,t);return!0===r&&(u.state=e),u},o.makeRe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e||"string"!=typeof e)throw TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1!==t.fastpaths&&("."===e[0]||"*"===e[0])&&(a.output=i.fastpaths(e,t)),a.output||(a=i(e,t)),o.compileRe(a,t,n,r)},o.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},o.constants=s,t.exports=o},54970,(e,t,n)=>{"use strict";let r=e.r(53174),i=e.r(19241);function a(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&(null===t.windows||void 0===t.windows)&&(t={...t,windows:i.isWindows()}),r(e,t,n)}Object.assign(a,r),t.exports=a},98223,71726,91996,e=>{"use strict";function t(e){return e.split(/(?:\r\n|\r|\n)/g).map(e=>e.trim()).filter(Boolean).filter(e=>!e.startsWith(";")).map(e=>{let t=e.match(/^(.+)\s(\d+)$/);if(!t)return{name:e,frameCount:1};{let e=parseInt(t[2],10);return{name:t[1],frameCount:e}}})}e.s(["parseImageFileList",()=>t],98223),e.s(["getActualResourceKey",()=>l,"getMissionInfo",()=>d,"getMissionList",()=>p,"getResourceKey",()=>a,"getResourceList",()=>u,"getResourceMap",()=>s,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>h],91996);var n=e.i(63738);function r(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}e.s(["normalizePath",()=>r],71726);let i=n.default;function a(e){return r(e).toLowerCase()}function s(){return i.resources}function o(e){let[t,...n]=i.resources[e],[r,a]=n[n.length-1];return[r,null!=a?a:t]}function l(e){let t=a(e);if(i.resources[t])return t;let n=t.replace(/\d+(\.(png))$/i,"$1");if(i.resources[n])return n;throw Error("Resource not found in manifest: ".concat(e))}function u(){return Object.keys(i.resources)}let c=["",".jpg",".png",".gif",".bmp"];function h(e){let t=a(e);for(let e of c){let n="".concat(t).concat(e);if(i.resources[n])return n}return t}function d(e){let t=i.missions[e];if(!t)throw Error("Mission not found: ".concat(e));return t}function p(){return Object.keys(i.missions)}},92552,(e,t,n)=>{"use strict";let r,i;function a(e,t){return t.reduce((e,t)=>{let[n,r]=t;return{type:"BinaryExpression",operator:n,left:e,right:r}},e)}function s(e,t){return{type:"UnaryExpression",operator:e,argument:t}}class o extends SyntaxError{format(e){let t="Error: "+this.message;if(this.location){let n=null,r=e.find(e=>e.source===this.location.source);r&&(n=r.text.split(/\r\n|\n|\r/g));let i=this.location.start,a=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(i):i,s=this.location.source+":"+a.line+":"+a.column;if(n){let e=this.location.end,r="".padEnd(a.line.toString().length," "),o=n[i.line-1],l=(i.line===e.line?e.column:o.length+1)-i.column||1;t+="\n --> "+s+"\n"+r+" |\n"+a.line+" | "+o+"\n"+r+" | "+"".padEnd(i.column-1," ")+"".padEnd(l,"^")}else t+="\n at "+s}return t}static buildMessage(e,t){function n(e){return e.codePointAt(0).toString(16).toUpperCase()}let r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function i(e){return r?e.replace(r,e=>"\\u{"+n(e)+"}"):e}function a(e){return i(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+n(e)))}function s(e){return i(e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+n(e)))}let o={literal:e=>'"'+a(e.text)+'"',class(e){let t=e.parts.map(e=>Array.isArray(e)?s(e[0])+"-"+s(e[1]):s(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function l(e){return o[e.type](e)}return"Expected "+function(e){let t=e.map(l);if(t.sort(),t.length>0){let e=1;for(let n=1;n]/,C=/^[+\-]/,R=/^[%*\/]/,P=/^[!\-~]/,I=/^[a-zA-Z_]/,L=/^[a-zA-Z0-9_]/,N=/^[ \t]/,D=/^[^"\\\n\r]/,U=/^[^'\\\n\r]/,O=/^[0-9a-fA-F]/,F=/^[0-9]/,k=/^[xX]/,z=/^[^\n\r]/,B=/^[\n\r]/,H=/^[ \t\n\r]/,V=tT(";",!1),G=tT("package",!1),W=tT("{",!1),j=tT("}",!1),X=tT("function",!1),q=tT("(",!1),Y=tT(")",!1),J=tT("::",!1),Z=tT(",",!1),K=tT("datablock",!1),$=tT(":",!1),Q=tT("new",!1),ee=tT("[",!1),et=tT("]",!1),en=tT("=",!1),er=tT(".",!1),ei=tT("if",!1),ea=tT("else",!1),es=tT("for",!1),eo=tT("while",!1),el=tT("do",!1),eu=tT("switch$",!1),ec=tT("switch",!1),eh=tT("case",!1),ed=tT("default",!1),ep=tT("or",!1),ef=tT("return",!1),em=tT("break",!1),eg=tT("continue",!1),ev=tT("+=",!1),ey=tT("-=",!1),e_=tT("*=",!1),ex=tT("/=",!1),eb=tT("%=",!1),eS=tT("<<=",!1),eM=tT(">>=",!1),ew=tT("&=",!1),eE=tT("|=",!1),eT=tT("^=",!1),eA=tT("?",!1),eC=tT("||",!1),eR=tT("&&",!1),eP=tT("|",!1),eI=tT("^",!1),eL=tT("&",!1),eN=tT("==",!1),eD=tT("!=",!1),eU=tT("<=",!1),eO=tT(">=",!1),eF=tA(["<",">"],!1,!1,!1),ek=tT("$=",!1),ez=tT("!$=",!1),eB=tT("@",!1),eH=tT("NL",!1),eV=tT("TAB",!1),eG=tT("SPC",!1),eW=tT("<<",!1),ej=tT(">>",!1),eX=tA(["+","-"],!1,!1,!1),eq=tA(["%","*","/"],!1,!1,!1),eY=tA(["!","-","~"],!1,!1,!1),eJ=tT("++",!1),eZ=tT("--",!1),eK=tT("*",!1),e$=tT("%",!1),eQ=tA([["a","z"],["A","Z"],"_"],!1,!1,!1),e0=tA([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),e1=tT("$",!1),e2=tT("parent",!1),e3=tA([" "," "],!1,!1,!1),e4=tT('"',!1),e5=tT("'",!1),e6=tT("\\",!1),e8=tA(['"',"\\","\n","\r"],!0,!1,!1),e9=tA(["'","\\","\n","\r"],!0,!1,!1),e7=tT("n",!1),te=tT("r",!1),tt=tT("t",!1),tn=tT("x",!1),tr=tA([["0","9"],["a","f"],["A","F"]],!1,!1,!1),ti=tT("cr",!1),ta=tT("cp",!1),ts=tT("co",!1),to=tT("c",!1),tl=tA([["0","9"]],!1,!1,!1),tu={type:"any"},tc=tT("0",!1),th=tA(["x","X"],!1,!1,!1),td=tT("-",!1),tp=tT("true",!1),tf=tT("false",!1),tm=tT("//",!1),tg=tA(["\n","\r"],!0,!1,!1),tv=tA(["\n","\r"],!1,!1,!1),ty=tT("/*",!1),t_=tT("*/",!1),tx=tA([" "," ","\n","\r"],!1,!1,!1),tb=0|t.peg$currPos,tS=[{line:1,column:1}],tM=tb,tw=t.peg$maxFailExpected||[],tE=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in c))throw Error("Can't start parsing from rule \""+t.startRule+'".');h=c[t.startRule]}function tT(e,t){return{type:"literal",text:e,ignoreCase:t}}function tA(e,t,n,r){return{type:"class",parts:e,inverted:t,ignoreCase:n,unicode:r}}function tC(t){let n,r=tS[t];if(r)return r;if(t>=tS.length)n=tS.length-1;else for(n=t;!tS[--n];);for(r={line:(r=tS[n]).line,column:r.column};ntM&&(tM=tb,tw=[]),tw.push(e))}function tI(){let e,t,n;for(nh(),e=[],t=tb,(n=nl())===l&&(n=tL()),n!==l?t=n=[n,nh()]:(tb=t,t=l);t!==l;)e.push(t),t=tb,(n=nl())===l&&(n=tL()),n!==l?t=n=[n,nh()]:(tb=t,t=l);return{type:"Program",body:e.map(e=>{let[t]=e;return t}).filter(Boolean),execScriptPaths:Array.from(r),hasDynamicExec:i}}function tL(){let t,n,r,i,a,s,o,u,c,h,f,_,x,w,E,T,A;return(t=function(){let t,n,r,i,a,s,o,u;if(t=tb,e.substr(tb,7)===d?(n=d,tb+=7):(n=l,0===tE&&tP(G)),n!==l)if(nc()!==l)if((r=nr())!==l)if(nu(),123===e.charCodeAt(tb)?(i="{",tb++):(i=l,0===tE&&tP(W)),i!==l){for(nh(),a=[],s=tb,(o=nl())===l&&(o=tL()),o!==l?s=o=[o,u=nh()]:(tb=s,s=l);s!==l;)a.push(s),s=tb,(o=nl())===l&&(o=tL()),o!==l?s=o=[o,u=nh()]:(tb=s,s=l);(125===e.charCodeAt(tb)?(s="}",tb++):(s=l,0===tE&&tP(j)),s!==l)?(o=nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),t={type:"PackageDeclaration",name:r,body:a.map(e=>{let[t]=e;return t}).filter(Boolean)}):(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o;if(t=tb,e.substr(tb,8)===p?(n=p,tb+=8):(n=l,0===tE&&tP(X)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i;if(t=tb,(n=nr())!==l)if("::"===e.substr(tb,2)?(r="::",tb+=2):(r=l,0===tE&&tP(J)),r!==l)if((i=nr())!==l)t={type:"MethodName",namespace:n,method:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=nr()),t}())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=function(){let t,n,r,i,a,s,o,u;if(t=tb,(n=nr())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=nr())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=nr())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=[n,...r.map(e=>{let[,,,t]=e;return t})]}else tb=t,t=l;return t}())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l)if(nu(),(o=tH())!==l)t={type:"FunctionDeclaration",name:r,params:a||[],body:o};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&((r=tb,(i=tN())!==l)?(nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a===l&&(a=null),nu(),r=i):(tb=r,r=l),(t=r)===l&&((s=tb,(o=tD())!==l)?(nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),nu(),s=o):(tb=s,s=l),(t=s)===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h,d;if(t=tb,"if"===e.substr(tb,2)?(n="if",tb+=2):(n=l,0===tE&&tP(ei)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),(s=tL())!==l){var p;o=tb,u=nu(),e.substr(tb,4)===m?(c=m,tb+=4):(c=l,0===tE&&tP(ea)),c!==l?(h=nu(),(d=tL())!==l?o=u=[u,c,h,d]:(tb=o,o=l)):(tb=o,o=l),o===l&&(o=null),t={type:"IfStatement",test:i,consequent:s,alternate:(p=o)?p[3]:null}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h;if(t=tb,"for"===e.substr(tb,3)?(n="for",tb+=3):(n=l,0===tE&&tP(es)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())===l&&(i=null),nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a!==l)if(nu(),(s=tV())===l&&(s=null),nu(),59===e.charCodeAt(tb)?(o=";",tb++):(o=l,0===tE&&tP(V)),o!==l)if(nu(),(u=tV())===l&&(u=null),nu(),41===e.charCodeAt(tb)?(c=")",tb++):(c=l,0===tE&&tP(Y)),c!==l)if(nu(),(h=tL())!==l){var d,p;d=i,p=s,t={type:"ForStatement",init:d,test:p,update:u,body:h}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u;if(t=tb,"do"===e.substr(tb,2)?(n="do",tb+=2):(n=l,0===tE&&tP(el)),n!==l)if(nu(),(r=tL())!==l)if(nu(),e.substr(tb,5)===g?(i=g,tb+=5):(i=l,0===tE&&tP(eo)),i!==l)if(nu(),40===e.charCodeAt(tb)?(a="(",tb++):(a=l,0===tE&&tP(q)),a!==l)if(nu(),(s=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(o=")",tb++):(o=l,0===tE&&tP(Y)),o!==l)nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),t={type:"DoWhileStatement",test:s,body:r};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s;if(t=tb,e.substr(tb,5)===g?(n=g,tb+=5):(n=l,0===tE&&tP(eo)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),(s=tL())!==l)t={type:"WhileStatement",test:i,body:s};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h;if(t=tb,e.substr(tb,7)===v?(n=v,tb+=7):(n=l,0===tE&&tP(eu)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),123===e.charCodeAt(tb)?(s="{",tb++):(s=l,0===tE&&tP(W)),s!==l){for(nh(),o=[],u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);u!==l;)o.push(u),u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);(125===e.charCodeAt(tb)?(u="}",tb++):(u=l,0===tE&&tP(j)),u!==l)?t={type:"SwitchStatement",stringMode:!0,discriminant:i,cases:o.map(e=>{let[t]=e;return t}).filter(e=>e&&"SwitchCase"===e.type)}:(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;if(t===l)if(t=tb,e.substr(tb,6)===y?(n=y,tb+=6):(n=l,0===tE&&tP(ec)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),123===e.charCodeAt(tb)?(s="{",tb++):(s=l,0===tE&&tP(W)),s!==l){for(nh(),o=[],u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);u!==l;)o.push(u),u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);(125===e.charCodeAt(tb)?(u="}",tb++):(u=l,0===tE&&tP(j)),u!==l)?t={type:"SwitchStatement",stringMode:!1,discriminant:i,cases:o.map(e=>{let[t]=e;return t}).filter(e=>e&&"SwitchCase"===e.type)}:(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a;if(t=tb,e.substr(tb,6)===b?(n=b,tb+=6):(n=l,0===tE&&tP(ef)),n!==l)if(r=tb,(i=nc())!==l&&(a=tV())!==l?r=i=[i,a]:(tb=r,r=l),r===l&&(r=null),i=nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a!==l){var s;t={type:"ReturnStatement",value:(s=r)?s[1]:null}}else tb=t,t=l;else tb=t,t=l;return t}())===l&&(c=tb,e.substr(tb,5)===S?(h=S,tb+=5):(h=l,0===tE&&tP(em)),h!==l?(nu(),59===e.charCodeAt(tb)?(f=";",tb++):(f=l,0===tE&&tP(V)),f!==l?c={type:"BreakStatement"}:(tb=c,c=l)):(tb=c,c=l),(t=c)===l&&(_=tb,e.substr(tb,8)===M?(x=M,tb+=8):(x=l,0===tE&&tP(eg)),x!==l?(nu(),59===e.charCodeAt(tb)?(w=";",tb++):(w=l,0===tE&&tP(V)),w!==l?_={type:"ContinueStatement"}:(tb=_,_=l)):(tb=_,_=l),(t=_)===l&&((E=tb,(T=tV())!==l&&(nu(),59===e.charCodeAt(tb)?(A=";",tb++):(A=l,0===tE&&tP(V)),A!==l))?E={type:"ExpressionStatement",expression:T}:(tb=E,E=l),(t=E)===l&&(t=tH())===l&&(t=nl())===l)))))&&(t=tb,nu(),59===e.charCodeAt(tb)?(n=";",tb++):(n=l,0===tE&&tP(V)),n!==l?(nu(),t=null):(tb=t,t=l)),t}function tN(){let t,n,r,i,a,s,o,u,c,h,d,p,m,g;if(t=tb,e.substr(tb,9)===f?(n=f,tb+=9):(n=l,0===tE&&tP(K)),n!==l)if(nc()!==l)if((r=nr())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=tO())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l){var v,y,_;if(nu(),o=tb,58===e.charCodeAt(tb)?(u=":",tb++):(u=l,0===tE&&tP($)),u!==l?(c=nu(),(h=nr())!==l?o=u=[u,c,h]:(tb=o,o=l)):(tb=o,o=l),o===l&&(o=null),u=nu(),c=tb,123===e.charCodeAt(tb)?(h="{",tb++):(h=l,0===tE&&tP(W)),h!==l){for(d=nu(),p=[],m=tU();m!==l;)p.push(m),m=tU();m=nu(),125===e.charCodeAt(tb)?(g="}",tb++):(g=l,0===tE&&tP(j)),g!==l?c=h=[h,d,p,m,g,nu()]:(tb=c,c=l)}else tb=c,c=l;c===l&&(c=null),v=a,y=o,_=c,t={type:"DatablockDeclaration",className:r,instanceName:v,parent:y?y[2]:null,body:_?_[2].filter(Boolean):[]}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}function tD(){let t,n,r,i,a,s,o,u,c,h,d,p;if(t=tb,"new"===e.substr(tb,3)?(n="new",tb+=3):(n=l,0===tE&&tP(Q)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i,a,s,o,u,c,h;if((t=tb,40===e.charCodeAt(tb)?(n="(",tb++):(n=l,0===tE&&tP(q)),n!==l&&(r=nu(),(i=tV())!==l&&(a=nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l)))?t=i:(tb=t,t=l),t===l)if(t=tb,(n=nr())!==l){var d;for(r=[],i=tb,a=nu(),91===e.charCodeAt(tb)?(s="[",tb++):(s=l,0===tE&&tP(ee)),s!==l?(o=nu(),(u=tz())!==l?(c=nu(),93===e.charCodeAt(tb)?(h="]",tb++):(h=l,0===tE&&tP(et)),h!==l?i=a=[a,s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),91===e.charCodeAt(tb)?(s="[",tb++):(s=l,0===tE&&tP(ee)),s!==l?(o=nu(),(u=tz())!==l?(c=nu(),93===e.charCodeAt(tb)?(h="]",tb++):(h=l,0===tE&&tP(et)),h!==l?i=a=[a,s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);d=n,t=r.reduce((e,t)=>{let[,,,n]=t;return{type:"IndexExpression",object:e,index:n}},d)}else tb=t,t=l;return t}())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=tO())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l){var f;if(nu(),o=tb,123===e.charCodeAt(tb)?(u="{",tb++):(u=l,0===tE&&tP(W)),u!==l){for(c=nu(),h=[],d=tU();d!==l;)h.push(d),d=tU();d=nu(),125===e.charCodeAt(tb)?(p="}",tb++):(p=l,0===tE&&tP(j)),p!==l?o=u=[u,c,h,d,p,nu()]:(tb=o,o=l)}else tb=o,o=l;o===l&&(o=null),t={type:"ObjectDeclaration",className:r,instanceName:a,body:(f=o)?f[2].filter(Boolean):[]}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}function tU(){let t,n,r;return(t=tb,(n=tD())!==l)?(nu(),59===e.charCodeAt(tb)?(r=";",tb++):(r=l,0===tE&&tP(V)),r===l&&(r=null),nu(),t=n):(tb=t,t=l),t===l&&((t=tb,(n=tN())!==l)?(nu(),59===e.charCodeAt(tb)?(r=";",tb++):(r=l,0===tE&&tP(V)),r===l&&(r=null),nu(),t=n):(tb=t,t=l),t===l&&(t=function(){let t,n,r,i,a;if(t=tb,nu(),(n=tF())!==l)if(nu(),61===e.charCodeAt(tb)?(r="=",tb++):(r=l,0===tE&&tP(en)),r!==l)if(nu(),(i=tV())!==l)nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a===l&&(a=null),nu(),t={type:"Assignment",target:n,value:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=nl())===l&&(t=function(){let t,n;if(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n!==l)for(;n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));else t=l;return t!==l&&(t=null),t}())),t}function tO(){let e;return(e=tQ())===l&&(e=nr())===l&&(e=no()),e}function tF(){let e,t,n,r;if(e=tb,(t=t9())!==l){for(n=[],r=tk();r!==l;)n.push(r),r=tk();e=n.reduce((e,t)=>"property"===t.type?{type:"MemberExpression",object:e,property:t.value}:{type:"IndexExpression",object:e,index:t.value},t)}else tb=e,e=l;return e}function tk(){let t,n,r,i;return(t=tb,46===e.charCodeAt(tb)?(n=".",tb++):(n=l,0===tE&&tP(er)),n!==l&&(nu(),(r=nr())!==l))?t={type:"property",value:r}:(tb=t,t=l),t===l&&((t=tb,91===e.charCodeAt(tb)?(n="[",tb++):(n=l,0===tE&&tP(ee)),n!==l&&(nu(),(r=tz())!==l&&(nu(),93===e.charCodeAt(tb)?(i="]",tb++):(i=l,0===tE&&tP(et)),i!==l)))?t={type:"index",value:r}:(tb=t,t=l)),t}function tz(){let t,n,r,i,a,s,o,u;if(t=tb,(n=tV())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=r.length>0?[n,...r.map(e=>{let[,,,t]=e;return t})]:n}else tb=t,t=l;return t}function tB(){let t,n,r,i,a,s,o,u,c;if(t=tb,e.substr(tb,4)===_?(n=_,tb+=4):(n=l,0===tE&&tP(eh)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i,a,s,o,u;if(t=tb,(n=t4())!==l){for(r=[],i=tb,a=nu(),"or"===e.substr(tb,2)?(s="or",tb+=2):(s=l,0===tE&&tP(ep)),s!==l&&(o=nc())!==l&&(u=t4())!==l?i=a=[a,s,o,u]:(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),"or"===e.substr(tb,2)?(s="or",tb+=2):(s=l,0===tE&&tP(ep)),s!==l&&(o=nc())!==l&&(u=t4())!==l?i=a=[a,s,o,u]:(tb=i,i=l);t=r.length>0?[n,...r.map(e=>{let[,,,t]=e;return t})]:n}else tb=t,t=l;return t}())!==l)if(nu(),58===e.charCodeAt(tb)?(i=":",tb++):(i=l,0===tE&&tP($)),i!==l){for(a=nh(),s=[],o=tb,(u=nl())===l&&(u=tL()),u!==l?o=u=[u,c=nh()]:(tb=o,o=l);o!==l;)s.push(o),o=tb,(u=nl())===l&&(u=tL()),u!==l?o=u=[u,c=nh()]:(tb=o,o=l);t={type:"SwitchCase",test:r,consequent:s.map(e=>{let[t]=e;return t}).filter(Boolean)}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;if(t===l)if(t=tb,e.substr(tb,7)===x?(n=x,tb+=7):(n=l,0===tE&&tP(ed)),n!==l)if(nu(),58===e.charCodeAt(tb)?(r=":",tb++):(r=l,0===tE&&tP($)),r!==l){for(nh(),i=[],a=tb,(s=nl())===l&&(s=tL()),s!==l?a=s=[s,o=nh()]:(tb=a,a=l);a!==l;)i.push(a),a=tb,(s=nl())===l&&(s=tL()),s!==l?a=s=[s,o=nh()]:(tb=a,a=l);t={type:"SwitchCase",test:null,consequent:i.map(e=>{let[t]=e;return t}).filter(Boolean)}}else tb=t,t=l;else tb=t,t=l;return t}function tH(){let t,n,r,i,a,s;if(t=tb,123===e.charCodeAt(tb)?(n="{",tb++):(n=l,0===tE&&tP(W)),n!==l){for(nh(),r=[],i=tb,(a=nl())===l&&(a=tL()),a!==l?i=a=[a,s=nh()]:(tb=i,i=l);i!==l;)r.push(i),i=tb,(a=nl())===l&&(a=tL()),a!==l?i=a=[a,s=nh()]:(tb=i,i=l);(125===e.charCodeAt(tb)?(i="}",tb++):(i=l,0===tE&&tP(j)),i!==l)?t={type:"BlockStatement",body:r.map(e=>{let[t]=e;return t}).filter(Boolean)}:(tb=t,t=l)}else tb=t,t=l;return t}function tV(){let t,n,r,i;if(t=tb,(n=tF())!==l)if(nu(),(r=tG())!==l)if(nu(),(i=tV())!==l)t={type:"AssignmentExpression",operator:r,target:n,value:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=function(){let t,n,r,i,a,s;if(t=tb,(n=tW())!==l)if(nu(),63===e.charCodeAt(tb)?(r="?",tb++):(r=l,0===tE&&tP(eA)),r!==l)if(nu(),(i=tV())!==l)if(nu(),58===e.charCodeAt(tb)?(a=":",tb++):(a=l,0===tE&&tP($)),a!==l)if(nu(),(s=tV())!==l)t={type:"ConditionalExpression",test:n,consequent:i,alternate:s};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=tW()),t}()),t}function tG(){let t;return 61===e.charCodeAt(tb)?(t="=",tb++):(t=l,0===tE&&tP(en)),t===l&&("+="===e.substr(tb,2)?(t="+=",tb+=2):(t=l,0===tE&&tP(ev)),t===l&&("-="===e.substr(tb,2)?(t="-=",tb+=2):(t=l,0===tE&&tP(ey)),t===l&&("*="===e.substr(tb,2)?(t="*=",tb+=2):(t=l,0===tE&&tP(e_)),t===l&&("/="===e.substr(tb,2)?(t="/=",tb+=2):(t=l,0===tE&&tP(ex)),t===l&&("%="===e.substr(tb,2)?(t="%=",tb+=2):(t=l,0===tE&&tP(eb)),t===l&&("<<="===e.substr(tb,3)?(t="<<=",tb+=3):(t=l,0===tE&&tP(eS)),t===l&&(">>="===e.substr(tb,3)?(t=">>=",tb+=3):(t=l,0===tE&&tP(eM)),t===l&&("&="===e.substr(tb,2)?(t="&=",tb+=2):(t=l,0===tE&&tP(ew)),t===l&&("|="===e.substr(tb,2)?(t="|=",tb+=2):(t=l,0===tE&&tP(eE)),t===l&&("^="===e.substr(tb,2)?(t="^=",tb+=2):(t=l,0===tE&&tP(eT)))))))))))),t}function tW(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tj())!==l){for(r=[],i=tb,s=nu(),"||"===e.substr(tb,2)?(o="||",tb+=2):(o=l,0===tE&&tP(eC)),o!==l?(u=nu(),(c=tj())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),"||"===e.substr(tb,2)?(o="||",tb+=2):(o=l,0===tE&&tP(eC)),o!==l?(u=nu(),(c=tj())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tj(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tX())!==l){for(r=[],i=tb,s=nu(),"&&"===e.substr(tb,2)?(o="&&",tb+=2):(o=l,0===tE&&tP(eR)),o!==l?(u=nu(),(c=tX())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),"&&"===e.substr(tb,2)?(o="&&",tb+=2):(o=l,0===tE&&tP(eR)),o!==l?(u=nu(),(c=tX())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tX(){let t,n,r,i,s,o,u,c,h;if(t=tb,(n=tq())!==l){for(r=[],i=tb,s=nu(),124===e.charCodeAt(tb)?(o="|",tb++):(o=l,0===tE&&tP(eP)),o!==l?(u=tb,tE++,124===e.charCodeAt(tb)?(c="|",tb++):(c=l,0===tE&&tP(eP)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tq())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),124===e.charCodeAt(tb)?(o="|",tb++):(o=l,0===tE&&tP(eP)),o!==l?(u=tb,tE++,124===e.charCodeAt(tb)?(c="|",tb++):(c=l,0===tE&&tP(eP)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tq())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tq(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tY())!==l){for(r=[],i=tb,s=nu(),94===e.charCodeAt(tb)?(o="^",tb++):(o=l,0===tE&&tP(eI)),o!==l?(u=nu(),(c=tY())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),94===e.charCodeAt(tb)?(o="^",tb++):(o=l,0===tE&&tP(eI)),o!==l?(u=nu(),(c=tY())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tY(){let t,n,r,i,s,o,u,c,h;if(t=tb,(n=tJ())!==l){for(r=[],i=tb,s=nu(),38===e.charCodeAt(tb)?(o="&",tb++):(o=l,0===tE&&tP(eL)),o!==l?(u=tb,tE++,38===e.charCodeAt(tb)?(c="&",tb++):(c=l,0===tE&&tP(eL)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tJ())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),38===e.charCodeAt(tb)?(o="&",tb++):(o=l,0===tE&&tP(eL)),o!==l?(u=tb,tE++,38===e.charCodeAt(tb)?(c="&",tb++):(c=l,0===tE&&tP(eL)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tJ())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tJ(){let e,t,n,r,i,s,o,u;if(e=tb,(t=tK())!==l){for(n=[],r=tb,i=nu(),(s=tZ())!==l?(o=nu(),(u=tK())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=tZ())!==l?(o=nu(),(u=tK())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function tZ(){let t;return"=="===e.substr(tb,2)?(t="==",tb+=2):(t=l,0===tE&&tP(eN)),t===l&&("!="===e.substr(tb,2)?(t="!=",tb+=2):(t=l,0===tE&&tP(eD))),t}function tK(){let e,t,n,r,i,s,o,u;if(e=tb,(t=tQ())!==l){for(n=[],r=tb,i=nu(),(s=t$())!==l?(o=nu(),(u=tQ())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t$())!==l?(o=nu(),(u=tQ())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t$(){let t;return"<="===e.substr(tb,2)?(t="<=",tb+=2):(t=l,0===tE&&tP(eU)),t===l&&(">="===e.substr(tb,2)?(t=">=",tb+=2):(t=l,0===tE&&tP(eO)),t===l&&(t=e.charAt(tb),A.test(t)?tb++:(t=l,0===tE&&tP(eF)))),t}function tQ(){let e,t,n,r,i,s,o,u;if(e=tb,(t=t2())!==l){for(n=[],r=tb,i=nu(),(s=t1())!==l?(o=nu(),(u=t0())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t1())!==l?(o=nu(),(u=t0())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t0(){let e,t,n,r;if(e=tb,(t=tF())!==l)if(nu(),(n=tG())!==l)if(nu(),(r=tV())!==l)e={type:"AssignmentExpression",operator:n,target:t,value:r};else tb=e,e=l;else tb=e,e=l;else tb=e,e=l;return e===l&&(e=t2()),e}function t1(){let t;return"$="===e.substr(tb,2)?(t="$=",tb+=2):(t=l,0===tE&&tP(ek)),t===l&&("!$="===e.substr(tb,3)?(t="!$=",tb+=3):(t=l,0===tE&&tP(ez)),t===l&&(64===e.charCodeAt(tb)?(t="@",tb++):(t=l,0===tE&&tP(eB)),t===l&&("NL"===e.substr(tb,2)?(t="NL",tb+=2):(t=l,0===tE&&tP(eH)),t===l&&("TAB"===e.substr(tb,3)?(t="TAB",tb+=3):(t=l,0===tE&&tP(eV)),t===l&&("SPC"===e.substr(tb,3)?(t="SPC",tb+=3):(t=l,0===tE&&tP(eG))))))),t}function t2(){let e,t,n,r,i,s,o,u;if(e=tb,(t=t4())!==l){for(n=[],r=tb,i=nu(),(s=t3())!==l?(o=nu(),(u=t4())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t3())!==l?(o=nu(),(u=t4())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t3(){let t;return"<<"===e.substr(tb,2)?(t="<<",tb+=2):(t=l,0===tE&&tP(eW)),t===l&&(">>"===e.substr(tb,2)?(t=">>",tb+=2):(t=l,0===tE&&tP(ej))),t}function t4(){let t,n,r,i,s,o,u,c;if(t=tb,(n=t5())!==l){for(r=[],i=tb,s=nu(),o=e.charAt(tb),C.test(o)?tb++:(o=l,0===tE&&tP(eX)),o!==l?(u=nu(),(c=t5())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),o=e.charAt(tb),C.test(o)?tb++:(o=l,0===tE&&tP(eX)),o!==l?(u=nu(),(c=t5())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function t5(){let t,n,r,i,s,o,u,c;if(t=tb,(n=t6())!==l){for(r=[],i=tb,s=nu(),o=e.charAt(tb),R.test(o)?tb++:(o=l,0===tE&&tP(eq)),o!==l?(u=nu(),(c=t6())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),o=e.charAt(tb),R.test(o)?tb++:(o=l,0===tE&&tP(eq)),o!==l?(u=nu(),(c=t6())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function t6(){let t,n,r;return(t=tb,n=e.charAt(tb),P.test(n)?tb++:(n=l,0===tE&&tP(eY)),n!==l&&(nu(),(r=t8())!==l))?t=s(n,r):(tb=t,t=l),t===l&&((t=tb,"++"===e.substr(tb,2)?(n="++",tb+=2):(n=l,0===tE&&tP(eJ)),n===l&&("--"===e.substr(tb,2)?(n="--",tb+=2):(n=l,0===tE&&tP(eZ))),n!==l&&(nu(),(r=t8())!==l))?t=s(n,r):(tb=t,t=l),t===l&&((t=tb,42===e.charCodeAt(tb)?(n="*",tb++):(n=l,0===tE&&tP(eK)),n!==l&&(nu(),(r=t8())!==l))?t={type:"TagDereferenceExpression",argument:r}:(tb=t,t=l),t===l&&(t=function(){let t,n,r;if(t=tb,(n=t9())!==l)if(nu(),"++"===e.substr(tb,2)?(r="++",tb+=2):(r=l,0===tE&&tP(eJ)),r===l&&("--"===e.substr(tb,2)?(r="--",tb+=2):(r=l,0===tE&&tP(eZ))),r!==l)t={type:"PostfixExpression",operator:r,argument:n};else tb=t,t=l;else tb=t,t=l;return t===l&&(t=t9()),t}()))),t}function t8(){let e,t,n,r;if(e=tb,(t=tF())!==l)if(nu(),(n=tG())!==l)if(nu(),(r=tV())!==l)e={type:"AssignmentExpression",operator:n,target:t,value:r};else tb=e,e=l;else tb=e,e=l;else tb=e,e=l;return e===l&&(e=t6()),e}function t9(){let t,n,a,s,o,u,c,h,d,p;if(t=tb,(n=function(){let t,n,r,i,a,s,o,u,c,h,d,p,f,m,g,v;if(t=tb,(o=tD())===l&&(o=tN())===l&&(o=function(){let t,n,r,i;if(t=tb,34===e.charCodeAt(tb)?(n='"',tb++):(n=l,0===tE&&tP(e4)),n!==l){for(r=[],i=ni();i!==l;)r.push(i),i=ni();(34===e.charCodeAt(tb)?(i='"',tb++):(i=l,0===tE&&tP(e4)),i!==l)?t={type:"StringLiteral",value:r.join("")}:(tb=t,t=l)}else tb=t,t=l;if(t===l)if(t=tb,39===e.charCodeAt(tb)?(n="'",tb++):(n=l,0===tE&&tP(e5)),n!==l){for(r=[],i=na();i!==l;)r.push(i),i=na();(39===e.charCodeAt(tb)?(i="'",tb++):(i=l,0===tE&&tP(e5)),i!==l)?t={type:"StringLiteral",value:r.join(""),tagged:!0}:(tb=t,t=l)}else tb=t,t=l;return t}())===l&&(o=no())===l&&((u=tb,e.substr(tb,4)===E?(c=E,tb+=4):(c=l,0===tE&&tP(tp)),c===l&&(e.substr(tb,5)===T?(c=T,tb+=5):(c=l,0===tE&&tP(tf))),c!==l&&(h=tb,tE++,d=np(),tE--,d===l?h=void 0:(tb=h,h=l),h!==l))?u={type:"BooleanLiteral",value:"true"===c}:(tb=u,u=l),(o=u)===l&&((p=ne())===l&&(p=nt())===l&&(p=nn()),(o=p)===l))&&((f=tb,40===e.charCodeAt(tb)?(m="(",tb++):(m=l,0===tE&&tP(q)),m!==l&&(nu(),(g=tV())!==l&&(nu(),41===e.charCodeAt(tb)?(v=")",tb++):(v=l,0===tE&&tP(Y)),v!==l)))?f=g:(tb=f,f=l),o=f),(n=o)!==l){for(r=[],i=tb,a=nu(),(s=tk())!==l?i=a=[a,s]:(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),(s=tk())!==l?i=a=[a,s]:(tb=i,i=l);t=r.reduce((e,t)=>{let[,n]=t;return"property"===n.type?{type:"MemberExpression",object:e,property:n.value}:{type:"IndexExpression",object:e,index:n.value}},n)}else tb=t,t=l;return t}())!==l){for(a=[],s=tb,o=nu(),40===e.charCodeAt(tb)?(u="(",tb++):(u=l,0===tE&&tP(q)),u!==l?(c=nu(),(h=t7())===l&&(h=null),d=nu(),41===e.charCodeAt(tb)?(p=")",tb++):(p=l,0===tE&&tP(Y)),p!==l?s=o=[o,u,c,h,d,p]:(tb=s,s=l)):(tb=s,s=l),s===l&&(s=tb,o=nu(),(u=tk())!==l?s=o=[o,u]:(tb=s,s=l));s!==l;)a.push(s),s=tb,o=nu(),40===e.charCodeAt(tb)?(u="(",tb++):(u=l,0===tE&&tP(q)),u!==l?(c=nu(),(h=t7())===l&&(h=null),d=nu(),41===e.charCodeAt(tb)?(p=")",tb++):(p=l,0===tE&&tP(Y)),p!==l?s=o=[o,u,c,h,d,p]:(tb=s,s=l)):(tb=s,s=l),s===l&&(s=tb,o=nu(),(u=tk())!==l?s=o=[o,u]:(tb=s,s=l));t=a.reduce((e,t)=>{if("("===t[1]){var n;let[,,,a]=t;return n=a||[],"Identifier"===e.type&&"exec"===e.name.toLowerCase()&&(n.length>0&&"StringLiteral"===n[0].type?r.add(n[0].value):i=!0),{type:"CallExpression",callee:e,arguments:n}}let a=t[1];return"property"===a.type?{type:"MemberExpression",object:e,property:a.value}:{type:"IndexExpression",object:e,index:a.value}},n)}else tb=t,t=l;return t}function t7(){let t,n,r,i,a,s,o,u;if(t=tb,(n=tV())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=[n,...r.map(e=>{let[,,,t]=e;return t})]}else tb=t,t=l;return t}function ne(){let t,n,r,i,a,s,o;if(t=tb,37===e.charCodeAt(tb)?(n="%",tb++):(n=l,0===tE&&tP(e$)),n!==l){if(r=tb,i=tb,a=e.charAt(tb),I.test(a)?tb++:(a=l,0===tE&&tP(eQ)),a!==l){for(s=[],o=e.charAt(tb),L.test(o)?tb++:(o=l,0===tE&&tP(e0));o!==l;)s.push(o),o=e.charAt(tb),L.test(o)?tb++:(o=l,0===tE&&tP(e0));i=a=[a,s]}else tb=i,i=l;(r=i!==l?e.substring(r,tb):i)!==l?t={type:"Variable",scope:"local",name:r}:(tb=t,t=l)}else tb=t,t=l;return t}function nt(){let t,n,r,i,a,s,o,u,c,h,d,p,f;if(t=tb,36===e.charCodeAt(tb)?(n="$",tb++):(n=l,0===tE&&tP(e1)),n!==l){if(r=tb,i=tb,"::"===e.substr(tb,2)?(a="::",tb+=2):(a=l,0===tE&&tP(J)),a===l&&(a=null),s=e.charAt(tb),I.test(s)?tb++:(s=l,0===tE&&tP(eQ)),s!==l){for(o=[],u=e.charAt(tb),L.test(u)?tb++:(u=l,0===tE&&tP(e0));u!==l;)o.push(u),u=e.charAt(tb),L.test(u)?tb++:(u=l,0===tE&&tP(e0));if(u=[],c=tb,"::"===e.substr(tb,2)?(h="::",tb+=2):(h=l,0===tE&&tP(J)),h!==l)if(d=e.charAt(tb),I.test(d)?tb++:(d=l,0===tE&&tP(eQ)),d!==l){for(p=[],f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));f!==l;)p.push(f),f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));c=h=[h,d,p]}else tb=c,c=l;else tb=c,c=l;for(;c!==l;)if(u.push(c),c=tb,"::"===e.substr(tb,2)?(h="::",tb+=2):(h=l,0===tE&&tP(J)),h!==l)if(d=e.charAt(tb),I.test(d)?tb++:(d=l,0===tE&&tP(eQ)),d!==l){for(p=[],f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));f!==l;)p.push(f),f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));c=h=[h,d,p]}else tb=c,c=l;else tb=c,c=l;i=a=[a,s,o,u]}else tb=i,i=l;(r=i!==l?e.substring(r,tb):i)!==l?t={type:"Variable",scope:"global",name:r}:(tb=t,t=l)}else tb=t,t=l;return t}function nn(){let t,n,r,i,a,s,o,u,c,h,d;if(t=tb,n=tb,r=tb,e.substr(tb,6)===w?(i=w,tb+=6):(i=l,0===tE&&tP(e2)),i!==l){for(a=[],s=e.charAt(tb),N.test(s)?tb++:(s=l,0===tE&&tP(e3));s!==l;)a.push(s),s=e.charAt(tb),N.test(s)?tb++:(s=l,0===tE&&tP(e3));if("::"===e.substr(tb,2)?(s="::",tb+=2):(s=l,0===tE&&tP(J)),s!==l){for(o=[],u=e.charAt(tb),N.test(u)?tb++:(u=l,0===tE&&tP(e3));u!==l;)o.push(u),u=e.charAt(tb),N.test(u)?tb++:(u=l,0===tE&&tP(e3));if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));r=i=[i,a,s,o,u,c]}else tb=r,r=l}else tb=r,r=l}else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n.replace(/\s+/g,"")}),(t=n)===l){if(t=tb,n=tb,r=tb,e.substr(tb,6)===w?(i=w,tb+=6):(i=l,0===tE&&tP(e2)),i!==l){if(a=[],s=tb,"::"===e.substr(tb,2)?(o="::",tb+=2):(o=l,0===tE&&tP(J)),o!==l)if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));s=o=[o,u,c]}else tb=s,s=l;else tb=s,s=l;if(s!==l)for(;s!==l;)if(a.push(s),s=tb,"::"===e.substr(tb,2)?(o="::",tb+=2):(o=l,0===tE&&tP(J)),o!==l)if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));s=o=[o,u,c]}else tb=s,s=l;else tb=s,s=l;else a=l;a!==l?r=i=[i,a]:(tb=r,r=l)}else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n}),(t=n)===l){if(t=tb,n=tb,r=tb,i=e.charAt(tb),I.test(i)?tb++:(i=l,0===tE&&tP(eQ)),i!==l){for(a=[],s=e.charAt(tb),L.test(s)?tb++:(s=l,0===tE&&tP(e0));s!==l;)a.push(s),s=e.charAt(tb),L.test(s)?tb++:(s=l,0===tE&&tP(e0));if(s=[],o=tb,"::"===e.substr(tb,2)?(u="::",tb+=2):(u=l,0===tE&&tP(J)),u!==l)if(c=e.charAt(tb),I.test(c)?tb++:(c=l,0===tE&&tP(eQ)),c!==l){for(h=[],d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));d!==l;)h.push(d),d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));o=u=[u,c,h]}else tb=o,o=l;else tb=o,o=l;for(;o!==l;)if(s.push(o),o=tb,"::"===e.substr(tb,2)?(u="::",tb+=2):(u=l,0===tE&&tP(J)),u!==l)if(c=e.charAt(tb),I.test(c)?tb++:(c=l,0===tE&&tP(eQ)),c!==l){for(h=[],d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));d!==l;)h.push(d),d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));o=u=[u,c,h]}else tb=o,o=l;else tb=o,o=l;r=i=[i,a,s]}else tb=r,r=l;(n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n}),t=n}}return t}function nr(){let e;return(e=ne())===l&&(e=nt())===l&&(e=nn()),e}function ni(){let t,n,r;return(t=tb,92===e.charCodeAt(tb)?(n="\\",tb++):(n=l,0===tE&&tP(e6)),n!==l&&(r=ns())!==l)?t=r:(tb=t,t=l),t===l&&(t=e.charAt(tb),D.test(t)?tb++:(t=l,0===tE&&tP(e8))),t}function na(){let t,n,r;return(t=tb,92===e.charCodeAt(tb)?(n="\\",tb++):(n=l,0===tE&&tP(e6)),n!==l&&(r=ns())!==l)?t=r:(tb=t,t=l),t===l&&(t=e.charAt(tb),U.test(t)?tb++:(t=l,0===tE&&tP(e9))),t}function ns(){let t,n,r,i,a,s;return t=tb,110===e.charCodeAt(tb)?(n="n",tb++):(n=l,0===tE&&tP(e7)),n!==l&&(n="\n"),(t=n)===l&&(t=tb,114===e.charCodeAt(tb)?(n="r",tb++):(n=l,0===tE&&tP(te)),n!==l&&(n="\r"),(t=n)===l)&&(t=tb,116===e.charCodeAt(tb)?(n="t",tb++):(n=l,0===tE&&tP(tt)),n!==l&&(n=" "),(t=n)===l)&&((t=tb,120===e.charCodeAt(tb)?(n="x",tb++):(n=l,0===tE&&tP(tn)),n!==l&&(r=tb,i=tb,a=e.charAt(tb),O.test(a)?tb++:(a=l,0===tE&&tP(tr)),a!==l?(s=e.charAt(tb),O.test(s)?tb++:(s=l,0===tE&&tP(tr)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l),(r=i!==l?e.substring(r,tb):i)!==l))?t=String.fromCharCode(parseInt(r,16)):(tb=t,t=l),t===l&&(t=tb,"cr"===e.substr(tb,2)?(n="cr",tb+=2):(n=l,0===tE&&tP(ti)),n!==l&&(n="\x0f"),(t=n)===l&&(t=tb,"cp"===e.substr(tb,2)?(n="cp",tb+=2):(n=l,0===tE&&tP(ta)),n!==l&&(n="\x10"),(t=n)===l))&&(t=tb,"co"===e.substr(tb,2)?(n="co",tb+=2):(n=l,0===tE&&tP(ts)),n!==l&&(n="\x11"),(t=n)===l)&&((t=tb,99===e.charCodeAt(tb)?(n="c",tb++):(n=l,0===tE&&tP(to)),n!==l&&(r=e.charAt(tb),F.test(r)?tb++:(r=l,0===tE&&tP(tl)),r!==l))?t=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(r,10)]):(tb=t,t=l),t===l&&(t=tb,e.length>tb?(n=e.charAt(tb),tb++):(n=l,0===tE&&tP(tu)),t=n))),t}function no(){let t,n,r,i,a,s,o,u,c;if(t=tb,n=tb,r=tb,48===e.charCodeAt(tb)?(i="0",tb++):(i=l,0===tE&&tP(tc)),i!==l)if(a=e.charAt(tb),k.test(a)?tb++:(a=l,0===tE&&tP(th)),a!==l){if(s=[],o=e.charAt(tb),O.test(o)?tb++:(o=l,0===tE&&tP(tr)),o!==l)for(;o!==l;)s.push(o),o=e.charAt(tb),O.test(o)?tb++:(o=l,0===tE&&tP(tr));else s=l;s!==l?r=i=[i,a,s]:(tb=r,r=l)}else tb=r,r=l;else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(r=tb,tE++,i=np(),tE--,i===l?r=void 0:(tb=r,r=l),r!==l)?t={type:"NumberLiteral",value:parseInt(n,16)}:(tb=t,t=l),t===l){if(t=tb,n=tb,r=tb,45===e.charCodeAt(tb)?(i="-",tb++):(i=l,0===tE&&tP(td)),i===l&&(i=null),a=[],s=e.charAt(tb),F.test(s)?tb++:(s=l,0===tE&&tP(tl)),s!==l)for(;s!==l;)a.push(s),s=e.charAt(tb),F.test(s)?tb++:(s=l,0===tE&&tP(tl));else a=l;if(a!==l){if(s=tb,46===e.charCodeAt(tb)?(o=".",tb++):(o=l,0===tE&&tP(er)),o!==l){if(u=[],c=e.charAt(tb),F.test(c)?tb++:(c=l,0===tE&&tP(tl)),c!==l)for(;c!==l;)u.push(c),c=e.charAt(tb),F.test(c)?tb++:(c=l,0===tE&&tP(tl));else u=l;u!==l?s=o=[o,u]:(tb=s,s=l)}else tb=s,s=l;s===l&&(s=null),r=i=[i,a,s]}else tb=r,r=l;if(r===l)if(r=tb,45===e.charCodeAt(tb)?(i="-",tb++):(i=l,0===tE&&tP(td)),i===l&&(i=null),46===e.charCodeAt(tb)?(a=".",tb++):(a=l,0===tE&&tP(er)),a!==l){if(s=[],o=e.charAt(tb),F.test(o)?tb++:(o=l,0===tE&&tP(tl)),o!==l)for(;o!==l;)s.push(o),o=e.charAt(tb),F.test(o)?tb++:(o=l,0===tE&&tP(tl));else s=l;s!==l?r=i=[i,a,s]:(tb=r,r=l)}else tb=r,r=l;(n=r!==l?e.substring(n,tb):r)!==l&&(r=tb,tE++,i=np(),tE--,i===l?r=void 0:(tb=r,r=l),r!==l)?t={type:"NumberLiteral",value:parseFloat(n)}:(tb=t,t=l)}return t}function nl(){let t;return(t=function(){let t,n,r,i,a;if(t=tb,"//"===e.substr(tb,2)?(n="//",tb+=2):(n=l,0===tE&&tP(tm)),n!==l){for(r=tb,i=[],a=e.charAt(tb),z.test(a)?tb++:(a=l,0===tE&&tP(tg));a!==l;)i.push(a),a=e.charAt(tb),z.test(a)?tb++:(a=l,0===tE&&tP(tg));r=e.substring(r,tb),i=e.charAt(tb),B.test(i)?tb++:(i=l,0===tE&&tP(tv)),i===l&&(i=null),t={type:"Comment",value:r}}else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o;if(t=tb,"/*"===e.substr(tb,2)?(n="/*",tb+=2):(n=l,0===tE&&tP(ty)),n!==l){for(r=tb,i=[],a=tb,s=tb,tE++,"*/"===e.substr(tb,2)?(o="*/",tb+=2):(o=l,0===tE&&tP(t_)),tE--,o===l?s=void 0:(tb=s,s=l),s!==l?(e.length>tb?(o=e.charAt(tb),tb++):(o=l,0===tE&&tP(tu)),o!==l?a=s=[s,o]:(tb=a,a=l)):(tb=a,a=l);a!==l;)i.push(a),a=tb,s=tb,tE++,"*/"===e.substr(tb,2)?(o="*/",tb+=2):(o=l,0===tE&&tP(t_)),tE--,o===l?s=void 0:(tb=s,s=l),s!==l?(e.length>tb?(o=e.charAt(tb),tb++):(o=l,0===tE&&tP(tu)),o!==l?a=s=[s,o]:(tb=a,a=l)):(tb=a,a=l);(r=e.substring(r,tb),"*/"===e.substr(tb,2)?(i="*/",tb+=2):(i=l,0===tE&&tP(t_)),i!==l)?t={type:"Comment",value:r}:(tb=t,t=l)}else tb=t,t=l;return t}()),t}function nu(){let t,n;for(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n===l&&(n=nd());n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n===l&&(n=nd());return t}function nc(){let t,n,r,i;if(t=tb,n=[],r=e.charAt(tb),H.test(r)?tb++:(r=l,0===tE&&tP(tx)),r!==l)for(;r!==l;)n.push(r),r=e.charAt(tb),H.test(r)?tb++:(r=l,0===tE&&tP(tx));else n=l;if(n!==l){for(r=[],i=e.charAt(tb),H.test(i)?tb++:(i=l,0===tE&&tP(tx)),i===l&&(i=nd());i!==l;)r.push(i),i=e.charAt(tb),H.test(i)?tb++:(i=l,0===tE&&tP(tx)),i===l&&(i=nd());t=n=[n,r]}else tb=t,t=l;return t}function nh(){let t,n;for(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));return t}function nd(){let t,n,r,i,a,s;if(t=tb,"//"===e.substr(tb,2)?(n="//",tb+=2):(n=l,0===tE&&tP(tm)),n!==l){for(r=[],i=e.charAt(tb),z.test(i)?tb++:(i=l,0===tE&&tP(tg));i!==l;)r.push(i),i=e.charAt(tb),z.test(i)?tb++:(i=l,0===tE&&tP(tg));i=e.charAt(tb),B.test(i)?tb++:(i=l,0===tE&&tP(tv)),i===l&&(i=null),t=n=[n,r,i]}else tb=t,t=l;if(t===l)if(t=tb,"/*"===e.substr(tb,2)?(n="/*",tb+=2):(n=l,0===tE&&tP(ty)),n!==l){for(r=[],i=tb,a=tb,tE++,"*/"===e.substr(tb,2)?(s="*/",tb+=2):(s=l,0===tE&&tP(t_)),tE--,s===l?a=void 0:(tb=a,a=l),a!==l?(e.length>tb?(s=e.charAt(tb),tb++):(s=l,0===tE&&tP(tu)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=tb,tE++,"*/"===e.substr(tb,2)?(s="*/",tb+=2):(s=l,0===tE&&tP(t_)),tE--,s===l?a=void 0:(tb=a,a=l),a!==l?(e.length>tb?(s=e.charAt(tb),tb++):(s=l,0===tE&&tP(tu)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l);"*/"===e.substr(tb,2)?(i="*/",tb+=2):(i=l,0===tE&&tP(t_)),i!==l?t=n=[n,r,i]:(tb=t,t=l)}else tb=t,t=l;return t}function np(){let t;return t=e.charAt(tb),L.test(t)?tb++:(t=l,0===tE&&tP(e0)),t}r=new Set,i=!1;let nf=(n=h())!==l&&tb===e.length;function nm(){var t,r,i;throw n!==l&&tb0&&void 0!==arguments[0]?arguments[0]:tb,n=e.codePointAt(t);return void 0===n?"":String.fromCodePoint(n)}(tM):null,i=tM{"use strict";e.s(["getFloat",()=>D,"getInt",()=>U,"getPosition",()=>O,"getProperty",()=>N,"getRotation",()=>k,"getScale",()=>F,"parseMissionScript",()=>L],62395);var t=e.i(90072);e.s(["parse",()=>A,"runServer",()=>C],86608);var n=e.i(92552);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){let t=e.indexOf("::");return -1===t?null:{namespace:e.slice(0,t),method:e.slice(t+2)}}let a={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class s{getAccessInfo(e){if("Variable"===e.type){let t=JSON.stringify(e.name),n="global"===e.scope?this.globals:this.locals;return{getter:"".concat(n,".get(").concat(t,")"),setter:e=>"".concat(n,".set(").concat(t,", ").concat(e,")"),postIncHelper:"".concat(n,".postInc(").concat(t,")"),postDecHelper:"".concat(n,".postDec(").concat(t,")")}}if("MemberExpression"===e.type){let t=this.expression(e.object),n="Identifier"===e.property.type?JSON.stringify(e.property.name):this.expression(e.property);return{getter:"".concat(this.runtime,".prop(").concat(t,", ").concat(n,")"),setter:e=>"".concat(this.runtime,".setProp(").concat(t,", ").concat(n,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".propPostInc(").concat(t,", ").concat(n,")"),postDecHelper:"".concat(this.runtime,".propPostDec(").concat(t,", ").concat(n,")")}}if("IndexExpression"===e.type){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Variable"===e.object.type){let n=JSON.stringify(e.object.name),r="global"===e.object.scope?this.globals:this.locals,i=t.join(", ");return{getter:"".concat(r,".get(").concat(n,", ").concat(i,")"),setter:e=>"".concat(r,".set(").concat(n,", ").concat(i,", ").concat(e,")"),postIncHelper:"".concat(r,".postInc(").concat(n,", ").concat(i,")"),postDecHelper:"".concat(r,".postDec(").concat(n,", ").concat(i,")")}}if("MemberExpression"===e.object.type){let n=e.object,r=this.expression(n.object),i="Identifier"===n.property.type?JSON.stringify(n.property.name):this.expression(n.property),a="".concat(this.runtime,".key(").concat(i,", ").concat(t.join(", "),")");return{getter:"".concat(this.runtime,".prop(").concat(r,", ").concat(a,")"),setter:e=>"".concat(this.runtime,".setProp(").concat(r,", ").concat(a,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".propPostInc(").concat(r,", ").concat(a,")"),postDecHelper:"".concat(this.runtime,".propPostDec(").concat(r,", ").concat(a,")")}}let n=this.expression(e.object),r=1===t.length?t[0]:"".concat(this.runtime,".key(").concat(t.join(", "),")");return{getter:"".concat(this.runtime,".getIndex(").concat(n,", ").concat(r,")"),setter:e=>"".concat(this.runtime,".setIndex(").concat(n,", ").concat(r,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".indexPostInc(").concat(n,", ").concat(r,")"),postDecHelper:"".concat(this.runtime,".indexPostDec(").concat(n,", ").concat(r,")")}}return null}generate(e){let t=[];for(let n of e.body){let e=this.statement(n);e&&t.push(e)}return t.join("\n\n")}statement(e){switch(e.type){case"Comment":return"";case"ExpressionStatement":return this.line("".concat(this.expression(e.expression),";"));case"FunctionDeclaration":return this.functionDeclaration(e);case"PackageDeclaration":return this.packageDeclaration(e);case"DatablockDeclaration":return this.datablockDeclaration(e);case"ObjectDeclaration":return this.line("".concat(this.objectDeclaration(e),";"));case"IfStatement":return this.ifStatement(e);case"ForStatement":return this.forStatement(e);case"WhileStatement":return this.whileStatement(e);case"DoWhileStatement":return this.doWhileStatement(e);case"SwitchStatement":return this.switchStatement(e);case"ReturnStatement":return this.returnStatement(e);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(e);default:throw Error("Unknown statement type: ".concat(e.type))}}functionDeclaration(e){let t=i(e.name.name);if(t){let n=t.namespace,r=t.method;this.currentClass=n.toLowerCase(),this.currentFunction=r.toLowerCase();let i=this.functionBody(e.body,e.params);return this.currentClass=null,this.currentFunction=null,"".concat(this.line("".concat(this.runtime,".registerMethod(").concat(JSON.stringify(n),", ").concat(JSON.stringify(r),", function() {")),"\n").concat(i,"\n").concat(this.line("});"))}{let t=e.name.name;this.currentFunction=t.toLowerCase();let n=this.functionBody(e.body,e.params);return this.currentFunction=null,"".concat(this.line("".concat(this.runtime,".registerFunction(").concat(JSON.stringify(t),", function() {")),"\n").concat(n,"\n").concat(this.line("});"))}}functionBody(e,t){this.indentLevel++;let n=[];n.push(this.line("const ".concat(this.locals," = ").concat(this.runtime,".locals();")));for(let e=0;ethis.statement(e)).join("\n\n");return this.indentLevel--,"".concat(this.line("".concat(this.runtime,".package(").concat(t,", function() {")),"\n").concat(n,"\n").concat(this.line("});"))}datablockDeclaration(e){let t=JSON.stringify(e.className.name),n=e.instanceName?JSON.stringify(e.instanceName.name):"null",r=e.parent?JSON.stringify(e.parent.name):"null",i=this.objectBody(e.body);return this.line("".concat(this.runtime,".datablock(").concat(t,", ").concat(n,", ").concat(r,", ").concat(i,");"))}objectDeclaration(e){let t="Identifier"===e.className.type?JSON.stringify(e.className.name):this.expression(e.className),n=null===e.instanceName?"null":"Identifier"===e.instanceName.type?JSON.stringify(e.instanceName.name):this.expression(e.instanceName),r=[],i=[];for(let t of e.body)"Assignment"===t.type?r.push(t):i.push(t);let a=this.objectBody(r);if(i.length>0){let e=i.map(e=>this.objectDeclaration(e)).join(",\n");return"".concat(this.runtime,".create(").concat(t,", ").concat(n,", ").concat(a,", [\n").concat(e,"\n])")}return"".concat(this.runtime,".create(").concat(t,", ").concat(n,", ").concat(a,")")}objectBody(e){if(0===e.length)return"{}";let t=[];for(let n of e)if("Assignment"===n.type){let e=this.expression(n.value);if("Identifier"===n.target.type){let r=n.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?t.push("".concat(r,": ").concat(e)):t.push("[".concat(JSON.stringify(r),"]: ").concat(e))}else if("IndexExpression"===n.target.type){let r=this.objectPropertyKey(n.target);t.push("[".concat(r,"]: ").concat(e))}else{let r=this.expression(n.target);t.push("[".concat(r,"]: ").concat(e))}}if(t.length<=1)return"{ ".concat(t.join(", ")," }");let n=this.indent.repeat(this.indentLevel+1),r=this.indent.repeat(this.indentLevel);return"{\n".concat(n).concat(t.join(",\n"+n),"\n").concat(r,"}")}objectPropertyKey(e){let t="Identifier"===e.object.type?JSON.stringify(e.object.name):this.expression(e.object),n=Array.isArray(e.index)?e.index.map(e=>this.expression(e)).join(", "):this.expression(e.index);return"".concat(this.runtime,".key(").concat(t,", ").concat(n,")")}ifStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.consequent);if(e.alternate)if("IfStatement"===e.alternate.type){let r=this.ifStatement(e.alternate).replace(/^\s*/,"");return this.line("if (".concat(t,") ").concat(n," else ").concat(r))}else{let r=this.statementAsBlock(e.alternate);return this.line("if (".concat(t,") ").concat(n," else ").concat(r))}return this.line("if (".concat(t,") ").concat(n))}forStatement(e){let t=e.init?this.expression(e.init):"",n=e.test?this.expression(e.test):"",r=e.update?this.expression(e.update):"",i=this.statementAsBlock(e.body);return this.line("for (".concat(t,"; ").concat(n,"; ").concat(r,") ").concat(i))}whileStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.body);return this.line("while (".concat(t,") ").concat(n))}doWhileStatement(e){let t=this.statementAsBlock(e.body),n=this.expression(e.test);return this.line("do ".concat(t," while (").concat(n,");"))}switchStatement(e){if(e.stringMode)return this.switchStringStatement(e);let t=this.expression(e.discriminant);this.indentLevel++;let n=[];for(let t of e.cases)n.push(this.switchCase(t));return this.indentLevel--,"".concat(this.line("switch (".concat(t,") {")),"\n").concat(n.join("\n"),"\n").concat(this.line("}"))}switchCase(e){let t=[];if(null===e.test)t.push(this.line("default:"));else if(Array.isArray(e.test))for(let n of e.test)t.push(this.line("case ".concat(this.expression(n),":")));else t.push(this.line("case ".concat(this.expression(e.test),":")));for(let n of(this.indentLevel++,e.consequent))t.push(this.statement(n));return t.push(this.line("break;")),this.indentLevel--,t.join("\n")}switchStringStatement(e){let t=this.expression(e.discriminant),n=[];for(let t of e.cases)if(null===t.test)n.push("default: () => { ".concat(this.blockContent(t.consequent)," }"));else if(Array.isArray(t.test))for(let e of t.test)n.push("".concat(this.expression(e),": () => { ").concat(this.blockContent(t.consequent)," }"));else n.push("".concat(this.expression(t.test),": () => { ").concat(this.blockContent(t.consequent)," }"));return this.line("".concat(this.runtime,".switchStr(").concat(t,", { ").concat(n.join(", ")," });"))}returnStatement(e){return e.value?this.line("return ".concat(this.expression(e.value),";")):this.line("return;")}blockStatement(e){this.indentLevel++;let t=e.body.map(e=>this.statement(e)).join("\n");return this.indentLevel--,"{\n".concat(t,"\n").concat(this.line("}"))}statementAsBlock(e){if("BlockStatement"===e.type)return this.blockStatement(e);this.indentLevel++;let t=this.statement(e);return this.indentLevel--,"{\n".concat(t,"\n").concat(this.line("}"))}blockContent(e){return e.map(e=>this.statement(e).trim()).join(" ")}expression(e){switch(e.type){case"Identifier":return this.identifier(e);case"Variable":return this.variable(e);case"NumberLiteral":case"BooleanLiteral":return String(e.value);case"StringLiteral":return JSON.stringify(e.value);case"BinaryExpression":return this.binaryExpression(e);case"UnaryExpression":return this.unaryExpression(e);case"PostfixExpression":return this.postfixExpression(e);case"AssignmentExpression":return this.assignmentExpression(e);case"ConditionalExpression":return"(".concat(this.expression(e.test)," ? ").concat(this.expression(e.consequent)," : ").concat(this.expression(e.alternate),")");case"CallExpression":return this.callExpression(e);case"MemberExpression":return this.memberExpression(e);case"IndexExpression":return this.indexExpression(e);case"TagDereferenceExpression":return"".concat(this.runtime,".deref(").concat(this.expression(e.argument),")");case"ObjectDeclaration":return this.objectDeclaration(e);case"DatablockDeclaration":return"".concat(this.runtime,".datablock(").concat(JSON.stringify(e.className.name),", ").concat(e.instanceName?JSON.stringify(e.instanceName.name):"null",", ").concat(e.parent?JSON.stringify(e.parent.name):"null",", ").concat(this.objectBody(e.body),")");default:throw Error("Unknown expression type: ".concat(e.type))}}identifier(e){let t=i(e.name);return t&&"parent"===t.namespace.toLowerCase()?e.name:t?"".concat(this.runtime,".nsRef(").concat(JSON.stringify(t.namespace),", ").concat(JSON.stringify(t.method),")"):JSON.stringify(e.name)}variable(e){return"global"===e.scope?"".concat(this.globals,".get(").concat(JSON.stringify(e.name),")"):"".concat(this.locals,".get(").concat(JSON.stringify(e.name),")")}binaryExpression(e){let t=this.expression(e.left),n=this.expression(e.right),r=e.operator,i=this.concatExpression(t,r,n);if(i)return i;if("$="===r)return"".concat(this.runtime,".streq(").concat(t,", ").concat(n,")");if("!$="===r)return"!".concat(this.runtime,".streq(").concat(t,", ").concat(n,")");if("&&"===r||"||"===r)return"(".concat(t," ").concat(r," ").concat(n,")");let s=a[r];return s?"".concat(s,"(").concat(t,", ").concat(n,")"):"(".concat(t," ").concat(r," ").concat(n,")")}unaryExpression(e){if("++"===e.operator||"--"===e.operator){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?1:-1;return t.setter("".concat(this.runtime,".add(").concat(t.getter,", ").concat(n,")"))}}let t=this.expression(e.argument);return"~"===e.operator?"".concat(this.runtime,".bitnot(").concat(t,")"):"-"===e.operator?"".concat(this.runtime,".neg(").concat(t,")"):"".concat(e.operator).concat(t)}postfixExpression(e){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?t.postIncHelper:t.postDecHelper;if(n)return n}return"".concat(this.expression(e.argument)).concat(e.operator)}assignmentExpression(e){let t=this.expression(e.value),n=e.operator,r=this.getAccessInfo(e.target);if(!r)throw Error("Unhandled assignment target type: ".concat(e.target.type));if("="===n)return r.setter(t);{let e=n.slice(0,-1),i=this.compoundAssignmentValue(r.getter,e,t);return r.setter(i)}}callExpression(e){let t=e.arguments.map(e=>this.expression(e)).join(", ");if("Identifier"===e.callee.type){let n=e.callee.name,r=i(n);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return"".concat(this.runtime,".parent(").concat(JSON.stringify(this.currentClass),", ").concat(JSON.stringify(r.method),", arguments[0]").concat(t?", "+t:"",")");else if(this.currentFunction)return"".concat(this.runtime,".parentFunc(").concat(JSON.stringify(this.currentFunction)).concat(t?", "+t:"",")");else throw Error("Parent:: call outside of function context");return r?"".concat(this.runtime,".nsCall(").concat(JSON.stringify(r.namespace),", ").concat(JSON.stringify(r.method)).concat(t?", "+t:"",")"):"".concat(this.functions,".call(").concat(JSON.stringify(n)).concat(t?", "+t:"",")")}if("MemberExpression"===e.callee.type){let n=this.expression(e.callee.object),r="Identifier"===e.callee.property.type?JSON.stringify(e.callee.property.name):this.expression(e.callee.property);return"".concat(this.runtime,".call(").concat(n,", ").concat(r).concat(t?", "+t:"",")")}let n=this.expression(e.callee);return"".concat(n,"(").concat(t,")")}memberExpression(e){let t=this.expression(e.object);return e.computed||"Identifier"!==e.property.type?"".concat(this.runtime,".prop(").concat(t,", ").concat(this.expression(e.property),")"):"".concat(this.runtime,".prop(").concat(t,", ").concat(JSON.stringify(e.property.name),")")}indexExpression(e){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Variable"===e.object.type){let n=JSON.stringify(e.object.name),r="global"===e.object.scope?this.globals:this.locals;return"".concat(r,".get(").concat(n,", ").concat(t.join(", "),")")}if("MemberExpression"===e.object.type){let n=e.object,r=this.expression(n.object),i="Identifier"===n.property.type?JSON.stringify(n.property.name):this.expression(n.property),a="".concat(this.runtime,".key(").concat(i,", ").concat(t.join(", "),")");return"".concat(this.runtime,".prop(").concat(r,", ").concat(a,")")}let n=this.expression(e.object);return 1===t.length?"".concat(this.runtime,".getIndex(").concat(n,", ").concat(t[0],")"):"".concat(this.runtime,".getIndex(").concat(n,", ").concat(this.runtime,".key(").concat(t.join(", "),"))")}line(e){return this.indent.repeat(this.indentLevel)+e}concatExpression(e,t,n){switch(t){case"@":return"".concat(this.runtime,".concat(").concat(e,", ").concat(n,")");case"SPC":return"".concat(this.runtime,".concat(").concat(e,', " ", ').concat(n,")");case"TAB":return"".concat(this.runtime,".concat(").concat(e,', "\\t", ').concat(n,")");case"NL":return"".concat(this.runtime,".concat(").concat(e,', "\\n", ').concat(n,")");default:return null}}compoundAssignmentValue(e,t,n){let r=this.concatExpression(e,t,n);if(r)return r;let i=a[t];return i?"".concat(i,"(").concat(e,", ").concat(n,")"):"(".concat(e," ").concat(t," ").concat(n,")")}constructor(e={}){var t,n,i,a,s;r(this,"indent",void 0),r(this,"runtime",void 0),r(this,"functions",void 0),r(this,"globals",void 0),r(this,"locals",void 0),r(this,"indentLevel",0),r(this,"currentClass",null),r(this,"currentFunction",null),this.indent=null!=(t=e.indent)?t:" ",this.runtime=null!=(n=e.runtime)?n:"$",this.functions=null!=(i=e.functions)?i:"$f",this.globals=null!=(a=e.globals)?a:"$g",this.locals=null!=(s=e.locals)?s:"$l"}}e.s(["createRuntime",()=>E,"createScriptCache",()=>b],33870);var o=e.i(54970);class l{get size(){return this.map.size}get(e){let t=this.keyLookup.get(e.toLowerCase());return void 0!==t?this.map.get(t):void 0}set(e,t){let n=e.toLowerCase(),r=this.keyLookup.get(n);return void 0!==r?this.map.set(r,t):(this.keyLookup.set(n,e),this.map.set(e,t)),this}has(e){return this.keyLookup.has(e.toLowerCase())}delete(e){let t=e.toLowerCase(),n=this.keyLookup.get(t);return void 0!==n&&(this.keyLookup.delete(t),this.map.delete(n))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(e){for(let[t,n]of this.map)e(n,t,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(e){return this.keyLookup.get(e.toLowerCase())}constructor(e){if(r(this,"map",new Map),r(this,"keyLookup",new Map),e)for(let[t,n]of e)this.set(t,n)}}class u{get size(){return this.set.size}add(e){return this.set.add(e.toLowerCase()),this}has(e){return this.set.has(e.toLowerCase())}delete(e){return this.set.delete(e.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}constructor(e){if(r(this,"set",new Set),e)for(let t of e)this.add(t)}}function c(e){return e.replace(/\\/g,"/").toLowerCase()}function h(e){return String(null!=e?e:"")}function d(e){return Number(e)||0}function p(e){let t=h(e||"0 0 0").split(" ").map(Number);return[t[0]||0,t[1]||0,t[2]||0]}function f(e,t,n){let r=0;for(;t+r0;){if(r>=e.length)return"";let i=f(e,r,n);if(r+i>=e.length)return"";r+=i+1,t--}let i=f(e,r,n);return 0===i?"":e.substring(r,r+i)}function g(e,t,n,r){let i=0,a=t;for(;a>0;){if(i>=e.length)return"";let t=f(e,i,r);if(i+t>=e.length)return"";i+=t+1,a--}let s=i,o=n-t+1;for(;o>0;){let t=f(e,i,r);if((i+=t)>=e.length)break;i++,o--}let l=i;return l>s&&r.includes(e[l-1])&&l--,e.substring(s,l)}function v(e,t){if(""===e)return 0;let n=0;for(let r=0;rt&&s>=e.length)break}return a.join(i)}function _(e,t,n,r){let i=[],a=0,s=0;for(;a1?n-1:0),i=1;ih(e).replace(/\\([ntr\\])/g,(e,t)=>"n"===t?"\n":"t"===t?" ":"r"===t?"\r":"\\"),expandescape:e=>h(e).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(e,t,n){console.warn("export(".concat(e,"): not implemented"))},quit(){console.warn("quit(): not implemented in browser")},trace(e){},isobject:e=>t().$.isObject(e),nametoid:e=>t().$.nameToId(e),strlen:e=>h(e).length,strchr(e,t){var n;let r=h(e),i=null!=(n=h(t)[0])?n:"",a=r.indexOf(i);return a>=0?r.substring(a):""},strpos:(e,t,n)=>h(e).indexOf(h(t),d(n)),strcmp(e,t){let n=h(e),r=h(t);return nr)},stricmp(e,t){let n=h(e).toLowerCase(),r=h(t).toLowerCase();return nr)},strstr:(e,t)=>h(e).indexOf(h(t)),getsubstr(e,t,n){let r=h(e),i=d(t);return void 0===n?r.substring(i):r.substring(i,i+d(n))},getword:(e,t)=>m(h(e),d(t)," \n"),getwordcount:e=>v(h(e)," \n"),getfield:(e,t)=>m(h(e),d(t)," \n"),getfieldcount:e=>v(h(e)," \n"),setword:(e,t,n)=>y(h(e),d(t),h(n)," \n"," "),setfield:(e,t,n)=>y(h(e),d(t),h(n)," \n"," "),firstword:e=>m(h(e),0," \n"),restwords:e=>g(h(e),1,1e6," \n"),trim:e=>h(e).trim(),ltrim:e=>h(e).replace(/^\s+/,""),rtrim:e=>h(e).replace(/\s+$/,""),strupr:e=>h(e).toUpperCase(),strlwr:e=>h(e).toLowerCase(),strreplace:(e,t,n)=>h(e).split(h(t)).join(h(n)),filterstring:(e,t)=>h(e),stripchars(e,t){let n=h(e),r=new Set(h(t).split(""));return n.split("").filter(e=>!r.has(e)).join("")},getfields(e,t,n){let r=void 0!==n?Number(n):1e6;return g(h(e),d(t),r," \n")},getwords(e,t,n){let r=void 0!==n?Number(n):1e6;return g(h(e),d(t),r," \n")},removeword:(e,t)=>_(h(e),d(t)," \n"," "),removefield:(e,t)=>_(h(e),d(t)," \n"," "),getrecord:(e,t)=>m(h(e),d(t),"\n"),getrecordcount:e=>v(h(e),"\n"),setrecord:(e,t,n)=>y(h(e),d(t),h(n),"\n","\n"),removerecord:(e,t)=>_(h(e),d(t),"\n","\n"),nexttoken(e,t,n){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:e=>h(e).replace(/[^\w\s-]/g,"").trim(),mabs:e=>Math.abs(d(e)),mfloor:e=>Math.floor(d(e)),mceil:e=>Math.ceil(d(e)),msqrt:e=>Math.sqrt(d(e)),mpow:(e,t)=>Math.pow(d(e),d(t)),msin:e=>Math.sin(d(e)),mcos:e=>Math.cos(d(e)),mtan:e=>Math.tan(d(e)),masin:e=>Math.asin(d(e)),macos:e=>Math.acos(d(e)),matan:(e,t)=>Math.atan2(d(e),d(t)),mlog:e=>Math.log(d(e)),getrandom(e,t){if(void 0===e)return Math.random();if(void 0===t)return Math.floor(Math.random()*(d(e)+1));let n=d(e);return Math.floor(Math.random()*(d(t)-n+1))+n},mdegtorad:e=>d(e)*(Math.PI/180),mradtodeg:e=>d(e)*(180/Math.PI),mfloatlength:(e,t)=>d(e).toFixed(d(t)),getboxcenter(e){let t=h(e).split(" ").map(Number),n=t[0]||0,r=t[1]||0,i=t[2]||0,a=t[3]||0,s=t[4]||0,o=t[5]||0;return"".concat((n+a)/2," ").concat((r+s)/2," ").concat((i+o)/2)},vectoradd(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(n+a," ").concat(r+s," ").concat(i+o)},vectorsub(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(n-a," ").concat(r-s," ").concat(i-o)},vectorscale(e,t){let[n,r,i]=p(e),a=d(t);return"".concat(n*a," ").concat(r*a," ").concat(i*a)},vectordot(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return n*a+r*s+i*o},vectorcross(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(r*o-i*s," ").concat(i*a-n*o," ").concat(n*s-r*a)},vectorlen(e){let[t,n,r]=p(e);return Math.sqrt(t*t+n*n+r*r)},vectornormalize(e){let[t,n,r]=p(e),i=Math.sqrt(t*t+n*n+r*r);return 0===i?"0 0 0":"".concat(t/i," ").concat(n/i," ").concat(r/i)},vectordist(e,t){let[n,r,i]=p(e),[a,s,o]=p(t),l=n-a,u=r-s,c=i-o;return Math.sqrt(l*l+u*u+c*c)},matrixcreate(e,t){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(e){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(e,t){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(e,t){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(e,t){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-t().state.startTime,getrealtime:()=>Date.now(),schedule(e,n,r){for(var i=arguments.length,a=Array(i>3?i-3:0),s=3;s{l.state.pendingTimeouts.delete(u);try{l.$f.call(String(r),...a)}catch(e){throw console.error("schedule: error calling ".concat(r,":"),e),e}},o);return l.state.pendingTimeouts.add(u),u},cancel(e){clearTimeout(e),t().state.pendingTimeouts.delete(e)},iseventpending:e=>t().state.pendingTimeouts.has(e),exec(e){let n=String(null!=e?e:"");if(console.debug("exec(".concat(JSON.stringify(n),"): preparing to execute…")),!n.includes("."))return console.error("exec: invalid script file name ".concat(JSON.stringify(n),".")),!1;let r=c(n),i=t(),{executedScripts:a,scripts:s}=i.state;if(a.has(r))return console.debug("exec(".concat(JSON.stringify(n),"): skipping (already executed)")),!0;let o=s.get(r);return null==o?(console.warn("exec(".concat(JSON.stringify(n),"): script not found")),!1):(a.add(r),console.debug("exec(".concat(JSON.stringify(n),"): executing!")),i.executeAST(o),!0)},compile(e){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:e=>n?n.isFile(h(e)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(e){let t=h(e),n=t.lastIndexOf(".");return n>=0?t.substring(n):""},filebase(e){let t=h(e),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),r=t.lastIndexOf("."),i=n>=0?n+1:0,a=r>i?r:t.length;return t.substring(i,a)},filepath(e){let t=h(e),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n>=0?t.substring(0,n):""},expandfilename(e){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile(e){var t;return n?(a=h(e),r=n.findFiles(a),i=0,null!=(t=r[i++])?t:""):(console.warn("findFirstFile(): no fileSystem handler configured"),"")},findnextfile(e){var t;let s=h(e);if(s!==a){if(!n)return"";a=s,r=n.findFiles(s)}return null!=(t=r[i++])?t:""},getfilecrc:e=>h(e),iswriteablefilename:e=>!1,activatepackage(e){t().$.activatePackage(h(e))},deactivatepackage(e){t().$.deactivatePackage(h(e))},ispackage:e=>t().$.isPackage(h(e)),isactivepackage:e=>t().$.isActivePackage(h(e)),getpackagelist:()=>t().$.getPackageList(),addmessagecallback(e,t){},alxcreatesource(){for(var e=arguments.length,t=Array(e),n=0;n0,alxlistenerf(e,t){},alxplay(){for(var e=arguments.length,t=Array(e),n=0;n!1,lockmouse(e){},addmaterialmapping(e,t){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:e=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:e=>!1,isfullscreen:()=>!1,screenshot(e){},setdisplaydevice:e=>!0,setfov(e){},setinteriorrendermode(e){},setopenglanisotropy(e){},setopenglmipreduction(e){},setopenglskymipreduction(e){},setopengltexturecompressionhint(e){},setscreenmode(e,t,n,r){},setverticalsync(e){},setzoomspeed(e){},togglefullscreen(){},videosetgammacorrection(e){},snaptoggle(){},addtaggedstring:e=>0,buildtaggedstring(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;rh(e),gettag:e=>0,gettaggedstring:e=>"",removetaggedstring(e){},commandtoclient(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i1?t-1:0),r=1;r!0,allowconnections(e){},startheartbeat(){},stopheartbeat(){},gotowebpage(e){},deletedatablocks(){},preloaddatablock:e=>!0,containerboxempty(){for(var e=arguments.length,t=Array(e),n=0;n0,containersearchnext:()=>0,initcontainerradiussearch(){for(var e=arguments.length,t=Array(e),n=0;n0,getcontrolobjectspeed:()=>0,getterrainheight:e=>0,lightscene(){for(var e=arguments.length,t=Array(e),n=0;n>>0}function w(e){if(null==e)return null;if("string"==typeof e)return e||null;if("number"==typeof e)return String(e);throw Error("Invalid instance name type: ".concat(typeof e))}function E(){var e,t,n;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=new l,a=new l,h=new l,d=[],p=new u,f=3,m=1027,g=new Map,v=new l,y=new l,_=new l,E=new l,T=new l;if(r.globals)for(let[e,t]of Object.entries(r.globals)){if(!e.startsWith("$"))throw Error('Global variable "'.concat(e,'" must start with $, e.g. "$').concat(e,'"'));_.set(e.slice(1),t)}let C=new Set,R=new Set,P=r.ignoreScripts&&r.ignoreScripts.length>0?(0,o.default)(r.ignoreScripts,{nocase:!0}):null,I=null!=(e=r.cache)?e:b(),L=I.scripts,N=I.generatedCode,D=new Map;function U(e){let t=D.get(e);return t&&t.length>0?t[t.length-1]:void 0}function O(e,t,n){let r;(r=D.get(e))||(r=[],D.set(e,r)),r.push(t);try{return n()}finally{let t=D.get(e);t&&t.pop()}}function F(e,t){return"".concat(e.toLowerCase(),"::").concat(t.toLowerCase())}function k(e,t){var n,r;return null!=(r=null==(n=i.get(e))?void 0:n.get(t))?r:null}let z=new Set,B=null,H=null,V=(null!=(t=r.builtins)?t:x)({runtime:()=>H,fileSystem:null!=(n=r.fileSystem)?n:null});function G(e){let t=h.get(e);if(!t)return void p.add(e);if(!t.active){for(let[e,n]of(t.active=!0,d.push(t.name),t.methods)){i.has(e)||i.set(e,new l);let t=i.get(e);for(let[e,r]of n)t.has(e)||t.set(e,[]),t.get(e).push(r)}for(let[e,n]of t.functions)a.has(e)||a.set(e,[]),a.get(e).push(n)}}function W(e){var t,n;return null==e||""===e?null:"object"==typeof e&&null!=e._id?e:"string"==typeof e?null!=(t=v.get(e))?t:null:"number"==typeof e&&null!=(n=g.get(e))?n:null}function j(e,t,n){let r=W(e);if(null==r)return 0;let i=J(r[t]);return r[t]=i+n,i}function X(e,t){let n=k(e,t);return n&&n.length>0?n[n.length-1]:null}function q(e,t,n,r){let i=k(e,t);return i&&0!==i.length?{found:!0,result:O(F(e,t),i.length-1,()=>i[i.length-1](n,...r))}:{found:!1}}function Y(e,t,n,r){let i=E.get(e);if(i){let e=i.get(t);if(e)for(let t of e)t(n,...r)}}function J(e){if(null==e||""===e)return 0;let t=Number(e);return isNaN(t)?0:t}function Z(e){if(!e||""===e)return null;e.startsWith("/")&&(e=e.slice(1));let t=e.split("/"),n=null;for(let e=0;e{var n;return(null==(n=t._name)?void 0:n.toLowerCase())===e});n=null!=t?t:null}if(!n)return null}}return n}function K(e){return null==e||""===e?null:Z(String(e))}function $(e){function t(e,t){return e+t.join("_")}return{get(n){for(var r,i=arguments.length,a=Array(i>1?i-1:0),s=1;s1?r-1:0),a=1;a1?r-1:0),a=1;a1?r-1:0),a=1;at.toLowerCase()===e.toLowerCase());for(let[e,r]of(-1!==n&&d.splice(n,1),t.methods)){let t=i.get(e);if(t)for(let[e,n]of r){let r=t.get(e);if(r){let e=r.indexOf(n);-1!==e&&r.splice(e,1)}}}for(let[e,n]of t.functions){let t=a.get(e);if(t){let e=t.indexOf(n);-1!==e&&t.splice(e,1)}}},create:function(e,t,n,r){let i=S(e),a=m++,s={_class:i,_className:e,_id:a};for(let[e,t]of Object.entries(n))s[S(e)]=t;s.superclass&&(s._superClass=S(String(s.superclass)),s.class&&T.set(S(String(s.class)),s._superClass)),g.set(a,s);let o=w(t);if(o&&(s._name=o,v.set(o,s)),r){for(let e of r)e._parent=s;s._children=r}let l=X(e,"onAdd");return l&&l(s),s},datablock:function(e,t,n,r){let i=S(e),a=f++,s={_class:i,_className:e,_id:a,_isDatablock:!0},o=w(n);if(o){let e=y.get(o);if(e){for(let[t,n]of Object.entries(e))t.startsWith("_")||(s[t]=n);s._parent=e}}for(let[e,t]of Object.entries(r))s[S(e)]=t;g.set(a,s);let l=w(t);return l&&(s._name=l,v.set(l,s),y.set(l,s)),s},deleteObject:function e(t){let n;if(null==t||("number"==typeof t?n=g.get(t):"string"==typeof t?n=v.get(t):"object"==typeof t&&t._id&&(n=t),!n))return!1;let r=X(n._className,"onRemove");if(r&&r(n),g.delete(n._id),n._name&&v.delete(n._name),n._isDatablock&&n._name&&y.delete(n._name),n._parent&&n._parent._children){let e=n._parent._children.indexOf(n);-1!==e&&n._parent._children.splice(e,1)}if(n._children)for(let t of[...n._children])e(t);return!0},prop:function(e,t){var n;let r=W(e);return null==r?"":null!=(n=r[S(t)])?n:""},setProp:function(e,t,n){let r=W(e);return null==r||(r[S(t)]=n),n},getIndex:function(e,t){var n;let r=W(e);return null==r?"":null!=(n=r[String(t)])?n:""},setIndex:function(e,t,n){let r=W(e);return null==r||(r[String(t)]=n),n},propPostInc:function(e,t){return j(e,S(t),1)},propPostDec:function(e,t){return j(e,S(t),-1)},indexPostInc:function(e,t){return j(e,String(t),1)},indexPostDec:function(e,t){return j(e,String(t),-1)},key:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r2?n-2:0),i=2;i2?n-2:0),i=2;io(...r)),u=r[0];return u&&"object"==typeof u&&Y(e,t,u,r.slice(1)),l},nsRef:function(e,t){let n=k(e,t);if(!n||0===n.length)return null;let r=F(e,t),i=n[n.length-1];return function(){for(var e=arguments.length,t=Array(e),a=0;ai(...t))}},parent:function(e,t,n){for(var r=arguments.length,i=Array(r>3?r-3:0),a=3;a=1){let r=l-1,a=O(o,r,()=>s[r](n,...i));return n&&"object"==typeof n&&Y(e,t,n,i),a}let u=T.get(e);for(;u;){let e=k(u,t);if(e&&e.length>0){let r=O(F(u,t),e.length-1,()=>e[e.length-1](n,...i));return n&&"object"==typeof n&&Y(u,t,n,i),r}u=T.get(u)}return""},parentFunc:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;ri[l](...n))},add:function(e,t){return J(e)+J(t)},sub:function(e,t){return J(e)-J(t)},mul:function(e,t){return J(e)*J(t)},div:function(e,t){return J(e)/J(t)},neg:function(e){return-J(e)},lt:function(e,t){return J(e)J(t)},ge:function(e,t){return J(e)>=J(t)},eq:function(e,t){return J(e)===J(t)},ne:function(e,t){return J(e)!==J(t)},mod:function(e,t){let n=0|Number(t);return 0===n?0:(0|Number(e))%n},bitand:function(e,t){return M(e)&M(t)},bitor:function(e,t){return M(e)|M(t)},bitxor:function(e,t){return M(e)^M(t)},shl:function(e,t){return M(M(e)<<(31&M(t)))},shr:function(e,t){return M(e)>>>(31&M(t))},bitnot:function(e){return~M(e)>>>0},concat:function(){for(var e=arguments.length,t=Array(e),n=0;nString(null!=e?e:"")).join("")},streq:function(e,t){return String(null!=e?e:"").toLowerCase()===String(null!=t?t:"").toLowerCase()},switchStr:function(e,t){let n=String(null!=e?e:"").toLowerCase();for(let[e,r]of Object.entries(t))if("default"!==e&&S(e)===n)return void r();t.default&&t.default()},deref:K,nameToId:function(e){let t=Z(e);return t?t._id:-1},isObject:function(e){return null!=e&&("object"==typeof e&&!!e._id||("number"==typeof e?g.has(e):"string"==typeof e&&v.has(e)))},isFunction:function(e){return a.has(e)||e.toLowerCase()in V},isPackage:function(e){return h.has(e)},isActivePackage:function(e){var t;let n=h.get(e);return null!=(t=null==n?void 0:n.active)&&t},getPackageList:function(){return d.join(" ")},locals:Q,onMethodCalled(e,t,n){let r=E.get(e);r||(r=new l,E.set(e,r));let i=r.get(t);i||(i=[],r.set(t,i)),i.push(n)}},et={call(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r0)return O(e.toLowerCase(),i.length-1,()=>i[i.length-1](...n));let s=V[e.toLowerCase()];return s?s(...n):(console.warn("Unknown function: ".concat(e,"(").concat(n.map(e=>JSON.stringify(e)).join(", "),")")),"")}},en=$(_),er={methods:i,functions:a,packages:h,activePackages:d,objectsById:g,objectsByName:v,datablocks:y,globals:_,executedScripts:C,failedScripts:R,scripts:L,generatedCode:N,pendingTimeouts:z,startTime:Date.now()};function ei(e){let t=function(e){let t=N.get(e);null==t&&(t=new s(void 0).generate(e),N.set(e,t));return t}(e),n=Q();Function("$","$f","$g","$l",t)(ee,et,en,n)}function ea(e,t){return{execute(){if(t){let e=c(t);er.executedScripts.add(e)}ei(e)}}}async function es(e,t,n){let i=r.loadScript;if(!i){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function a(e){var a,s;null==(a=r.signal)||a.throwIfAborted();let o=c(e);if(er.scripts.has(o)||er.failedScripts.has(o))return;if(P&&P(o)){console.warn("Ignoring script: ".concat(e)),er.failedScripts.add(o);return}if(n.has(o))return;let l=t.get(o);if(l)return void await l;null==(s=r.progress)||s.addItem(e);let u=(async()=>{var a,s,l;let u,c=await i(e);if(null==c){console.warn("Script not found: ".concat(e)),er.failedScripts.add(o),null==(s=r.progress)||s.completeItem();return}try{u=A(c,{filename:e})}catch(t){console.warn("Failed to parse script: ".concat(e),t),er.failedScripts.add(o),null==(l=r.progress)||l.completeItem();return}let h=new Set(n);h.add(o),await es(u.execScriptPaths,t,h),er.scripts.set(o,u),null==(a=r.progress)||a.completeItem()})();t.set(o,u),await u}await Promise.all(e.map(a))}async function eo(e){var t,n,i;let a=r.loadScript;if(!a)throw Error("loadFromPath requires loadScript option to be set");let s=c(e);if(er.scripts.has(s))return ea(er.scripts.get(s),e);null==(t=r.progress)||t.addItem(e);let o=await a(e);if(null==o)throw null==(i=r.progress)||i.completeItem(),Error("Script not found: ".concat(e));let l=await el(o,{path:e});return null==(n=r.progress)||n.completeItem(),l}async function el(e,t){if(null==t?void 0:t.path){let e=c(t.path);if(er.scripts.has(e))return ea(er.scripts.get(e),t.path)}return eu(A(e,{filename:null==t?void 0:t.path}),t)}async function eu(e,t){var n;let i=new Map,a=new Set;if(null==t?void 0:t.path){let n=c(t.path);er.scripts.set(n,e),a.add(n)}let s=[...e.execScriptPaths,...null!=(n=r.preloadScripts)?n:[]];return await es(s,i,a),ea(e,null==t?void 0:t.path)}return H={$:ee,$f:et,$g:en,state:er,destroy:function(){for(let e of er.pendingTimeouts)clearTimeout(e);er.pendingTimeouts.clear()},executeAST:ei,loadFromPath:eo,loadFromSource:el,loadFromAST:eu,call:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;rv.get(e)}}function T(){let e=new Set,t=0,n=0,r=null;function i(){for(let t of e)t()}return{get total(){return t},get loaded(){return n},get current(){return r},get progress(){return 0===t?0:n/t},on(t,n){e.add(n)},off(t,n){e.delete(n)},addItem(e){t++,r=e,i()},completeItem(){n++,r=null,i()},setCurrent(e){r=e,i()}}}function A(e,t){try{return n.default.parse(e)}catch(e){if((null==t?void 0:t.filename)&&e.location)throw Error("".concat(t.filename,":").concat(e.location.start.line,":").concat(e.location.start.column,": ").concat(e.message),{cause:e});throw e}}function C(e){let{missionName:t,missionType:n,runtimeOptions:r,onMissionLoadDone:i}=e,{signal:a,fileSystem:s}=null!=r?r:{},o=E({...r,globals:{...null==r?void 0:r.globals,"$Host::Map":t,"$Host::MissionType":n}}),l="".concat(n,"Game"),u="scripts/".concat(l,".cs"),c=async function(){try{let e=await o.loadFromPath("scripts/server.cs");null==a||a.throwIfAborted(),await o.loadFromPath("scripts/DefaultGame.cs"),null==a||a.throwIfAborted();try{await o.loadFromPath(u)}catch(e){}null==a||a.throwIfAborted(),await o.loadFromPath("missions/".concat(t,".mis")),null==a||a.throwIfAborted(),e.execute(),i&&o.$.onMethodCalled("DefaultGame","missionLoadDone",i);let n=await o.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");null==a||a.throwIfAborted(),n.execute()}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;throw e}}();return{runtime:o,ready:c}}e.s(["createProgressTracker",()=>T],38433);let R=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,P=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,I=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i;function L(e){var t,n,r,i,a,s;let o=A(e),{pragma:l,sections:u}=function(e){let t={},n=[],r={name:null,comments:[]};for(let i of e.body)if("Comment"===i.type){let e=function(e){let t;return(t=e.match(P))?{type:"sectionBegin",name:t[1]}:(t=e.match(I))?{type:"sectionEnd",name:t[1]}:(t=e.match(R))?{type:"definition",identifier:t[1],value:t[2]}:null}(i.value);if(e)switch(e.type){case"definition":null===r.name?t[e.identifier.toLowerCase()]=e.value:r.comments.push(i.value);break;case"sectionBegin":(null!==r.name||r.comments.length>0)&&n.push(r),r={name:e.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==r.name&&n.push(r),r={name:null,comments:[]}}else r.comments.push(i.value)}return(null!==r.name||r.comments.length>0)&&n.push(r),{pragma:t,sections:n}}(o);function c(e){var t,n;return null!=(n=null==(t=u.find(t=>t.name===e))?void 0:t.comments.map(e=>e.trimStart()).join("\n"))?n:null}return{displayName:null!=(n=l.displayname)?n:null,missionTypes:null!=(r=null==(t=l.missiontypes)?void 0:t.split(/\s+/).filter(Boolean))?r:[],missionBriefing:c("MISSION BRIEFING"),briefingWav:null!=(i=l.briefingwav)?i:null,bitmap:null!=(a=l.bitmap)?a:null,planetName:null!=(s=l.planetname)?s:null,missionBlurb:c("MISSION BLURB"),missionQuote:c("MISSION QUOTE"),missionString:c("MISSION STRING"),execScriptPaths:o.execScriptPaths,hasDynamicExec:o.hasDynamicExec,ast:o}}function N(e,t){if(e)return e[t.toLowerCase()]}function D(e,t){let n=e[t.toLowerCase()];return null==n?n:parseFloat(n)}function U(e,t){let n=e[t.toLowerCase()];return null==n?n:parseInt(n,10)}function O(e){var t;let[n,r,i]=(null!=(t=e.position)?t:"0 0 0").split(" ").map(e=>parseFloat(e));return[r||0,i||0,n||0]}function F(e){var t;let[n,r,i]=(null!=(t=e.scale)?t:"1 1 1").split(" ").map(e=>parseFloat(e));return[r||0,i||0,n||0]}function k(e){var n;let[r,i,a,s]=(null!=(n=e.rotation)?n:"1 0 0 0").split(" ").map(e=>parseFloat(e)),o=new t.Vector3(i,a,r).normalize(),l=-(Math.PI/180*s);return new t.Quaternion().setFromAxisAngle(o,l)}},12979,e=>{"use strict";e.s(["BASE_URL",()=>a,"FALLBACK_TEXTURE_URL",()=>o,"audioToUrl",()=>f,"getUrlForPath",()=>l,"iflTextureToUrl",()=>d,"interiorToUrl",()=>u,"loadDetailMapList",()=>m,"loadImageFrameList",()=>y,"loadMission",()=>g,"loadTerrain",()=>v,"shapeToUrl",()=>c,"terrainTextureToUrl",()=>h,"textureToUrl",()=>p],12979);var t=e.i(98223),n=e.i(91996),r=e.i(62395),i=e.i(71726);let a="/t2-mapper",s="".concat(a,"/base/"),o="".concat(a,"/magenta.png");function l(e,t){let r;try{r=(0,n.getActualResourceKey)(e)}catch(n){if(t)return console.warn('Resource "'.concat(e,'" not found - rendering fallback.')),t;throw n}let[i,a]=(0,n.getSourceAndPath)(r);return i?"".concat(s,"@vl2/").concat(i,"/").concat(a):"".concat(s).concat(a)}function u(e){return l("interiors/".concat(e)).replace(/\.dif$/i,".glb")}function c(e){return l("shapes/".concat(e)).replace(/\.dts$/i,".glb")}function h(e){return e=e.replace(/^terrain\./,""),l((0,n.getStandardTextureResourceKey)("textures/terrain/".concat(e)),o)}function d(e,t){let r=(0,i.normalizePath)(t).split("/"),a=r.length>1?r.slice(0,-1).join("/")+"/":"",s="".concat(a).concat(e);return l((0,n.getStandardTextureResourceKey)(s),o)}function p(e){return l((0,n.getStandardTextureResourceKey)("textures/".concat(e)),o)}function f(e){return l("audio/".concat(e))}async function m(e){let t=l("textures/".concat(e)),n=await fetch(t);return(await n.text()).split(/(?:\r\n|\r|\n)/).map(e=>{if(!(e=e.trim()).startsWith(";"))return e}).filter(Boolean)}async function g(e){let t=(0,n.getMissionInfo)(e),i=await fetch(l(t.resourcePath)),a=await i.text();return(0,r.parseMissionScript)(a)}async function v(e){let t=await fetch(l("terrains/".concat(e)));return function(e){let t=new DataView(e),n=0,r=t.getUint8(n++),i=new Uint16Array(65536),a=[],s=e=>{let r="";for(let i=0;i0&&a.push(i)}let o=[];for(let e of a){let e=new Uint8Array(65536);for(let r=0;r<65536;r++){var l=t.getUint8(n++);e[r]=l}o.push(e)}return{version:r,textureNames:a,heightMap:i,alphaMaps:o}}(await t.arrayBuffer())}async function y(e){let n=l(e),r=await fetch(n),i=await r.text();return(0,t.parseImageFileList)(i)}},5230,e=>{"use strict";e.s(["useFrame",()=>t.D]);var t=e.i(46712)},16096,e=>{"use strict";e.s(["useThree",()=>t.C]);var t=e.i(46712)},79123,e=>{"use strict";e.s(["SettingsProvider",()=>u,"useControls",()=>l,"useDebug",()=>o,"useSettings",()=>s]);var t=e.i(43476),n=e.i(71645);let r=(0,n.createContext)(null),i=(0,n.createContext)(null),a=(0,n.createContext)(null);function s(){return(0,n.useContext)(r)}function o(){return(0,n.useContext)(i)}function l(){return(0,n.useContext)(a)}function u(e){let{children:s}=e,[o,l]=(0,n.useState)(!0),[u,c]=(0,n.useState)(!1),[h,d]=(0,n.useState)(1),[p,f]=(0,n.useState)(90),[m,g]=(0,n.useState)(!1),[v,y]=(0,n.useState)(!0),[_,x]=(0,n.useState)(!1),b=(0,n.useMemo)(()=>({fogEnabled:o,setFogEnabled:l,highQualityFog:u,setHighQualityFog:c,fov:p,setFov:f,audioEnabled:m,setAudioEnabled:g,animationEnabled:v,setAnimationEnabled:y}),[o,u,p,m,v]),S=(0,n.useMemo)(()=>({debugMode:_,setDebugMode:x}),[_,x]),M=(0,n.useMemo)(()=>({speedMultiplier:h,setSpeedMultiplier:d}),[h,d]);(0,n.useEffect)(()=>{let e={};try{e=JSON.parse(localStorage.getItem("settings"))||{}}catch(e){}null!=e.debugMode&&x(e.debugMode),null!=e.audioEnabled&&g(e.audioEnabled),null!=e.animationEnabled&&y(e.animationEnabled),null!=e.fogEnabled&&l(e.fogEnabled),null!=e.highQualityFog&&c(e.highQualityFog),null!=e.speedMultiplier&&d(e.speedMultiplier),null!=e.fov&&f(e.fov)},[]);let w=(0,n.useRef)(null);return(0,n.useEffect)(()=>(w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{try{localStorage.setItem("settings",JSON.stringify({fogEnabled:o,highQualityFog:u,speedMultiplier:h,fov:p,audioEnabled:m,animationEnabled:v,debugMode:_}))}catch(e){}},500),()=>{w.current&&clearTimeout(w.current)}),[o,u,h,p,m,v,_]),(0,t.jsx)(r.Provider,{value:b,children:(0,t.jsx)(i.Provider,{value:S,children:(0,t.jsx)(a.Provider,{value:M,children:s})})})}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/544fd4f09b7df0da.js b/docs/_next/static/chunks/544fd4f09b7df0da.js deleted file mode 100644 index 26431ee1..00000000 --- a/docs/_next/static/chunks/544fd4f09b7df0da.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,6112,51475,77482,e=>{"use strict";e.s(["useDatablock",()=>u],6112),e.s(["RuntimeProvider",()=>s,"useRuntime",()=>c],77482);var t=e.i(43476),r=e.i(71645);e.s(["TickProvider",()=>a,"useTick",()=>o],51475);var n=e.i(5230);let i=(0,r.createContext)(null);function a(e){let{children:a}=e,o=(0,r.useRef)(void 0),l=(0,r.useRef)(0),s=(0,r.useRef)(0);(0,n.useFrame)((e,t)=>{for(l.current+=t;l.current>=.03125;)if(l.current-=.03125,s.current++,o.current)for(let e of o.current)e(s.current)});let c=(0,r.useCallback)(e=>(null!=o.current||(o.current=new Set),o.current.add(e),()=>{o.current.delete(e)}),[]),u=(0,r.useCallback)(()=>s.current,[]),d=(0,r.useMemo)(()=>({subscribe:c,getTick:u}),[c,u]);return(0,t.jsx)(i.Provider,{value:d,children:a})}function o(e){let t=(0,r.useContext)(i);if(!t)throw Error("useTick must be used within a TickProvider");let n=(0,r.useRef)(e);n.current=e,(0,r.useEffect)(()=>t.subscribe(e=>n.current(e)),[t])}let l=(0,r.createContext)(null);function s(e){let{runtime:r,children:n}=e;return(0,t.jsx)(l.Provider,{value:r,children:(0,t.jsx)(a,{children:n})})}function c(){let e=(0,r.useContext)(l);if(!e)throw Error("useRuntime must be used within a RuntimeProvider");return e}function u(e){let t=c();if(e)return t.state.datablocks.get(e)}},47071,80520,e=>{"use strict";e.s(["useTexture",()=>o],47071);var t=e.i(71645),r=e.i(90072),n=e.i(16096);e.s(["useLoader",()=>i.G],80520);var i=e.i(46712),i=i;let a=e=>e===Object(e)&&!Array.isArray(e)&&"function"!=typeof e;function o(e,o){let l=(0,n.useThree)(e=>e.gl),s=(0,i.G)(r.TextureLoader,a(e)?Object.values(e):e);return(0,t.useLayoutEffect)(()=>{null==o||o(s)},[o]),(0,t.useEffect)(()=>{if("initTexture"in l){let e=[];Array.isArray(s)?e=s:s instanceof r.Texture?e=[s]:a(s)&&(e=Object.values(s)),e.forEach(e=>{e instanceof r.Texture&&l.initTexture(e)})}},[l,s]),(0,t.useMemo)(()=>{if(!a(e))return s;{let t={},r=0;for(let n in e)t[n]=s[r++];return t}},[e,s])}o.preload=e=>i.G.preload(r.TextureLoader,e),o.clear=e=>i.G.clear(r.TextureLoader,e)},75567,e=>{"use strict";e.s(["setupAlphaTestedTexture",()=>i,"setupColor",()=>n,"setupMask",()=>a]);var t=e.i(90072);function r(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{repeat:n=[1,1],disableMipmaps:i=!1}=r;return e.wrapS=e.wrapT=t.RepeatWrapping,e.colorSpace=t.SRGBColorSpace,e.repeat.set(...n),e.flipY=!1,e.anisotropy=16,i?(e.generateMipmaps=!1,e.minFilter=t.LinearFilter):(e.generateMipmaps=!0,e.minFilter=t.LinearMipmapLinearFilter),e.magFilter=t.LinearFilter,e.needsUpdate=!0,e}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[1,1];return r(e,{repeat:t})}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[1,1];return r(e,{repeat:t,disableMipmaps:!0})}function a(e){let r=new t.DataTexture(e,256,256,t.RedFormat,t.UnsignedByteType);return r.colorSpace=t.NoColorSpace,r.wrapS=r.wrapT=t.RepeatWrapping,r.generateMipmaps=!1,r.minFilter=t.LinearFilter,r.magFilter=t.LinearFilter,r.needsUpdate=!0,r}},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},77975,e=>{"use strict";e.s(["useDistanceFromCamera",()=>a],77975);var t=e.i(5230),r=e.i(16096),n=e.i(71645),i=e.i(90072);function a(e){let{camera:a}=(0,r.useThree)(),o=(0,n.useRef)(null),l=function(e){let r=(0,n.useRef)(null);return(0,t.useFrame)(()=>{e.current&&(null!=r.current||(r.current=new i.Vector3),e.current.getWorldPosition(r.current))}),r}(e);return(0,t.useFrame)(()=>{l.current?o.current=a.position.distanceTo(l.current):o.current=null}),o}},89887,60099,e=>{"use strict";let t,r;e.s(["FloatingLabel",()=>P],89887);var n=e.i(43476),i=e.i(71645),a=e.i(77975),o=e.i(5230);e.s(["Html",()=>M],60099);var l=e.i(31067),s=e.i(88014),c=e.i(90072),u=e.i(16096);let d=new c.Vector3,f=new c.Vector3,m=new c.Vector3,h=new c.Vector2;function p(e,t,r){let n=d.setFromMatrixPosition(e.matrixWorld);n.project(t);let i=r.width/2,a=r.height/2;return[n.x*i+i,-(n.y*a)+a]}let x=e=>1e-10>Math.abs(e)?0:e;function v(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n="matrix3d(";for(let r=0;16!==r;r++)n+=x(t[r]*e.elements[r])+(15!==r?",":")");return r+n}let y=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>v(e,t)),g=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>v(e,r(t),"translate(-50%,-50%)")),M=i.forwardRef((e,t)=>{let{children:r,eps:n=.001,style:a,className:v,prepend:M,center:b,fullscreen:P,portal:w,distanceFactor:T,sprite:S=!1,transform:R=!1,occlude:E,onOcclude:F,castShadow:W,receiveShadow:C,material:L,geometry:j,zIndexRange:A=[0x1000037,0],calculatePosition:k=p,as:z="div",wrapperClass:O,pointerEvents:D="auto",...I}=e,{gl:N,camera:V,scene:G,size:H,raycaster:U,events:B,viewport:K}=(0,u.useThree)(),[_]=i.useState(()=>document.createElement(z)),Y=i.useRef(null),Z=i.useRef(null),q=i.useRef(0),J=i.useRef([0,0]),Q=i.useRef(null),X=i.useRef(null),$=(null==w?void 0:w.current)||B.connected||N.domElement.parentNode,ee=i.useRef(null),et=i.useRef(!1),er=i.useMemo(()=>E&&"blending"!==E||Array.isArray(E)&&E.length&&function(e){return e&&"object"==typeof e&&"current"in e}(E[0]),[E]);i.useLayoutEffect(()=>{let e=N.domElement;E&&"blending"===E?(e.style.zIndex="".concat(Math.floor(A[0]/2)),e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[E]),i.useLayoutEffect(()=>{if(Z.current){let e=Y.current=s.createRoot(_);if(G.updateMatrixWorld(),R)_.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=k(Z.current,V,H);_.style.cssText="position:absolute;top:0;left:0;transform:translate3d(".concat(e[0],"px,").concat(e[1],"px,0);transform-origin:0 0;")}return $&&(M?$.prepend(_):$.appendChild(_)),()=>{$&&$.removeChild(_),e.unmount()}}},[$,R]),i.useLayoutEffect(()=>{O&&(_.className=O)},[O]);let en=i.useMemo(()=>R?{position:"absolute",top:0,left:0,width:H.width,height:H.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:b?"translate3d(-50%,-50%,0)":"none",...P&&{top:-H.height/2,left:-H.width/2,width:H.width,height:H.height},...a},[a,b,P,H,R]),ei=i.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);i.useLayoutEffect(()=>{var e,n;et.current=!1,R?null==(e=Y.current)||e.render(i.createElement("div",{ref:Q,style:en},i.createElement("div",{ref:X,style:ei},i.createElement("div",{ref:t,className:v,style:a,children:r})))):null==(n=Y.current)||n.render(i.createElement("div",{ref:t,style:en,className:v,children:r}))});let ea=i.useRef(!0);(0,o.useFrame)(e=>{if(Z.current){V.updateMatrixWorld(),Z.current.updateWorldMatrix(!0,!1);let e=R?J.current:k(Z.current,V,H);if(R||Math.abs(q.current-V.zoom)>n||Math.abs(J.current[0]-e[0])>n||Math.abs(J.current[1]-e[1])>n){let t=function(e,t){let r=d.setFromMatrixPosition(e.matrixWorld),n=f.setFromMatrixPosition(t.matrixWorld),i=r.sub(n),a=t.getWorldDirection(m);return i.angleTo(a)>Math.PI/2}(Z.current,V),r=!1;er&&(Array.isArray(E)?r=E.map(e=>e.current):"blending"!==E&&(r=[G]));let n=ea.current;r?ea.current=function(e,t,r,n){let i=d.setFromMatrixPosition(e.matrixWorld),a=i.clone();a.project(t),h.set(a.x,a.y),r.setFromCamera(h,t);let o=r.intersectObjects(n,!0);if(o.length){let e=o[0].distance;return i.distanceTo(r.ray.origin)({vertexShader:R?void 0:'\n /*\n This shader is from the THREE\'s SpriteMaterial.\n We need to turn the backing plane into a Sprite\n (make it always face the camera) if "transfrom"\n is false.\n */\n #include \n\n void main() {\n vec2 center = vec2(0., 1.);\n float rotation = 0.0;\n\n // This is somewhat arbitrary, but it seems to work well\n // Need to figure out how to derive this dynamically if it even matters\n float size = 0.03;\n\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n }\n ',fragmentShader:"\n void main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n "}),[R]);return i.createElement("group",(0,l.default)({},I,{ref:Z}),E&&!er&&i.createElement("mesh",{castShadow:W,receiveShadow:C,ref:ee},j||i.createElement("planeGeometry",null),L||i.createElement("shaderMaterial",{side:c.DoubleSide,vertexShader:eo.vertexShader,fragmentShader:eo.fragmentShader})))}),b=[0,0,0],P=(0,i.memo)(function(e){let{children:t,color:r="white",position:l=b,opacity:s="fadeWithDistance"}=e,c="fadeWithDistance"===s,u=(0,i.useRef)(null),d=(0,a.useDistanceFromCamera)(u),[f,m]=(0,i.useState)(0!==s),h=(0,i.useRef)(null);return(0,i.useEffect)(()=>{if(c&&h.current&&null!=d.current){let e=Math.max(0,Math.min(1,1-d.current/200));h.current.style.opacity=e.toString()}},[f,c]),(0,o.useFrame)(()=>{if(c){let e=d.current,t=null!=e&&e<200;if(f!==t&&m(t),h.current&&t){let t=Math.max(0,Math.min(1,1-e/200));h.current.style.opacity=t.toString()}}else m(0!==s),h.current&&(h.current.style.opacity=s.toString())}),(0,n.jsx)("group",{ref:u,children:f?(0,n.jsx)(M,{position:l,center:!0,children:(0,n.jsx)("div",{ref:h,className:"StaticShapeLabel",style:{color:r},children:t})}):null})})},51434,e=>{"use strict";e.s(["AudioProvider",()=>o,"useAudio",()=>l]);var t=e.i(43476),r=e.i(71645),n=e.i(16096),i=e.i(90072);let a=(0,r.createContext)(void 0);function o(e){let{children:o}=e,{camera:l}=(0,n.useThree)(),[s,c]=(0,r.useState)({audioLoader:null,audioListener:null});return(0,r.useEffect)(()=>{let e=new i.AudioLoader,t=l.children.find(e=>e instanceof i.AudioListener);t||(t=new i.AudioListener,l.add(t)),c({audioLoader:e,audioListener:t})},[l]),(0,t.jsx)(a.Provider,{value:s,children:o})}function l(){let e=(0,r.useContext)(a);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}},61921,e=>{e.v(t=>Promise.all(["static/chunks/5342f4b5b8c465ca.js"].map(t=>e.l(t))).then(()=>t(29055)))},25147,e=>{e.v(t=>Promise.all(["static/chunks/6a22d5a06cf91e1e.js"].map(t=>e.l(t))).then(()=>t(63724)))},18599,e=>{e.v(t=>Promise.all(["static/chunks/bd1dcee0b953cac2.js"].map(t=>e.l(t))).then(()=>t(42585)))}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/6a22d5a06cf91e1e.js b/docs/_next/static/chunks/6a22d5a06cf91e1e.js deleted file mode 100644 index a8a9bc54..00000000 --- a/docs/_next/static/chunks/6a22d5a06cf91e1e.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63724,e=>{"use strict";e.s(["ForceFieldBare",()=>d],63724);var r=e.i(43476),o=e.i(71645),t=e.i(47071),n=e.i(5230),a=e.i(90072),l=e.i(62395),i=e.i(12979),u=e.i(79123),s=e.i(6112);function c(e){let r=(0,o.useMemo)(()=>{let[r,o,t]=e,n=new a.BoxGeometry(r,o,t);return n.translate(r/2,o/2,t/2),n},[e]);return(0,o.useEffect)(()=>()=>r.dispose(),[r]),r}function m(e){let{scale:l,color:i,baseTranslucency:s,textureUrls:m,numFrames:f,framesPerSec:d,scrollSpeed:p,umapping:v,vmapping:g}=e,{animationEnabled:h}=(0,u.useSettings)(),x=c(l),y=(0,t.useTexture)(m,e=>{e.forEach(e=>{e.wrapS=e.wrapT=a.RepeatWrapping,e.colorSpace=a.LinearSRGBColorSpace,e.flipY=!1,e.needsUpdate=!0})}),F=(0,o.useMemo)(()=>(function(e){var r,o,t,n;let{textures:l,scale:i,umapping:u,vmapping:s,color:c,baseTranslucency:m}=e,f=[...i].sort((e,r)=>r-e),d=new a.Vector2(f[0]*u,f[1]*s),p=l[0];return new a.ShaderMaterial({uniforms:{frame0:{value:p},frame1:{value:null!=(r=l[1])?r:p},frame2:{value:null!=(o=l[2])?o:p},frame3:{value:null!=(t=l[3])?t:p},frame4:{value:null!=(n=l[4])?n:p},currentFrame:{value:0},vScroll:{value:0},uvScale:{value:d},tintColor:{value:new a.Color(...c)},opacity:{value:m},opacityFactor:{value:.5},fogColor:{value:new a.Color},fogNear:{value:1},fogFar:{value:2e3}},vertexShader:"\n#include \n\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n #include \n}\n",fragmentShader:"\n#include \n\nuniform sampler2D frame0;\nuniform sampler2D frame1;\nuniform sampler2D frame2;\nuniform sampler2D frame3;\nuniform sampler2D frame4;\nuniform int currentFrame;\nuniform float vScroll;\nuniform vec2 uvScale;\nuniform vec3 tintColor;\nuniform float opacity;\nuniform float opacityFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n // Scale and scroll UVs\n vec2 scrolledUv = vec2(vUv.x * uvScale.x, vUv.y * uvScale.y + vScroll);\n\n // Sample the current frame\n vec4 texColor;\n if (currentFrame == 0) {\n texColor = texture2D(frame0, scrolledUv);\n } else if (currentFrame == 1) {\n texColor = texture2D(frame1, scrolledUv);\n } else if (currentFrame == 2) {\n texColor = texture2D(frame2, scrolledUv);\n } else if (currentFrame == 3) {\n texColor = texture2D(frame3, scrolledUv);\n } else {\n texColor = texture2D(frame4, scrolledUv);\n }\n\n // Tribes 2 GL_MODULATE: output = texture * vertexColor\n vec3 modulatedColor = texColor.rgb * tintColor;\n\n // Gamma correction: T2 textures were authored for CRT displays (~2.2 gamma).\n // Converting to linear space makes them appear as they did on those displays.\n // This significantly darkens the colors to match the original look.\n modulatedColor = pow(modulatedColor, vec3(2.2));\n\n float adjustedOpacity = opacity * opacityFactor;\n\n gl_FragColor = vec4(modulatedColor, adjustedOpacity);\n\n // Custom fog for additive blending: fade out rather than blend to fog color.\n // Standard fog (mix toward fogColor) doesn't work with additive blending\n // because we'd still be adding fogColor to the framebuffer.\n #ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp(-fogDensity * fogDensity * vFogDepth * vFogDepth);\n #else\n float fogFactor = smoothstep(fogNear, fogFar, vFogDepth);\n #endif\n gl_FragColor.a *= 1.0 - fogFactor;\n #endif\n}\n",transparent:!0,blending:a.AdditiveBlending,side:a.DoubleSide,depthWrite:!1,fog:!0})})({textures:y,scale:l,umapping:v,vmapping:g,color:i,baseTranslucency:s}),[y,l,v,g,i,s]);(0,o.useEffect)(()=>()=>F.dispose(),[F]);let S=(0,o.useRef)(0);return(0,n.useFrame)((e,r)=>{if(!h){S.current=0,F.uniforms.currentFrame.value=0,F.uniforms.vScroll.value=0;return}S.current+=r,F.uniforms.currentFrame.value=Math.floor(S.current*d)%f,F.uniforms.vScroll.value=S.current*p}),(0,r.jsx)("mesh",{geometry:x,material:F,renderOrder:1})}function f(e){let{scale:t,color:n,baseTranslucency:l}=e,i=c(t),u=(0,o.useMemo)(()=>new a.Color(Math.pow(n[0],2.2),Math.pow(n[1],2.2),Math.pow(n[2],2.2)),[n]);return(0,r.jsx)("mesh",{geometry:i,renderOrder:1,children:(0,r.jsx)("meshBasicMaterial",{color:u,transparent:!0,opacity:.5*l,blending:a.AdditiveBlending,side:a.DoubleSide,depthWrite:!1,fog:!1})})}let d=(0,o.memo)(function(e){let{object:t}=e,n=(0,o.useMemo)(()=>(0,l.getPosition)(t),[t]),a=(0,o.useMemo)(()=>(0,l.getRotation)(t),[t]),u=(0,o.useMemo)(()=>(0,l.getScale)(t),[t]),c=(0,s.useDatablock)((0,l.getProperty)(t,"dataBlock")),d=(0,l.getProperty)(c,"color"),p=(0,o.useMemo)(()=>d?function(e){var r,o,t;let n=e.split(" ").map(e=>parseFloat(e));return[null!=(r=n[0])?r:0,null!=(o=n[1])?o:0,null!=(t=n[2])?t:0]}(d):[1,1,1],[d]),v=parseFloat((0,l.getProperty)(c,"baseTranslucency"))||1,g=parseInt((0,l.getProperty)(c,"numFrames"),10)||1,h=parseFloat((0,l.getProperty)(c,"framesPerSec"))||1,x=parseFloat((0,l.getProperty)(c,"scrollSpeed"))||0,y=parseFloat((0,l.getProperty)(c,"umapping"))||1,F=parseFloat((0,l.getProperty)(c,"vmapping"))||1,S=(0,o.useMemo)(()=>(function(e,r){let o=[];for(let t=0;t{"use strict";e.s(["useTexture",()=>a],47071);var t=e.i(71645),n=e.i(90072),r=e.i(16096);e.s(["useLoader",()=>i.G],80520);var i=e.i(46712),i=i;let o=e=>e===Object(e)&&!Array.isArray(e)&&"function"!=typeof e;function a(e,a){let l=(0,r.useThree)(e=>e.gl),s=(0,i.G)(n.TextureLoader,o(e)?Object.values(e):e);return(0,t.useLayoutEffect)(()=>{null==a||a(s)},[a]),(0,t.useEffect)(()=>{if("initTexture"in l){let e=[];Array.isArray(s)?e=s:s instanceof n.Texture?e=[s]:o(s)&&(e=Object.values(s)),e.forEach(e=>{e instanceof n.Texture&&l.initTexture(e)})}},[l,s]),(0,t.useMemo)(()=>{if(!o(e))return s;{let t={},n=0;for(let r in e)t[r]=s[n++];return t}},[e,s])}a.preload=e=>i.G.preload(n.TextureLoader,e),a.clear=e=>i.G.clear(n.TextureLoader,e)},6112,51475,77482,e=>{"use strict";e.s(["useDatablock",()=>u],6112),e.s(["RuntimeProvider",()=>s,"useRuntime",()=>c],77482);var t=e.i(43476),n=e.i(71645);e.s(["TickProvider",()=>o,"useTick",()=>a],51475);var r=e.i(5230);let i=(0,n.createContext)(null);function o(e){let{children:o}=e,a=(0,n.useRef)(void 0),l=(0,n.useRef)(0),s=(0,n.useRef)(0);(0,r.useFrame)((e,t)=>{for(l.current+=t;l.current>=.03125;)if(l.current-=.03125,s.current++,a.current)for(let e of a.current)e(s.current)});let c=(0,n.useCallback)(e=>(null!=a.current||(a.current=new Set),a.current.add(e),()=>{a.current.delete(e)}),[]),u=(0,n.useCallback)(()=>s.current,[]),f=(0,n.useMemo)(()=>({subscribe:c,getTick:u}),[c,u]);return(0,t.jsx)(i.Provider,{value:f,children:o})}function a(e){let t=(0,n.useContext)(i);if(!t)throw Error("useTick must be used within a TickProvider");let r=(0,n.useRef)(e);r.current=e,(0,n.useEffect)(()=>t.subscribe(e=>r.current(e)),[t])}let l=(0,n.createContext)(null);function s(e){let{runtime:n,children:r}=e;return(0,t.jsx)(l.Provider,{value:n,children:(0,t.jsx)(o,{children:r})})}function c(){let e=(0,n.useContext)(l);if(!e)throw Error("useRuntime must be used within a RuntimeProvider");return e}function u(e){let t=c();if(e)return t.state.datablocks.get(e)}},75567,e=>{"use strict";e.s(["setupAlphaTestedTexture",()=>i,"setupColor",()=>r,"setupMask",()=>o]);var t=e.i(90072);function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{repeat:r=[1,1],disableMipmaps:i=!1}=n;return e.wrapS=e.wrapT=t.RepeatWrapping,e.colorSpace=t.SRGBColorSpace,e.repeat.set(...r),e.flipY=!1,e.anisotropy=16,i?(e.generateMipmaps=!1,e.minFilter=t.LinearFilter):(e.generateMipmaps=!0,e.minFilter=t.LinearMipmapLinearFilter),e.magFilter=t.LinearFilter,e.needsUpdate=!0,e}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[1,1];return n(e,{repeat:t})}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[1,1];return n(e,{repeat:t,disableMipmaps:!0})}function o(e){let n=new t.DataTexture(e,256,256,t.RedFormat,t.UnsignedByteType);return n.colorSpace=t.NoColorSpace,n.wrapS=n.wrapT=t.RepeatWrapping,n.generateMipmaps=!1,n.minFilter=t.LinearFilter,n.magFilter=t.LinearFilter,n.needsUpdate=!0,n}},47021,e=>{"use strict";e.s(["fogFragmentShader",()=>n,"injectCustomFog",()=>i,"installCustomFogShader",()=>r]);var t=e.i(8560);let n="\n#ifdef USE_FOG\n float dist = vFogDepth;\n\n // Discard fragments at or beyond visible distance - matches Torque's behavior\n // where objects beyond visibleDistance are not rendered at all.\n // This prevents fully-fogged geometry from showing as silhouettes against\n // the sky's fog-to-sky gradient.\n if (dist >= fogFar) {\n discard;\n }\n\n // Step 1: Calculate distance-based haze (quadratic falloff)\n // Since we discard at fogFar, haze never reaches 1.0 here\n float haze = 0.0;\n if (dist > fogNear) {\n float fogScale = 1.0 / (fogFar - fogNear);\n float distFactor = (dist - fogNear) * fogScale - 1.0;\n haze = 1.0 - distFactor * distFactor;\n }\n\n // Step 2: Calculate fog volume contributions\n // Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false)\n // All fog uses the global fogColor - see Tribes2_Fog_System.md for details\n float volumeFog = 0.0;\n\n #ifdef USE_VOLUMETRIC_FOG\n {\n #ifdef USE_FOG_WORLD_POSITION\n float fragmentHeight = vFogWorldPosition.y;\n #else\n float fragmentHeight = cameraHeight;\n #endif\n\n float deltaY = fragmentHeight - cameraHeight;\n float absDeltaY = abs(deltaY);\n\n // Determine if we're going up (positive) or down (negative)\n if (absDeltaY > 0.01) {\n // Non-horizontal ray: ray-march through fog volumes\n for (int i = 0; i < 3; i++) {\n int offset = i * 4;\n float volVisDist = fogVolumeData[offset + 0];\n float volMinH = fogVolumeData[offset + 1];\n float volMaxH = fogVolumeData[offset + 2];\n float volPct = fogVolumeData[offset + 3];\n\n // Skip inactive volumes (visibleDistance = 0)\n if (volVisDist <= 0.0) continue;\n\n // Calculate fog factor for this volume\n // From Torque: factor = (1 / (volumeVisDist * visFactor)) * percentage\n // where visFactor is smVisibleDistanceMod (a user quality pref, default 1.0)\n // Since we don't have quality settings, we use visFactor = 1.0\n float factor = (1.0 / volVisDist) * volPct;\n\n // Find ray intersection with this volume's height range\n float rayMinY = min(cameraHeight, fragmentHeight);\n float rayMaxY = max(cameraHeight, fragmentHeight);\n\n // Check if ray intersects volume height range\n if (rayMinY < volMaxH && rayMaxY > volMinH) {\n float intersectMin = max(rayMinY, volMinH);\n float intersectMax = min(rayMaxY, volMaxH);\n float intersectHeight = intersectMax - intersectMin;\n\n // Calculate distance traveled through this volume using similar triangles:\n // subDist / dist = intersectHeight / absDeltaY\n float subDist = dist * (intersectHeight / absDeltaY);\n\n // Accumulate fog: fog += subDist * factor\n volumeFog += subDist * factor;\n }\n }\n } else {\n // Near-horizontal ray: if camera is inside a volume, apply full fog for that volume\n for (int i = 0; i < 3; i++) {\n int offset = i * 4;\n float volVisDist = fogVolumeData[offset + 0];\n float volMinH = fogVolumeData[offset + 1];\n float volMaxH = fogVolumeData[offset + 2];\n float volPct = fogVolumeData[offset + 3];\n\n if (volVisDist <= 0.0) continue;\n\n // If camera is inside this volume, apply fog for full distance\n if (cameraHeight >= volMinH && cameraHeight <= volMaxH) {\n float factor = (1.0 / volVisDist) * volPct;\n volumeFog += dist * factor;\n }\n }\n }\n }\n #endif\n\n // Step 3: Combine haze and volume fog\n // Torque's clamping: if (bandPct + hazePct > 1) hazePct = 1 - bandPct\n // This gives fog volumes priority over haze\n float volPct = min(volumeFog, 1.0);\n float hazePct = haze;\n if (volPct + hazePct > 1.0) {\n hazePct = 1.0 - volPct;\n }\n float fogFactor = hazePct + volPct;\n\n // Apply fog using global fogColor (per-volume colors not used in Tribes 2)\n gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor);\n#endif\n";function r(){t.ShaderChunk.fog_pars_fragment="\n#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n\n // Custom volumetric fog uniforms (only defined when USE_VOLUMETRIC_FOG is set)\n // Format: [visDist, minH, maxH, percentage] x 3 volumes = 12 floats\n #ifdef USE_VOLUMETRIC_FOG\n uniform float fogVolumeData[12];\n uniform float cameraHeight;\n #endif\n\n #ifdef USE_FOG_WORLD_POSITION\n varying vec3 vFogWorldPosition;\n #endif\n#endif\n",t.ShaderChunk.fog_fragment=n,t.ShaderChunk.fog_pars_vertex="\n#ifdef USE_FOG\n varying float vFogDepth;\n #ifdef USE_FOG_WORLD_POSITION\n varying vec3 vFogWorldPosition;\n #endif\n#endif\n",t.ShaderChunk.fog_vertex="\n#ifdef USE_FOG\n // Use Euclidean distance from camera, not view-space z-depth\n // This ensures fog doesn't change when rotating the camera\n vFogDepth = length(mvPosition.xyz);\n #ifdef USE_FOG_WORLD_POSITION\n vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz;\n #endif\n#endif\n"}function i(e,t){e.uniforms.fogVolumeData=t.fogVolumeData,e.uniforms.cameraHeight=t.cameraHeight,e.vertexShader=e.vertexShader.replace("#include ","#include \n#ifdef USE_FOG\n #define USE_FOG_WORLD_POSITION\n #define USE_VOLUMETRIC_FOG\n varying vec3 vFogWorldPosition;\n#endif"),e.vertexShader=e.vertexShader.replace("#include ","#include \n#ifdef USE_FOG\n vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz;\n#endif"),e.fragmentShader=e.fragmentShader.replace("#include ","#include \n#ifdef USE_FOG\n #define USE_VOLUMETRIC_FOG\n uniform float fogVolumeData[12];\n uniform float cameraHeight;\n #define USE_FOG_WORLD_POSITION\n varying vec3 vFogWorldPosition;\n#endif"),e.fragmentShader=e.fragmentShader.replace("#include ",n)}},48066,e=>{"use strict";e.s(["globalFogUniforms",()=>t,"packFogVolumeData",()=>i,"resetGlobalFogUniforms",()=>r,"updateGlobalFogUniforms",()=>n]);let t={fogVolumeData:{value:new Float32Array(12)},cameraHeight:{value:0}};function n(e,n){t.cameraHeight.value=e,t.fogVolumeData.value.set(n)}function r(){t.cameraHeight.value=0,t.fogVolumeData.value.fill(0)}function i(e){let t=new Float32Array(12);for(let n=0;n<3;n++){let r=4*n,i=e[n];i&&(t[r+0]=i.visibleDistance,t[r+1]=i.minHeight,t[r+2]=i.maxHeight,t[r+3]=i.percentage)}return t}},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},77975,e=>{"use strict";e.s(["useDistanceFromCamera",()=>o],77975);var t=e.i(5230),n=e.i(16096),r=e.i(71645),i=e.i(90072);function o(e){let{camera:o}=(0,n.useThree)(),a=(0,r.useRef)(null),l=function(e){let n=(0,r.useRef)(null);return(0,t.useFrame)(()=>{e.current&&(null!=n.current||(n.current=new i.Vector3),e.current.getWorldPosition(n.current))}),n}(e);return(0,t.useFrame)(()=>{l.current?a.current=o.position.distanceTo(l.current):a.current=null}),a}},89887,60099,e=>{"use strict";let t,n;e.s(["FloatingLabel",()=>M],89887);var r=e.i(43476),i=e.i(71645),o=e.i(77975),a=e.i(5230);e.s(["Html",()=>F],60099);var l=e.i(31067),s=e.i(88014),c=e.i(90072),u=e.i(16096);let f=new c.Vector3,d=new c.Vector3,m=new c.Vector3,g=new c.Vector2;function h(e,t,n){let r=f.setFromMatrixPosition(e.matrixWorld);r.project(t);let i=n.width/2,o=n.height/2;return[r.x*i+i,-(r.y*o)+o]}let v=e=>1e-10>Math.abs(e)?0:e;function p(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="matrix3d(";for(let n=0;16!==n;n++)r+=v(t[n]*e.elements[n])+(15!==n?",":")");return n+r}let x=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>p(e,t)),y=(n=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>p(e,n(t),"translate(-50%,-50%)")),F=i.forwardRef((e,t)=>{let{children:n,eps:r=.001,style:o,className:p,prepend:F,center:b,fullscreen:M,portal:S,distanceFactor:P,sprite:_=!1,transform:D=!1,occlude:T,onOcclude:E,castShadow:w,receiveShadow:O,material:C,geometry:H,zIndexRange:R=[0x1000037,0],calculatePosition:W=h,as:V="div",wrapperClass:L,pointerEvents:U="auto",...z}=e,{gl:G,camera:k,scene:A,size:I,raycaster:j,events:N,viewport:Y}=(0,u.useThree)(),[q]=i.useState(()=>document.createElement(V)),B=i.useRef(null),K=i.useRef(null),X=i.useRef(0),Z=i.useRef([0,0]),$=i.useRef(null),J=i.useRef(null),Q=(null==S?void 0:S.current)||N.connected||G.domElement.parentNode,ee=i.useRef(null),et=i.useRef(!1),en=i.useMemo(()=>T&&"blending"!==T||Array.isArray(T)&&T.length&&function(e){return e&&"object"==typeof e&&"current"in e}(T[0]),[T]);i.useLayoutEffect(()=>{let e=G.domElement;T&&"blending"===T?(e.style.zIndex="".concat(Math.floor(R[0]/2)),e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[T]),i.useLayoutEffect(()=>{if(K.current){let e=B.current=s.createRoot(q);if(A.updateMatrixWorld(),D)q.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=W(K.current,k,I);q.style.cssText="position:absolute;top:0;left:0;transform:translate3d(".concat(e[0],"px,").concat(e[1],"px,0);transform-origin:0 0;")}return Q&&(F?Q.prepend(q):Q.appendChild(q)),()=>{Q&&Q.removeChild(q),e.unmount()}}},[Q,D]),i.useLayoutEffect(()=>{L&&(q.className=L)},[L]);let er=i.useMemo(()=>D?{position:"absolute",top:0,left:0,width:I.width,height:I.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:b?"translate3d(-50%,-50%,0)":"none",...M&&{top:-I.height/2,left:-I.width/2,width:I.width,height:I.height},...o},[o,b,M,I,D]),ei=i.useMemo(()=>({position:"absolute",pointerEvents:U}),[U]);i.useLayoutEffect(()=>{var e,r;et.current=!1,D?null==(e=B.current)||e.render(i.createElement("div",{ref:$,style:er},i.createElement("div",{ref:J,style:ei},i.createElement("div",{ref:t,className:p,style:o,children:n})))):null==(r=B.current)||r.render(i.createElement("div",{ref:t,style:er,className:p,children:n}))});let eo=i.useRef(!0);(0,a.useFrame)(e=>{if(K.current){k.updateMatrixWorld(),K.current.updateWorldMatrix(!0,!1);let e=D?Z.current:W(K.current,k,I);if(D||Math.abs(X.current-k.zoom)>r||Math.abs(Z.current[0]-e[0])>r||Math.abs(Z.current[1]-e[1])>r){let t=function(e,t){let n=f.setFromMatrixPosition(e.matrixWorld),r=d.setFromMatrixPosition(t.matrixWorld),i=n.sub(r),o=t.getWorldDirection(m);return i.angleTo(o)>Math.PI/2}(K.current,k),n=!1;en&&(Array.isArray(T)?n=T.map(e=>e.current):"blending"!==T&&(n=[A]));let r=eo.current;n?eo.current=function(e,t,n,r){let i=f.setFromMatrixPosition(e.matrixWorld),o=i.clone();o.project(t),g.set(o.x,o.y),n.setFromCamera(g,t);let a=n.intersectObjects(r,!0);if(a.length){let e=a[0].distance;return i.distanceTo(n.ray.origin)({vertexShader:D?void 0:'\n /*\n This shader is from the THREE\'s SpriteMaterial.\n We need to turn the backing plane into a Sprite\n (make it always face the camera) if "transfrom"\n is false.\n */\n #include \n\n void main() {\n vec2 center = vec2(0., 1.);\n float rotation = 0.0;\n\n // This is somewhat arbitrary, but it seems to work well\n // Need to figure out how to derive this dynamically if it even matters\n float size = 0.03;\n\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n }\n ',fragmentShader:"\n void main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n "}),[D]);return i.createElement("group",(0,l.default)({},z,{ref:K}),T&&!en&&i.createElement("mesh",{castShadow:w,receiveShadow:O,ref:ee},H||i.createElement("planeGeometry",null),C||i.createElement("shaderMaterial",{side:c.DoubleSide,vertexShader:ea.vertexShader,fragmentShader:ea.fragmentShader})))}),b=[0,0,0],M=(0,i.memo)(function(e){let{children:t,color:n="white",position:l=b,opacity:s="fadeWithDistance"}=e,c="fadeWithDistance"===s,u=(0,i.useRef)(null),f=(0,o.useDistanceFromCamera)(u),[d,m]=(0,i.useState)(0!==s),g=(0,i.useRef)(null);return(0,i.useEffect)(()=>{if(c&&g.current&&null!=f.current){let e=Math.max(0,Math.min(1,1-f.current/200));g.current.style.opacity=e.toString()}},[d,c]),(0,a.useFrame)(()=>{if(c){let e=f.current,t=null!=e&&e<200;if(d!==t&&m(t),g.current&&t){let t=Math.max(0,Math.min(1,1-e/200));g.current.style.opacity=t.toString()}}else m(0!==s),g.current&&(g.current.style.opacity=s.toString())}),(0,r.jsx)("group",{ref:u,children:d?(0,r.jsx)(F,{position:l,center:!0,children:(0,r.jsx)("div",{ref:g,className:"StaticShapeLabel",style:{color:n},children:t})}):null})})},51434,e=>{"use strict";e.s(["AudioProvider",()=>a,"useAudio",()=>l]);var t=e.i(43476),n=e.i(71645),r=e.i(16096),i=e.i(90072);let o=(0,n.createContext)(void 0);function a(e){let{children:a}=e,{camera:l}=(0,r.useThree)(),[s,c]=(0,n.useState)({audioLoader:null,audioListener:null});return(0,n.useEffect)(()=>{let e=new i.AudioLoader,t=l.children.find(e=>e instanceof i.AudioListener);t||(t=new i.AudioListener,l.add(t)),c({audioLoader:e,audioListener:t})},[l]),(0,t.jsx)(o.Provider,{value:s,children:a})}function l(){let e=(0,n.useContext)(o);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}},61921,e=>{e.v(t=>Promise.all(["static/chunks/5342f4b5b8c465ca.js"].map(t=>e.l(t))).then(()=>t(29055)))},25147,e=>{e.v(t=>Promise.all(["static/chunks/40a2f59d0c05dc35.js"].map(t=>e.l(t))).then(()=>t(63724)))},18599,e=>{e.v(t=>Promise.all(["static/chunks/f863efae27259b81.js"].map(t=>e.l(t))).then(()=>t(42585)))}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/bce28defe6a29ff5.js b/docs/_next/static/chunks/bce28defe6a29ff5.js new file mode 100644 index 00000000..b5a0d9dc --- /dev/null +++ b/docs/_next/static/chunks/bce28defe6a29ff5.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,t,r)=>{t.exports=e.r(76562)},38360,(e,t,r)=>{var n={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},i=Object.keys(n).join("|"),a=RegExp(i,"g"),o=RegExp(i,"");function s(e){return n[e]}var l=function(e){return e.replace(a,s)};t.exports=l,t.exports.has=function(e){return!!e.match(o)},t.exports.remove=l},29402,(e,t,r)=>{var n,i,a="__lodash_hash_undefined__",o=1/0,s="[object Arguments]",l="[object Array]",u="[object Boolean]",c="[object Date]",d="[object Error]",f="[object Function]",h="[object Map]",m="[object Number]",p="[object Object]",A="[object Promise]",g="[object RegExp]",B="[object Set]",C="[object String]",y="[object Symbol]",b="[object WeakMap]",M="[object ArrayBuffer]",E="[object DataView]",x=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,S=/^\./,T=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,R=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,D={};D["[object Float32Array]"]=D["[object Float64Array]"]=D["[object Int8Array]"]=D["[object Int16Array]"]=D["[object Int32Array]"]=D["[object Uint8Array]"]=D["[object Uint8ClampedArray]"]=D["[object Uint16Array]"]=D["[object Uint32Array]"]=!0,D[s]=D[l]=D[M]=D[u]=D[E]=D[c]=D[d]=D[f]=D[h]=D[m]=D[p]=D[g]=D[B]=D[C]=D[b]=!1;var G=e.g&&e.g.Object===Object&&e.g,L="object"==typeof self&&self&&self.Object===Object&&self,P=G||L||Function("return this")(),H=r&&!r.nodeType&&r,O=H&&t&&!t.nodeType&&t,k=O&&O.exports===H&&G.process,_=function(){try{return k&&k.binding("util")}catch(e){}}(),U=_&&_.isTypedArray;function j(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1},ey.prototype.set=function(e,t){var r=this.__data__,n=ex(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},eb.prototype.clear=function(){this.__data__={hash:new eC,map:new(es||ey),string:new eC}},eb.prototype.delete=function(e){return eG(this,e).delete(e)},eb.prototype.get=function(e){return eG(this,e).get(e)},eb.prototype.has=function(e){return eG(this,e).has(e)},eb.prototype.set=function(e,t){return eG(this,e).set(e,t),this},eM.prototype.add=eM.prototype.push=function(e){return this.__data__.set(e,a),this},eM.prototype.has=function(e){return this.__data__.has(e)},eE.prototype.clear=function(){this.__data__=new ey},eE.prototype.delete=function(e){return this.__data__.delete(e)},eE.prototype.get=function(e){return this.__data__.get(e)},eE.prototype.has=function(e){return this.__data__.has(e)},eE.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ey){var n=r.__data__;if(!es||n.length<199)return n.push([e,t]),this;r=this.__data__=new eb(n)}return r.set(e,t),this};var eF=function(e,t){return function(r,n){if(null==r)return r;if(!eW(r))return e(r,n);for(var i=r.length,a=-1,o=Object(r);(t?a--:++as))return!1;var u=a.get(e);if(u&&a.get(t))return u==t;var c=-1,d=!0,f=1&i?new eM:void 0;for(a.set(e,t),a.set(t,e);++c-1&&e%1==0&&e-1&&e%1==0&&e<=0x1fffffffffffff}function eq(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function eY(e){return!!e&&"object"==typeof e}function eZ(e){return"symbol"==typeof e||eY(e)&&$.call(e)==y}var ez=U?J(U):function(e){return eY(e)&&eX(e.length)&&!!D[$.call(e)]};function e$(e){return eW(e)?function(e,t){var r=eQ(e)||eK(e)?function(e,t){for(var r=-1,n=Array(e);++rt||a&&o&&l&&!s&&!u||n&&o&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&e=s)return l;return l*("desc"==r[n]?-1:1)}}return e.index-t.index}(e,t,r)});l--;)s[l]=s[l].value;return s}(e,t,r))}},81405,(e,t,r)=>{e.e,t.exports=function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function r(e){for(var t=0;to+1e3&&(l.update(1e3*s/(e-o),100),o=e,s=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:r}};return e.Panel=function(e,t,r){var n=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),s=80*o,l=48*o,u=3*o,c=2*o,d=3*o,f=15*o,h=74*o,m=30*o,p=document.createElement("canvas");p.width=s,p.height=l,p.style.cssText="width:80px;height:48px";var A=p.getContext("2d");return A.font="bold "+9*o+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=r,A.fillRect(0,0,s,l),A.fillStyle=t,A.fillText(e,u,c),A.fillRect(d,f,h,m),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d,f,h,m),{dom:p,update:function(l,g){n=Math.min(n,l),i=Math.max(i,l),A.fillStyle=r,A.globalAlpha=1,A.fillRect(0,0,s,f),A.fillStyle=t,A.fillText(a(l)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),A.drawImage(p,d+o,f,h-o,m,d,f,h-o,m),A.fillRect(d+h-o,f,o,m),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d+h-o,f,o,a((1-l/g)*m))}}},e}()},31713,e=>{"use strict";let t;e.s(["default",()=>l5],31713);var r,n,i,a,o,s,l,u,c,d,f,h,m,p,A,g,B,C,y,b,M,E,x,F,S,T,w,R,I,D,G,L,P,H,O,k,_,U,j,J,N,K,Q,W,V,X,q,Y,Z,z,$,ee,et,er,en,ei,ea,eo,es=e.i(43476),el=e.i(71645),eu=e.i(18566),ec=e.i(46712);e.s(["ACESFilmicToneMapping",()=>ef.ACESFilmicToneMapping,"AddEquation",()=>ef.AddEquation,"AddOperation",()=>ef.AddOperation,"AdditiveAnimationBlendMode",()=>ef.AdditiveAnimationBlendMode,"AdditiveBlending",()=>ef.AdditiveBlending,"AgXToneMapping",()=>ef.AgXToneMapping,"AlphaFormat",()=>ef.AlphaFormat,"AlwaysCompare",()=>ef.AlwaysCompare,"AlwaysDepth",()=>ef.AlwaysDepth,"AlwaysStencilFunc",()=>ef.AlwaysStencilFunc,"AmbientLight",()=>ef.AmbientLight,"AnimationAction",()=>ef.AnimationAction,"AnimationClip",()=>ef.AnimationClip,"AnimationLoader",()=>ef.AnimationLoader,"AnimationMixer",()=>ef.AnimationMixer,"AnimationObjectGroup",()=>ef.AnimationObjectGroup,"AnimationUtils",()=>ef.AnimationUtils,"ArcCurve",()=>ef.ArcCurve,"ArrayCamera",()=>ef.ArrayCamera,"ArrowHelper",()=>ef.ArrowHelper,"AttachedBindMode",()=>ef.AttachedBindMode,"Audio",()=>ef.Audio,"AudioAnalyser",()=>ef.AudioAnalyser,"AudioContext",()=>ef.AudioContext,"AudioListener",()=>ef.AudioListener,"AudioLoader",()=>ef.AudioLoader,"AxesHelper",()=>ef.AxesHelper,"BackSide",()=>ef.BackSide,"BasicDepthPacking",()=>ef.BasicDepthPacking,"BasicShadowMap",()=>ef.BasicShadowMap,"BatchedMesh",()=>ef.BatchedMesh,"Bone",()=>ef.Bone,"BooleanKeyframeTrack",()=>ef.BooleanKeyframeTrack,"Box2",()=>ef.Box2,"Box3",()=>ef.Box3,"Box3Helper",()=>ef.Box3Helper,"BoxGeometry",()=>ef.BoxGeometry,"BoxHelper",()=>ef.BoxHelper,"BufferAttribute",()=>ef.BufferAttribute,"BufferGeometry",()=>ef.BufferGeometry,"BufferGeometryLoader",()=>ef.BufferGeometryLoader,"ByteType",()=>ef.ByteType,"Cache",()=>ef.Cache,"Camera",()=>ef.Camera,"CameraHelper",()=>ef.CameraHelper,"CanvasTexture",()=>ef.CanvasTexture,"CapsuleGeometry",()=>ef.CapsuleGeometry,"CatmullRomCurve3",()=>ef.CatmullRomCurve3,"CineonToneMapping",()=>ef.CineonToneMapping,"CircleGeometry",()=>ef.CircleGeometry,"ClampToEdgeWrapping",()=>ef.ClampToEdgeWrapping,"Clock",()=>ef.Clock,"Color",()=>ef.Color,"ColorKeyframeTrack",()=>ef.ColorKeyframeTrack,"ColorManagement",()=>ef.ColorManagement,"CompressedArrayTexture",()=>ef.CompressedArrayTexture,"CompressedCubeTexture",()=>ef.CompressedCubeTexture,"CompressedTexture",()=>ef.CompressedTexture,"CompressedTextureLoader",()=>ef.CompressedTextureLoader,"ConeGeometry",()=>ef.ConeGeometry,"ConstantAlphaFactor",()=>ef.ConstantAlphaFactor,"ConstantColorFactor",()=>ef.ConstantColorFactor,"Controls",()=>ef.Controls,"CubeCamera",()=>ef.CubeCamera,"CubeReflectionMapping",()=>ef.CubeReflectionMapping,"CubeRefractionMapping",()=>ef.CubeRefractionMapping,"CubeTexture",()=>ef.CubeTexture,"CubeTextureLoader",()=>ef.CubeTextureLoader,"CubeUVReflectionMapping",()=>ef.CubeUVReflectionMapping,"CubicBezierCurve",()=>ef.CubicBezierCurve,"CubicBezierCurve3",()=>ef.CubicBezierCurve3,"CubicInterpolant",()=>ef.CubicInterpolant,"CullFaceBack",()=>ef.CullFaceBack,"CullFaceFront",()=>ef.CullFaceFront,"CullFaceFrontBack",()=>ef.CullFaceFrontBack,"CullFaceNone",()=>ef.CullFaceNone,"Curve",()=>ef.Curve,"CurvePath",()=>ef.CurvePath,"CustomBlending",()=>ef.CustomBlending,"CustomToneMapping",()=>ef.CustomToneMapping,"CylinderGeometry",()=>ef.CylinderGeometry,"Cylindrical",()=>ef.Cylindrical,"Data3DTexture",()=>ef.Data3DTexture,"DataArrayTexture",()=>ef.DataArrayTexture,"DataTexture",()=>ef.DataTexture,"DataTextureLoader",()=>ef.DataTextureLoader,"DataUtils",()=>ef.DataUtils,"DecrementStencilOp",()=>ef.DecrementStencilOp,"DecrementWrapStencilOp",()=>ef.DecrementWrapStencilOp,"DefaultLoadingManager",()=>ef.DefaultLoadingManager,"DepthFormat",()=>ef.DepthFormat,"DepthStencilFormat",()=>ef.DepthStencilFormat,"DepthTexture",()=>ef.DepthTexture,"DetachedBindMode",()=>ef.DetachedBindMode,"DirectionalLight",()=>ef.DirectionalLight,"DirectionalLightHelper",()=>ef.DirectionalLightHelper,"DiscreteInterpolant",()=>ef.DiscreteInterpolant,"DodecahedronGeometry",()=>ef.DodecahedronGeometry,"DoubleSide",()=>ef.DoubleSide,"DstAlphaFactor",()=>ef.DstAlphaFactor,"DstColorFactor",()=>ef.DstColorFactor,"DynamicCopyUsage",()=>ef.DynamicCopyUsage,"DynamicDrawUsage",()=>ef.DynamicDrawUsage,"DynamicReadUsage",()=>ef.DynamicReadUsage,"EdgesGeometry",()=>ef.EdgesGeometry,"EllipseCurve",()=>ef.EllipseCurve,"EqualCompare",()=>ef.EqualCompare,"EqualDepth",()=>ef.EqualDepth,"EqualStencilFunc",()=>ef.EqualStencilFunc,"EquirectangularReflectionMapping",()=>ef.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>ef.EquirectangularRefractionMapping,"Euler",()=>ef.Euler,"EventDispatcher",()=>ef.EventDispatcher,"ExternalTexture",()=>ef.ExternalTexture,"ExtrudeGeometry",()=>ef.ExtrudeGeometry,"FileLoader",()=>ef.FileLoader,"Float16BufferAttribute",()=>ef.Float16BufferAttribute,"Float32BufferAttribute",()=>ef.Float32BufferAttribute,"FloatType",()=>ef.FloatType,"Fog",()=>ef.Fog,"FogExp2",()=>ef.FogExp2,"FramebufferTexture",()=>ef.FramebufferTexture,"FrontSide",()=>ef.FrontSide,"Frustum",()=>ef.Frustum,"FrustumArray",()=>ef.FrustumArray,"GLBufferAttribute",()=>ef.GLBufferAttribute,"GLSL1",()=>ef.GLSL1,"GLSL3",()=>ef.GLSL3,"GreaterCompare",()=>ef.GreaterCompare,"GreaterDepth",()=>ef.GreaterDepth,"GreaterEqualCompare",()=>ef.GreaterEqualCompare,"GreaterEqualDepth",()=>ef.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>ef.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>ef.GreaterStencilFunc,"GridHelper",()=>ef.GridHelper,"Group",()=>ef.Group,"HalfFloatType",()=>ef.HalfFloatType,"HemisphereLight",()=>ef.HemisphereLight,"HemisphereLightHelper",()=>ef.HemisphereLightHelper,"IcosahedronGeometry",()=>ef.IcosahedronGeometry,"ImageBitmapLoader",()=>ef.ImageBitmapLoader,"ImageLoader",()=>ef.ImageLoader,"ImageUtils",()=>ef.ImageUtils,"IncrementStencilOp",()=>ef.IncrementStencilOp,"IncrementWrapStencilOp",()=>ef.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>ef.InstancedBufferAttribute,"InstancedBufferGeometry",()=>ef.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>ef.InstancedInterleavedBuffer,"InstancedMesh",()=>ef.InstancedMesh,"Int16BufferAttribute",()=>ef.Int16BufferAttribute,"Int32BufferAttribute",()=>ef.Int32BufferAttribute,"Int8BufferAttribute",()=>ef.Int8BufferAttribute,"IntType",()=>ef.IntType,"InterleavedBuffer",()=>ef.InterleavedBuffer,"InterleavedBufferAttribute",()=>ef.InterleavedBufferAttribute,"Interpolant",()=>ef.Interpolant,"InterpolateDiscrete",()=>ef.InterpolateDiscrete,"InterpolateLinear",()=>ef.InterpolateLinear,"InterpolateSmooth",()=>ef.InterpolateSmooth,"InterpolationSamplingMode",()=>ef.InterpolationSamplingMode,"InterpolationSamplingType",()=>ef.InterpolationSamplingType,"InvertStencilOp",()=>ef.InvertStencilOp,"KeepStencilOp",()=>ef.KeepStencilOp,"KeyframeTrack",()=>ef.KeyframeTrack,"LOD",()=>ef.LOD,"LatheGeometry",()=>ef.LatheGeometry,"Layers",()=>ef.Layers,"LessCompare",()=>ef.LessCompare,"LessDepth",()=>ef.LessDepth,"LessEqualCompare",()=>ef.LessEqualCompare,"LessEqualDepth",()=>ef.LessEqualDepth,"LessEqualStencilFunc",()=>ef.LessEqualStencilFunc,"LessStencilFunc",()=>ef.LessStencilFunc,"Light",()=>ef.Light,"LightProbe",()=>ef.LightProbe,"Line",()=>ef.Line,"Line3",()=>ef.Line3,"LineBasicMaterial",()=>ef.LineBasicMaterial,"LineCurve",()=>ef.LineCurve,"LineCurve3",()=>ef.LineCurve3,"LineDashedMaterial",()=>ef.LineDashedMaterial,"LineLoop",()=>ef.LineLoop,"LineSegments",()=>ef.LineSegments,"LinearFilter",()=>ef.LinearFilter,"LinearInterpolant",()=>ef.LinearInterpolant,"LinearMipMapLinearFilter",()=>ef.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>ef.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>ef.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>ef.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>ef.LinearSRGBColorSpace,"LinearToneMapping",()=>ef.LinearToneMapping,"LinearTransfer",()=>ef.LinearTransfer,"Loader",()=>ef.Loader,"LoaderUtils",()=>ef.LoaderUtils,"LoadingManager",()=>ef.LoadingManager,"LoopOnce",()=>ef.LoopOnce,"LoopPingPong",()=>ef.LoopPingPong,"LoopRepeat",()=>ef.LoopRepeat,"MOUSE",()=>ef.MOUSE,"Material",()=>ef.Material,"MaterialLoader",()=>ef.MaterialLoader,"MathUtils",()=>ef.MathUtils,"Matrix2",()=>ef.Matrix2,"Matrix3",()=>ef.Matrix3,"Matrix4",()=>ef.Matrix4,"MaxEquation",()=>ef.MaxEquation,"Mesh",()=>ef.Mesh,"MeshBasicMaterial",()=>ef.MeshBasicMaterial,"MeshDepthMaterial",()=>ef.MeshDepthMaterial,"MeshDistanceMaterial",()=>ef.MeshDistanceMaterial,"MeshLambertMaterial",()=>ef.MeshLambertMaterial,"MeshMatcapMaterial",()=>ef.MeshMatcapMaterial,"MeshNormalMaterial",()=>ef.MeshNormalMaterial,"MeshPhongMaterial",()=>ef.MeshPhongMaterial,"MeshPhysicalMaterial",()=>ef.MeshPhysicalMaterial,"MeshStandardMaterial",()=>ef.MeshStandardMaterial,"MeshToonMaterial",()=>ef.MeshToonMaterial,"MinEquation",()=>ef.MinEquation,"MirroredRepeatWrapping",()=>ef.MirroredRepeatWrapping,"MixOperation",()=>ef.MixOperation,"MultiplyBlending",()=>ef.MultiplyBlending,"MultiplyOperation",()=>ef.MultiplyOperation,"NearestFilter",()=>ef.NearestFilter,"NearestMipMapLinearFilter",()=>ef.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>ef.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>ef.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>ef.NearestMipmapNearestFilter,"NeutralToneMapping",()=>ef.NeutralToneMapping,"NeverCompare",()=>ef.NeverCompare,"NeverDepth",()=>ef.NeverDepth,"NeverStencilFunc",()=>ef.NeverStencilFunc,"NoBlending",()=>ef.NoBlending,"NoColorSpace",()=>ef.NoColorSpace,"NoToneMapping",()=>ef.NoToneMapping,"NormalAnimationBlendMode",()=>ef.NormalAnimationBlendMode,"NormalBlending",()=>ef.NormalBlending,"NotEqualCompare",()=>ef.NotEqualCompare,"NotEqualDepth",()=>ef.NotEqualDepth,"NotEqualStencilFunc",()=>ef.NotEqualStencilFunc,"NumberKeyframeTrack",()=>ef.NumberKeyframeTrack,"Object3D",()=>ef.Object3D,"ObjectLoader",()=>ef.ObjectLoader,"ObjectSpaceNormalMap",()=>ef.ObjectSpaceNormalMap,"OctahedronGeometry",()=>ef.OctahedronGeometry,"OneFactor",()=>ef.OneFactor,"OneMinusConstantAlphaFactor",()=>ef.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>ef.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>ef.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>ef.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>ef.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>ef.OneMinusSrcColorFactor,"OrthographicCamera",()=>ef.OrthographicCamera,"PCFShadowMap",()=>ef.PCFShadowMap,"PCFSoftShadowMap",()=>ef.PCFSoftShadowMap,"PMREMGenerator",()=>ed.PMREMGenerator,"Path",()=>ef.Path,"PerspectiveCamera",()=>ef.PerspectiveCamera,"Plane",()=>ef.Plane,"PlaneGeometry",()=>ef.PlaneGeometry,"PlaneHelper",()=>ef.PlaneHelper,"PointLight",()=>ef.PointLight,"PointLightHelper",()=>ef.PointLightHelper,"Points",()=>ef.Points,"PointsMaterial",()=>ef.PointsMaterial,"PolarGridHelper",()=>ef.PolarGridHelper,"PolyhedronGeometry",()=>ef.PolyhedronGeometry,"PositionalAudio",()=>ef.PositionalAudio,"PropertyBinding",()=>ef.PropertyBinding,"PropertyMixer",()=>ef.PropertyMixer,"QuadraticBezierCurve",()=>ef.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>ef.QuadraticBezierCurve3,"Quaternion",()=>ef.Quaternion,"QuaternionKeyframeTrack",()=>ef.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>ef.QuaternionLinearInterpolant,"RED_GREEN_RGTC2_Format",()=>ef.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>ef.RED_RGTC1_Format,"REVISION",()=>ef.REVISION,"RGBADepthPacking",()=>ef.RGBADepthPacking,"RGBAFormat",()=>ef.RGBAFormat,"RGBAIntegerFormat",()=>ef.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>ef.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>ef.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>ef.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>ef.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>ef.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>ef.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>ef.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>ef.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>ef.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>ef.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>ef.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>ef.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>ef.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>ef.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>ef.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>ef.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>ef.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>ef.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>ef.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>ef.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>ef.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>ef.RGBDepthPacking,"RGBFormat",()=>ef.RGBFormat,"RGBIntegerFormat",()=>ef.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>ef.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>ef.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>ef.RGB_ETC1_Format,"RGB_ETC2_Format",()=>ef.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>ef.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>ef.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>ef.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>ef.RGDepthPacking,"RGFormat",()=>ef.RGFormat,"RGIntegerFormat",()=>ef.RGIntegerFormat,"RawShaderMaterial",()=>ef.RawShaderMaterial,"Ray",()=>ef.Ray,"Raycaster",()=>ef.Raycaster,"RectAreaLight",()=>ef.RectAreaLight,"RedFormat",()=>ef.RedFormat,"RedIntegerFormat",()=>ef.RedIntegerFormat,"ReinhardToneMapping",()=>ef.ReinhardToneMapping,"RenderTarget",()=>ef.RenderTarget,"RenderTarget3D",()=>ef.RenderTarget3D,"RepeatWrapping",()=>ef.RepeatWrapping,"ReplaceStencilOp",()=>ef.ReplaceStencilOp,"ReverseSubtractEquation",()=>ef.ReverseSubtractEquation,"RingGeometry",()=>ef.RingGeometry,"SIGNED_RED_GREEN_RGTC2_Format",()=>ef.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>ef.SIGNED_RED_RGTC1_Format,"SRGBColorSpace",()=>ef.SRGBColorSpace,"SRGBTransfer",()=>ef.SRGBTransfer,"Scene",()=>ef.Scene,"ShaderChunk",()=>ed.ShaderChunk,"ShaderLib",()=>ed.ShaderLib,"ShaderMaterial",()=>ef.ShaderMaterial,"ShadowMaterial",()=>ef.ShadowMaterial,"Shape",()=>ef.Shape,"ShapeGeometry",()=>ef.ShapeGeometry,"ShapePath",()=>ef.ShapePath,"ShapeUtils",()=>ef.ShapeUtils,"ShortType",()=>ef.ShortType,"Skeleton",()=>ef.Skeleton,"SkeletonHelper",()=>ef.SkeletonHelper,"SkinnedMesh",()=>ef.SkinnedMesh,"Source",()=>ef.Source,"Sphere",()=>ef.Sphere,"SphereGeometry",()=>ef.SphereGeometry,"Spherical",()=>ef.Spherical,"SphericalHarmonics3",()=>ef.SphericalHarmonics3,"SplineCurve",()=>ef.SplineCurve,"SpotLight",()=>ef.SpotLight,"SpotLightHelper",()=>ef.SpotLightHelper,"Sprite",()=>ef.Sprite,"SpriteMaterial",()=>ef.SpriteMaterial,"SrcAlphaFactor",()=>ef.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>ef.SrcAlphaSaturateFactor,"SrcColorFactor",()=>ef.SrcColorFactor,"StaticCopyUsage",()=>ef.StaticCopyUsage,"StaticDrawUsage",()=>ef.StaticDrawUsage,"StaticReadUsage",()=>ef.StaticReadUsage,"StereoCamera",()=>ef.StereoCamera,"StreamCopyUsage",()=>ef.StreamCopyUsage,"StreamDrawUsage",()=>ef.StreamDrawUsage,"StreamReadUsage",()=>ef.StreamReadUsage,"StringKeyframeTrack",()=>ef.StringKeyframeTrack,"SubtractEquation",()=>ef.SubtractEquation,"SubtractiveBlending",()=>ef.SubtractiveBlending,"TOUCH",()=>ef.TOUCH,"TangentSpaceNormalMap",()=>ef.TangentSpaceNormalMap,"TetrahedronGeometry",()=>ef.TetrahedronGeometry,"Texture",()=>ef.Texture,"TextureLoader",()=>ef.TextureLoader,"TextureUtils",()=>ef.TextureUtils,"Timer",()=>ef.Timer,"TimestampQuery",()=>ef.TimestampQuery,"TorusGeometry",()=>ef.TorusGeometry,"TorusKnotGeometry",()=>ef.TorusKnotGeometry,"Triangle",()=>ef.Triangle,"TriangleFanDrawMode",()=>ef.TriangleFanDrawMode,"TriangleStripDrawMode",()=>ef.TriangleStripDrawMode,"TrianglesDrawMode",()=>ef.TrianglesDrawMode,"TubeGeometry",()=>ef.TubeGeometry,"UVMapping",()=>ef.UVMapping,"Uint16BufferAttribute",()=>ef.Uint16BufferAttribute,"Uint32BufferAttribute",()=>ef.Uint32BufferAttribute,"Uint8BufferAttribute",()=>ef.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>ef.Uint8ClampedBufferAttribute,"Uniform",()=>ef.Uniform,"UniformsGroup",()=>ef.UniformsGroup,"UniformsLib",()=>ed.UniformsLib,"UniformsUtils",()=>ef.UniformsUtils,"UnsignedByteType",()=>ef.UnsignedByteType,"UnsignedInt101111Type",()=>ef.UnsignedInt101111Type,"UnsignedInt248Type",()=>ef.UnsignedInt248Type,"UnsignedInt5999Type",()=>ef.UnsignedInt5999Type,"UnsignedIntType",()=>ef.UnsignedIntType,"UnsignedShort4444Type",()=>ef.UnsignedShort4444Type,"UnsignedShort5551Type",()=>ef.UnsignedShort5551Type,"UnsignedShortType",()=>ef.UnsignedShortType,"VSMShadowMap",()=>ef.VSMShadowMap,"Vector2",()=>ef.Vector2,"Vector3",()=>ef.Vector3,"Vector4",()=>ef.Vector4,"VectorKeyframeTrack",()=>ef.VectorKeyframeTrack,"VideoFrameTexture",()=>ef.VideoFrameTexture,"VideoTexture",()=>ef.VideoTexture,"WebGL3DRenderTarget",()=>ef.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>ef.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>ef.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>ef.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>ef.WebGLRenderTarget,"WebGLRenderer",()=>ed.WebGLRenderer,"WebGLUtils",()=>ed.WebGLUtils,"WebGPUCoordinateSystem",()=>ef.WebGPUCoordinateSystem,"WebXRController",()=>ef.WebXRController,"WireframeGeometry",()=>ef.WireframeGeometry,"WrapAroundEnding",()=>ef.WrapAroundEnding,"ZeroCurvatureEnding",()=>ef.ZeroCurvatureEnding,"ZeroFactor",()=>ef.ZeroFactor,"ZeroSlopeEnding",()=>ef.ZeroSlopeEnding,"ZeroStencilOp",()=>ef.ZeroStencilOp,"createCanvasElement",()=>ef.createCanvasElement],32009);var ed=e.i(8560),ef=e.i(90072),eh=e.i(32009);function em(e,t){let r;return function(){for(var n=arguments.length,i=Array(n),a=0;ae(...i),t)}}let ep=["x","y","top","bottom","left","right","width","height"];var eA=e.i(46791);function eg(e){let{ref:t,children:r,fallback:n,resize:i,style:a,gl:o,events:s=ec.f,eventSource:l,eventPrefix:u,shadows:c,linear:d,flat:f,legacy:h,orthographic:m,frameloop:p,dpr:A,performance:g,raycaster:B,camera:C,scene:y,onPointerMissed:b,onCreated:M,...E}=e;el.useMemo(()=>(0,ec.e)(eh),[]);let x=(0,ec.u)(),[F,S]=function(){var e,t,r;let{debounce:n,scroll:i,polyfill:a,offsetSize:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{debounce:0,scroll:!1,offsetSize:!1},s=a||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[l,u]=(0,el.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=(0,el.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l,orientationHandler:null}),d=n?"number"==typeof n?n:n.scroll:null,f=n?"number"==typeof n?n:n.resize:null,h=(0,el.useRef)(!1);(0,el.useEffect)(()=>(h.current=!0,()=>void(h.current=!1)));let[m,p,A]=(0,el.useMemo)(()=>{let e=()=>{let e,t;if(!c.current.element)return;let{left:r,top:n,width:i,height:a,bottom:s,right:l,x:d,y:f}=c.current.element.getBoundingClientRect(),m={left:r,top:n,width:i,height:a,bottom:s,right:l,x:d,y:f};c.current.element instanceof HTMLElement&&o&&(m.height=c.current.element.offsetHeight,m.width=c.current.element.offsetWidth),Object.freeze(m),h.current&&(e=c.current.lastBounds,t=m,!ep.every(r=>e[r]===t[r]))&&u(c.current.lastBounds=m)};return[e,f?em(e,f):e,d?em(e,d):e]},[u,o,d,f]);function g(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",A,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function B(){c.current.element&&(c.current.resizeObserver=new s(A),c.current.resizeObserver.observe(c.current.element),i&&c.current.scrollContainers&&c.current.scrollContainers.forEach(e=>e.addEventListener("scroll",A,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{A()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}return e=A,t=!!i,(0,el.useEffect)(()=>{if(t)return window.addEventListener("scroll",e,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",e,!0)},[e,t]),r=p,(0,el.useEffect)(()=>(window.addEventListener("resize",r),()=>void window.removeEventListener("resize",r)),[r]),(0,el.useEffect)(()=>{g(),B()},[i,A,p]),(0,el.useEffect)(()=>g,[]),[e=>{e&&e!==c.current.element&&(g(),c.current.element=e,c.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),B())},l,m]}({scroll:!0,debounce:{scroll:50,resize:0},...i}),T=el.useRef(null),w=el.useRef(null);el.useImperativeHandle(t,()=>T.current);let R=(0,ec.a)(b),[I,D]=el.useState(!1),[G,L]=el.useState(!1);if(I)throw I;if(G)throw G;let P=el.useRef(null);(0,ec.b)(()=>{let e=T.current;S.width>0&&S.height>0&&e&&(P.current||(P.current=(0,ec.c)(e)),async function(){await P.current.configure({gl:o,scene:y,events:s,shadows:c,linear:d,flat:f,legacy:h,orthographic:m,frameloop:p,dpr:A,performance:g,raycaster:B,camera:C,size:S,onPointerMissed:function(){for(var e=arguments.length,t=Array(e),r=0;r{null==e.events.connect||e.events.connect(l?(0,ec.i)(l)?l.current:l:w.current),u&&e.setEvents({compute:(e,t)=>{let r=e[u+"X"],n=e[u+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(n/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==M||M(e)}}),P.current.render((0,es.jsx)(x,{children:(0,es.jsx)(ec.E,{set:L,children:(0,es.jsx)(el.Suspense,{fallback:(0,es.jsx)(ec.B,{set:D}),children:null!=r?r:null})})}))}())}),el.useEffect(()=>{let e=T.current;if(e)return()=>(0,ec.d)(e)},[]);let H=l?"none":"auto";return(0,es.jsx)("div",{ref:w,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:H,...a},...E,children:(0,es.jsx)("div",{ref:F,style:{width:"100%",height:"100%"},children:(0,es.jsx)("canvas",{ref:T,style:{display:"block"},children:n})})})}function ev(e){return(0,es.jsx)(eA.FiberProvider,{children:(0,es.jsx)(eg,{...e})})}function eB(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function eC(e,t){var r=eB(e,t,"get");return r.get?r.get.call(e):r.value}function ey(e,t){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object")}function eb(e,t,r){ey(e,t),t.set(e,r)}function eM(e,t,r){var n=eB(e,t,"set");if(n.set)n.set.call(e,r);else{if(!n.writable)throw TypeError("attempted to set read only private field");n.value=r}return r}function eE(e,t,r){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return r}function ex(e,t){ey(e,t),t.add(e)}e.i(39695),e.i(98133),e.i(95087);var eF=class{subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}};e.i(47167);var eS={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},eT=new(r=new WeakMap,n=new WeakMap,class{setTimeoutProvider(e){eM(this,r,e)}setTimeout(e,t){return eC(this,r).setTimeout(e,t)}clearTimeout(e){eC(this,r).clearTimeout(e)}setInterval(e,t){return eC(this,r).setInterval(e,t)}clearInterval(e){eC(this,r).clearInterval(e)}constructor(){eb(this,r,{writable:!0,value:eS}),eb(this,n,{writable:!0,value:!1})}}),ew="undefined"==typeof window||"Deno"in globalThis;function eR(){}function eI(e){return"number"==typeof e&&e>=0&&e!==1/0}function eD(e,t){return Math.max(e+(t||0)-Date.now(),0)}function eG(e,t){return"function"==typeof e?e(t):e}function eL(e,t){return"function"==typeof e?e(t):e}function eP(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(n){if(t.queryHash!==eO(o,t.options))return!1}else if(!e_(t.queryKey,o))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof s||t.isStale()===s)&&(!i||i===t.state.fetchStatus)&&(!a||!!a(t))}function eH(e,t){let{exact:r,status:n,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(ek(t.options.mutationKey)!==ek(a))return!1}else if(!e_(t.options.mutationKey,a))return!1}return(!n||t.state.status===n)&&(!i||!!i(t))}function eO(e,t){return((null==t?void 0:t.queryKeyHashFn)||ek)(e)}function ek(e){return JSON.stringify(e,(e,t)=>eN(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function e_(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>e_(e[r],t[r]))}var eU=Object.prototype.hasOwnProperty;function ej(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function eJ(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function eN(e){if(!eK(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!eK(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function eK(e){return"[object Object]"===Object.prototype.toString.call(e)}function eQ(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r){if(t===r)return t;let n=eJ(t)&&eJ(r);if(!n&&!(eN(t)&&eN(r)))return r;let i=(n?t:Object.keys(t)).length,a=n?r:Object.keys(r),o=a.length,s=n?Array(o):{},l=0;for(let u=0;u2&&void 0!==arguments[2]?arguments[2]:0,n=[...e,t];return r&&n.length>r?n.slice(1):n}function eV(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var eX=Symbol();function eq(e,t){return!e.queryFn&&(null==t?void 0:t.initialPromise)?()=>t.initialPromise:e.queryFn&&e.queryFn!==eX?e.queryFn:()=>Promise.reject(Error("Missing queryFn: '".concat(e.queryHash,"'")))}var eY=new(i=new WeakMap,a=new WeakMap,o=new WeakMap,class extends eF{onSubscribe(){eC(this,a)||this.setEventListener(eC(this,o))}onUnsubscribe(){var e;this.hasListeners()||(null==(e=eC(this,a))||e.call(this),eM(this,a,void 0))}setEventListener(e){var t;eM(this,o,e),null==(t=eC(this,a))||t.call(this),eM(this,a,e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()}))}setFocused(e){eC(this,i)!==e&&(eM(this,i,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return"boolean"==typeof eC(this,i)?eC(this,i):(null==(e=globalThis.document)?void 0:e.visibilityState)!=="hidden"}constructor(){super(),eb(this,i,{writable:!0,value:void 0}),eb(this,a,{writable:!0,value:void 0}),eb(this,o,{writable:!0,value:void 0}),eM(this,o,e=>{if(!ew&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}}),eZ=function(e){setTimeout(e,0)},ez=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=eZ,a=n=>{t?e.push(n):i(()=>{r(n)})};return{batch:a=>{let o;t++;try{o=a()}finally{--t||(()=>{let t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return o},batchCalls:e=>function(){for(var t=arguments.length,r=Array(t),n=0;n{e(...r)})},schedule:a,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}(),e$=new(s=new WeakMap,l=new WeakMap,u=new WeakMap,class extends eF{onSubscribe(){eC(this,l)||this.setEventListener(eC(this,u))}onUnsubscribe(){var e;this.hasListeners()||(null==(e=eC(this,l))||e.call(this),eM(this,l,void 0))}setEventListener(e){var t;eM(this,u,e),null==(t=eC(this,l))||t.call(this),eM(this,l,e(this.setOnline.bind(this)))}setOnline(e){eC(this,s)!==e&&(eM(this,s,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return eC(this,s)}constructor(){super(),eb(this,s,{writable:!0,value:!0}),eb(this,l,{writable:!0,value:void 0}),eb(this,u,{writable:!0,value:void 0}),eM(this,u,e=>{if(!ew&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}});function e0(){let e,t,r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function e1(e){return Math.min(1e3*2**e,3e4)}function e9(e){return(null!=e?e:"online")!=="online"||e$.isOnline()}var e2=class extends Error{constructor(e){super("CancelledError"),this.revert=null==e?void 0:e.revert,this.silent=null==e?void 0:e.silent}};function e8(e){let t,r=!1,n=0,i=e0(),a=()=>eY.isFocused()&&("always"===e.networkMode||e$.isOnline())&&e.canRun(),o=()=>e9(e.networkMode)&&e.canRun(),s=e=>{"pending"===i.status&&(null==t||t(),i.resolve(e))},l=e=>{"pending"===i.status&&(null==t||t(),i.reject(e))},u=()=>new Promise(r=>{var n;t=e=>{("pending"!==i.status||a())&&r(e)},null==(n=e.onPause)||n.call(e)}).then(()=>{if(t=void 0,"pending"===i.status){var r;null==(r=e.onContinue)||r.call(e)}}),c=()=>{let t;if("pending"!==i.status)return;let o=0===n?e.initialPromise:void 0;try{t=null!=o?o:e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(s).catch(t=>{var o,s,d;if("pending"!==i.status)return;let f=null!=(s=e.retry)?s:3*!ew,h=null!=(d=e.retryDelay)?d:e1,m="function"==typeof h?h(n,t):h,p=!0===f||"number"==typeof f&&n{eT.setTimeout(e,m)}).then(()=>a()?void 0:u()).then(()=>{r?l(t):c()})})};return{promise:i,status:()=>i.status,cancel:t=>{if("pending"===i.status){var r;let n=new e2(t);l(n),null==(r=e.onCancel)||r.call(e,n)}},continue:()=>(null==t||t(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:o,start:()=>(o()?c():u().then(c),i)}}var e3=(c=new WeakMap,class{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),eI(this.gcTime)&&eM(this,c,eT.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,null!=e?e:ew?1/0:3e5)}clearGcTimeout(){eC(this,c)&&(eT.clearTimeout(eC(this,c)),eM(this,c,void 0))}constructor(){eb(this,c,{writable:!0,value:void 0})}}),e5=(d=new WeakMap,f=new WeakMap,h=new WeakMap,m=new WeakMap,p=new WeakMap,A=new WeakMap,g=new WeakMap,B=new WeakSet,class extends e3{get meta(){return this.options.meta}get promise(){var e;return null==(e=eC(this,p))?void 0:e.promise}setOptions(e){if(this.options={...eC(this,A),...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=e7(this.options);void 0!==e.data&&(this.setState(e4(e.data,e.dataUpdatedAt)),eM(this,d,e))}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||eC(this,h).remove(this)}setData(e,t){let r=eQ(this.state.data,e,this.options);return eE(this,B,te).call(this,{data:r,type:"success",dataUpdatedAt:null==t?void 0:t.updatedAt,manual:null==t?void 0:t.manual}),r}setState(e,t){eE(this,B,te).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var t,r;let n=null==(t=eC(this,p))?void 0:t.promise;return null==(r=eC(this,p))||r.cancel(e),n?n.then(eR).catch(eR):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(eC(this,d))}isActive(){return this.observers.some(e=>!1!==eL(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===eX||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===eG(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!eD(this.state.dataUpdatedAt,e))}onFocus(){var e;let t=this.observers.find(e=>e.shouldFetchOnWindowFocus());null==t||t.refetch({cancelRefetch:!1}),null==(e=eC(this,p))||e.continue()}onOnline(){var e;let t=this.observers.find(e=>e.shouldFetchOnReconnect());null==t||t.refetch({cancelRefetch:!1}),null==(e=eC(this,p))||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),eC(this,h).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(eC(this,p)&&(eC(this,g)?eC(this,p).cancel({revert:!0}):eC(this,p).cancelRetry()),this.scheduleGc()),eC(this,h).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||eE(this,B,te).call(this,{type:"invalidate"})}async fetch(e,t){var r,n,i,a,o,s,l,u,c,d,A,C;if("idle"!==this.state.fetchStatus&&(null==(r=eC(this,p))?void 0:r.status())!=="rejected"){if(void 0!==this.state.data&&(null==t?void 0:t.cancelRefetch))this.cancel({silent:!0});else if(eC(this,p))return eC(this,p).continueRetry(),eC(this,p).promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let y=new AbortController,b=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(eM(this,g,!0),y.signal)})},M=()=>{let e=eq(this.options,t),r=(()=>{let e={client:eC(this,m),queryKey:this.queryKey,meta:this.meta};return b(e),e})();return(eM(this,g,!1),this.options.persister)?this.options.persister(e,r,this):e(r)},E=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:eC(this,m),state:this.state,fetchFn:M};return b(e),e})();null==(n=this.options.behavior)||n.onFetch(E,this),eM(this,f,this.state),("idle"===this.state.fetchStatus||this.state.fetchMeta!==(null==(i=E.fetchOptions)?void 0:i.meta))&&eE(this,B,te).call(this,{type:"fetch",meta:null==(a=E.fetchOptions)?void 0:a.meta}),eM(this,p,e8({initialPromise:null==t?void 0:t.initialPromise,fn:E.fetchFn,onCancel:e=>{e instanceof e2&&e.revert&&this.setState({...eC(this,f),fetchStatus:"idle"}),y.abort()},onFail:(e,t)=>{eE(this,B,te).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{eE(this,B,te).call(this,{type:"pause"})},onContinue:()=>{eE(this,B,te).call(this,{type:"continue"})},retry:E.options.retry,retryDelay:E.options.retryDelay,networkMode:E.options.networkMode,canRun:()=>!0}));try{let e=await eC(this,p).start();if(void 0===e)throw Error("".concat(this.queryHash," data is undefined"));return this.setData(e),null==(o=(s=eC(this,h).config).onSuccess)||o.call(s,e,this),null==(l=(u=eC(this,h).config).onSettled)||l.call(u,e,this.state.error,this),e}catch(e){if(e instanceof e2){if(e.silent)return eC(this,p).promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw eE(this,B,te).call(this,{type:"error",error:e}),null==(c=(d=eC(this,h).config).onError)||c.call(d,e,this),null==(A=(C=eC(this,h).config).onSettled)||A.call(C,this.state.data,e,this),e}finally{this.scheduleGc()}}constructor(e){var t;super(),ex(this,B),eb(this,d,{writable:!0,value:void 0}),eb(this,f,{writable:!0,value:void 0}),eb(this,h,{writable:!0,value:void 0}),eb(this,m,{writable:!0,value:void 0}),eb(this,p,{writable:!0,value:void 0}),eb(this,A,{writable:!0,value:void 0}),eb(this,g,{writable:!0,value:void 0}),eM(this,g,!1),eM(this,A,e.defaultOptions),this.setOptions(e.options),this.observers=[],eM(this,m,e.client),eM(this,h,eC(this,m).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,eM(this,d,e7(this.options)),this.state=null!=(t=e.state)?t:eC(this,d),this.scheduleGc()}});function e6(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:e9(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function e4(e,t){return{data:e,dataUpdatedAt:null!=t?t:Date.now(),error:null,isInvalidated:!1,status:"success"}}function e7(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?null!=n?n:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}function te(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":var r;return{...t,...e6(t.data,this.options),fetchMeta:null!=(r=e.meta)?r:null};case"success":let n={...t,...e4(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return eM(this,f,e.manual?n:void 0),n;case"error":let i=e.error;return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),ez.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),eC(this,h).notify({query:this,type:"updated",action:e})})}var tt=(C=new WeakMap,y=new WeakMap,b=new WeakMap,M=new WeakMap,E=new WeakMap,x=new WeakMap,F=new WeakMap,S=new WeakMap,T=new WeakMap,w=new WeakMap,R=new WeakMap,I=new WeakMap,D=new WeakMap,G=new WeakMap,L=new WeakMap,P=new WeakSet,H=new WeakSet,O=new WeakSet,k=new WeakSet,_=new WeakSet,U=new WeakSet,j=new WeakSet,J=new WeakSet,N=new WeakSet,class extends eF{bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(eC(this,y).addObserver(this),tr(eC(this,y),this.options)?eE(this,P,to).call(this):this.updateResult(),eE(this,_,tc).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return tn(eC(this,y),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return tn(eC(this,y),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,eE(this,U,td).call(this),eE(this,j,tf).call(this),eC(this,y).removeObserver(this)}setOptions(e){let t=this.options,r=eC(this,y);if(this.options=eC(this,C).defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof eL(this.options.enabled,eC(this,y)))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");eE(this,J,th).call(this),eC(this,y).setOptions(this.options),t._defaulted&&!ej(this.options,t)&&eC(this,C).getQueryCache().notify({type:"observerOptionsUpdated",query:eC(this,y),observer:this});let n=this.hasListeners();n&&ti(eC(this,y),r,this.options,t)&&eE(this,P,to).call(this),this.updateResult(),n&&(eC(this,y)!==r||eL(this.options.enabled,eC(this,y))!==eL(t.enabled,eC(this,y))||eG(this.options.staleTime,eC(this,y))!==eG(t.staleTime,eC(this,y)))&&eE(this,H,ts).call(this);let i=eE(this,O,tl).call(this);n&&(eC(this,y)!==r||eL(this.options.enabled,eC(this,y))!==eL(t.enabled,eC(this,y))||i!==eC(this,G))&&eE(this,k,tu).call(this,i)}getOptimisticResult(e){var t,r;let n=eC(this,C).getQueryCache().build(eC(this,C),e),i=this.createResult(n,e);return t=this,r=i,ej(t.getCurrentResult(),r)||(eM(this,M,i),eM(this,x,this.options),eM(this,E,eC(this,y).state)),i}getCurrentResult(){return eC(this,M)}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),null==t||t(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==eC(this,F).status||eC(this,F).reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){eC(this,L).add(e)}getCurrentQuery(){return eC(this,y)}refetch(){let{...e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.fetch({...e})}fetchOptimistic(e){let t=eC(this,C).defaultQueryOptions(e),r=eC(this,C).getQueryCache().build(eC(this,C),t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){var t;return eE(this,P,to).call(this,{...e,cancelRefetch:null==(t=e.cancelRefetch)||t}).then(()=>(this.updateResult(),eC(this,M)))}createResult(e,t){let r,n=eC(this,y),i=this.options,a=eC(this,M),o=eC(this,E),s=eC(this,x),l=e!==n?e.state:eC(this,b),{state:u}=e,c={...u},d=!1;if(t._optimisticResults){let r=this.hasListeners(),a=!r&&tr(e,t),o=r&&ti(e,n,t,i);(a||o)&&(c={...c,...e6(u.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:f,errorUpdatedAt:h,status:m}=c;r=c.data;let p=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===m){let e;if((null==a?void 0:a.isPlaceholderData)&&t.placeholderData===(null==s?void 0:s.placeholderData))e=a.data,p=!0;else{var A;e="function"==typeof t.placeholderData?t.placeholderData(null==(A=eC(this,R))?void 0:A.state.data,eC(this,R)):t.placeholderData}void 0!==e&&(m="success",r=eQ(null==a?void 0:a.data,e,t),d=!0)}if(t.select&&void 0!==r&&!p)if(a&&r===(null==o?void 0:o.data)&&t.select===eC(this,T))r=eC(this,w);else try{eM(this,T,t.select),r=t.select(r),r=eQ(null==a?void 0:a.data,r,t),eM(this,w,r),eM(this,S,null)}catch(e){eM(this,S,e)}eC(this,S)&&(f=eC(this,S),r=eC(this,w),h=Date.now(),m="error");let g="fetching"===c.fetchStatus,B="pending"===m,C="error"===m,I=B&&g,D=void 0!==r,G={status:m,fetchStatus:c.fetchStatus,isPending:B,isSuccess:"success"===m,isError:C,isInitialLoading:I,isLoading:I,data:r,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:g,isRefetching:g&&!B,isLoadingError:C&&!D,isPaused:"paused"===c.fetchStatus,isPlaceholderData:d,isRefetchError:C&&D,isStale:ta(e,t),refetch:this.refetch,promise:eC(this,F),isEnabled:!1!==eL(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=e=>{"error"===G.status?e.reject(G.error):void 0!==G.data&&e.resolve(G.data)},r=()=>{t(eM(this,F,G.promise=e0()))},i=eC(this,F);switch(i.status){case"pending":e.queryHash===n.queryHash&&t(i);break;case"fulfilled":("error"===G.status||G.data!==i.value)&&r();break;case"rejected":("error"!==G.status||G.error!==i.reason)&&r()}}return G}updateResult(){let e=eC(this,M),t=this.createResult(eC(this,y),this.options);if(eM(this,E,eC(this,y).state),eM(this,x,this.options),void 0!==eC(this,E).data&&eM(this,R,eC(this,y)),ej(t,e))return;eM(this,M,t);let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!eC(this,L).size)return!0;let n=new Set(null!=r?r:eC(this,L));return this.options.throwOnError&&n.add("error"),Object.keys(eC(this,M)).some(t=>eC(this,M)[t]!==e[t]&&n.has(t))};eE(this,N,tm).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&eE(this,_,tc).call(this)}constructor(e,t){super(),ex(this,P),ex(this,H),ex(this,O),ex(this,k),ex(this,_),ex(this,U),ex(this,j),ex(this,J),ex(this,N),eb(this,C,{writable:!0,value:void 0}),eb(this,y,{writable:!0,value:void 0}),eb(this,b,{writable:!0,value:void 0}),eb(this,M,{writable:!0,value:void 0}),eb(this,E,{writable:!0,value:void 0}),eb(this,x,{writable:!0,value:void 0}),eb(this,F,{writable:!0,value:void 0}),eb(this,S,{writable:!0,value:void 0}),eb(this,T,{writable:!0,value:void 0}),eb(this,w,{writable:!0,value:void 0}),eb(this,R,{writable:!0,value:void 0}),eb(this,I,{writable:!0,value:void 0}),eb(this,D,{writable:!0,value:void 0}),eb(this,G,{writable:!0,value:void 0}),eb(this,L,{writable:!0,value:new Set}),this.options=t,eM(this,C,e),eM(this,S,null),eM(this,F,e0()),this.bindMethods(),this.setOptions(t)}});function tr(e,t){return!1!==eL(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&tn(e,t,t.refetchOnMount)}function tn(e,t,r){if(!1!==eL(t.enabled,e)&&"static"!==eG(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&ta(e,t)}return!1}function ti(e,t,r,n){return(e!==t||!1===eL(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&ta(e,r)}function ta(e,t){return!1!==eL(t.enabled,e)&&e.isStaleByTime(eG(t.staleTime,e))}function to(e){eE(this,J,th).call(this);let t=eC(this,y).fetch(this.options,e);return(null==e?void 0:e.throwOnError)||(t=t.catch(eR)),t}function ts(){eE(this,U,td).call(this);let e=eG(this.options.staleTime,eC(this,y));if(ew||eC(this,M).isStale||!eI(e))return;let t=eD(eC(this,M).dataUpdatedAt,e);eM(this,I,eT.setTimeout(()=>{eC(this,M).isStale||this.updateResult()},t+1))}function tl(){var e;return null!=(e="function"==typeof this.options.refetchInterval?this.options.refetchInterval(eC(this,y)):this.options.refetchInterval)&&e}function tu(e){eE(this,j,tf).call(this),eM(this,G,e),!ew&&!1!==eL(this.options.enabled,eC(this,y))&&eI(eC(this,G))&&0!==eC(this,G)&&eM(this,D,eT.setInterval(()=>{(this.options.refetchIntervalInBackground||eY.isFocused())&&eE(this,P,to).call(this)},eC(this,G)))}function tc(){eE(this,H,ts).call(this),eE(this,k,tu).call(this,eE(this,O,tl).call(this))}function td(){eC(this,I)&&(eT.clearTimeout(eC(this,I)),eM(this,I,void 0))}function tf(){eC(this,D)&&(eT.clearInterval(eC(this,D)),eM(this,D,void 0))}function th(){let e=eC(this,C).getQueryCache().build(eC(this,C),this.options);if(e===eC(this,y))return;let t=eC(this,y);eM(this,y,e),eM(this,b,e.state),this.hasListeners()&&(null==t||t.removeObserver(this),e.addObserver(this))}function tm(e){ez.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(eC(this,M))}),eC(this,C).getQueryCache().notify({query:eC(this,y),type:"observerResultsUpdated"})})}var tp=el.createContext(void 0),tA=e=>{let{client:t,children:r}=e;return el.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,es.jsx)(tp.Provider,{value:t,children:r})},tg=el.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),tv=el.createContext(!1);tv.Provider;var tB=(e,t)=>void 0===t.state.data,tC=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function ty(e,t,r){var n,i,a,o,s;let l=el.useContext(tv),u=el.useContext(tg),c=(e=>{let t=el.useContext(tp);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t})(r),d=c.defaultQueryOptions(e);if(null==(i=c.getDefaultOptions().queries)||null==(n=i._experimental_beforeQuery)||n.call(i,d),d._optimisticResults=l?"isRestoring":"optimistic",d.suspense){let e=e=>"static"===e?e:Math.max(null!=e?e:1e3,1e3),t=d.staleTime;d.staleTime="function"==typeof t?function(){for(var r=arguments.length,n=Array(r),i=0;i{u.clearReset()},[u]);let f=!c.getQueryCache().get(d.queryHash),[h]=el.useState(()=>new t(c,d)),m=h.getOptimisticResult(d),p=!l&&!1!==e.subscribed;if(el.useSyncExternalStore(el.useCallback(e=>{let t=p?h.subscribe(ez.batchCalls(e)):eR;return h.updateResult(),t},[h,p]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),el.useEffect(()=>{h.setOptions(d)},[d,h]),(null==d?void 0:d.suspense)&&m.isPending)throw tC(d,h,u);if((e=>{var t,r;let{result:n,errorResetBoundary:i,throwOnError:a,query:o,suspense:s}=e;return n.isError&&!i.isReset()&&!n.isFetching&&o&&(s&&void 0===n.data||(t=a,r=[n.error,o],"function"==typeof t?t(...r):!!t))})({result:m,errorResetBoundary:u,throwOnError:d.throwOnError,query:c.getQueryCache().get(d.queryHash),suspense:d.suspense}))throw m.error;if(null==(o=c.getDefaultOptions().queries)||null==(a=o._experimental_afterQuery)||a.call(o,d,m),d.experimental_prefetchInRender&&!ew&&m.isLoading&&m.isFetching&&!l){let e=f?tC(d,h,u):null==(s=c.getQueryCache().get(d.queryHash))?void 0:s.promise;null==e||e.catch(eR).finally(()=>{h.updateResult()})}return d.notifyOnChangeProps?m:h.trackResult(m)}var tb=e.i(54970),tM=e.i(12979),tE=e.i(5230),tx=e.i(16096),tF=e.i(62395),tS=e.i(75567),tT=e.i(47071);let tw={directional:4,ambient:1.5},tR={directional:3,ambient:1},tI={directional:1,ambient:1.5};var tD=e.i(79123),tG=e.i(47021),tL=e.i(48066);let tP={0:32,1:32,2:32,3:32,4:32,5:32};function tH(e){let{displacementMap:t,visibilityMask:r,textureNames:n,alphaTextures:i,detailTextureName:a,lightmap:o}=e,{debugMode:s}=(0,tD.useDebug)(),l=(0,tT.useTexture)(n.map(e=>(0,tM.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,tS.setupColor)(e))}),u=a?(0,tM.textureToUrl)(a):null,c=(0,tT.useTexture)(null!=u?u:tM.FALLBACK_TEXTURE_URL,e=>{(0,tS.setupColor)(e)}),d=(0,el.useCallback)(e=>{!function(e){let{shader:t,baseTextures:r,alphaTextures:n,visibilityMask:i,tiling:a,debugMode:o=!1,detailTexture:s=null,lightmap:l=null}=e,u=r.length;if(t.uniforms.terrainDirectionalFactor={value:tw.directional},t.uniforms.terrainAmbientFactor={value:tw.ambient},r.forEach((e,r)=>{t.uniforms["albedo".concat(r)]={value:e}}),n.forEach((e,r)=>{r>0&&(t.uniforms["mask".concat(r)]={value:e})}),i&&(t.uniforms.visibilityMask={value:i}),r.forEach((e,r)=>{var n;t.uniforms["tiling".concat(r)]={value:null!=(n=a[r])?n:32}}),t.uniforms.debugMode={value:+!!o},l&&(t.uniforms.terrainLightmap={value:l}),s&&(t.uniforms.detailTexture={value:s},t.uniforms.detailTiling={value:64},t.uniforms.detailFadeDistance={value:150},t.vertexShader=t.vertexShader.replace("#include ","#include \nvarying vec3 vTerrainWorldPos;"),t.vertexShader=t.vertexShader.replace("#include ","#include \nvTerrainWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;")),t.fragmentShader="\nuniform float terrainDirectionalFactor;\nuniform float terrainAmbientFactor;\nuniform sampler2D albedo0;\nuniform sampler2D albedo1;\nuniform sampler2D albedo2;\nuniform sampler2D albedo3;\nuniform sampler2D albedo4;\nuniform sampler2D albedo5;\nuniform sampler2D mask1;\nuniform sampler2D mask2;\nuniform sampler2D mask3;\nuniform sampler2D mask4;\nuniform sampler2D mask5;\nuniform float tiling0;\nuniform float tiling1;\nuniform float tiling2;\nuniform float tiling3;\nuniform float tiling4;\nuniform float tiling5;\nuniform float debugMode;\n".concat(i?"uniform sampler2D visibilityMask;":"","\n").concat(l?"uniform sampler2D terrainLightmap;":"","\n").concat(s?"uniform sampler2D detailTexture;\nuniform float detailTiling;\nuniform float detailFadeDistance;\nvarying vec3 vTerrainWorldPos;":"","\n\n// Wireframe edge detection for debug mode\nfloat getWireframe(vec2 uv, float gridSize, float lineWidth) {\n vec2 gridUv = uv * gridSize;\n vec2 grid = abs(fract(gridUv - 0.5) - 0.5);\n vec2 deriv = fwidth(gridUv);\n vec2 edge = smoothstep(vec2(0.0), deriv * lineWidth, grid);\n return 1.0 - min(edge.x, edge.y);\n}\n")+t.fragmentShader,i){let e="#include ";t.fragmentShader=t.fragmentShader.replace(e,"".concat(e,"\n // Early discard for invisible areas (before fog/lighting)\n float visibility = texture2D(visibilityMask, vMapUv).r;\n if (visibility < 0.5) {\n discard;\n }\n "))}t.fragmentShader=t.fragmentShader.replace("#include ","\n // Sample base albedo layers (sRGB textures auto-decoded to linear)\n vec2 baseUv = vMapUv;\n vec3 c0 = texture2D(albedo0, baseUv * vec2(tiling0)).rgb;\n ".concat(u>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":"","\n ").concat(u>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":"","\n ").concat(u>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":"","\n ").concat(u>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":"","\n ").concat(u>5?"vec3 c5 = texture2D(albedo5, baseUv * vec2(tiling5)).rgb;":"","\n\n // Sample linear masks (use R channel)\n // Add +0.5 texel offset: Torque samples alpha at grid corners (integer indices),\n // but GPU linear filtering samples at texel centers. This offset aligns them.\n vec2 alphaUv = baseUv + vec2(0.5 / ").concat(256,".0);\n float a1 = texture2D(mask1, alphaUv).r;\n ").concat(u>1?"float a2 = texture2D(mask2, alphaUv).r;":"","\n ").concat(u>2?"float a3 = texture2D(mask3, alphaUv).r;":"","\n ").concat(u>3?"float a4 = texture2D(mask4, alphaUv).r;":"","\n ").concat(u>4?"float a5 = texture2D(mask5, alphaUv).r;":"","\n\n // Bottom-up compositing: each mask tells how much the higher layer replaces lower\n ").concat(u>1?"vec3 blended = mix(c0, c1, clamp(a1, 0.0, 1.0));":"","\n ").concat(u>2?"blended = mix(blended, c2, clamp(a2, 0.0, 1.0));":"","\n ").concat(u>3?"blended = mix(blended, c3, clamp(a3, 0.0, 1.0));":"","\n ").concat(u>4?"blended = mix(blended, c4, clamp(a4, 0.0, 1.0));":"","\n ").concat(u>5?"blended = mix(blended, c5, clamp(a5, 0.0, 1.0));":"","\n\n // Assign to diffuseColor before lighting\n vec3 textureColor = ").concat(u>1?"blended":"c0",";\n\n ").concat(s?"// Detail texture blending (Torque-style multiplicative blend)\n // Sample detail texture at high frequency tiling\n vec3 detailColor = texture2D(detailTexture, baseUv * detailTiling).rgb;\n\n // Calculate distance-based fade factor using world positions\n // Torque: distFactor = (zeroDetailDistance - distance) / zeroDetailDistance\n float distToCamera = distance(vTerrainWorldPos, cameraPosition);\n float detailFade = clamp(1.0 - distToCamera / detailFadeDistance, 0.0, 1.0);\n\n // Torque blending: dst * lerp(1.0, detailTexel, fadeFactor)\n // Detail textures are authored with bright values (~0.8 mean), not 0.5 gray\n // Direct multiplication adds subtle darkening for surface detail\n textureColor *= mix(vec3(1.0), detailColor, detailFade);":"","\n\n // Apply texture color or debug mode solid gray\n if (debugMode > 0.5) {\n // Solid gray to visualize lighting only (without texture influence)\n diffuseColor.rgb = vec3(0.5);\n } else {\n // Scale texture to prevent clipping, preserving shadow visibility\n diffuseColor.rgb = textureColor * ").concat(.7,";\n }\n")),l&&(t.fragmentShader=t.fragmentShader.replace("#include ","#include \n\n// Override RE_Direct to use terrain lightmap for smooth NdotL\n#undef RE_Direct\nvoid RE_Direct_TerrainLightmap( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n // Sample pre-computed terrain lightmap (smooth NdotL values)\n // Add +0.5 texel offset to align GPU texel-center sampling with Torque's corner sampling\n vec2 lightmapUv = vMapUv + vec2(0.5 / ".concat(512,".0);\n float lightmapNdotL = texture2D(terrainLightmap, lightmapUv).r;\n\n // Use lightmap NdotL instead of dot(geometryNormal, directLight.direction)\n // directLight.color already has shadow factor applied from getShadow()\n // Apply terrain-specific directional intensity multiplier\n vec3 directIrradiance = lightmapNdotL * directLight.color * terrainDirectionalFactor;\n\n // Debug mode: visualize raw lightmap values (no textures)\n if (debugMode > 0.5) {\n reflectedLight.directDiffuse = directIrradiance;\n } else {\n reflectedLight.directDiffuse += directIrradiance * BRDF_Lambert( material.diffuseColor );\n }\n}\n#define RE_Direct RE_Direct_TerrainLightmap\n\n")),t.fragmentShader=t.fragmentShader.replace("#include ","#include \n// Fix: Recalculate irradiance without using vertex normals (causes banding)\n// Use flat upward normal for hemisphere/light probe calculations\n#if defined( RE_IndirectDiffuse )\n{\n vec3 flatNormal = vec3(0.0, 1.0, 0.0);\n irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, flatNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[i], flatNormal );\n }\n #endif\n}\n#endif\n")),t.fragmentShader=t.fragmentShader.replace("#include ","#include \n // Scale indirect (ambient) light to increase shadow contrast on terrain\n reflectedLight.indirectDiffuse *= terrainAmbientFactor;\n")}({shader:e,baseTextures:l,alphaTextures:i,visibilityMask:r,tiling:tP,debugMode:s,detailTexture:u?c:null,lightmap:o}),(0,tG.injectCustomFog)(e,tL.globalFogUniforms)},[l,i,r,s,c,u,o]),f="".concat(s?"debug":"normal","-").concat(u?"detail":"nodetail","-").concat(o?"lightmap":"nolightmap");return(0,es.jsx)("meshLambertMaterial",{map:t,depthWrite:!0,side:ef.DoubleSide,onBeforeCompile:d},f)}function tO(e){let{displacementMap:t,visibilityMask:r,textureNames:n,alphaTextures:i,detailTextureName:a,lightmap:o}=e;return(0,es.jsx)(el.Suspense,{fallback:(0,es.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",displacementMap:t,displacementScale:2048,wireframe:!0}),children:(0,es.jsx)(tH,{displacementMap:t,visibilityMask:r,textureNames:n,alphaTextures:i,detailTextureName:a,lightmap:o})})}let tk=(0,el.memo)(function(e){let{tileX:t,tileZ:r,blockSize:n,basePosition:i,textureNames:a,geometry:o,displacementMap:s,visibilityMask:l,alphaTextures:u,detailTextureName:c,lightmap:d,visible:f=!0}=e,h=(0,el.useMemo)(()=>[i.x+t*n+1024,0,i.z+r*n+1024],[t,r,n,i]);return(0,es.jsx)("mesh",{position:h,geometry:o,receiveShadow:!0,castShadow:!0,visible:f,children:(0,es.jsx)(tO,{displacementMap:s,visibilityMask:l,textureNames:a,alphaTextures:u,detailTextureName:c,lightmap:d})})});var t_=e.i(77482);function tU(e){return(0,t_.useRuntime)().getObjectByName(e)}function tj(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,i=r>>16,a=256*n;for(let r=0;r0?r:null!=(e=(0,tF.getFloat)(t,"visibleDistance"))?e:600}(),l=(0,tx.useThree)(e=>e.camera),u=(0,el.useMemo)(()=>{let[e,,t]=(0,tF.getPosition)(r);return{x:e,z:t}},[r]),c=(0,el.useMemo)(()=>{let e=(0,tF.getProperty)(r,"emptySquares");return e?e.split(" ").map(e=>parseInt(e,10)):[]},[r]),{data:d}=ty({queryKey:["terrain",n],queryFn:()=>(0,tM.loadTerrain)(n)},tt,void 0),f=(0,el.useMemo)(()=>{if(!d)return null;let e=256*i,t=new ef.PlaneGeometry(e,e,256,256);return t.rotateX(-Math.PI/2),t.rotateY(-Math.PI/2),!function(e,t,r){let n=e.attributes.position,i=e.attributes.uv,a=e.attributes.normal,o=n.array,s=i.array,l=a.array,u=n.count,c=(e,r)=>(e=Math.max(0,Math.min(255,e)),t[256*(r=Math.max(0,Math.min(255,r)))+e]/65535*2048),d=(e,r)=>{let n=Math.floor(e=Math.max(0,Math.min(255,e))),i=Math.floor(r=Math.max(0,Math.min(255,r))),a=Math.min(n+1,255),o=Math.min(i+1,255),s=e-n,l=r-i,u=t[256*i+n]/65535*2048,c=t[256*i+a]/65535*2048,d=t[256*o+n]/65535*2048;return(u*(1-s)+c*s)*(1-l)+(d*(1-s)+t[256*o+a]/65535*2048*s)*l};for(let e=0;e0?(p/=B,A/=B,g/=B):(p=0,A=1,g=0),l[3*e]=p,l[3*e+1]=A,l[3*e+2]=g}n.needsUpdate=!0,a.needsUpdate=!0}(t,d.heightMap,i),t},[i,d]),h=tU("Sun"),m=(0,el.useMemo)(()=>{var e;if(!h)return new ef.Vector3(.57735,-.57735,.57735);let[t,r,n]=(null!=(e=(0,tF.getProperty)(h,"direction"))?e:"0.57735 0.57735 -0.57735").split(" ").map(e=>parseFloat(e)),i=Math.sqrt(t*t+n*n+r*r);return new ef.Vector3(t/i,n/i,r/i)},[h]),p=(0,el.useMemo)(()=>d?function(e,t,r){let n=(t,r)=>{let n=(t%256+256)%256,i=(r%256+256)%256,a=Math.floor(n),o=Math.floor(i),s=a+1&255,l=o+1&255,u=n-a,c=i-o,d=e[256*o+a]/65535,f=e[256*o+s]/65535,h=e[256*l+a]/65535;return((d*(1-u)+f*u)*(1-c)+(h*(1-u)+e[256*l+s]/65535*u)*c)*2048},i=new ef.Vector3(-t.x,-t.y,-t.z).normalize(),a=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let o=t/2+.25,s=e/2+.25,l=n(o-.5,s),u=n(o+.5,s),c=n(o,s-.5),d=n(o,s+.5),f=-((d-c)/1),h=-((u-l)/1),m=Math.sqrt(f*f+r*r+h*h),p=Math.max(0,f/m*i.x+r/m*i.y+h/m*i.z);a[512*e+t]=Math.floor(255*p)}let o=new ef.DataTexture(a,512,512,ef.RedFormat,ef.UnsignedByteType);return o.colorSpace=ef.NoColorSpace,o.generateMipmaps=!0,o.wrapS=ef.ClampToEdgeWrapping,o.wrapT=ef.ClampToEdgeWrapping,o.magFilter=ef.LinearFilter,o.minFilter=ef.LinearFilter,o.needsUpdate=!0,o}(d.heightMap,m,i):null,[d,m,i]),A=(0,el.useMemo)(()=>{if(!d)return null;let e=function(e){let t=new Float32Array(e.length);for(let r=0;rtj(c),[c]),B=(0,el.useMemo)(()=>tj([]),[]),C=(0,el.useMemo)(()=>d?d.alphaMaps.map(e=>(0,tS.setupMask)(e)):null,[d]),y=(0,el.useMemo)(()=>{let e=2*Math.ceil(s/o)+1;return e*e-1},[s,o]),b=(0,el.useMemo)(()=>Array.from({length:y},(e,t)=>t),[y]),[M,E]=(0,el.useState)(()=>Array(y).fill(null)),x=(0,el.useRef)({xStart:0,xEnd:0,zStart:0,zEnd:0});return((0,tE.useFrame)(()=>{let e=l.position.x-u.x,t=l.position.z-u.z,r=Math.floor((e-s)/o),n=Math.ceil((e+s)/o),i=Math.floor((t-s)/o),a=Math.ceil((t+s)/o),c=x.current;if(r===c.xStart&&n===c.xEnd&&i===c.zStart&&a===c.zEnd)return;c.xStart=r,c.xEnd=n,c.zStart=i,c.zEnd=a;let d=[];for(let e=r;e{var t,r;let n=M[e];return(0,es.jsx)(tk,{tileX:null!=(t=null==n?void 0:n.tileX)?t:0,tileZ:null!=(r=null==n?void 0:n.tileZ)?r:0,blockSize:o,basePosition:u,textureNames:d.textureNames,geometry:f,displacementMap:A,visibilityMask:B,alphaTextures:C,detailTextureName:a,lightmap:p,visible:null!==n},e)})]}):null}),tN=(0,el.createContext)(null);function tK(){return(0,el.useContext)(tN)}var tQ=el;let tW=(0,tQ.createContext)(null),tV={didCatch:!1,error:null};class tX extends tQ.Component{static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,i=Array(n),a=0;a0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)){var i,a;null==(i=(a=this.props).onReset)||i.call(a,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(tV)}}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(r)o=(0,tQ.createElement)(r,e);else if(void 0!==n)o=n;else throw a}return(0,tQ.createElement)(tW.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=tV}}var tq=e.i(31067),tY=ef;function tZ(e,t){if(t===ef.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==ef.TriangleFanDrawMode&&t!==ef.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported."));return}let s=new rH(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});s.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}s.setExtensions(a),s.setPlugins(o),s.parse(r,n)}parseAsync(e,t){let r=this;return new Promise(function(n,i){r.parse(e,t,n,i)})}constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new t4(e)}),this.register(function(e){return new t7(e)}),this.register(function(e){return new rl(e)}),this.register(function(e){return new ru(e)}),this.register(function(e){return new rc(e)}),this.register(function(e){return new rt(e)}),this.register(function(e){return new rr(e)}),this.register(function(e){return new rn(e)}),this.register(function(e){return new ri(e)}),this.register(function(e){return new t6(e)}),this.register(function(e){return new ra(e)}),this.register(function(e){return new re(e)}),this.register(function(e){return new rs(e)}),this.register(function(e){return new ro(e)}),this.register(function(e){return new t3(e)}),this.register(function(e){return new rd(e)}),this.register(function(e){return new rf(e)})}}function t2(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let t8={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class t3{_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,n=t.length;r=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,i.source,a)}constructor(e){this.parser=e,this.name=t8.KHR_TEXTURE_BASISU}}class ru{loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=n.images[a.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}constructor(e){this.parser=e,this.name=t8.EXT_TEXTURE_WEBP,this.isSupported=null}}class rc{loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=n.images[a.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}constructor(e){this.parser=e,this.name=t8.EXT_TEXTURE_AVIF,this.isSupported=null}}class rd{loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],n=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return n.then(function(t){let r=e.byteOffset||0,n=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,r,n);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}}constructor(e){this.name=t8.EXT_MESHOPT_COMPRESSION,this.parser=e}}class rf{createNodeMesh(e){let t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;for(let e of t.meshes[r.mesh].primitives)if(e.mode!==rb.TRIANGLES&&e.mode!==rb.TRIANGLE_STRIP&&e.mode!==rb.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=r.extensions[this.name].attributes,i=[],a={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(a[e]=t,a[e])));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then(e=>{let t=e.pop(),r=t.isGroup?t.children:[t],n=e[0].count,i=[];for(let e of r){let t=new tY.Matrix4,r=new tY.Vector3,o=new tY.Quaternion,s=new tY.Vector3(1,1,1),l=new tY.InstancedMesh(e.geometry,e.material,n);for(let e=0;e=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},rT={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},rw={CUBICSPLINE:void 0,LINEAR:tY.InterpolateLinear,STEP:tY.InterpolateDiscrete},rR={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function rI(e,t,r){for(let n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function rD(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function rG(e){let t="",r=Object.keys(e).sort();for(let n=0,i=r.length;n{let r=this.associations.get(e);for(let[n,a]of(null!=r&&this.associations.set(t,r),e.children.entries()))i(a,t.children[n])};return i(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&a.setY(t,d[e*s+1]),s>=3&&a.setZ(t,d[e*s+2]),s>=4&&a.setW(t,d[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,r=this.options,n=t.textures[e].source,i=t.images[n],a=this.textureLoader;if(i.uri){let e=r.manager.getHandler(i.uri);null!==e&&(a=e)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,r){let n=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];let l=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);let r=(i.samplers||{})[a.sampler]||{};return t.magFilter=rE[r.magFilter]||tY.LinearFilter,t.minFilter=rE[r.minFilter]||tY.LinearMipmapLinearFilter,t.wrapS=rx[r.wrapS]||tY.RepeatWrapping,t.wrapT=rx[r.wrapT]||tY.RepeatWrapping,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=l,l}loadImageSource(e,t){let r=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=r.images[e],a=self.URL||self.webkitURL,o=i.uri||"",s=!1;if(void 0!==i.bufferView)o=this.getDependency("bufferView",i.bufferView).then(function(e){s=!0;let t=new Blob([e],{type:i.mimeType});return o=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(o).then(function(e){return new Promise(function(r,i){let a=r;!0===t.isImageBitmapLoader&&(a=function(e){let t=new tY.Texture(e);t.needsUpdate=!0,r(t)}),t.load(tY.LoaderUtils.resolveURL(e,n.path),a,void 0,i)})}).then(function(e){var t;return!0===s&&a.revokeObjectURL(o),rD(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=l,l}assignTexture(e,t,r,n){let i=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((a=a.clone()).channel=r.texCoord),i.extensions[t8.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[t8.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[t8.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==n&&("number"==typeof n&&(n=3001===n?t0:t1),"colorSpace"in a?a.colorSpace=n:a.encoding=n===t0?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,r=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new tY.PointsMaterial,tY.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){let e="LineBasicMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new tY.LineBasicMaterial,tY.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(n||i||a){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return tY.MeshStandardMaterial}loadMaterial(e){let t,r=this,n=this.json,i=this.extensions,a=n.materials[e],o={},s=a.extensions||{},l=[];if(s[t8.KHR_MATERIALS_UNLIT]){let e=i[t8.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(o,a,r))}else{let n=a.pbrMetallicRoughness||{};if(o.color=new tY.Color(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],t1),o.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(r.assignTexture(o,"map",n.baseColorTexture,t0)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(r.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),l.push(r.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===a.doubleSided&&(o.side=tY.DoubleSide);let u=a.alphaMode||rR.OPAQUE;if(u===rR.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,u===rR.MASK&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==tY.MeshBasicMaterial&&(l.push(r.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new tY.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==tY.MeshBasicMaterial&&(l.push(r.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==tY.MeshBasicMaterial){let e=a.emissiveFactor;o.emissive=new tY.Color().setRGB(e[0],e[1],e[2],t1)}return void 0!==a.emissiveTexture&&t!==tY.MeshBasicMaterial&&l.push(r.assignTexture(o,"emissiveMap",a.emissiveTexture,t0)),Promise.all(l).then(function(){let n=new t(o);return a.name&&(n.name=a.name),rD(n,a),r.associations.set(n,{materials:e}),a.extensions&&rI(i,n,a),n})}createUniqueName(e){let t=tY.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,r=this.extensions,n=this.primitiveCache,i=[];for(let a=0,o=e.length;a0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,n=t.weights.length;r1?new tY.Group:1===t.length?t[0]:new tY.Object3D)!==t[0])for(let e=0,r=t.length;e{let t=new Map;for(let[e,r]of n.associations)(e instanceof tY.Material||e instanceof tY.Texture)&&t.set(e,r);return e.traverse(e=>{let r=n.associations.get(e);null!=r&&t.set(e,r)}),t})(i),i})}_createAnimationTracks(e,t,r,n,i){let a,o=[],s=e.name?e.name:e.uuid,l=[];switch(rT[i.path]===rT.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(s),rT[i.path]){case rT.weights:a=tY.NumberKeyframeTrack;break;case rT.rotation:a=tY.QuaternionKeyframeTrack;break;case rT.position:case rT.scale:a=tY.VectorKeyframeTrack;break;default:a=1===r.itemSize?tY.NumberKeyframeTrack:tY.VectorKeyframeTrack}let u=void 0!==n.interpolation?rw[n.interpolation]:tY.InterpolateLinear,c=this._getArrayFromAccessor(r);for(let e=0,r=l.length;e-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||n&&i<98?this.textureLoader=new tY.TextureLoader(this.options.manager):this.textureLoader=new tY.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new tY.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}}function rO(e,t,r){let n=t.attributes,i=[];for(let t in n){let a=rS[t]||t.toLowerCase();a in e.attributes||i.push(function(t,n){return r.getDependency("accessor",t).then(function(t){e.setAttribute(n,t)})}(n[t],a))}if(void 0!==t.indices&&!e.index){let n=r.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(n)}return rD(e,t),!function(e,t,r){let n=t.attributes,i=new tY.Box3;if(void 0===n.POSITION)return;{let e=r.json.accessors[n.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new tY.Vector3(t[0],t[1],t[2]),new tY.Vector3(a[0],a[1],a[2])),e.normalized){let t=rL(rM[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new tY.Vector3,t=new tY.Vector3;for(let n=0,i=a.length;n{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(n)},r,n)}decodeDracoFile(e,t,r,n){let i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let n=JSON.stringify(t);if(r_.has(e)){let t=r_.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(i,a).then(n=>(r=n,new Promise((n,a)=>{r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&i&&this._releaseTask(r,i)}),r_.set(e,{key:n,promise:o}),o}_createGeometry(e){let t=new rk.BufferGeometry;e.index&&t.setIndex(new rk.BufferAttribute(e.index.array,1));for(let r=0;r{r.load(e,t,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let n=rj.toString(),i=["/* draco decoder */",r,"\n/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtht._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{let t=e.draco,r=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(i),i.byteLength);try{let e=function(e,t,r,n){let i,a,o=n.attributeIDs,s=n.attributeTypes,l=t.GetEncodedGeometryType(r);if(l===e.TRIANGULAR_MESH)i=new e.Mesh,a=t.DecodeBufferToMesh(r,i);else if(l===e.POINT_CLOUD)i=new e.PointCloud,a=t.DecodeBufferToPointCloud(r,i);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!a.ok()||0===i.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());let u={index:null,attributes:[]};for(let r in o){let a,l,c=self[s[r]];if(n.useUniqueIDs)l=o[r],a=t.GetAttributeByUniqueId(i,l);else{if(-1===(l=t.GetAttributeId(i,e[o[r]])))continue;a=t.GetAttribute(i,l)}u.attributes.push(function(e,t,r,n,i,a){let o=a.num_components(),s=r.num_points()*o,l=s*i.BYTES_PER_ELEMENT,u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,a,u,l,c);let d=new i(e.HEAPF32.buffer,c,s).slice();return e._free(c),{name:n,array:d,itemSize:o}}(e,t,i,r,c,a))}return l===e.TRIANGULAR_MESH&&(u.index=function(e,t,r){let n=3*r.num_faces(),i=4*n,a=e._malloc(i);t.GetTrianglesUInt32Array(r,i,a);let o=new Uint32Array(e.HEAPF32.buffer,a,n).slice();return e._free(a),{array:o,itemSize:1}}(e,t,i)),e.destroy(i),u}(t,r,o,a),i=e.attributes.map(e=>e.array.buffer);e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(o),t.destroy(r)}})}}}var rJ=e.i(80520);let rN={clone:function(e){let t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(let i=0;i{let{isChild:r=!1,object:n,children:i,deep:a,castShadow:o,receiveShadow:s,inject:l,keys:u,...c}=e,d={keys:u,deep:a,inject:l,castShadow:o,receiveShadow:s};if(Array.isArray(n=el.useMemo(()=>{if(!1===r&&!Array.isArray(n)){let e=!1;if(n.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return rN.clone(n)}return n},[n,r])))return el.createElement("group",(0,tq.default)({},c,{ref:t}),n.map(e=>el.createElement(rK,(0,tq.default)({key:e.uuid,object:e},d))),i);let{children:f,...h}=function(e,t){let{keys:r=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:n,inject:i,castShadow:a,receiveShadow:o}=t,s={};for(let t of r)s[t]=e[t];return n&&(s.geometry&&"materialsOnly"!==n&&(s.geometry=s.geometry.clone()),s.material&&"geometriesOnly"!==n&&(s.material=s.material.clone())),i&&(s="function"==typeof i?{...s,children:i(e)}:el.isValidElement(i)?{...s,children:i}:{...s,...i}),e instanceof ef.Mesh&&(a&&(s.castShadow=!0),o&&(s.receiveShadow=!0)),s}(n,d),m=n.type[0].toLowerCase()+n.type.slice(1);return el.createElement(m,(0,tq.default)({},h,c,{ref:t}),n.children.map(e=>"Bone"===e.type?el.createElement("primitive",(0,tq.default)({key:e.uuid,object:e},d)):el.createElement(rK,(0,tq.default)({key:e.uuid,object:e},d,{isChild:!0}))),i,f)}),rQ=null,rW="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function rV(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2?arguments[2]:void 0;return i=>{n&&n(i),e&&(rQ||(rQ=new rU),rQ.setDecoderPath("string"==typeof e?e:rW),i.setDRACOLoader(rQ)),r&&i.setMeshoptDecoder((()=>{let e;if(t)return t;let r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let i="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";WebAssembly.validate(r)&&(i="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");let a=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let i=0;i{(e=t.instance).exports.__wasm_call_ctors()});function o(t,r,n,i,a,o){let s=e.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,c);let f=t(u,n,i,c,a.length);if(0===f&&o&&o(u,l,i),r.set(d.subarray(u,u+n*i)),s(u-s(0)),0!==f)throw Error("Malformed buffer data: ".concat(f))}let s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return t={ready:a,supported:!0,decodeVertexBuffer(t,r,n,i,a){o(e.exports.meshopt_decodeVertexBuffer,t,r,n,i,e.exports[s[a]])},decodeIndexBuffer(t,r,n,i){o(e.exports.meshopt_decodeIndexBuffer,t,r,n,i)},decodeIndexSequence(t,r,n,i){o(e.exports.meshopt_decodeIndexSequence,t,r,n,i)},decodeGltfBuffer(t,r,n,i,a,u){o(e.exports[l[a]],t,r,n,i,e.exports[s[u]])}}})())}}let rX=(e,t,r,n)=>(0,rJ.useLoader)(t9,e,rV(t,r,n));rX.preload=(e,t,r,n)=>rJ.useLoader.preload(t9,e,rV(t,r,n)),rX.clear=e=>rJ.useLoader.clear(t9,e),rX.setDecoderPath=e=>{rW=e};var rq=e.i(89887);function rY(e){var t,r;let{materialName:n,material:i,lightMap:a}=e,o=(0,tM.textureToUrl)(n),s=(0,tT.useTexture)(o,e=>(0,tS.setupColor)(e)),l=new Set(null!=(r=null==i||null==(t=i.userData)?void 0:t.flag_names)?r:[]).has("SelfIlluminating"),u=(0,el.useCallback)(e=>{(0,tG.injectCustomFog)(e,tL.globalFogUniforms),e.uniforms.interiorDirectionalFactor={value:tR.directional},e.uniforms.interiorAmbientFactor={value:tR.ambient},e.fragmentShader=e.fragmentShader.replace("#include ","#include \nuniform float interiorDirectionalFactor;\nuniform float interiorAmbientFactor;\n"),e.fragmentShader=e.fragmentShader.replace("#include ","#include \n // Apply interior-specific lighting multipliers\n reflectedLight.directDiffuse *= interiorDirectionalFactor;\n reflectedLight.indirectDiffuse *= interiorAmbientFactor;\n")},[]);return l?(0,es.jsx)("meshBasicMaterial",{map:s,side:2,toneMapped:!1,onBeforeCompile:u}):(0,es.jsx)("meshLambertMaterial",{map:s,lightMap:null!=a?a:void 0,lightMapIntensity:a?2.5:void 0,side:2,onBeforeCompile:u})}function rZ(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace="srgb-linear"),null!=t?t:null}function rz(e){let{node:t}=e,r=(0,el.useMemo)(()=>t.material?Array.isArray(t.material)?t.material.map(e=>rZ(e)):[rZ(t.material)]:[],[t.material]);return(0,es.jsx)("mesh",{geometry:t.geometry,castShadow:!0,receiveShadow:!0,children:t.material?(0,es.jsx)(el.Suspense,{fallback:(0,es.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(t.material)?t.material.map((e,t)=>(0,es.jsx)(rY,{materialName:e.userData.resource_path,material:e,lightMap:r[t]},t)):(0,es.jsx)(rY,{materialName:t.material.userData.resource_path,material:t.material,lightMap:r[0]})}):null})}let r$=(0,el.memo)(e=>{let{interiorFile:t}=e,{nodes:r}=rX((0,tM.interiorToUrl)(t)),{debugMode:n}=(0,tD.useDebug)();return(0,es.jsxs)("group",{rotation:[0,-Math.PI/2,0],children:[Object.entries(r).filter(e=>{let[,t]=e;return t.isMesh}).map(e=>{let[t,r]=e;return(0,es.jsx)(rz,{node:r},t)}),n?(0,es.jsx)(rq.FloatingLabel,{children:t}):null]})});function r0(e){let{color:t,label:r}=e;return(0,es.jsxs)("mesh",{children:[(0,es.jsx)("boxGeometry",{args:[10,10,10]}),(0,es.jsx)("meshStandardMaterial",{color:t,wireframe:!0}),r?(0,es.jsx)(rq.FloatingLabel,{color:t,children:r}):null]})}function r1(e){let{label:t}=e,{debugMode:r}=(0,tD.useDebug)();return r?(0,es.jsx)(r0,{color:"red",label:t}):null}let r9=(0,el.memo)(function(e){let{object:t}=e,r=(0,tF.getProperty)(t,"interiorFile"),n=(0,el.useMemo)(()=>(0,tF.getPosition)(t),[t]),i=(0,el.useMemo)(()=>(0,tF.getScale)(t),[t]),a=(0,el.useMemo)(()=>(0,tF.getRotation)(t),[t]);return(0,es.jsx)("group",{position:n,quaternion:a,scale:i,children:(0,es.jsx)(tX,{fallback:(0,es.jsx)(r1,{label:r}),children:(0,es.jsx)(el.Suspense,{fallback:(0,es.jsx)(r0,{color:"orange"}),children:(0,es.jsx)(r$,{interiorFile:r})})})})});function r2(e,t){let{path:r}=t,[n]=(0,rJ.useLoader)(ef.CubeTextureLoader,[e],e=>e.setPath(r));return n}r2.preload=(e,t)=>{let{path:r}=t;return rJ.useLoader.preload(ef.CubeTextureLoader,[e],e=>e.setPath(r))};function r8(e){return e.wrapS=ef.RepeatWrapping,e.wrapT=ef.RepeatWrapping,e.minFilter=ef.LinearFilter,e.magFilter=ef.LinearFilter,e.colorSpace=ef.NoColorSpace,e.needsUpdate=!0,e}function r3(e){let{textureUrl:t,radius:r,heightPercent:n,speed:i,windDirection:a,layerIndex:o,debugMode:s,animationEnabled:l}=e,u=(0,el.useRef)(null),c=(0,el.useRef)(new ef.Vector2(0,0)),d=(0,tT.useTexture)(t,r8),f=(0,el.useMemo)(()=>{let e=n-.05;return function(e,t,r,n){let i=new ef.BufferGeometry,a=new Float32Array(75),o=new Float32Array(50),s=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],l=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,i=-e+r*l,u=e-t*l,c=e*s[n];a[3*n]=i,a[3*n+1]=c,a[3*n+2]=u,o[2*n]=r,o[2*n+1]=t}!function(e){let t=t=>({x:e[3*t],y:e[3*t+1],z:e[3*t+2]}),r=(t,r,n,i)=>{e[3*t]=r,e[3*t+1]=n,e[3*t+2]=i},n=t(1),i=t(3),a=t(5),o=t(6),s=t(8),l=t(9),u=t(15),c=t(16),d=t(18),f=t(19),h=t(21),m=t(23),p=a.x+(n.x-a.x)*.5,A=a.y+(n.y-a.y)*.5,g=a.z+(n.z-a.z)*.5;r(0,o.x+(p-o.x)*2,o.y+(A-o.y)*2,o.z+(g-o.z)*2),p=l.x+(i.x-l.x)*.5,A=l.y+(i.y-l.y)*.5,g=l.z+(i.z-l.z)*.5,r(4,s.x+(p-s.x)*2,s.y+(A-s.y)*2,s.z+(g-s.z)*2),p=h.x+(u.x-h.x)*.5,A=h.y+(u.y-h.y)*.5,g=h.z+(u.z-h.z)*.5,r(20,c.x+(p-c.x)*2,c.y+(A-c.y)*2,c.z+(g-c.z)*2),p=m.x+(f.x-m.x)*.5,A=m.y+(f.y-m.y)*.5,g=m.z+(f.z-m.z)*.5,r(24,d.x+(p-d.x)*2,d.y+(A-d.y)*2,d.z+(g-d.z)*2)}(a);let u=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let i=e[3*n],a=e[3*n+2],o=1.3-Math.sqrt(i*i+a*a)/t;o<.4?o=0:o>.8&&(o=1),r[n]=o}return r}(a,e),c=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,i=r+5,a=i+1;c.push(r,i,a),c.push(r,a,n)}return i.setIndex(c),i.setAttribute("position",new ef.Float32BufferAttribute(a,3)),i.setAttribute("uv",new ef.Float32BufferAttribute(o,2)),i.setAttribute("alpha",new ef.Float32BufferAttribute(u,1)),i.computeBoundingSphere(),i}(r,n,e,0)},[r,n]),h=(0,el.useMemo)(()=>new ef.ShaderMaterial({uniforms:{cloudTexture:{value:d},uvOffset:{value:new ef.Vector2(0,0)},debugMode:{value:+!!s},layerIndex:{value:o}},vertexShader:"\n attribute float alpha;\n\n uniform vec2 uvOffset;\n\n varying vec2 vUv;\n varying float vAlpha;\n\n void main() {\n // Apply UV offset for scrolling\n vUv = uv + uvOffset;\n vAlpha = alpha;\n\n vec4 pos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n // Set depth to far plane so clouds are always visible and behind other geometry\n gl_Position = pos.xyww;\n }\n",fragmentShader:"\n uniform sampler2D cloudTexture;\n uniform float debugMode;\n uniform int layerIndex;\n\n varying vec2 vUv;\n varying float vAlpha;\n\n void main() {\n vec4 texColor = texture2D(cloudTexture, vUv);\n\n // Debug mode: show layer-colored clouds (red, green, blue for layers 0, 1, 2)\n if (debugMode > 0.5) {\n vec3 debugColor;\n if (layerIndex == 0) {\n debugColor = vec3(1.0, 0.3, 0.3); // Red\n } else if (layerIndex == 1) {\n debugColor = vec3(0.3, 1.0, 0.3); // Green\n } else {\n debugColor = vec3(0.3, 0.3, 1.0); // Blue\n }\n // Use same alpha calculation as normal mode\n gl_FragColor = vec4(debugColor, texColor.a * vAlpha);\n return;\n }\n\n // Tribes 2 uses GL_MODULATE: final = texture × vertex color\n // Vertex color is white with varying alpha, so:\n // Final RGB = Texture RGB × 1.0 = Texture RGB\n // Final Alpha = Texture Alpha × Vertex Alpha\n float finalAlpha = texColor.a * vAlpha;\n\n // Output clouds with texture color and combined alpha\n gl_FragColor = vec4(texColor.rgb, finalAlpha);\n }\n",transparent:!0,depthWrite:!1,side:ef.DoubleSide}),[d,s,o]);return(0,tE.useFrame)((e,t)=>{if(!u.current||!l)return;let r=1e3*t/32;c.current.x+=a.x*i*r,c.current.y+=a.y*i*r,c.current.x=c.current.x-Math.floor(c.current.x),c.current.y=c.current.y-Math.floor(c.current.y),u.current.uniforms.uvOffset.value.copy(c.current)}),(0,el.useEffect)(()=>()=>{f.dispose(),h.dispose()},[f,h]),(0,es.jsx)("mesh",{geometry:f,frustumCulled:!1,renderOrder:10,children:(0,es.jsx)("primitive",{ref:u,object:h,attach:"material"})})}function r5(e){var t,r;let{object:n}=e,{debugMode:i}=(0,tD.useDebug)(),{animationEnabled:a}=(0,tD.useSettings)(),{data:o}=ty({queryKey:["detailMapList",r=(0,tF.getProperty)(n,"materialList")],queryFn:()=>(0,tM.loadDetailMapList)(r),enabled:!!r},tt,void 0),s=.95*(null!=(t=(0,tF.getFloat)(n,"visibleDistance"))?t:500),l=(0,el.useMemo)(()=>{var e,t,r;return[null!=(e=(0,tF.getFloat)(n,"cloudSpeed1"))?e:1e-4,null!=(t=(0,tF.getFloat)(n,"cloudSpeed2"))?t:2e-4,null!=(r=(0,tF.getFloat)(n,"cloudSpeed3"))?r:3e-4]},[n]),u=(0,el.useMemo)(()=>{let e=[.35,.25,.2],t=[];for(let i=0;i<3;i++){var r;let a=null!=(r=(0,tF.getFloat)(n,"cloudHeightPer".concat(i)))?r:e[i];t.push(a)}return t},[n]),c=(0,el.useMemo)(()=>{let e=(0,tF.getProperty)(n,"windVelocity");if(e){let[t,r]=e.split(" ").map(e=>parseFloat(e));if(0!==t||0!==r)return new ef.Vector2(r,-t).normalize()}return new ef.Vector2(1,0)},[n]),d=(0,el.useMemo)(()=>{if(!o)return[];let e=[];for(let n=7;n{let{camera:t}=e;f.current&&f.current.position.copy(t.position)}),d&&0!==d.length)?(0,es.jsx)("group",{ref:f,children:d.map((e,t)=>{let r=(0,tM.textureToUrl)(e.texture);return(0,es.jsx)(el.Suspense,{fallback:null,children:(0,es.jsx)(r3,{textureUrl:r,radius:s,heightPercent:e.height,speed:e.speed,windDirection:c,layerIndex:t,debugMode:i,animationEnabled:a})},t)})}):null}tM.BASE_URL;let r6=!1;function r4(e){if(!e)return;let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return[new ef.Color().setRGB(t,r,n),new ef.Color().setRGB(t,r,n).convertSRGBToLinear()]}function r7(e){let{skyBoxFiles:t,fogColor:r,fogState:n}=e,{camera:i}=(0,tx.useThree)(),a=r2(t,{path:""}),o=(0,el.useMemo)(()=>i.projectionMatrixInverse,[i]),s=(0,el.useMemo)(()=>n?(0,tL.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),l=(0,el.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]);return(0,es.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,es.jsxs)("bufferGeometry",{children:[(0,es.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,es.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,es.jsx)("shaderMaterial",{uniforms:{skybox:{value:a},fogColor:{value:null!=r?r:new ef.Color(0,0,0)},enableFog:{value:!!r},inverseProjectionMatrix:{value:o},cameraMatrixWorld:{value:i.matrixWorld},cameraHeight:tL.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:l}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.9999, 1.0);\n }\n ",fragmentShader:'\n uniform samplerCube skybox;\n uniform vec3 fogColor;\n uniform bool enableFog;\n uniform mat4 inverseProjectionMatrix;\n uniform mat4 cameraMatrixWorld;\n uniform float cameraHeight;\n uniform float fogVolumeData[12];\n uniform float horizonFogHeight;\n\n varying vec2 vUv;\n\n // Convert linear to sRGB for display\n // shaderMaterial does NOT get automatic linear->sRGB output conversion\n // Use proper sRGB transfer function (not simplified gamma 2.2) to match Three.js\n vec3 linearToSRGB(vec3 linear) {\n vec3 low = linear * 12.92;\n vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055;\n return mix(low, high, step(vec3(0.0031308), linear));\n }\n\n void main() {\n vec2 ndc = vUv * 2.0 - 1.0;\n vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0);\n viewPos.xyz /= viewPos.w;\n vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz);\n direction = vec3(direction.z, direction.y, -direction.x);\n // Sample skybox - Three.js CubeTexture with SRGBColorSpace auto-converts to linear\n vec4 skyColor = textureCube(skybox, direction);\n vec3 finalColor;\n\n if (enableFog) {\n vec3 effectiveFogColor = fogColor;\n\n // Calculate how much fog volume the ray passes through\n // For skybox at "infinite" distance, the relevant height is how much\n // of the volume is above/below camera depending on view direction\n float volumeFogInfluence = 0.0;\n\n for (int i = 0; i < 3; i++) {\n int offset = i * 4;\n float volVisDist = fogVolumeData[offset + 0];\n float volMinH = fogVolumeData[offset + 1];\n float volMaxH = fogVolumeData[offset + 2];\n float volPct = fogVolumeData[offset + 3];\n\n if (volVisDist <= 0.0) continue;\n\n // Check if camera is inside this volume\n if (cameraHeight >= volMinH && cameraHeight <= volMaxH) {\n // Camera is inside the fog volume\n // Looking horizontally or up at shallow angles means ray travels\n // through more fog before exiting the volume\n float heightAboveCamera = volMaxH - cameraHeight;\n float heightBelowCamera = cameraHeight - volMinH;\n float volumeHeight = volMaxH - volMinH;\n\n // For horizontal rays (direction.y ≈ 0), maximum fog influence\n // For rays going up steeply, less fog (exits volume quickly)\n // For rays going down, more fog (travels through volume below)\n float rayInfluence;\n if (direction.y >= 0.0) {\n // Looking up: influence based on how steep we\'re looking\n // Shallow angles = long path through fog = high influence\n rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y);\n } else {\n // Looking down: always high fog (into the volume)\n rayInfluence = 1.0;\n }\n\n // Scale by percentage and volume depth factor\n volumeFogInfluence += rayInfluence * volPct;\n }\n }\n\n // Base fog factor from view direction (for haze at horizon)\n // In Torque, the fog "bans" (bands) are rendered as geometry from\n // height 0 (HORIZON) to height 60 (OFFSET_HEIGHT) on the skybox.\n // The skybox corner is at mSkyBoxPt.x = mRadius / sqrt(3).\n //\n // horizonFogHeight is the direction.y value where the fog band ends:\n // horizonFogHeight = 60 / sqrt(skyBoxPt.x^2 + 60^2)\n //\n // For Firestorm (visDist=600): mRadius=570, skyBoxPt.x=329, horizonFogHeight≈0.18\n //\n // Torque renders the fog bands as geometry with linear vertex alpha\n // interpolation. We use a squared curve (t^2) to create a gentler\n // falloff at the top of the gradient, matching Tribes 2\'s appearance.\n float baseFogFactor;\n if (direction.y <= 0.0) {\n // Looking at or below horizon: full fog\n baseFogFactor = 1.0;\n } else if (direction.y >= horizonFogHeight) {\n // Above fog band: no fog\n baseFogFactor = 0.0;\n } else {\n // Within fog band: squared curve for gentler falloff at top\n float t = direction.y / horizonFogHeight;\n baseFogFactor = (1.0 - t) * (1.0 - t);\n }\n\n // Combine base fog with volume fog influence\n // When inside a volume, increase fog intensity\n float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5);\n\n finalColor = mix(skyColor.rgb, effectiveFogColor, finalFogFactor);\n } else {\n finalColor = skyColor.rgb;\n }\n // Convert linear result to sRGB for display\n gl_FragColor = vec4(linearToSRGB(finalColor), 1.0);\n }\n ',depthWrite:!1,depthTest:!1})]})}function ne(e){let{materialList:t,fogColor:r,fogState:n}=e,{data:i}=ty({queryKey:["detailMapList",t],queryFn:()=>(0,tM.loadDetailMapList)(t)},tt,void 0),a=(0,el.useMemo)(()=>i?[(0,tM.textureToUrl)(i[1]),(0,tM.textureToUrl)(i[3]),(0,tM.textureToUrl)(i[4]),(0,tM.textureToUrl)(i[5]),(0,tM.textureToUrl)(i[0]),(0,tM.textureToUrl)(i[2])]:null,[i]);return a?(0,es.jsx)(r7,{skyBoxFiles:a,fogColor:r,fogState:n}):null}function nt(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function nr(e){let{fogState:t}=e,{scene:r,camera:n}=(0,tx.useThree)(),i=(0,el.useRef)(null),a=(0,el.useMemo)(()=>(0,tL.packFogVolumeData)(t.fogVolumes),[t.fogVolumes]);return(0,el.useEffect)(()=>{r6||((0,tG.installCustomFogShader)(),r6=!0)},[]),(0,el.useEffect)(()=>{(0,tL.resetGlobalFogUniforms)();let[e,o]=nt(t,n.position.y),s=new ef.Fog(t.fogColor,e,o);return r.fog=s,i.current=s,(0,tL.updateGlobalFogUniforms)(n.position.y,a),()=>{r.fog=null,i.current=null,(0,tL.resetGlobalFogUniforms)()}},[r,n,t,a]),(0,tE.useFrame)(()=>{let e=i.current;if(!e)return;let r=n.position.y,[o,s]=nt(t,r);e.near=o,e.far=s,e.color.copy(t.fogColor),(0,tL.updateGlobalFogUniforms)(r,a)}),null}let nn=/borg|xorg|porg|dorg|plant|tree|bush|fern|vine|grass|leaf|flower|frond|palm|foliage/i;function ni(e){return nn.test(e)}let na=(0,el.createContext)(null);function no(e){let{children:t,shapeName:r,type:n}=e,i=(0,el.useMemo)(()=>ni(r),[r]),a=(0,el.useMemo)(()=>({shapeName:r,type:n,isOrganic:i}),[r,n,i]);return(0,es.jsx)(na.Provider,{value:a,children:t})}var ns=e.i(51475);let nl=new Map;function nu(e){e.onBeforeCompile=t=>{(0,tG.injectCustomFog)(t,tL.globalFogUniforms),e instanceof ef.MeshLambertMaterial&&(t.uniforms.shapeDirectionalFactor={value:tI.directional},t.uniforms.shapeAmbientFactor={value:tI.ambient},t.fragmentShader=t.fragmentShader.replace("#include ","#include \nuniform float shapeDirectionalFactor;\nuniform float shapeAmbientFactor;\n"),t.fragmentShader=t.fragmentShader.replace("#include ","#include \n // Apply shape-specific lighting multipliers\n reflectedLight.directDiffuse *= shapeDirectionalFactor;\n reflectedLight.indirectDiffuse *= shapeAmbientFactor;\n"))}}function nc(e,t,r,n){let i=r.has("Translucent"),a=r.has("Additive"),o=r.has("SelfIlluminating");if(r.has("NeverEnvMap"),o){let e=new ef.MeshBasicMaterial({map:t,side:2,transparent:a,alphaTest:.5*!a,blending:a?ef.AdditiveBlending:void 0,fog:!0});return nu(e),e}if(n||i){let e={map:t,transparent:!1,alphaTest:.5,reflectivity:0},r=new ef.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),n=new ef.MeshLambertMaterial({...e,side:0});return nu(r),nu(n),[r,n]}let s=new ef.MeshLambertMaterial({map:t,side:2,reflectivity:0});return nu(s),s}let nd=(0,el.memo)(function(e){var t;let{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:o=!1,receiveShadow:s=!1}=e,l=r.userData.resource_path,u=new Set(null!=(t=r.userData.flag_names)?t:[]),c=function(e){let{animationEnabled:t}=(0,tD.useSettings)(),{data:r}=ty({queryKey:["ifl",e],queryFn:()=>(0,tM.loadImageFrameList)(e),enabled:!0,suspense:!0,throwOnError:tB,placeholderData:void 0},tt,void 0),n=(0,el.useMemo)(()=>r.map(t=>(0,tM.iflTextureToUrl)(t.name,e)),[r,e]),i=(0,tT.useTexture)(n),a=(0,el.useMemo)(()=>{var t;let n,a=nl.get(e);return a||(a=function(e){let t=e[0].image.width,r=e[0].image.height,n=e.length,i=Math.ceil(Math.sqrt(n)),a=Math.ceil(n/i),o=document.createElement("canvas");o.width=t*i,o.height=r*a;let s=o.getContext("2d");e.forEach((e,n)=>{let a=Math.floor(n/i);s.drawImage(e.image,n%i*t,a*r)});let l=new ef.CanvasTexture(o);return l.colorSpace=ef.SRGBColorSpace,l.generateMipmaps=!1,l.minFilter=ef.NearestFilter,l.magFilter=ef.NearestFilter,l.wrapS=ef.ClampToEdgeWrapping,l.wrapT=ef.ClampToEdgeWrapping,l.repeat.set(1/i,1/a),{texture:l,columns:i,rows:a,frameCount:n,frameStartTicks:[],totalTicks:0,lastFrame:-1}}(i),nl.set(e,a)),n=0,(t=a).frameStartTicks=r.map(e=>{let t=n;return n+=e.frameCount,t}),t.totalTicks=n,a},[e,i,r]);return(0,ns.useTick)(e=>{let r=t?function(e,t){if(0===e.totalTicks)return 0;let r=t%e.totalTicks,{frameStartTicks:n}=e;for(let e=n.length-1;e>=0;e--)if(r>=n[e])return e;return 0}(a,e):0;!function(e,t){if(t===e.lastFrame)return;e.lastFrame=t;let r=t%e.columns,n=e.rows-1-Math.floor(t/e.columns);e.texture.offset.set(r/e.columns,n/e.rows)}(a,r)}),a.texture}("textures/".concat(l,".ifl")),d=n&&ni(n),f=(0,el.useMemo)(()=>nc(r,c,u,d),[r,c,u,d]);return Array.isArray(f)?(0,es.jsxs)(es.Fragment,{children:[(0,es.jsx)("mesh",{geometry:a||i,castShadow:o,receiveShadow:s,children:(0,es.jsx)("primitive",{object:f[0],attach:"material"})}),(0,es.jsx)("mesh",{geometry:i,castShadow:o,receiveShadow:s,children:(0,es.jsx)("primitive",{object:f[1],attach:"material"})})]}):(0,es.jsx)("mesh",{geometry:i,castShadow:o,receiveShadow:s,children:(0,es.jsx)("primitive",{object:f,attach:"material"})})}),nf=(0,el.memo)(function(e){var t;let{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:o=!1,receiveShadow:s=!1}=e,l=r.userData.resource_path,u=new Set(null!=(t=r.userData.flag_names)?t:[]),c=(0,el.useMemo)(()=>(l||console.warn('No resource_path was found on "'.concat(n,'" - rendering fallback.')),l?(0,tM.textureToUrl)(l):tM.FALLBACK_TEXTURE_URL),[l,n]),d=n&&ni(n),f=u.has("Translucent"),h=(0,tT.useTexture)(c,e=>d||f?(0,tS.setupAlphaTestedTexture)(e):(0,tS.setupColor)(e)),m=(0,el.useMemo)(()=>nc(r,h,u,d),[r,h,u,d]);return Array.isArray(m)?(0,es.jsxs)(es.Fragment,{children:[(0,es.jsx)("mesh",{geometry:a||i,castShadow:o,receiveShadow:s,children:(0,es.jsx)("primitive",{object:m[0],attach:"material"})}),(0,es.jsx)("mesh",{geometry:i,castShadow:o,receiveShadow:s,children:(0,es.jsx)("primitive",{object:m[1],attach:"material"})})]}):(0,es.jsx)("mesh",{geometry:i,castShadow:o,receiveShadow:s,children:(0,es.jsx)("primitive",{object:m,attach:"material"})})}),nh=(0,el.memo)(function(e){var t;let{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:o=!1,receiveShadow:s=!1}=e,l=new Set(null!=(t=r.userData.flag_names)?t:[]).has("IflMaterial"),u=r.userData.resource_path;return l&&u?(0,es.jsx)(nd,{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:o,receiveShadow:s}):r.name?(0,es.jsx)(nf,{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:o,receiveShadow:s}):null});function nm(e){let{color:t,label:r}=e;return(0,es.jsxs)("mesh",{children:[(0,es.jsx)("boxGeometry",{args:[10,10,10]}),(0,es.jsx)("meshStandardMaterial",{color:t,wireframe:!0}),r?(0,es.jsx)(rq.FloatingLabel,{color:t,children:r}):null]})}function np(e){let{color:t,label:r}=e,{debugMode:n}=(0,tD.useDebug)();return n?(0,es.jsx)(nm,{color:t,label:r}):null}function nA(e){let{shapeName:t,loadingColor:r="yellow",children:n}=e;return t?(0,es.jsx)(tX,{fallback:(0,es.jsx)(np,{color:"red",label:t}),children:(0,es.jsxs)(el.Suspense,{fallback:(0,es.jsx)(nm,{color:r}),children:[(0,es.jsx)(ng,{}),n]})}):(0,es.jsx)(np,{color:"orange"})}let ng=(0,el.memo)(function(){let{shapeName:e,isOrganic:t}=(0,el.useContext)(na),{debugMode:r}=(0,tD.useDebug)(),{nodes:n}=rX((0,tM.shapeToUrl)(e)),i=(0,el.useMemo)(()=>{let e=Object.values(n).filter(e=>e.skeleton);if(e.length>0){var t=e[0].skeleton;let r=new Set;return t.bones.forEach((e,t)=>{e.name.match(/^Hulk/i)&&r.add(t)}),r}return new Set},[n]),a=(0,el.useMemo)(()=>Object.entries(n).filter(e=>{let[t,r]=e;return r.material&&"Unassigned"!==r.material.name&&!r.name.match(/^Hulk/i)}).map(e=>{let[r,n]=e,a=function(e,t){if(0===t.size||!e.attributes.skinIndex)return e;let r=e.attributes.skinIndex,n=e.attributes.skinWeight,i=e.index,a=Array(r.count).fill(!1);for(let e=0;e.01&&t.has(o)){a[e]=!0;break}}if(i){let t=[],r=i.array;for(let e=0;e1){let t=0,r=0,n=0;for(let a of e)t+=i[3*a],r+=i[3*a+1],n+=i[3*a+2];let a=Math.sqrt(t*t+r*r+n*n);for(let o of(a>0&&(t/=a,r/=a,n/=a),e))i[3*o]=t,i[3*o+1]=r,i[3*o+2]=n}if(r.needsUpdate=!0,t){let e=(o=a.clone()).attributes.normal,t=e.array;for(let e=0;e{let{node:r,geometry:n,backGeometry:i}=t;return(0,es.jsx)(el.Suspense,{fallback:(0,es.jsx)("mesh",{geometry:n,children:(0,es.jsx)("meshStandardMaterial",{color:"gray",wireframe:!0})}),children:r.material?Array.isArray(r.material)?r.material.map((t,r)=>(0,es.jsx)(nh,{material:t,shapeName:e,geometry:n,backGeometry:i,castShadow:o,receiveShadow:o},r)):(0,es.jsx)(nh,{material:r.material,shapeName:e,geometry:n,backGeometry:i,castShadow:o,receiveShadow:o}):null},r.id)}),r?(0,es.jsx)(rq.FloatingLabel,{children:e}):null]})});var nv=e.i(6112);let nB={1:"Storm",2:"Inferno"},nC=(0,el.createContext)(null);function ny(){let e=(0,el.useContext)(nC);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function nb(e){let{children:t}=e,{camera:r}=(0,tx.useThree)(),[n,i]=(0,el.useState)(0),[a,o]=(0,el.useState)({}),s=(0,el.useCallback)(e=>{o(t=>({...t,[e.id]:e}))},[]),l=(0,el.useCallback)(e=>{o(t=>{let{[e.id]:r,...n}=t;return n})},[]),u=Object.keys(a).length,c=(0,el.useCallback)(()=>{i(e=>0===u?0:(e+1)%u)},[u]),d=(0,el.useCallback)(e=>{e>=0&&e{if(n({registerCamera:s,unregisterCamera:l,nextCamera:c,setCameraIndex:d,cameraCount:u}),[s,l,c,d,u]);return(0,es.jsx)(nC.Provider,{value:f,children:t})}let nM=(0,el.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),nE={AudioEmitter:function(e){let{audioEnabled:t}=(0,tD.useSettings)();return t?(0,es.jsx)(nM,{...e}):null},Camera:function(e){let{object:t}=e,{registerCamera:r,unregisterCamera:n}=ny(),i=(0,el.useId)(),a=(0,tF.getProperty)(t,"dataBlock"),o=(0,el.useMemo)(()=>(0,tF.getPosition)(t),[t]),s=(0,el.useMemo)(()=>(0,tF.getRotation)(t),[t]);return(0,el.useEffect)(()=>{if("Observer"===a){let e={id:i,position:new ef.Vector3(...o),rotation:s};return r(e),()=>{n(e)}}},[i,a,r,n,o,s]),null},ForceFieldBare:(0,el.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:r9,Item:function(e){var t,r;let{object:n}=e,i=tK(),a=null!=(t=(0,tF.getProperty)(n,"dataBlock"))?t:"",o=(0,nv.useDatablock)(a),s=(0,el.useMemo)(()=>(0,tF.getPosition)(n),[n]),l=(0,el.useMemo)(()=>(0,tF.getScale)(n),[n]),u=(0,el.useMemo)(()=>(0,tF.getRotation)(n),[n]),c=(0,tF.getProperty)(o,"shapeFile");c||console.error(" missing shape for datablock: ".concat(a));let d=(null==a?void 0:a.toLowerCase())==="flag",f=null!=(r=null==i?void 0:i.team)?r:null,h=f&&f>0?nB[f]:null,m=d&&h?"".concat(h," Flag"):null;return(0,es.jsx)(no,{shapeName:c,type:"Item",children:(0,es.jsx)("group",{position:s,quaternion:u,scale:l,children:(0,es.jsx)(nA,{shapeName:c,loadingColor:"pink",children:m?(0,es.jsx)(rq.FloatingLabel,{opacity:.6,children:m}):null})})})},SimGroup:function(e){var t;let{object:r}=e,n=tK(),i=(0,el.useMemo)(()=>{let e=null,t=!1;if(n&&n.hasTeams){if(t=!0,null!=n.team)e=n.team;else if(r._name){let t=r._name.match(/^team(\d+)$/i);t&&(e=parseInt(t[1],10))}}else r._name&&(t="teams"===r._name.toLowerCase());return{object:r,parent:n,hasTeams:t,team:e}},[r,n]);return(0,es.jsx)(tN.Provider,{value:i,children:(null!=(t=r._children)?t:[]).map((e,t)=>nx(e,t))})},Sky:function(e){var t;let{object:r}=e,{fogEnabled:n,highQualityFog:i}=(0,tD.useSettings)(),a=(0,tF.getProperty)(r,"materialList"),o=(0,el.useMemo)(()=>r4((0,tF.getProperty)(r,"SkySolidColor")),[r]),s=null!=(t=(0,tF.getInt)(r,"useSkyTextures"))?t:1,l=(0,el.useMemo)(()=>(function(e){var t,r;let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=null!=(t=(0,tF.getFloat)(e,"fogDistance"))?t:0,a=null!=(r=(0,tF.getFloat)(e,"visibleDistance"))?r:1e3,o=(0,tF.getFloat)(e,"high_fogDistance"),s=(0,tF.getFloat)(e,"high_visibleDistance"),l=n&&null!=o&&o>0?o:i,u=n&&null!=s&&s>0?s:a,c=function(e){if(!e)return new ef.Color(.5,.5,.5);let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return new ef.Color().setRGB(t,r,n).convertSRGBToLinear()}((0,tF.getProperty)(e,"fogColor")),d=[];for(let t=1;t<=3;t++){let r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!e)return null;let r=e.split(" ").map(e=>parseFloat(e));if(r.length<3)return null;let[n,i,a]=r;return n<=0||a<=i?null:{visibleDistance:n,minHeight:i,maxHeight:a,percentage:Math.max(0,Math.min(1,t))}}((0,tF.getProperty)(e,"fogVolume".concat(t)),1);r&&d.push(r)}let f=d.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:l,visibleDistance:u,fogColor:c,fogVolumes:d,fogLine:f,enabled:u>l}})(r,i),[r,i]),u=(0,el.useMemo)(()=>r4((0,tF.getProperty)(r,"fogColor")),[r]),c=o||u,d=l.enabled&&n,f=l.fogColor,{scene:h,gl:m}=(0,tx.useThree)();return(0,el.useEffect)(()=>{if(d){let e=f.clone();h.background=e,m.setClearColor(e)}else if(c){let e=c[0].clone();h.background=e,m.setClearColor(e)}else h.background=null;return()=>{h.background=null}},[h,m,d,f,c]),(0,es.jsxs)(es.Fragment,{children:[a&&s?(0,es.jsx)(el.Suspense,{fallback:null,children:(0,es.jsx)(ne,{materialList:a,fogColor:d?f:void 0,fogState:d?l:void 0},a)}):null,(0,es.jsx)(el.Suspense,{children:(0,es.jsx)(r5,{object:r})}),d?(0,es.jsx)(nr,{fogState:l}):null]})},StaticShape:function(e){var t;let{object:r}=e,n=null!=(t=(0,tF.getProperty)(r,"dataBlock"))?t:"",i=(0,nv.useDatablock)(n),a=(0,el.useMemo)(()=>(0,tF.getPosition)(r),[r]),o=(0,el.useMemo)(()=>(0,tF.getRotation)(r),[r]),s=(0,el.useMemo)(()=>(0,tF.getScale)(r),[r]),l=(0,tF.getProperty)(i,"shapeFile");return l||console.error(" missing shape for datablock: ".concat(n)),(0,es.jsx)(no,{shapeName:l,type:"StaticShape",children:(0,es.jsx)("group",{position:a,quaternion:o,scale:s,children:(0,es.jsx)(nA,{shapeName:l})})})},Sun:function(e){let{object:t}=e,r=(0,el.useMemo)(()=>{var e;let[r,n,i]=(null!=(e=(0,tF.getProperty)(t,"direction"))?e:"0.57735 0.57735 -0.57735").split(" ").map(e=>parseFloat(e)),a=Math.sqrt(r*r+i*i+n*n);return new ef.Vector3(r/a,i/a,n/a)},[t]),n=(0,el.useMemo)(()=>new ef.Vector3(-(5e3*r.x),-(5e3*r.y),-(5e3*r.z)),[r]),i=(0,el.useMemo)(()=>{var e;let[r,n,i]=(null!=(e=(0,tF.getProperty)(t,"color"))?e:"0.7 0.7 0.7 1").split(" ").map(e=>parseFloat(e));return new ef.Color(r,n,i)},[t]),a=(0,el.useMemo)(()=>{var e;let[r,n,i]=(null!=(e=(0,tF.getProperty)(t,"ambient"))?e:"0.5 0.5 0.5 1").split(" ").map(e=>parseFloat(e));return new ef.Color(r,n,i)},[t]);return(0,es.jsxs)(es.Fragment,{children:[(0,es.jsx)("directionalLight",{position:n,color:i,intensity:1,castShadow:!0,"shadow-mapSize-width":8192,"shadow-mapSize-height":8192,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-3e-4,"shadow-normalBias":.5}),(0,es.jsx)("ambientLight",{color:a,intensity:1})]})},TerrainBlock:tJ,TSStatic:function(e){let{object:t}=e,r=(0,tF.getProperty)(t,"shapeName"),n=(0,el.useMemo)(()=>(0,tF.getPosition)(t),[t]),i=(0,el.useMemo)(()=>(0,tF.getRotation)(t),[t]),a=(0,el.useMemo)(()=>(0,tF.getScale)(t),[t]);return r||console.error(" missing shapeName for object",t),(0,es.jsx)(no,{shapeName:r,type:"TSStatic",children:(0,es.jsx)("group",{position:n,quaternion:i,scale:a,children:(0,es.jsx)(nA,{shapeName:r})})})},Turret:function(e){var t;let{object:r}=e,n=null!=(t=(0,tF.getProperty)(r,"dataBlock"))?t:"",i=(0,tF.getProperty)(r,"initialBarrel"),a=(0,nv.useDatablock)(n),o=(0,nv.useDatablock)(i),s=(0,el.useMemo)(()=>(0,tF.getPosition)(r),[r]),l=(0,el.useMemo)(()=>(0,tF.getRotation)(r),[r]),u=(0,el.useMemo)(()=>(0,tF.getScale)(r),[r]),c=(0,tF.getProperty)(a,"shapeFile"),d=(0,tF.getProperty)(o,"shapeFile");return c||console.error(" missing shape for datablock: ".concat(n)),i&&!d&&console.error(" missing shape for barrel datablock: ".concat(i)),(0,es.jsx)(no,{shapeName:c,type:"Turret",children:(0,es.jsxs)("group",{position:s,quaternion:l,scale:u,children:[(0,es.jsx)(nA,{shapeName:c}),d?(0,es.jsx)(no,{shapeName:d,type:"Turret",children:(0,es.jsx)("group",{position:[0,1.5,0],children:(0,es.jsx)(nA,{shapeName:d})})}):null]})})},WaterBlock:(0,el.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function(e){let{object:t}=e;tK();let r=(0,el.useMemo)(()=>(0,tF.getPosition)(t),[t]),n=(0,tF.getProperty)(t,"name");return n?(0,es.jsx)(rq.FloatingLabel,{position:r,opacity:.6,children:n}):null}};function nx(e,t){let r=nE[e._className];return r?(0,es.jsx)(el.Suspense,{children:(0,es.jsx)(r,{object:e})},t):null}var nF=e.i(86608),nS=e.i(38433),nT=e.i(33870),nw=e.i(91996);let nR=async e=>{let t;try{t=(0,tM.getUrlForPath)(e)}catch(t){return console.warn("Script not in manifest: ".concat(e," (").concat(t,")")),null}try{let r=await fetch(t);if(!r.ok)return console.error("Script fetch failed: ".concat(e," (").concat(r.status,")")),null;return await r.text()}catch(t){return console.error("Script fetch error: ".concat(e)),console.error(t),null}},nI=(0,nT.createScriptCache)(),nD={findFiles:e=>{let t=(0,tb.default)(e,{nocase:!0});return(0,nw.getResourceList)().filter(e=>t(e)).map(e=>{let[t,r]=(0,nw.getSourceAndPath)(e);return r})},isFile:e=>null!=(0,nw.getResourceMap)()[(0,nw.getResourceKey)(e)]},nG=(0,el.memo)(function(e){let{name:t,onLoadingChange:r}=e,{data:n}=ty({queryKey:["parsedMission",t],queryFn:()=>(0,tM.loadMission)(t)},tt,void 0),{missionGroup:i,runtime:a,progress:o}=function(e,t){let[r,n]=(0,el.useState)({missionGroup:void 0,runtime:void 0,progress:0});return(0,el.useEffect)(()=>{if(!t)return;let r=new AbortController,i=t.missionTypes[0],a=(0,nS.createProgressTracker)(),o=()=>{n(e=>({...e,progress:a.progress}))};a.on("update",o);let{runtime:s}=(0,nF.runServer)({missionName:e,missionType:i,runtimeOptions:{loadScript:nR,fileSystem:nD,cache:nI,signal:r.signal,progress:a,ignoreScripts:["scripts/admin.cs","scripts/ai.cs","scripts/aiBotProfiles.cs","scripts/aiBountyGame.cs","scripts/aiChat.cs","scripts/aiCnH.cs","scripts/aiCTF.cs","scripts/aiDeathMatch.cs","scripts/aiDebug.cs","scripts/aiDefaultTasks.cs","scripts/aiDnD.cs","scripts/aiHumanTasks.cs","scripts/aiHunters.cs","scripts/aiInventory.cs","scripts/aiObjectiveBuilder.cs","scripts/aiObjectives.cs","scripts/aiRabbit.cs","scripts/aiSiege.cs","scripts/aiTDM.cs","scripts/aiTeamHunters.cs","scripts/deathMessages.cs","scripts/graphBuild.cs","scripts/navGraph.cs","scripts/serverTasks.cs","scripts/spdialog.cs"]},onMissionLoadDone:()=>{n({missionGroup:s.getObjectByName("MissionGroup"),runtime:s,progress:1})}});return()=>{a.off("update",o),r.abort(),s.destroy()}},[e,t]),r}(t,n),s=!i||!a;return((0,el.useEffect)(()=>{null==r||r(s,o)},[s,o,r]),s)?null:(0,es.jsx)(t_.RuntimeProvider,{runtime:a,children:nx(i)})});function nL(e,t){var r=eB(e,t,"update");if(r.set){if(!r.get)throw TypeError("attempted to read set only private field");return"__destrWrapper"in r||(r.__destrWrapper={set value(v){r.set.call(e,v)},get value(){return r.get.call(e)}}),r.__destrWrapper}if(!r.writable)throw TypeError("attempted to set read only private field");return r}var nP=(K=new WeakMap,class extends eF{build(e,t,r){var n;let i=t.queryKey,a=null!=(n=t.queryHash)?n:eO(i,t),o=this.get(a);return o||(o=new e5({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){eC(this,K).has(e.queryHash)||(eC(this,K).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=eC(this,K).get(e.queryHash);t&&(e.destroy(),t===e&&eC(this,K).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ez.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return eC(this,K).get(e)}getAll(){return[...eC(this,K).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>eP(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.getAll();return Object.keys(e).length>0?t.filter(t=>eP(e,t)):t}notify(e){ez.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ez.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ez.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}constructor(e={}){super(),eb(this,K,{writable:!0,value:void 0}),this.config=e,eM(this,K,new Map)}}),nH=(Q=new WeakMap,W=new WeakMap,V=new WeakMap,X=new WeakMap,q=new WeakSet,class extends e3{setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){eC(this,W).includes(e)||(eC(this,W).push(e),this.clearGcTimeout(),eC(this,V).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){eM(this,W,eC(this,W).filter(t=>t!==e)),this.scheduleGc(),eC(this,V).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){eC(this,W).length||("pending"===this.state.status?this.scheduleGc():eC(this,V).remove(this))}continue(){var e,t;return null!=(t=null==(e=eC(this,X))?void 0:e.continue())?t:this.execute(this.state.variables)}async execute(e){var t,r,n,i,a,o,s,l,u,c,d,f,h,m,p,A,g,B,C,y,b;let M=()=>{eE(this,q,nO).call(this,{type:"continue"})},E={client:eC(this,Q),meta:this.options.meta,mutationKey:this.options.mutationKey};eM(this,X,e8({fn:()=>this.options.mutationFn?this.options.mutationFn(e,E):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{eE(this,q,nO).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{eE(this,q,nO).call(this,{type:"pause"})},onContinue:M,retry:null!=(t=this.options.retry)?t:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>eC(this,V).canRun(this)}));let x="pending"===this.state.status,F=!eC(this,X).canStart();try{if(x)M();else{eE(this,q,nO).call(this,{type:"pending",variables:e,isPaused:F}),await (null==(c=(d=eC(this,V).config).onMutate)?void 0:c.call(d,e,this,E));let t=await (null==(f=(h=this.options).onMutate)?void 0:f.call(h,e,E));t!==this.state.context&&eE(this,q,nO).call(this,{type:"pending",context:t,variables:e,isPaused:F})}let t=await eC(this,X).start();return await (null==(r=(n=eC(this,V).config).onSuccess)?void 0:r.call(n,t,e,this.state.context,this,E)),await (null==(i=(a=this.options).onSuccess)?void 0:i.call(a,t,e,this.state.context,E)),await (null==(o=(s=eC(this,V).config).onSettled)?void 0:o.call(s,t,null,this.state.variables,this.state.context,this,E)),await (null==(l=(u=this.options).onSettled)?void 0:l.call(u,t,null,e,this.state.context,E)),eE(this,q,nO).call(this,{type:"success",data:t}),t}catch(t){try{throw await (null==(m=(p=eC(this,V).config).onError)?void 0:m.call(p,t,e,this.state.context,this,E)),await (null==(A=(g=this.options).onError)?void 0:A.call(g,t,e,this.state.context,E)),await (null==(B=(C=eC(this,V).config).onSettled)?void 0:B.call(C,void 0,t,this.state.variables,this.state.context,this,E)),await (null==(y=(b=this.options).onSettled)?void 0:y.call(b,void 0,t,e,this.state.context,E)),t}finally{eE(this,q,nO).call(this,{type:"error",error:t})}}finally{eC(this,V).runNext(this)}}constructor(e){super(),ex(this,q),eb(this,Q,{writable:!0,value:void 0}),eb(this,W,{writable:!0,value:void 0}),eb(this,V,{writable:!0,value:void 0}),eb(this,X,{writable:!0,value:void 0}),eM(this,Q,e.client),this.mutationId=e.mutationId,eM(this,V,e.mutationCache),eM(this,W,[]),this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}});function nO(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),ez.batch(()=>{eC(this,W).forEach(t=>{t.onMutationUpdate(e)}),eC(this,V).notify({mutation:this,type:"updated",action:e})})}var nk=(Y=new WeakMap,Z=new WeakMap,z=new WeakMap,class extends eF{build(e,t,r){let n=new nH({client:e,mutationCache:this,mutationId:++nL(this,z).value,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){eC(this,Y).add(e);let t=n_(e);if("string"==typeof t){let r=eC(this,Z).get(t);r?r.push(e):eC(this,Z).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(eC(this,Y).delete(e)){let t=n_(e);if("string"==typeof t){let r=eC(this,Z).get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&eC(this,Z).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=n_(e);if("string"!=typeof t)return!0;{let r=eC(this,Z).get(t),n=null==r?void 0:r.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=n_(e);if("string"!=typeof t)return Promise.resolve();{var r,n;let i=null==(r=eC(this,Z).get(t))?void 0:r.find(t=>t!==e&&t.state.isPaused);return null!=(n=null==i?void 0:i.continue())?n:Promise.resolve()}}clear(){ez.batch(()=>{eC(this,Y).forEach(e=>{this.notify({type:"removed",mutation:e})}),eC(this,Y).clear(),eC(this,Z).clear()})}getAll(){return Array.from(eC(this,Y))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>eH(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getAll().filter(t=>eH(e,t))}notify(e){ez.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ez.batch(()=>Promise.all(e.map(e=>e.continue().catch(eR))))}constructor(e={}){super(),eb(this,Y,{writable:!0,value:void 0}),eb(this,Z,{writable:!0,value:void 0}),eb(this,z,{writable:!0,value:void 0}),this.config=e,eM(this,Y,new Set),eM(this,Z,new Map),eM(this,z,0)}});function n_(e){var t;return null==(t=e.options.scope)?void 0:t.id}function nU(e){return{onFetch:(t,r)=>{var n,i,a,o,s;let l=t.options,u=null==(a=t.fetchOptions)||null==(i=a.meta)||null==(n=i.fetchMore)?void 0:n.direction,c=(null==(o=t.state.data)?void 0:o.pages)||[],d=(null==(s=t.state.data)?void 0:s.pageParams)||[],f={pages:[],pageParams:[]},h=0,m=async()=>{let r=!1,n=eq(t.options,t.fetchOptions),i=async(e,i,a)=>{if(r)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);let o=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:i,direction:a?"backward":"forward",meta:t.options.meta};return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)}),e})(),s=await n(o),{maxPages:l}=t.options,u=a?eV:eW;return{pages:u(e.pages,s,l),pageParams:u(e.pageParams,i,l)}};if(u&&c.length){let e="backward"===u,t={pages:c,pageParams:d},r=(e?function(e,t){var r;let{pages:n,pageParams:i}=t;return n.length>0?null==(r=e.getPreviousPageParam)?void 0:r.call(e,n[0],n,i[0],i):void 0}:nj)(l,t);f=await i(t,r,e)}else{let t=null!=e?e:c.length;do{var a;let e=0===h?null!=(a=d[0])?a:l.initialPageParam:nj(l,f);if(h>0&&null==e)break;f=await i(f,e),h++}while(h{var e,n;return null==(e=(n=t.options).persister)?void 0:e.call(n,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=m}}}function nj(e,t){let{pages:r,pageParams:n}=t,i=r.length-1;return r.length>0?e.getNextPageParam(r[i],r,n[i],n):void 0}var nJ=($=new WeakMap,ee=new WeakMap,et=new WeakMap,er=new WeakMap,en=new WeakMap,ei=new WeakMap,ea=new WeakMap,eo=new WeakMap,class{mount(){nL(this,ei).value++,1===eC(this,ei)&&(eM(this,ea,eY.subscribe(async e=>{e&&(await this.resumePausedMutations(),eC(this,$).onFocus())})),eM(this,eo,e$.subscribe(async e=>{e&&(await this.resumePausedMutations(),eC(this,$).onOnline())})))}unmount(){var e,t;nL(this,ei).value--,0===eC(this,ei)&&(null==(e=eC(this,ea))||e.call(this),eM(this,ea,void 0),null==(t=eC(this,eo))||t.call(this),eM(this,eo,void 0))}isFetching(e){return eC(this,$).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return eC(this,ee).findAll({...e,status:"pending"}).length}getQueryData(e){var t;let r=this.defaultQueryOptions({queryKey:e});return null==(t=eC(this,$).get(r.queryHash))?void 0:t.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=eC(this,$).build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(eG(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return eC(this,$).findAll(e).map(e=>{let{queryKey:t,state:r}=e;return[t,r.data]})}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),i=eC(this,$).get(n.queryHash),a=null==i?void 0:i.state.data,o="function"==typeof t?t(a):t;if(void 0!==o)return eC(this,$).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return ez.batch(()=>eC(this,$).findAll(e).map(e=>{let{queryKey:n}=e;return[n,this.setQueryData(n,t,r)]}))}getQueryState(e){var t;let r=this.defaultQueryOptions({queryKey:e});return null==(t=eC(this,$).get(r.queryHash))?void 0:t.state}removeQueries(e){let t=eC(this,$);ez.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=eC(this,$);return ez.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={revert:!0,...t};return Promise.all(ez.batch(()=>eC(this,$).findAll(e).map(e=>e.cancel(r)))).then(eR).catch(eR)}invalidateQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ez.batch(()=>{var r,n;return(eC(this,$).findAll(e).forEach(e=>{e.invalidate()}),(null==e?void 0:e.refetchType)==="none")?Promise.resolve():this.refetchQueries({...e,type:null!=(n=null!=(r=null==e?void 0:e.refetchType)?r:null==e?void 0:e.type)?n:"active"},t)})}refetchQueries(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={...r,cancelRefetch:null==(t=r.cancelRefetch)||t};return Promise.all(ez.batch(()=>eC(this,$).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(eR)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(eR)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=eC(this,$).build(this,t);return r.isStaleByTime(eG(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(eR).catch(eR)}fetchInfiniteQuery(e){return e.behavior=nU(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(eR).catch(eR)}ensureInfiniteQueryData(e){return e.behavior=nU(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return e$.isOnline()?eC(this,ee).resumePausedMutations():Promise.resolve()}getQueryCache(){return eC(this,$)}getMutationCache(){return eC(this,ee)}getDefaultOptions(){return eC(this,et)}setDefaultOptions(e){eM(this,et,e)}setQueryDefaults(e,t){eC(this,er).set(ek(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...eC(this,er).values()],r={};return t.forEach(t=>{e_(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){eC(this,en).set(ek(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...eC(this,en).values()],r={};return t.forEach(t=>{e_(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...eC(this,et).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=eO(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===eX&&(t.enabled=!1),t}defaultMutationOptions(e){return(null==e?void 0:e._defaulted)?e:{...eC(this,et).mutations,...(null==e?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){eC(this,$).clear(),eC(this,ee).clear()}constructor(e={}){eb(this,$,{writable:!0,value:void 0}),eb(this,ee,{writable:!0,value:void 0}),eb(this,et,{writable:!0,value:void 0}),eb(this,er,{writable:!0,value:void 0}),eb(this,en,{writable:!0,value:void 0}),eb(this,ei,{writable:!0,value:void 0}),eb(this,ea,{writable:!0,value:void 0}),eb(this,eo,{writable:!0,value:void 0}),eM(this,$,e.queryCache||new nP),eM(this,ee,e.mutationCache||new nk),eM(this,et,e.defaultOptions||{}),eM(this,er,new Map),eM(this,en,new Map),eM(this,ei,0)}}),nN=e.i(8155);let nK=e=>e,nQ=e=>{let t=(0,nN.createStore)(e),r=e=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nK,r=el.default.useSyncExternalStore(e.subscribe,el.default.useCallback(()=>t(e.getState()),[e,t]),el.default.useCallback(()=>t(e.getInitialState()),[e,t]));return el.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},nW=el.createContext(null);function nV(e){let{map:t,children:r,onChange:n,domElement:i}=e,a=t.map(e=>e.name+e.keys).join("-"),o=el.useMemo(()=>{let e,r;return e=()=>t.reduce((e,t)=>({...e,[t.name]:!1}),{}),(r=(t,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let a=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,o=e(n.getState());a=r=>{let n=e(r);if(!i(o,n)){let e=o;t(o=n,e)}},(null==r?void 0:r.fireImmediately)&&t(o,o)}return i(a)},e(t,r,n)})?nQ(r):nQ},[a]),s=el.useMemo(()=>[o.subscribe,o.getState,o],[a]),l=o.setState;return el.useEffect(()=>{let e=t.map(e=>{let{name:t,keys:r,up:i}=e;return{keys:r,up:i,fn:e=>{l({[t]:e}),n&&n(t,e,s[1]())}}}).reduce((e,t)=>{let{keys:r,fn:n,up:i=!0}=t;return r.forEach(t=>e[t]={fn:n,pressed:!1,up:i}),e},{}),r=t=>{let{key:r,code:n}=t,i=e[r]||e[n];if(!i)return;let{fn:a,pressed:o,up:s}=i;i.pressed=!0,(s||!o)&&a(!0)},a=t=>{let{key:r,code:n}=t,i=e[r]||e[n];if(!i)return;let{fn:a,up:o}=i;i.pressed=!1,o&&a(!1)},o=i||window;return o.addEventListener("keydown",r,{passive:!0}),o.addEventListener("keyup",a,{passive:!0}),()=>{o.removeEventListener("keydown",r),o.removeEventListener("keyup",a)}},[i,a]),el.createElement(nW.Provider,{value:s,children:r})}var nX=Object.defineProperty;class nq{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,n=r.length;t((e,t,r)=>t in e?nX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r))(this,"_listeners")}}var nY=Object.defineProperty,nZ=(e,t,r)=>(((e,t,r)=>t in e?nY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),r);let nz=new ef.Euler(0,0,0,"YXZ"),n$=new ef.Vector3,n0={type:"change"},n1={type:"lock"},n9={type:"unlock"},n2=Math.PI/2;class n8 extends nq{constructor(e,t){super(),nZ(this,"camera"),nZ(this,"domElement"),nZ(this,"isLocked"),nZ(this,"minPolarAngle"),nZ(this,"maxPolarAngle"),nZ(this,"pointerSpeed"),nZ(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(nz.setFromQuaternion(this.camera.quaternion),nz.y-=.002*e.movementX*this.pointerSpeed,nz.x-=.002*e.movementY*this.pointerSpeed,nz.x=Math.max(n2-this.maxPolarAngle,Math.min(n2-this.minPolarAngle,nz.x)),this.camera.quaternion.setFromEuler(nz),this.dispatchEvent(n0))}),nZ(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(n1),this.isLocked=!0):(this.dispatchEvent(n9),this.isLocked=!1))}),nZ(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),nZ(this,"connect",e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),nZ(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),nZ(this,"dispose",()=>{this.disconnect()}),nZ(this,"getObject",()=>this.camera),nZ(this,"direction",new ef.Vector3(0,0,-1)),nZ(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),nZ(this,"moveForward",e=>{n$.setFromMatrixColumn(this.camera.matrix,0),n$.crossVectors(this.camera.up,n$),this.camera.position.addScaledVector(n$,e)}),nZ(this,"moveRight",e=>{n$.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(n$,e)}),nZ(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),nZ(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}var n3=function(e){return e.forward="forward",e.backward="backward",e.left="left",e.right="right",e.up="up",e.down="down",e.camera1="camera1",e.camera2="camera2",e.camera3="camera3",e.camera4="camera4",e.camera5="camera5",e.camera6="camera6",e.camera7="camera7",e.camera8="camera8",e.camera9="camera9",e}(n3||{});function n5(){let{speedMultiplier:e,setSpeedMultiplier:t}=(0,tD.useControls)(),[r,n]=function(e){let[t,r,n]=el.useContext(nW);return[t,r]}(),{camera:i,gl:a}=(0,tx.useThree)(),{nextCamera:o,setCameraIndex:s,cameraCount:l}=ny(),u=(0,el.useRef)(null),c=(0,el.useRef)(new ef.Vector3),d=(0,el.useRef)(new ef.Vector3),f=(0,el.useRef)(new ef.Vector3);return(0,el.useEffect)(()=>{let e=new n8(i,a.domElement);u.current=e;let t=t=>{e.isLocked?o():t.target===a.domElement&&e.lock()};return document.addEventListener("click",t),()=>{document.removeEventListener("click",t),e.dispose()}},[i,a,o]),(0,el.useEffect)(()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return r(t=>{for(let r=0;r{let e=e=>{e.preventDefault();let r=e.deltaY>0?-1:1,n=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*r;t(e=>Math.max(.1,Math.min(5,Math.round((e+n)*20)/20)))},r=a.domElement;return r.addEventListener("wheel",e,{passive:!1}),()=>{r.removeEventListener("wheel",e)}},[a]),(0,tE.useFrame)((t,r)=>{let{forward:a,backward:o,left:s,right:l,up:u,down:h}=n();(a||o||s||l||u||h)&&(i.getWorldDirection(c.current),c.current.normalize(),d.current.crossVectors(i.up,c.current).normalize(),f.current.set(0,0,0),a&&f.current.add(c.current),o&&f.current.sub(c.current),s&&f.current.add(d.current),l&&f.current.sub(d.current),u&&(f.current.y+=1),h&&(f.current.y-=1),f.current.lengthSq()>0&&(f.current.normalize().multiplyScalar(80*e*r),i.position.add(f.current)))}),null}let n6=[{name:"forward",keys:["KeyW"]},{name:"backward",keys:["KeyS"]},{name:"left",keys:["KeyA"]},{name:"right",keys:["KeyD"]},{name:"up",keys:["Space"]},{name:"down",keys:["ShiftLeft","ShiftRight"]},{name:"camera1",keys:["Digit1"]},{name:"camera2",keys:["Digit2"]},{name:"camera3",keys:["Digit3"]},{name:"camera4",keys:["Digit4"]},{name:"camera5",keys:["Digit5"]},{name:"camera6",keys:["Digit6"]},{name:"camera7",keys:["Digit7"]},{name:"camera8",keys:["Digit8"]},{name:"camera9",keys:["Digit9"]}];function n4(){return(0,el.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()};return window.addEventListener("keydown",e,{capture:!0}),window.addEventListener("keyup",e,{capture:!0}),()=>{window.removeEventListener("keydown",e,{capture:!0}),window.removeEventListener("keyup",e,{capture:!0})}},[]),(0,es.jsx)(nV,{map:n6,children:(0,es.jsx)(n5,{})})}var n7=function(){var e;return"undefined"!=typeof window&&!!(null==(e=window.document)?void 0:e.createElement)}();function ie(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function it(e){return e?"self"in e?e.self:ie(e).defaultView||window:self}function ir(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{activeElement:r}=ie(e);if(!(null==r?void 0:r.nodeName))return null;if(ia(r)&&r.contentDocument)return ir(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=ie(r).getElementById(e);if(t)return t}}return r}function ii(e,t){return e===t||e.contains(t)}function ia(e){return"IFRAME"===e.tagName}function io(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==is.indexOf(e.type)}var is=["button","color","file","image","reset","submit"];function il(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function iu(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function ic(e){return e.isContentEditable||iu(e)}function id(e){let t=0,r=0;if(iu(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let n=ie(e).getSelection();if((null==n?void 0:n.rangeCount)&&n.anchorNode&&ii(e,n.anchorNode)&&n.focusNode&&ii(e,n.focusNode)){let i=n.getRangeAt(0),a=i.cloneRange();a.selectNodeContents(e),a.setEnd(i.startContainer,i.startOffset),t=a.toString().length,a.setEnd(i.endContainer,i.endOffset),r=a.toString().length}}return{start:t,end:r}}function ih(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function im(e){if(!e)return null;let t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){let{overflowY:r}=getComputedStyle(e);if(t(r))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){let{overflowX:r}=getComputedStyle(e);if(t(r))return e}return im(e.parentElement)||document.scrollingElement||document.body}function ip(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n1?t-1:0),n=1;n{if(n){let t=setTimeout(e,n);return()=>clearTimeout(t)}let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,a,!0),r()}),a=()=>{i(),r()};return e.addEventListener(t,a,{once:!0,capture:!0}),i}function ik(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window,i=[];try{for(let a of(n.document.addEventListener(e,t,r),Array.from(n.frames)))i.push(ik(e,t,r,a))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,r)}catch(e){}for(let e of i)e()}}var i_={...el},iU=i_.useId;i_.useDeferredValue;var ij=i_.useInsertionEffect,iJ=n7?el.useLayoutEffect:el.useEffect;function iN(e){let t=(0,el.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return ij?ij(()=>{t.current=e}):t.current=e,(0,el.useCallback)(function(){for(var e,r=arguments.length,n=Array(r),i=0;i{if(t.some(Boolean))return e=>{for(let r of t)iT(r,e)}},t)}function iQ(e){if(iU){let t=iU();return e||t}let[t,r]=(0,el.useState)(e);return iJ(()=>{if(e||t)return;let n=Math.random().toString(36).slice(2,8);r("id-".concat(n))},[e,t]),e||t}function iW(e,t){let r=(0,el.useRef)(!1);(0,el.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,el.useEffect)(()=>()=>{r.current=!1},[])}function iV(){return(0,el.useReducer)(()=>[],[])}function iX(e){return iN("function"==typeof e?e:()=>e)}function iq(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=(0,el.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:n}}function iY(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,[r,n]=(0,el.useState)(null);return{portalRef:iK(n,t),portalNode:r,domReady:!e||r}}var iZ=!1,iz=!1,i$=0,i0=0;function i1(e){(function(e){let t=e.movementX||e.screenX-i$,r=e.movementY||e.screenY-i0;return i$=e.screenX,i0=e.screenY,t||r||!1})(e)&&(iz=!0)}function i9(){iz=!1}function i2(e){let t=el.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function i8(e,t){return el.memo(e,t)}function i3(e,t){let r,{wrapElement:n,render:i,...a}=t,o=iK(t.ref,i&&(0,el.isValidElement)(i)&&("ref"in i.props||"ref"in i)?({...i.props}).ref||i.ref:null);if(el.isValidElement(i)){let e={...i.props,ref:o};r=el.cloneElement(i,function(e,t){let r={...e};for(let n in t){if(!iC(t,n))continue;if("className"===n){let n="className";r[n]=e[n]?"".concat(e[n]," ").concat(t[n]):t[n];continue}if("style"===n){let n="style";r[n]=e[n]?{...e[n],...t[n]}:t[n];continue}let i=t[n];if("function"==typeof i&&n.startsWith("on")){let t=e[n];if("function"==typeof t){r[n]=function(){for(var e=arguments.length,r=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return e(t)};return t.displayName=e.name,t}function i6(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=el.createContext(void 0),n=el.createContext(void 0),i=()=>el.useContext(r),a=t=>e.reduceRight((e,r)=>(0,es.jsx)(r,{...t,children:e}),(0,es.jsx)(r.Provider,{...t}));return{context:r,scopedContext:n,useContext:i,useScopedContext:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=el.useContext(n),r=i();return e?t:t||r},useProviderContext:()=>{let e=el.useContext(n),t=i();if(!e||e!==t)return t},ContextProvider:a,ScopedContextProvider:e=>(0,es.jsx)(a,{...e,children:t.reduceRight((t,r)=>(0,es.jsx)(r,{...e,children:t}),(0,es.jsx)(n.Provider,{...e}))})}}var i4=i6(),i7=i4.useContext;i4.useScopedContext,i4.useProviderContext;var ae=i6([i4.ContextProvider],[i4.ScopedContextProvider]),at=ae.useContext;ae.useScopedContext;var ar=ae.useProviderContext,an=ae.ContextProvider,ai=ae.ScopedContextProvider,aa=(0,el.createContext)(void 0),ao=(0,el.createContext)(void 0),as=(0,el.createContext)(!0),al="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function au(e){return!(!e.matches(al)||!il(e)||e.closest("[inert]"))}function ac(e){if(!au(e)||0>Number.parseInt(e.getAttribute("tabindex")||"0",10))return!1;if(!("form"in e)||!e.form||e.checked||"radio"!==e.type)return!0;let t=e.form.elements.namedItem(e.name);if(!t||!("length"in t))return!0;let r=ir(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function ad(e,t){let r=Array.from(e.querySelectorAll(al));t&&r.unshift(e);let n=r.filter(au);return n.forEach((e,t)=>{if(ia(e)&&e.contentDocument){let r=e.contentDocument.body;n.splice(t,1,...ad(r))}}),n}function af(e,t,r){let n=Array.from(e.querySelectorAll(al)),i=n.filter(ac);return(t&&ac(e)&&i.unshift(e),i.forEach((e,t)=>{if(ia(e)&&e.contentDocument){let n=af(e.contentDocument.body,!1,r);i.splice(t,1,...n)}}),!i.length&&r)?n:i}function ah(e,t){return function(e,t,r,n){let i=ir(e),a=ad(e,t),o=a.indexOf(i),s=a.slice(o+1);return s.find(ac)||(r?a.find(ac):null)||(n?s[0]:null)||null}(document.body,!1,e,t)}function am(e,t){return function(e,t,r,n){let i=ir(e),a=ad(e,t).reverse(),o=a.indexOf(i),s=a.slice(o+1);return s.find(ac)||(r?a.find(ac):null)||(n?s[0]:null)||null}(document.body,!1,e,t)}function ap(e){let t=ir(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function aA(e){let t=ir(e);if(!t)return!1;if(ii(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector("#".concat(CSS.escape(r))))}function ag(e){!aA(e)&&au(e)&&e.focus()}var av=iI(),aB=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],aC=Symbol("safariFocusAncestor");function ay(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function ab(e,t){return iN(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var aM=!1,aE=!0;function ax(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(aE=!1)}function aF(e){e.metaKey||e.ctrlKey||e.altKey||(aE=!0)}var aS=i5(function(e){var t,r,n,i,a;let{focusable:o=!0,accessibleWhenDisabled:s,autoFocus:l,onFocusVisible:u,...c}=e,d=(0,el.useRef)(null);(0,el.useEffect)(()=>{o&&(aM||(ik("mousedown",ax,!0),ik("keydown",aF,!0),aM=!0))},[o]),av&&(0,el.useEffect)(()=>{if(!o)return;let e=d.current;if(!e||!ay(e))return;let t="labels"in e?e.labels:null;if(!t)return;let r=()=>queueMicrotask(()=>e.focus());for(let e of t)e.addEventListener("mouseup",r);return()=>{for(let e of t)e.removeEventListener("mouseup",r)}},[o]);let f=o&&ix(c),h=!!f&&!s,[m,p]=(0,el.useState)(!1);(0,el.useEffect)(()=>{o&&h&&m&&p(!1)},[o,h,m]),(0,el.useEffect)(()=>{if(!o||!m)return;let e=d.current;if(!e||"undefined"==typeof IntersectionObserver)return;let t=new IntersectionObserver(()=>{au(e)||p(!1)});return t.observe(e),()=>t.disconnect()},[o,m]);let A=ab(c.onKeyPressCapture,f),g=ab(c.onMouseDownCapture,f),B=ab(c.onClickCapture,f),C=c.onMouseDown,y=iN(e=>{if(null==C||C(e),e.defaultPrevented||!o)return;let t=e.currentTarget;if(!av||iD(e)||!io(t)&&!ay(t))return;let r=!1,n=()=>{r=!0};t.addEventListener("focusin",n,{capture:!0,once:!0});let i=function(e){for(;e&&!au(e);)e=e.closest(al);return e||null}(t.parentElement);i&&(i[aC]=!0),iO(t,"mouseup",()=>{t.removeEventListener("focusin",n,!0),i&&(i[aC]=!1),r||ag(t)})}),b=(e,t)=>{if(t&&(e.currentTarget=t),!o)return;let r=e.currentTarget;r&&ap(r)&&(null==u||u(e),e.defaultPrevented||(r.dataset.focusVisible="true",p(!0)))},M=c.onKeyDownCapture,E=iN(e=>{if(null==M||M(e),e.defaultPrevented||!o||m||e.metaKey||e.altKey||e.ctrlKey||!iG(e))return;let t=e.currentTarget;iO(t,"focusout",()=>b(e,t))}),x=c.onFocusCapture,F=iN(e=>{if(null==x||x(e),e.defaultPrevented||!o)return;if(!iG(e))return void p(!1);let t=e.currentTarget;aE||function(e){let{tagName:t,readOnly:r,type:n}=e;return"TEXTAREA"===t&&!r||"SELECT"===t&&!r||("INPUT"!==t||r?!!e.isContentEditable||"combobox"===e.getAttribute("role")&&!!e.dataset.name:aB.includes(n))}(e.target)?iO(e.target,"focusout",()=>b(e,t)):p(!1)}),S=c.onBlur,T=iN(e=>{null==S||S(e),o&&iH(e)&&(e.currentTarget.removeAttribute("data-focus-visible"),p(!1))}),w=(0,el.useContext)(as),R=iN(e=>{o&&l&&e&&w&&queueMicrotask(()=>{!ap(e)&&au(e)&&e.focus()})}),I=function(e,t){let r=e=>{if("string"==typeof e)return e},[n,i]=(0,el.useState)(()=>r(void 0));return iJ(()=>{let t=e&&"current"in e?e.current:e;i((null==t?void 0:t.tagName.toLowerCase())||r(void 0))},[e,t]),n}(d),D=o&&(!I||"button"===I||"summary"===I||"input"===I||"select"===I||"textarea"===I||"a"===I),G=o&&(!I||"button"===I||"input"===I||"select"===I||"textarea"===I),L=c.style,P=(0,el.useMemo)(()=>h?{pointerEvents:"none",...L}:L,[h,L]);return c={"data-focus-visible":o&&m||void 0,"data-autofocus":l||void 0,"aria-disabled":f||void 0,...c,ref:iK(d,R,c.ref),style:P,tabIndex:(t=o,r=h,n=D,i=G,a=c.tabIndex,t?r?n&&!i?-1:void 0:n?a:a||0:a),disabled:!!G&&!!h||void 0,contentEditable:f?void 0:c.contentEditable,onKeyPressCapture:A,onClickCapture:B,onMouseDownCapture:g,onMouseDown:y,onKeyDownCapture:E,onFocusCapture:F,onBlur:T},iF(c)});function aT(e){let t=[];for(let r of e)t.push(...r);return t}function aw(e){return e.slice().reverse()}function aR(e,t,r){return iN(n=>{var i;if(null==t||t(n),n.defaultPrevented||n.isPropagationStopped()||!iG(n)||"Shift"===n.key||"Control"===n.key||"Alt"===n.key||"Meta"===n.key||function(e){let t=e.target;return(!t||!!iu(t))&&1===e.key.length&&!e.ctrlKey&&!e.metaKey}(n))return;let a=e.getState(),o=null==(i=iA(e,a.activeId))?void 0:i.element;if(!o)return;let{view:s,...l}=n;o!==(null==r?void 0:r.current)&&o.focus(),!function(e,t,r){let n=new KeyboardEvent(t,r);return e.dispatchEvent(n)}(o,n.type,l)&&n.preventDefault(),n.currentTarget.contains(o)&&n.stopPropagation()})}i2(function(e){return i3("div",aS(e))});var aI=i5(function(e){let{store:t,composite:r=!0,focusOnMove:n=r,moveOnKeyPress:i=!0,...a}=e,o=ar();iM(t=t||o,!1);let s=(0,el.useRef)(null),l=(0,el.useRef)(null),u=function(e){let[t,r]=(0,el.useState)(!1),n=(0,el.useCallback)(()=>r(!0),[]),i=e.useState(t=>iA(e,t.activeId));return(0,el.useEffect)(()=>{let e=null==i?void 0:i.element;t&&e&&(r(!1),e.focus({preventScroll:!0}))},[i,t]),n}(t),c=t.useState("moves"),[,d]=function(e){let[t,r]=(0,el.useState)(null);return iJ(()=>{if(null==t||!e)return;let r=null;return e(e=>(r=e,t)),()=>{e(r)}},[t,e]),[t,r]}(r?t.setBaseElement:null);(0,el.useEffect)(()=>{var e;if(!t||!c||!r||!n)return;let{activeId:i}=t.getState(),a=null==(e=iA(t,i))?void 0:e.element;a&&("scrollIntoView"in a?(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",inline:"nearest",...void 0})):a.focus())},[t,c,r,n]),iJ(()=>{if(!t||!c||!r)return;let{baseElement:e,activeId:n}=t.getState();if(null!==n||!e)return;let i=l.current;l.current=null,i&&iL(i,{relatedTarget:e}),ap(e)||e.focus()},[t,c,r]);let f=t.useState("activeId"),h=t.useState("virtualFocus");iJ(()=>{var e;if(!t||!r||!h)return;let n=l.current;if(l.current=null,!n)return;let i=(null==(e=iA(t,f))?void 0:e.element)||ir(n);i!==n&&iL(n,{relatedTarget:i})},[t,f,h,r]);let m=aR(t,a.onKeyDownCapture,l),p=aR(t,a.onKeyUpCapture,l),A=a.onFocusCapture,g=iN(e=>{if(null==A||A(e),e.defaultPrevented||!t)return;let{virtualFocus:r}=t.getState();if(!r)return;let n=e.relatedTarget,i=function(e){let t=e[ig];return delete e[ig],t}(e.currentTarget);iG(e)&&i&&(e.stopPropagation(),l.current=n)}),B=a.onFocus,C=iN(e=>{if(null==B||B(e),e.defaultPrevented||!r||!t)return;let{relatedTarget:n}=e,{virtualFocus:i}=t.getState();i?iG(e)&&!iv(t,n)&&queueMicrotask(u):iG(e)&&t.setActiveId(null)}),y=a.onBlurCapture,b=iN(e=>{var r;if(null==y||y(e),e.defaultPrevented||!t)return;let{virtualFocus:n,activeId:i}=t.getState();if(!n)return;let a=null==(r=iA(t,i))?void 0:r.element,o=e.relatedTarget,s=iv(t,o),u=l.current;l.current=null,iG(e)&&s?(o===a?u&&u!==o&&iL(u,e):a?iL(a,e):u&&iL(u,e),e.stopPropagation()):!iv(t,e.target)&&a&&iL(a,e)}),M=a.onKeyDown,E=iX(i),x=iN(e=>{var r;if(null==M||M(e),e.nativeEvent.isComposing||e.defaultPrevented||!t||!iG(e))return;let{orientation:n,renderedItems:i,activeId:a}=t.getState(),o=iA(t,a);if(null==(r=null==o?void 0:o.element)?void 0:r.isConnected)return;let s="horizontal"!==n,l="vertical"!==n,u=i.some(e=>!!e.rowId);if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&iu(e.currentTarget))return;let c={ArrowUp:(u||s)&&(()=>{if(u){let e=aT(aw(function(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}(i))).find(e=>!e.disabled);return null==e?void 0:e.id}return null==t?void 0:t.last()}),ArrowRight:(u||l)&&t.first,ArrowDown:(u||s)&&t.first,ArrowLeft:(u||l)&&t.last,Home:t.first,End:t.last,PageUp:t.first,PageDown:t.last}[e.key];if(c){let r=c();if(void 0!==r){if(!E(e))return;e.preventDefault(),t.move(r)}}});return a=iq(a,e=>(0,es.jsx)(an,{value:t,children:e}),[t]),a={"aria-activedescendant":t.useState(e=>{var n;if(t&&r&&e.virtualFocus)return null==(n=iA(t,e.activeId))?void 0:n.id}),...a,ref:iK(s,d,a.ref),onKeyDownCapture:m,onKeyUpCapture:p,onFocusCapture:g,onFocus:C,onBlurCapture:b,onKeyDown:x},a=aS({focusable:t.useState(e=>r&&(e.virtualFocus||null===e.activeId)),...a})});i2(function(e){return i3("div",aI(e))});var aD=i6();aD.useContext,aD.useScopedContext;var aG=aD.useProviderContext,aL=i6([aD.ContextProvider],[aD.ScopedContextProvider]);aL.useContext,aL.useScopedContext;var aP=aL.useProviderContext,aH=aL.ContextProvider,aO=aL.ScopedContextProvider,ak=(0,el.createContext)(void 0),a_=(0,el.createContext)(void 0),aU=i6([aH],[aO]);aU.useContext,aU.useScopedContext;var aj=aU.useProviderContext,aJ=aU.ContextProvider,aN=aU.ScopedContextProvider,aK=i5(function(e){let{store:t,...r}=e,n=aj();return t=t||n,r={...r,ref:iK(null==t?void 0:t.setAnchorElement,r.ref)}});i2(function(e){return i3("div",aK(e))});var aQ=(0,el.createContext)(void 0),aW=i6([aJ,an],[aN,ai]),aV=aW.useContext,aX=aW.useScopedContext,aq=aW.useProviderContext,aY=aW.ContextProvider,aZ=aW.ScopedContextProvider,az=(0,el.createContext)(void 0),a$=(0,el.createContext)(!1);function a0(e,t){let r=e.__unstableInternals;return iM(r,"Invalid store"),r[t]}function a1(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n2&&void 0!==arguments[2]?arguments[2]:d;return r.add(t),m.set(t,e),()=>{var e;null==(e=h.get(t))||e(),h.delete(t),m.delete(t),r.delete(t)}},A=function(e,t){var n,s;let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!iC(i,e))return;let c=(s=i[e],"function"==typeof t?t("function"==typeof s?s():s):t);if(c===i[e])return;if(!l)for(let t of r)null==(n=null==t?void 0:t.setState)||n.call(t,e,c);let p=i;i={...i,[e]:c};let A=Symbol();o=A,u.add(e);let g=(t,r,n)=>{var a;let o=m.get(t);(!o||o.some(t=>n?n.has(t):t===e))&&(null==(a=h.get(t))||a(),h.set(t,t(i,r)))};for(let e of d)g(e,p);queueMicrotask(()=>{if(o!==A)return;let e=i;for(let e of f)g(e,a,u);a=e,u.clear()})},g={getState:()=>i,setState:A,__unstableInternals:{setup:e=>(c.add(e),()=>c.delete(e)),init:()=>{let e=l.size,t=Symbol();l.add(t);let n=()=>{l.delete(t),l.size||s()};if(e)return n;let a=Object.keys(i).map(e=>iy(...r.map(t=>{var r;let n=null==(r=null==t?void 0:t.getState)?void 0:r.call(t);if(n&&iC(n,e))return a3(t,[e],t=>{A(e,t[e],!0)})}))),o=[];for(let e of c)o.push(e());return s=iy(...a,...o,...r.map(a2)),n},subscribe:(e,t)=>p(e,t),sync:(e,t)=>(h.set(t,t(i,i)),p(e,t)),batch:(e,t)=>(h.set(t,t(i,a)),p(e,t,f)),pick:e=>a1(function(e,t){let r={};for(let n of t)iC(e,n)&&(r[n]=e[n]);return r}(i,e),g),omit:e=>a1(function(e,t){let r={...e};for(let e of t)iC(r,e)&&delete r[e];return r}(i,e),g)}};return g}function a9(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n!e.disabled&&e.value);return(null==n?void 0:n.value)===t}function ot(e,t){return!!t&&null!=e&&(e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}var or=i5(function(e){let{store:t,focusable:r=!0,autoSelect:n=!1,getAutoSelectId:i,setValueOnChange:a,showMinLength:o=0,showOnChange:s,showOnMouseDown:l,showOnClick:u=l,showOnKeyDown:c,showOnKeyPress:d=c,blurActiveItemOnClick:f,setValueOnClick:h=!0,moveOnKeyPress:m=!0,autoComplete:p="list",...A}=e,g=aq();iM(t=t||g,!1);let B=(0,el.useRef)(null),[C,y]=iV(),b=(0,el.useRef)(!1),M=(0,el.useRef)(!1),E=t.useState(e=>e.virtualFocus&&n),x="inline"===p||"both"===p,[F,S]=(0,el.useState)(x);!function(e,t){let r=(0,el.useRef)(!1);iJ(()=>{if(r.current)return e();r.current=!0},t),iJ(()=>()=>{r.current=!1},[])}(()=>{x&&S(!0)},[x]);let T=t.useState("value"),w=(0,el.useRef)();(0,el.useEffect)(()=>a3(t,["selectedValue","activeId"],(e,t)=>{w.current=t.selectedValue}),[]);let R=t.useState(e=>{var t;if(x&&F){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=w.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),I=t.useState("renderedItems"),D=t.useState("open"),G=t.useState("contentElement"),L=(0,el.useMemo)(()=>{if(!x||!F)return T;if(oe(I,R,E)){if(ot(T,R)){let e=(null==R?void 0:R.slice(T.length))||"";return T+e}return T}return R||T},[x,F,I,R,E,T]);(0,el.useEffect)(()=>{let e=B.current;if(!e)return;let t=()=>S(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,el.useEffect)(()=>{if(!x||!F||!R||!oe(I,R,E)||!ot(T,R))return;let e=iB;return queueMicrotask(()=>{let t=B.current;if(!t)return;let{start:r,end:n}=id(t),i=T.length,a=R.length;ip(t,i,a),e=()=>{if(!ap(t))return;let{start:e,end:o}=id(t);e===i&&o===a&&ip(t,r,n)}}),()=>e()},[C,x,F,R,I,E,T]);let P=(0,el.useRef)(null),H=iN(i),O=(0,el.useRef)(null);(0,el.useEffect)(()=>{if(!D||!G)return;let e=im(G);if(!e)return;P.current=e;let r=()=>{b.current=!1},n=()=>{if(!t||!b.current)return;let{activeId:e}=t.getState();null!==e&&e!==O.current&&(b.current=!1)},i={passive:!0,capture:!0};return e.addEventListener("wheel",r,i),e.addEventListener("touchmove",r,i),e.addEventListener("scroll",n,i),()=>{e.removeEventListener("wheel",r,!0),e.removeEventListener("touchmove",r,!0),e.removeEventListener("scroll",n,!0)}},[D,G,t]),iJ(()=>{T&&(M.current||(b.current=!0))},[T]),iJ(()=>{"always"!==E&&D||(b.current=D)},[E,D]);let k=t.useState("resetValueOnSelect");iW(()=>{var e,r;let n=b.current;if(!t||!D||!n&&!k)return;let{baseElement:i,contentElement:a,activeId:o}=t.getState();if(!i||ap(i)){if(null==a?void 0:a.hasAttribute("data-placing")){let e=new MutationObserver(y);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(E&&n){let r=H(I),n=void 0!==r?r:null!=(e=function(e){let t=e.find(e=>{var t;return!e.disabled&&(null==(t=e.element)?void 0:t.getAttribute("role"))!=="tab"});return null==t?void 0:t.id}(I))?e:t.first();O.current=n,t.move(null!=n?n:null)}else{let e=null==(r=t.item(o||t.first()))?void 0:r.element;e&&"scrollIntoView"in e&&e.scrollIntoView({block:"nearest",inline:"nearest"})}}},[t,D,C,T,E,k,H,I]),(0,el.useEffect)(()=>{if(!x)return;let e=B.current;if(!e)return;let r=[e,G].filter(e=>!!e),n=e=>{r.every(t=>iH(e,t))&&(null==t||t.setValue(L))};for(let e of r)e.addEventListener("focusout",n);return()=>{for(let e of r)e.removeEventListener("focusout",n)}},[x,G,t,L]);let _=e=>e.currentTarget.value.length>=o,U=A.onChange,j=iX(null!=s?s:_),J=iX(null!=a?a:!t.tag),N=iN(e=>{if(null==U||U(e),e.defaultPrevented||!t)return;let r=e.currentTarget,{value:n,selectionStart:i,selectionEnd:a}=r,o=e.nativeEvent;if(b.current=!0,"input"===o.type&&(o.isComposing&&(b.current=!1,M.current=!0),x)){let e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=i===n.length;S(e&&t)}if(J(e)){let e=n===t.getState().value;t.setValue(n),queueMicrotask(()=>{ip(r,i,a)}),x&&E&&e&&y()}j(e)&&t.show(),E&&b.current||t.setActiveId(null)}),K=A.onCompositionEnd,Q=iN(e=>{b.current=!0,M.current=!1,null==K||K(e),!e.defaultPrevented&&E&&y()}),W=A.onMouseDown,V=iX(null!=f?f:()=>!!(null==t?void 0:t.getState().includesBaseElement)),X=iX(h),q=iX(null!=u?u:_),Y=iN(e=>{null==W||W(e),e.defaultPrevented||e.button||e.ctrlKey||t&&(V(e)&&t.setActiveId(null),X(e)&&t.setValue(L),q(e)&&iO(e.currentTarget,"mouseup",t.show))}),Z=A.onKeyDown,z=iX(null!=d?d:_),$=iN(e=>{if(null==Z||Z(e),e.repeat||(b.current=!1),e.defaultPrevented||e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||!t)return;let{open:r}=t.getState();!r&&("ArrowUp"===e.key||"ArrowDown"===e.key)&&z(e)&&(e.preventDefault(),t.show())}),ee=A.onBlur,et=iN(e=>{if(b.current=!1,null==ee||ee(e),e.defaultPrevented)return}),er=iQ(A.id),en=t.useState(e=>null===e.activeId);return A={id:er,role:"combobox","aria-autocomplete":"inline"===p||"list"===p||"both"===p||"none"===p?p:void 0,"aria-haspopup":ih(G,"listbox"),"aria-expanded":D,"aria-controls":null==G?void 0:G.id,"data-active-item":en||void 0,value:L,...A,ref:iK(B,A.ref),onChange:N,onCompositionEnd:Q,onMouseDown:Y,onKeyDown:$,onBlur:et},A=aI({store:t,focusable:r,...A,moveOnKeyPress:e=>!iE(m,e)&&(x&&S(!0),!0)}),{autoComplete:"off",...A=aK({store:t,...A})}}),on=i2(function(e){return i3("input",or(e))});function oi(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var oa=Symbol("composite-hover"),oo=i5(function(e){let{store:t,focusOnHover:r=!0,blurOnHoverEnd:n=!!r,...i}=e,a=at();iM(t=t||a,!1);let o=((0,el.useEffect)(()=>{iZ||(ik("mousemove",i1,!0),ik("mousedown",i9,!0),ik("mouseup",i9,!0),ik("keydown",i9,!0),ik("scroll",i9,!0),iZ=!0)},[]),iN(()=>iz)),s=i.onMouseMove,l=iX(r),u=iN(e=>{if((null==s||s(e),!e.defaultPrevented&&o())&&l(e)){if(!aA(e.currentTarget)){let e=null==t?void 0:t.getState().baseElement;e&&!ap(e)&&e.focus()}null==t||t.setActiveId(e.currentTarget.id)}}),c=i.onMouseLeave,d=iX(n),f=iN(e=>{var r;null==c||c(e),!(e.defaultPrevented||!o()||function(e){let t=oi(e);return!!t&&ii(e.currentTarget,t)}(e)||function(e){let t=oi(e);if(!t)return!1;do{if(iC(t,oa)&&t[oa])return!0;t=t.parentElement}while(t)return!1}(e))&&l(e)&&d(e)&&(null==t||t.setActiveId(null),null==(r=null==t?void 0:t.getState().baseElement)||r.focus())}),h=(0,el.useCallback)(e=>{e&&(e[oa]=!0)},[]);return iF(i={...i,ref:iK(h,i.ref),onMouseMove:u,onMouseLeave:f})});i8(i2(function(e){return i3("div",oo(e))}));var os=i5(function(e){let{store:t,shouldRegisterItem:r=!0,getItem:n=ib,element:i,...a}=e,o=i7();t=t||o;let s=iQ(a.id),l=(0,el.useRef)(i);return(0,el.useEffect)(()=>{let e=l.current;if(!s||!e||!r)return;let i=n({id:s,element:e});return null==t?void 0:t.renderItem(i)},[s,r,n,t]),iF(a={...a,ref:iK(l,a.ref)})});function ol(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?io(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(io(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}i2(function(e){return i3("div",os(e))});var ou=Symbol("command"),oc=i5(function(e){let{clickOnEnter:t=!0,clickOnSpace:r=!0,...n}=e,i=(0,el.useRef)(null),[a,o]=(0,el.useState)(!1);(0,el.useEffect)(()=>{i.current&&o(io(i.current))},[]);let[s,l]=(0,el.useState)(!1),u=(0,el.useRef)(!1),c=ix(n),[d,f]=function(e,t,r){let n=e.onLoadedMetadataCapture,i=(0,el.useMemo)(()=>Object.assign(()=>{},{...n,[t]:r}),[n,t,r]);return[null==n?void 0:n[t],{onLoadedMetadataCapture:i}]}(n,ou,!0),h=n.onKeyDown,m=iN(e=>{null==h||h(e);let n=e.currentTarget;if(e.defaultPrevented||d||c||!iG(e)||iu(n)||n.isContentEditable)return;let i=t&&"Enter"===e.key,a=r&&" "===e.key,o="Enter"===e.key&&!t,s=" "===e.key&&!r;if(o||s)return void e.preventDefault();if(i||a){let t=ol(e);if(i){if(!t){e.preventDefault();let{view:t,...r}=e,i=()=>iP(n,r);n7&&/firefox\//i.test(navigator.userAgent)?iO(n,"keyup",i):queueMicrotask(i)}}else a&&(u.current=!0,t||(e.preventDefault(),l(!0)))}}),p=n.onKeyUp,A=iN(e=>{if(null==p||p(e),e.defaultPrevented||d||c||e.metaKey)return;let t=r&&" "===e.key;if(u.current&&t&&(u.current=!1,!ol(e))){e.preventDefault(),l(!1);let t=e.currentTarget,{view:r,...n}=e;queueMicrotask(()=>iP(t,n))}});return aS(n={"data-active":s||void 0,type:a?"button":void 0,...f,...n,ref:iK(i,n.ref),onKeyDown:m,onKeyUp:A})});i2(function(e){return i3("button",oc(e))});var{useSyncExternalStore:od}=e.i(2239).default,of=()=>()=>{};function oh(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ib,r=el.useCallback(t=>e?a8(e,null,t):of(),[e]),n=()=>{let r="string"==typeof t?t:null,n="function"==typeof t?t:null,i=null==e?void 0:e.getState();return n?n(i):i&&r&&iC(i,r)?i[r]:void 0};return od(r,n,n)}function om(e,t){let r=el.useRef({}),n=el.useCallback(t=>e?a8(e,null,t):of(),[e]),i=()=>{let n=null==e?void 0:e.getState(),i=!1,a=r.current;for(let e in t){let r=t[e];if("function"==typeof r){let t=r(n);t!==a[e]&&(a[e]=t,i=!0)}if("string"==typeof r){if(!n||!iC(n,r))continue;let t=n[r];t!==a[e]&&(a[e]=t,i=!0)}}return i&&(r.current={...a}),r.current};return od(n,i,i)}function op(e,t,r,n){let i=iC(t,r)?t[r]:void 0,a=function(e){let t=(0,el.useRef)(e);return iJ(()=>{t.current=e}),t}({value:i,setValue:n?t[n]:void 0});iJ(()=>a3(e,[r],(e,t)=>{let{value:n,setValue:i}=a.current;i&&e[r]!==t[r]&&e[r]!==n&&i(e[r])}),[e,r]),iJ(()=>{if(void 0!==i)return e.setState(r,i),a5(e,[r],()=>{void 0!==i&&e.setState(r,i)})})}function oA(e,t){let[r,n]=el.useState(()=>e(t));iJ(()=>a2(r),[r]);let i=el.useCallback(e=>oh(r,e),[r]);return[el.useMemo(()=>({...r,useState:i}),[r,i]),iN(()=>{n(r=>e({...t,...r.getState()}))})]}function og(e,t,r){var n;let i,a,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!t||!r)return;let{renderedItems:s}=t.getState(),l=im(e);if(!l)return;let u=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.clientHeight,{top:n}=e.getBoundingClientRect(),i=1.5*Math.max(.875*r,r-40),a=t?r-i+n:i+n;return"HTML"===e.tagName?a+e.scrollTop:a}(l,o);for(let e=0;e1&&void 0!==arguments[1]&&arguments[1],{top:r}=e.getBoundingClientRect();return t?r+e.clientHeight:r}(l,o)-u,d=Math.abs(c);if(o&&c<=0||!o&&c>=0){void 0!==a&&ar||(e&&(null==h?void 0:h.baseElement)&&h.baseElement===e.baseElement?h.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===d,ariaSetSize:e=>null!=s?s:e&&(null==h?void 0:h.ariaSetSize)&&h.baseElement===e.baseElement?h.ariaSetSize:void 0,ariaPosInSet(e){if(null!=l)return l;if(!e||!(null==h?void 0:h.ariaPosInSet)||h.baseElement!==e.baseElement)return;let t=e.renderedItems.filter(e=>e.rowId===p);return h.ariaPosInSet+t.findIndex(e=>e.id===d)},isTabbable(e){if(!(null==e?void 0:e.renderedItems.length))return!0;if(e.virtualFocus)return!1;if(a)return!0;if(null===e.activeId)return!1;let r=null==t?void 0:t.item(e.activeId);return null!=r&&!!r.disabled||null==r||!r.element||e.activeId===d}}),b=(0,el.useCallback)(e=>{var t;let r={...e,id:d||e.id,rowId:p,disabled:!!m,children:null==(t=e.element)?void 0:t.textContent};return o?o(r):r},[d,p,m,o]),M=u.onFocus,E=(0,el.useRef)(!1),x=iN(e=>{var r,n;if(null==M||M(e),e.defaultPrevented||iD(e)||!d||!t||(r=t,!iG(e)&&iv(r,e.target)))return;let{virtualFocus:i,baseElement:a}=t.getState();if(t.setActiveId(d),ic(e.currentTarget)&&function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(iu(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=ie(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(e.currentTarget),i&&iG(e))!ic(n=e.currentTarget)&&("INPUT"!==n.tagName||io(n))&&(null==a?void 0:a.isConnected)&&((iI()&&e.currentTarget.hasAttribute("data-autofocus")&&e.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),E.current=!0,e.relatedTarget===a||iv(t,e.relatedTarget))?(a[ig]=!0,a.focus({preventScroll:!0})):a.focus())}),F=u.onBlurCapture,S=iN(e=>{if(null==F||F(e),e.defaultPrevented)return;let r=null==t?void 0:t.getState();(null==r?void 0:r.virtualFocus)&&E.current&&(E.current=!1,e.preventDefault(),e.stopPropagation())}),T=u.onKeyDown,w=iX(n),R=iX(i),I=iN(e=>{if(null==T||T(e),e.defaultPrevented||!iG(e)||!t)return;let{currentTarget:r}=e,n=t.getState(),i=t.item(d),a=!!(null==i?void 0:i.rowId),o="horizontal"!==n.orientation,s="vertical"!==n.orientation,l=()=>!(!a&&!s&&n.baseElement&&iu(n.baseElement)),u={ArrowUp:(a||o)&&t.up,ArrowRight:(a||s)&&t.next,ArrowDown:(a||o)&&t.down,ArrowLeft:(a||s)&&t.previous,Home:()=>{if(l())return!a||e.ctrlKey?null==t?void 0:t.first():null==t?void 0:t.previous(-1)},End:()=>{if(l())return!a||e.ctrlKey?null==t?void 0:t.last():null==t?void 0:t.next(-1)},PageUp:()=>og(r,t,null==t?void 0:t.up,!0),PageDown:()=>og(r,t,null==t?void 0:t.down)}[e.key];if(u){if(ic(r)){let t=id(r),n=s&&"ArrowLeft"===e.key,i=s&&"ArrowRight"===e.key,a=o&&"ArrowUp"===e.key,l=o&&"ArrowDown"===e.key;if(i||l){let{length:e}=function(e){if(iu(e))return e.value;if(e.isContentEditable){let t=ie(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(r);if(t.end!==e)return}else if((n||a)&&0!==t.start)return}let n=u();if(w(e)||void 0!==n){if(!R(e))return;e.preventDefault(),t.move(n)}}}),D=(0,el.useMemo)(()=>({id:d,baseElement:A}),[d,A]);return u={id:d,"data-active-item":g||void 0,...u=iq(u,e=>(0,es.jsx)(aa.Provider,{value:D,children:e}),[D]),ref:iK(f,u.ref),tabIndex:y?u.tabIndex:-1,onFocus:x,onBlurCapture:S,onKeyDown:I},u=oc(u),iF({...u=os({store:t,...u,getItem:b,shouldRegisterItem:!!d&&u.shouldRegisterItem}),"aria-setsize":B,"aria-posinset":C})});i8(i2(function(e){return i3("button",ov(e))}));var oB=i5(function(e){var t,r;let{store:n,value:i,hideOnClick:a,setValueOnClick:o,selectValueOnClick:s=!0,resetValueOnSelect:l,focusOnHover:u=!1,moveOnKeyPress:c=!0,getItem:d,...f}=e,h=aX();iM(n=n||h,!1);let{resetValueOnSelectState:m,multiSelectable:p,selected:A}=om(n,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>(function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)})(e.selectedValue,i)}),g=(0,el.useCallback)(e=>{let t={...e,value:i};return d?d(t):t},[i,d]);o=null!=o?o:!p,a=null!=a?a:null!=i&&!p;let B=f.onClick,C=iX(o),y=iX(s),b=iX(null!=(t=null!=l?l:m)?t:p),M=iX(a),E=iN(e=>{null==B||B(e),!(e.defaultPrevented||function(e){let t=e.currentTarget;if(!t)return!1;let r=t.tagName.toLowerCase();return!!e.altKey&&("a"===r||"button"===r&&"submit"===t.type||"input"===r&&"submit"===t.type)}(e))&&!function(e){let t=e.currentTarget;if(!t)return!1;let r=iR();if(r&&!e.metaKey||!r&&!e.ctrlKey)return!1;let n=t.tagName.toLowerCase();return"a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type}(e)&&(null!=i&&(y(e)&&(b(e)&&(null==n||n.resetValue()),null==n||n.setSelectedValue(e=>Array.isArray(e)?e.includes(i)?e.filter(e=>e!==i):[...e,i]:i)),C(e)&&(null==n||n.setValue(i))),M(e)&&(null==n||n.hide()))}),x=f.onKeyDown,F=iN(e=>{if(null==x||x(e),e.defaultPrevented)return;let t=null==n?void 0:n.getState().baseElement;!(!t||ap(t))&&(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask(()=>t.focus()),iu(t)&&(null==n||n.setValue(t.value)))});p&&null!=A&&(f={"aria-selected":A,...f}),f=iq(f,e=>(0,es.jsx)(az.Provider,{value:i,children:(0,es.jsx)(a$.Provider,{value:null!=A&&A,children:e})}),[i,A]),f={role:null!=(r=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,el.useContext)(aQ)])?r:"option",children:i,...f,onClick:E,onKeyDown:F};let S=iX(c);return f=ov({store:n,...f,getItem:g,moveOnKeyPress:e=>{if(!S(e))return!1;let t=new Event("combobox-item-move"),r=null==n?void 0:n.getState().baseElement;return null==r||r.dispatchEvent(t),!0}}),f=oo({store:n,focusOnHover:u,...f})}),oC=i8(i2(function(e){return i3("div",oB(e))})),oy=e.i(74080);function ob(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function oM(){for(var e=arguments.length,t=Array(e),r=0;r{let r=t.endsWith("ms")?1:1e3,n=Number.parseFloat(t||"0s")*r;return n>e?n:e},0)}function oE(e,t,r){return!r&&!1!==t&&(!e||!!t)}var ox=i5(function(e){let{store:t,alwaysVisible:r,...n}=e,i=aG();iM(t=t||i,!1);let a=(0,el.useRef)(null),o=iQ(n.id),[s,l]=(0,el.useState)(null),u=t.useState("open"),c=t.useState("mounted"),d=t.useState("animated"),f=t.useState("contentElement"),h=oh(t.disclosure,"contentElement");iJ(()=>{a.current&&(null==t||t.setContentElement(a.current))},[t]),iJ(()=>{let e;return null==t||t.setState("animated",t=>(e=t,!0)),()=>{void 0!==e&&(null==t||t.setState("animated",e))}},[t]),iJ(()=>{if(d){var e;let t;return(null==f?void 0:f.isConnected)?(e=()=>{l(u?"enter":c?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void l(null)}},[d,f,u,c]),iJ(()=>{if(!t||!d||!s||!f)return;let e=()=>null==t?void 0:t.setState("animating",!1),r=()=>(0,oy.flushSync)(e);if("leave"===s&&u||"enter"===s&&!u)return;if("number"==typeof d)return ob(d,r);let{transitionDuration:n,animationDuration:i,transitionDelay:a,animationDelay:o}=getComputedStyle(f),{transitionDuration:l="0",animationDuration:c="0",transitionDelay:m="0",animationDelay:p="0"}=h?getComputedStyle(h):{},A=oM(a,o,m,p)+oM(n,i,l,c);if(!A){"enter"===s&&t.setState("animated",!1),e();return}return ob(Math.max(A-1e3/60,0),r)},[t,d,f,h,u,s]);let m=oE(c,(n=iq(n,e=>(0,es.jsx)(aO,{value:t,children:e}),[t])).hidden,r),p=n.style,A=(0,el.useMemo)(()=>m?{...p,display:"none"}:p,[m,p]);return iF(n={id:o,"data-open":u||void 0,"data-enter":"enter"===s||void 0,"data-leave":"leave"===s||void 0,hidden:m,...n,ref:iK(o?t.setContentElement:null,a,n.ref),style:A})}),oF=i2(function(e){return i3("div",ox(e))});i2(function(e){let{unmountOnHide:t,...r}=e,n=aG();return!1===oh(r.store||n,e=>!t||(null==e?void 0:e.mounted))?null:(0,es.jsx)(oF,{...r})});var oS=i5(function(e){let{store:t,alwaysVisible:r,...n}=e,i=aX(!0),a=aV(),o=!!(t=t||a)&&t===i;iM(t,!1);let s=(0,el.useRef)(null),l=iQ(n.id),u=t.useState("mounted"),c=oE(u,n.hidden,r),d=c?{...n.style,display:"none"}:n.style,f=t.useState(e=>Array.isArray(e.selectedValue)),h=function(e,t,r){let n=function(e){let[t]=(0,el.useState)(e);return t}(r),[i,a]=(0,el.useState)(n);return(0,el.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r)return;let i=()=>{let e=r.getAttribute(t);a(null==e?n:e)},o=new MutationObserver(i);return o.observe(r,{attributeFilter:[t]}),i(),()=>o.disconnect()},[e,t,n]),i}(s,"role",n.role),m="listbox"===h||"tree"===h||"grid"===h,[p,A]=(0,el.useState)(!1),g=t.useState("contentElement");iJ(()=>{if(!u)return;let e=s.current;if(!e||g!==e)return;let t=()=>{A(!!e.querySelector("[role='listbox']"))},r=new MutationObserver(t);return r.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>r.disconnect()},[u,g]),p||(n={role:"listbox","aria-multiselectable":m&&f||void 0,...n}),n=iq(n,e=>(0,es.jsx)(aZ,{value:t,children:(0,es.jsx)(aQ.Provider,{value:h,children:e})}),[t,h]);let B=!l||i&&o?null:t.setContentElement;return iF(n={id:l,hidden:c,...n,ref:iK(B,s,n.ref),style:d})}),oT=i2(function(e){return i3("div",oS(e))}),ow=(0,el.createContext)(null),oR=i5(function(e){return{...e,style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px",...e.style}}});i2(function(e){return i3("span",oR(e))});var oI=i5(function(e){return oR(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),oD=i2(function(e){return i3("span",oI(e))});function oG(e){queueMicrotask(()=>{null==e||e.focus()})}var oL=i5(function(e){let{preserveTabOrder:t,preserveTabOrderAnchor:r,portalElement:n,portalRef:i,portal:a=!0,...o}=e,s=(0,el.useRef)(null),l=iK(s,o.ref),u=(0,el.useContext)(ow),[c,d]=(0,el.useState)(null),[f,h]=(0,el.useState)(null),m=(0,el.useRef)(null),p=(0,el.useRef)(null),A=(0,el.useRef)(null),g=(0,el.useRef)(null);return iJ(()=>{let e=s.current;if(!e||!a)return void d(null);let t=n?"function"==typeof n?n(e):n:ie(e).createElement("div");if(!t)return void d(null);let r=t.isConnected;if(r||(u||ie(e).body).appendChild(t),t.id||(t.id=e.id?"portal/".concat(e.id):function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";return"".concat(e?"".concat(e,"-"):"").concat(Math.random().toString(36).slice(2,8))}()),d(t),iT(i,t),!r)return()=>{t.remove(),iT(i,null)}},[a,n,u,i]),iJ(()=>{if(!a||!t||!r)return;let e=ie(r).createElement("span");return e.style.position="fixed",r.insertAdjacentElement("afterend",e),h(e),()=>{e.remove(),h(null)}},[a,t,r]),(0,el.useEffect)(()=>{if(!c||!t)return;let e=0,r=t=>{if(!iH(t))return;let r="focusin"===t.type;if(cancelAnimationFrame(e),r){let e=c.querySelectorAll("[data-tabindex]"),t=e=>{let t=e.getAttribute("data-tabindex");e.removeAttribute("data-tabindex"),t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")};for(let r of(c.hasAttribute("data-tabindex")&&t(c),e))t(r);return}e=requestAnimationFrame(()=>{for(let e of af(c,!0))!function(e){var t;let r=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",r),e.setAttribute("tabindex","-1")}(e)})};return c.addEventListener("focusin",r,!0),c.addEventListener("focusout",r,!0),()=>{cancelAnimationFrame(e),c.removeEventListener("focusin",r,!0),c.removeEventListener("focusout",r,!0)}},[c,t]),o={...o=iq(o,e=>{if(e=(0,es.jsx)(ow.Provider,{value:c||u,children:e}),!a)return e;if(!c)return(0,es.jsx)("span",{ref:l,id:o.id,style:{position:"fixed"},hidden:!0});e=(0,es.jsxs)(es.Fragment,{children:[t&&c&&(0,es.jsx)(oD,{ref:p,"data-focus-trap":o.id,className:"__focus-trap-inner-before",onFocus:e=>{iH(e,c)?oG(ah()):oG(m.current)}}),e,t&&c&&(0,es.jsx)(oD,{ref:A,"data-focus-trap":o.id,className:"__focus-trap-inner-after",onFocus:e=>{iH(e,c)?oG(am()):oG(g.current)}})]}),c&&(e=(0,oy.createPortal)(e,c));let r=(0,es.jsxs)(es.Fragment,{children:[t&&c&&(0,es.jsx)(oD,{ref:m,"data-focus-trap":o.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==g.current&&iH(e,c)?oG(p.current):oG(am())}}),t&&(0,es.jsx)("span",{"aria-owns":null==c?void 0:c.id,style:{position:"fixed"}}),t&&c&&(0,es.jsx)(oD,{ref:g,"data-focus-trap":o.id,className:"__focus-trap-outer-after",onFocus:e=>{if(iH(e,c))oG(A.current);else{let e=ah();if(e===p.current)return void requestAnimationFrame(()=>{var e;return null==(e=ah())?void 0:e.focus()});oG(e)}}})]});return f&&t&&(r=(0,oy.createPortal)(r,f)),(0,es.jsxs)(es.Fragment,{children:[r,e]})},[c,u,a,o.id,t,f]),ref:l}});i2(function(e){return i3("div",oL(e))});var oP=(0,el.createContext)(0);function oH(e){let{level:t,children:r}=e,n=(0,el.useContext)(oP),i=Math.max(Math.min(t||n+1,6),1);return(0,es.jsx)(oP.Provider,{value:i,children:r})}var oO=i5(function(e){let{autoFocusOnShow:t=!0,...r}=e;return iq(r,e=>(0,es.jsx)(as.Provider,{value:t,children:e}),[t])});i2(function(e){return i3("div",oO(e))});var ok=new WeakMap;function o_(e,t,r){ok.has(e)||ok.set(e,new Map);let n=ok.get(e),i=n.get(t);if(!i)return n.set(t,r()),()=>{var e;null==(e=n.get(t))||e(),n.delete(t)};let a=r(),o=()=>{a(),i(),n.delete(t)};return n.set(t,o),()=>{n.get(t)===o&&(a(),n.set(t,i))}}function oU(e,t,r){return o_(e,t,()=>{let n=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)}})}function oj(e,t,r){return o_(e,t,()=>{let n=t in e,i=e[t];return e[t]=r,()=>{n?e[t]=i:delete e[t]}})}function oJ(e,t){return e?o_(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var oN=["SCRIPT","STYLE"];function oK(e){return"__ariakit-dialog-snapshot-".concat(e)}function oQ(e,t,r,n){for(let i of t){if(!(null==i?void 0:i.isConnected))continue;let a=t.some(e=>!!e&&e!==i&&e.contains(i)),o=ie(i),s=i;for(;i.parentElement&&i!==o.body;){if(null==n||n(i.parentElement,s),!a)for(let n of i.parentElement.children)(function(e,t,r){return!oN.includes(t.tagName)&&!!function(e,t){let r=ie(t),n=oK(e);if(!r.body[n])return!0;for(;;){if(t===r.body)return!1;if(t[n])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!r.some(e=>e&&ii(t,e))})(e,n,t)&&r(n,s);i=i.parentElement}}}function oW(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;ni===e))}function oV(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"__ariakit-dialog-".concat(t?"ancestor":"outside").concat(e?"-".concat(e):"")}function oX(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return iy(oj(e,oV("",!0),!0),oj(e,oV(t,!0),!0))}function oq(e,t){if(e[oV(t,!0)])return!0;let r=oV(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function oY(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return oQ(e,t,t=>{oW(t,...n)||r.unshift(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return iy(oj(e,oV(),!0),oj(e,oV(t),!0))}(t,e))},(t,n)=>{n.hasAttribute("data-dialog")&&n.id!==e||r.unshift(oX(t,e))}),()=>{for(let e of r)e()}}function oZ(e){let{store:t,type:r,listener:n,capture:i,domReady:a}=e,o=iN(n),s=oh(t,"open"),l=(0,el.useRef)(!1);iJ(()=>{if(!s||!a)return;let{contentElement:e}=t.getState();if(!e)return;let r=()=>{l.current=!0};return e.addEventListener("focusin",r,!0),()=>e.removeEventListener("focusin",r,!0)},[t,s,a]),(0,el.useEffect)(()=>{if(s)return ik(r,e=>{let{contentElement:r,disclosureElement:n}=t.getState(),i=e.target;if(r&&i)!(!("HTML"===i.tagName||ii(ie(i).body,i))||ii(r,i)||function(e,t){if(!e)return!1;if(ii(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=ie(e).getElementById(r);if(t)return ii(e,t)}return!1}(n,i)||i.hasAttribute("data-focus-trap")||function(e,t){if(!("clientY"in e))return!1;let r=t.getBoundingClientRect();return 0!==r.width&&0!==r.height&&r.top<=e.clientY&&e.clientY<=r.top+r.height&&r.left<=e.clientX&&e.clientX<=r.left+r.width}(e,r))&&(!l.current||oq(i,r.id))&&(i&&i[aC]||o(e))},i)},[s,i])}function oz(e,t){return"function"==typeof e?e(t):!!e}var o$=(0,el.createContext)({});function o0(){return"inert"in HTMLElement.prototype}function o1(e,t){if(!("style"in e))return iB;if(o0())return oj(e,"inert",!0);let r=af(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&ii(t,e)))return iB;let r=o_(e,"focus",()=>(e.focus=iB,()=>{delete e.focus}));return iy(oU(e,"tabindex","-1"),r)});return iy(...r,oU(e,"aria-hidden","true"),oJ(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function o9(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=a4(e.store,a6(e.disclosure,["contentElement","disclosureElement"]));a7(e,t);let r=null==t?void 0:t.getState(),n=iS(e.open,null==r?void 0:r.open,e.defaultOpen,!1),i=iS(e.animated,null==r?void 0:r.animated,!1),a=a1({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:iS(null==r?void 0:r.contentElement,null),disclosureElement:iS(null==r?void 0:r.disclosureElement,null)},t);return a9(a,()=>a3(a,["animated","animating"],e=>{e.animated||a.setState("animating",!1)})),a9(a,()=>a8(a,["open"],()=>{a.getState().animated&&a.setState("animating",!0)})),a9(a,()=>a3(a,["open","animating"],e=>{a.setState("mounted",e.open||e.animating)})),{...a,disclosure:e.disclosure,setOpen:e=>a.setState("open",e),show:()=>a.setState("open",!0),hide:()=>a.setState("open",!1),toggle:()=>a.setState("open",e=>!e),stopAnimation:()=>a.setState("animating",!1),setContentElement:e=>a.setState("contentElement",e),setDisclosureElement:e=>a.setState("disclosureElement",e)}}function o2(e,t,r){return iW(t,[r.store,r.disclosure]),op(e,r,"open","setOpen"),op(e,r,"mounted","setMounted"),op(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}i5(function(e){return e});var o8=i2(function(e){return i3("div",e)});function o3(e){let{store:t,backdrop:r,alwaysVisible:n,hidden:i}=e,a=(0,el.useRef)(null),o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[t,r]=oA(o9,e);return o2(t,r,e)}({disclosure:t}),s=oh(t,"contentElement");(0,el.useEffect)(()=>{let e=a.current;e&&s&&(e.style.zIndex=getComputedStyle(s).zIndex)},[s]),iJ(()=>{let e=null==s?void 0:s.id;if(!e)return;let t=a.current;if(t)return oX(t,e)},[s]);let l=ox({ref:a,store:o,role:"presentation","data-backdrop":(null==s?void 0:s.id)||"",alwaysVisible:n,hidden:null!=i?i:void 0,style:{position:"fixed",top:0,right:0,bottom:0,left:0}});if(!r)return null;if((0,el.isValidElement)(r))return(0,es.jsx)(o8,{...l,render:r});let u="boolean"!=typeof r?r:"div";return(0,es.jsx)(o8,{...l,render:(0,es.jsx)(u,{})})}function o5(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o9(e)}Object.assign(o8,["a","button","details","dialog","div","form","h1","h2","h3","h4","h5","h6","header","img","input","label","li","nav","ol","p","section","select","span","summary","textarea","ul","svg"].reduce((e,t)=>(e[t]=i2(function(e){return i3(t,e)}),e),{}));var o6=iI();function o4(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;let r="current"in e?e.current:e;return r?t?au(r)?r:null:r:null}var o7=i5(function(e){let{store:t,open:r,onClose:n,focusable:i=!0,modal:a=!0,portal:o=!!a,backdrop:s=!!a,hideOnEscape:l=!0,hideOnInteractOutside:u=!0,getPersistentElements:c,preventBodyScroll:d=!!a,autoFocusOnShow:f=!0,autoFocusOnHide:h=!0,initialFocus:m,finalFocus:p,unmountOnHide:A,unstable_treeSnapshotKey:g,...B}=e,C=aP(),y=(0,el.useRef)(null),b=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[t,r]=oA(o5,e);return o2(t,r,e)}({store:t||C,open:r,setOpen(e){if(e)return;let t=y.current;if(!t)return;let r=new Event("close",{bubbles:!1,cancelable:!0});n&&t.addEventListener("close",n,{once:!0}),t.dispatchEvent(r),r.defaultPrevented&&b.setOpen(!0)}}),{portalRef:M,domReady:E}=iY(o,B.portalRef),x=B.preserveTabOrder,F=oh(b,e=>x&&!a&&e.mounted),S=iQ(B.id),T=oh(b,"open"),w=oh(b,"mounted"),R=oh(b,"contentElement"),I=oE(w,B.hidden,B.alwaysVisible),D=function(e){let{attribute:t,contentId:r,contentElement:n,enabled:i}=e,[a,o]=iV(),s=(0,el.useCallback)(()=>{if(!i||!n)return!1;let{body:e}=ie(n),a=e.getAttribute(t);return!a||a===r},[a,i,n,t,r]);return(0,el.useEffect)(()=>{if(!i||!r||!n)return;let{body:e}=ie(n);if(s())return e.setAttribute(t,r),()=>e.removeAttribute(t);let a=new MutationObserver(()=>(0,oy.flushSync)(o));return a.observe(e,{attributeFilter:[t]}),()=>a.disconnect()},[a,i,r,n,s,t]),s}({attribute:"data-dialog-prevent-body-scroll",contentElement:R,contentId:S,enabled:d&&!I});(0,el.useEffect)(()=>{var e,t;if(!D()||!R)return;let r=ie(R),n=it(R),{documentElement:i,body:a}=r,o=i.style.getPropertyValue("--scrollbar-width"),s=o?Number.parseInt(o,10):n.innerWidth-i.clientWidth,l=Math.round(i.getBoundingClientRect().left)+i.scrollLeft?"paddingLeft":"paddingRight",u=iR()&&!(n7&&navigator.platform.startsWith("Mac")&&!iw());return iy((e="--scrollbar-width",t="".concat(s,"px"),i?o_(i,e,()=>{let r=i.style.getPropertyValue(e);return i.style.setProperty(e,t),()=>{r?i.style.setProperty(e,r):i.style.removeProperty(e)}}):()=>{}),u?(()=>{var e,t;let{scrollX:r,scrollY:i,visualViewport:o}=n,u=null!=(e=null==o?void 0:o.offsetLeft)?e:0,c=null!=(t=null==o?void 0:o.offsetTop)?t:0,d=oJ(a,{position:"fixed",overflow:"hidden",top:"".concat(-(i-Math.floor(c)),"px"),left:"".concat(-(r-Math.floor(u)),"px"),right:"0",[l]:"".concat(s,"px")});return()=>{d(),n.scrollTo({left:r,top:i,behavior:"instant"})}})():oJ(a,{overflow:"hidden",[l]:"".concat(s,"px")}))},[D,R]);let G=function(e){let t=(0,el.useRef)();return(0,el.useEffect)(()=>{if(!e){t.current=null;return}return ik("mousedown",e=>{t.current=e.target},!0)},[e]),t}(oh(b,"open")),L={store:b,domReady:E,capture:!0};oZ({...L,type:"click",listener:e=>{let{contentElement:t}=b.getState(),r=G.current;r&&il(r)&&oq(r,null==t?void 0:t.id)&&oz(u,e)&&b.hide()}}),oZ({...L,type:"focusin",listener:e=>{let{contentElement:t}=b.getState();t&&e.target!==ie(t)&&oz(u,e)&&b.hide()}}),oZ({...L,type:"contextmenu",listener:e=>{oz(u,e)&&b.hide()}});let{wrapElement:P,nestedDialogs:H}=function(e){let t=(0,el.useContext)(o$),[r,n]=(0,el.useState)([]),i=(0,el.useCallback)(e=>{var r;return n(t=>[...t,e]),iy(null==(r=t.add)?void 0:r.call(t,e),()=>{n(t=>t.filter(t=>t!==e))})},[t]);iJ(()=>a3(e,["open","contentElement"],r=>{var n;if(r.open&&r.contentElement)return null==(n=t.add)?void 0:n.call(t,e)}),[e,t]);let a=(0,el.useMemo)(()=>({store:e,add:i}),[e,i]);return{wrapElement:(0,el.useCallback)(e=>(0,es.jsx)(o$.Provider,{value:a,children:e}),[a]),nestedDialogs:r}}(b);B=iq(B,P,[P]),iJ(()=>{if(!T)return;let e=y.current,t=ir(e,!0);t&&"BODY"!==t.tagName&&(e&&ii(e,t)||b.setDisclosureElement(t))},[b,T]),o6&&(0,el.useEffect)(()=>{if(!w)return;let{disclosureElement:e}=b.getState();if(!e||!io(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),iO(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||ag(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[b,w]),(0,el.useEffect)(()=>{if(!w||!E)return;let e=y.current;if(!e)return;let t=it(e),r=t.visualViewport||t,n=()=>{var r,n;let i=null!=(n=null==(r=t.visualViewport)?void 0:r.height)?n:t.innerHeight;e.style.setProperty("--dialog-viewport-height","".concat(i,"px"))};return n(),r.addEventListener("resize",n),()=>{r.removeEventListener("resize",n)}},[w,E]),(0,el.useEffect)(()=>{if(!a||!w||!E)return;let e=y.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t=b.hide;let r=ie(e).createElement("button");return r.type="button",r.tabIndex=-1,r.textContent="Dismiss popup",Object.assign(r.style,{border:"0px",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0px",position:"absolute",whiteSpace:"nowrap",width:"1px"}),r.addEventListener("click",t),e.prepend(r),()=>{r.removeEventListener("click",t),r.remove()}}},[b,a,w,E]),iJ(()=>{if(!o0()||T||!w||!E)return;let e=y.current;if(e)return o1(e)},[T,w,E]);let O=T&&E;iJ(()=>{if(!S||!O)return;var e=[y.current];let{body:t}=ie(e[0]),r=[];return oQ(S,e,e=>{r.push(oj(e,oK(S),!0))}),iy(oj(t,oK(S),!0),()=>{for(let e of r)e()})},[S,O,g]);let k=iN(c);iJ(()=>{if(!S||!O)return;let{disclosureElement:e}=b.getState(),t=[y.current,...k()||[],...H.map(e=>e.getState().contentElement)];return a?iy(oY(S,t),function(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return oQ(e,t,e=>{oW(e,...n)||!function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;ni===e))}(e,...n)&&r.unshift(o1(e,t))},e=>{e.hasAttribute("role")&&(t.some(t=>t&&ii(t,e))||r.unshift(oU(e,"role","none")))}),()=>{for(let e of r)e()}}(S,t)):oY(S,[e,...t])},[S,b,O,k,H,a,g]);let _=!!f,U=iX(f),[j,J]=(0,el.useState)(!1);(0,el.useEffect)(()=>{if(!T||!_||!E||!(null==R?void 0:R.isConnected))return;let e=o4(m,!0)||R.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[n]=af(e,t,r);return n||null}(R,!0,o&&F)||R,t=au(e);U(t?e:null)&&(J(!0),queueMicrotask(()=>{e.focus(),o6&&t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[T,_,E,R,m,o,F,U]);let N=!!h,K=iX(h),[Q,W]=(0,el.useState)(!1);(0,el.useEffect)(()=>{if(T)return W(!0),()=>W(!1)},[T]);let V=(0,el.useCallback)(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],{disclosureElement:r}=b.getState();if(function(e){let t=ir();return!(!t||e&&ii(e,t))&&!!au(t)}(e))return;let n=o4(p)||r;if(null==n?void 0:n.id){let e=ie(n),t='[aria-activedescendant="'.concat(n.id,'"]'),r=e.querySelector(t);r&&(n=r)}if(n&&!au(n)){let e=n.closest("[data-dialog]");if(null==e?void 0:e.id){let t=ie(e),r='[aria-controls~="'.concat(e.id,'"]'),i=t.querySelector(r);i&&(n=i)}}let i=n&&au(n);if(!i&&t)return void requestAnimationFrame(()=>V(e,!1));K(i?n:null)&&i&&(null==n||n.focus({preventScroll:!0}))},[b,p,K]),X=(0,el.useRef)(!1);iJ(()=>{if(T||!Q||!N)return;let e=y.current;X.current=!0,V(e)},[T,Q,E,N,V]),(0,el.useEffect)(()=>{if(!Q||!N)return;let e=y.current;return()=>{if(X.current){X.current=!1;return}V(e)}},[Q,N,V]);let q=iX(l);(0,el.useEffect)(()=>{if(E&&w)return ik("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=y.current;if(!t||oq(t))return;let r=e.target;if(!r)return;let{disclosureElement:n}=b.getState();("BODY"===r.tagName||ii(t,r)||!n||ii(n,r))&&q(e)&&b.hide()},!0)},[b,E,w,q]);let Y=(B=iq(B,e=>(0,es.jsx)(oH,{level:a?1:void 0,children:e}),[a])).hidden,Z=B.alwaysVisible;B=iq(B,e=>s?(0,es.jsxs)(es.Fragment,{children:[(0,es.jsx)(o3,{store:b,backdrop:s,hidden:Y,alwaysVisible:Z}),e]}):e,[b,s,Y,Z]);let[z,$]=(0,el.useState)(),[ee,et]=(0,el.useState)();return B=oO({...B={id:S,"data-dialog":"",role:"dialog",tabIndex:i?-1:void 0,"aria-labelledby":z,"aria-describedby":ee,...B=iq(B,e=>(0,es.jsx)(aO,{value:b,children:(0,es.jsx)(ak.Provider,{value:$,children:(0,es.jsx)(a_.Provider,{value:et,children:e})})}),[b]),ref:iK(y,B.ref)},autoFocusOnShow:j}),B=oL({portal:o,...B=aS({...B=ox({store:b,...B}),focusable:i}),portalRef:M,preserveTabOrder:F})});function se(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aP;return i2(function(r){let n=t();return oh(r.store||n,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,es.jsx)(e,{...r}):null})}se(i2(function(e){return i3("div",o7(e))}),aP);let st=Math.min,sr=Math.max,sn=Math.round,si=Math.floor,sa=e=>({x:e,y:e}),so={left:"right",right:"left",bottom:"top",top:"bottom"},ss={start:"end",end:"start"};function sl(e,t){return"function"==typeof e?e(t):e}function su(e){return e.split("-")[0]}function sc(e){return e.split("-")[1]}function sd(e){return"x"===e?"y":"x"}function sf(e){return"y"===e?"height":"width"}let sh=new Set(["top","bottom"]);function sm(e){return sh.has(su(e))?"y":"x"}function sp(e){return e.replace(/start|end/g,e=>ss[e])}let sA=["left","right"],sg=["right","left"],sv=["top","bottom"],sB=["bottom","top"];function sC(e){return e.replace(/left|right|bottom|top/g,e=>so[e])}function sy(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function sb(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function sM(e,t,r){let n,{reference:i,floating:a}=e,o=sm(t),s=sd(sm(t)),l=sf(s),u=su(t),c="y"===o,d=i.x+i.width/2-a.width/2,f=i.y+i.height/2-a.height/2,h=i[l]/2-a[l]/2;switch(u){case"top":n={x:d,y:i.y-a.height};break;case"bottom":n={x:d,y:i.y+i.height};break;case"right":n={x:i.x+i.width,y:f};break;case"left":n={x:i.x-a.width,y:f};break;default:n={x:i.x,y:i.y}}switch(sc(t)){case"start":n[s]-=h*(r&&c?-1:1);break;case"end":n[s]+=h*(r&&c?-1:1)}return n}let sE=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:o}=r,s=a.filter(Boolean),l=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=sM(u,n,l),f=n,h={},m=0;for(let r=0;r{try{return e.matches(t)}catch(e){return!1}})}let sj=["transform","translate","scale","rotate","perspective"],sJ=["transform","translate","scale","rotate","perspective","filter"],sN=["paint","layout","strict","content"];function sK(e){let t=sQ(),r=sG(e)?sX(e):e;return sj.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||sJ.some(e=>(r.willChange||"").includes(e))||sN.some(e=>(r.contain||"").includes(e))}function sQ(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let sW=new Set(["html","body","#document"]);function sV(e){return sW.has(sw(e))}function sX(e){return sR(e).getComputedStyle(e)}function sq(e){return sG(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sY(e){if("html"===sw(e))return e;let t=e.assignedSlot||e.parentNode||sP(e)&&e.host||sI(e);return sP(t)?t.host:t}function sZ(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=sY(t);return sV(r)?t.ownerDocument?t.ownerDocument.body:t.body:sL(r)&&sO(r)?r:e(r)}(e),a=i===(null==(n=e.ownerDocument)?void 0:n.body),o=sR(i);if(a){let e=sz(o);return t.concat(o,o.visualViewport||[],sO(i)?i:[],e&&r?sZ(e):[])}return t.concat(i,sZ(i,[],r))}function sz(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function s$(e){let t=sX(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=sL(e),a=i?e.offsetWidth:r,o=i?e.offsetHeight:n,s=sn(r)!==a||sn(n)!==o;return s&&(r=a,n=o),{width:r,height:n,$:s}}function s0(e){return sG(e)?e:e.contextElement}function s1(e){let t=s0(e);if(!sL(t))return sa(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:a}=s$(t),o=(a?sn(r.width):r.width)/n,s=(a?sn(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let s9=sa(0);function s2(e){let t=sR(e);return sQ()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:s9}function s8(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=s0(e),s=sa(1);t&&(n?sG(n)&&(s=s1(n)):s=s1(e));let l=(void 0===(i=r)&&(i=!1),n&&(!i||n===sR(o))&&i)?s2(o):sa(0),u=(a.left+l.x)/s.x,c=(a.top+l.y)/s.y,d=a.width/s.x,f=a.height/s.y;if(o){let e=sR(o),t=n&&sG(n)?sR(n):n,r=e,i=sz(r);for(;i&&n&&t!==r;){let e=s1(i),t=i.getBoundingClientRect(),n=sX(i),a=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,f*=e.y,u+=a,c+=o,i=sz(r=sR(i))}}return sb({width:d,height:f,x:u,y:c})}function s3(e,t){let r=sq(e).scrollLeft;return t?t.left+r:s8(sI(e)).left+r}function s5(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-s3(e,r),y:r.top+t.scrollTop}}let s6=new Set(["absolute","fixed"]);function s4(e,t,r){let n;if("viewport"===t)n=function(e,t){let r=sR(e),n=sI(e),i=r.visualViewport,a=n.clientWidth,o=n.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;let e=sQ();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}let u=s3(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else u<=25&&(a+=u);return{width:a,height:o,x:s,y:l}}(e,r);else if("document"===t)n=function(e){let t=sI(e),r=sq(e),n=e.ownerDocument.body,i=sr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=sr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),o=-r.scrollLeft+s3(e),s=-r.scrollTop;return"rtl"===sX(n).direction&&(o+=sr(t.clientWidth,n.clientWidth)-i),{width:i,height:a,x:o,y:s}}(sI(e));else if(sG(t))n=function(e,t){let r=s8(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,a=sL(e)?s1(e):sa(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y;return{width:o,height:s,x:i*a.x,y:n*a.y}}(t,r);else{let r=s2(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return sb(n)}function s7(e){return"static"===sX(e).position}function le(e,t){if(!sL(e)||"fixed"===sX(e).position)return null;if(t)return t(e);let r=e.offsetParent;return sI(e)===r&&(r=r.ownerDocument.body),r}function lt(e,t){var r;let n=sR(e);if(sU(e))return n;if(!sL(e)){let t=sY(e);for(;t&&!sV(t);){if(sG(t)&&!s7(t))return t;t=sY(t)}return n}let i=le(e,t);for(;i&&(r=i,sk.has(sw(r)))&&s7(i);)i=le(i,t);return i&&sV(i)&&s7(i)&&!sK(i)?n:i||function(e){let t=sY(e);for(;sL(t)&&!sV(t);){if(sK(t))return t;if(sU(t))break;t=sY(t)}return null}(e)||n}let lr=async function(e){let t=this.getOffsetParent||lt,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=sL(t),i=sI(t),a="fixed"===r,o=s8(e,!0,a,t),s={scrollLeft:0,scrollTop:0},l=sa(0);if(n||!n&&!a)if(("body"!==sw(t)||sO(i))&&(s=sq(t)),n){let e=s8(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=s3(i));a&&!n&&i&&(l.x=s3(i));let u=!i||n||a?sa(0):s5(i,s);return{x:o.left+s.scrollLeft-l.x-u.x,y:o.top+s.scrollTop-l.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},ln={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,a="fixed"===i,o=sI(n),s=!!t&&sU(t.floating);if(n===o||s&&a)return r;let l={scrollLeft:0,scrollTop:0},u=sa(1),c=sa(0),d=sL(n);if((d||!d&&!a)&&(("body"!==sw(n)||sO(o))&&(l=sq(n)),sL(n))){let e=s8(n);u=s1(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let f=!o||d||a?sa(0):s5(o,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:r.y*u.y-l.scrollTop*u.y+c.y+f.y}},getDocumentElement:sI,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?sU(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=sZ(e,[],!1).filter(e=>sG(e)&&"body"!==sw(e)),i=null,a="fixed"===sX(e).position,o=a?sY(e):e;for(;sG(o)&&!sV(o);){let t=sX(o),r=sK(o);r||"fixed"!==t.position||(i=null),(a?!r&&!i:!r&&"static"===t.position&&!!i&&s6.has(i.position)||sO(o)&&!r&&function e(t,r){let n=sY(t);return!(n===r||!sG(n)||sV(n))&&("fixed"===sX(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=sY(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=a[0],s=a.reduce((e,r)=>{let n=s4(t,r,i);return e.top=sr(n.top,e.top),e.right=st(n.right,e.right),e.bottom=st(n.bottom,e.bottom),e.left=sr(n.left,e.left),e},s4(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:lt,getElementRects:lr,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=s$(e);return{width:t,height:r}},getScale:s1,isElement:sG,isRTL:function(e){return"rtl"===sX(e).direction}};function li(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function la(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if("function"==typeof DOMRect)return new DOMRect(e,t,r,n);let i={x:e,y:t,width:r,height:n,top:t,right:e+r,bottom:t+n,left:e};return{...i,toJSON:()=>i}}function lo(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function ls(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var ll=i5(function(e){let{store:t,modal:r=!1,portal:n=!!r,preserveTabOrder:i=!0,autoFocusOnShow:a=!0,wrapperProps:o,fixed:s=!1,flip:l=!0,shift:u=0,slide:c=!0,overlap:d=!1,sameWidth:f=!1,fitViewport:h=!1,gutter:m,arrowPadding:p=4,overflowPadding:A=8,getAnchorRect:g,updatePosition:B,...C}=e,y=aj();iM(t=t||y,!1);let b=t.useState("arrowElement"),M=t.useState("anchorElement"),E=t.useState("disclosureElement"),x=t.useState("popoverElement"),F=t.useState("contentElement"),S=t.useState("placement"),T=t.useState("mounted"),w=t.useState("rendered"),R=(0,el.useRef)(null),[I,D]=(0,el.useState)(!1),{portalRef:G,domReady:L}=iY(n,C.portalRef),P=iN(g),H=iN(B),O=!!B;iJ(()=>{if(!(null==x?void 0:x.isConnected))return;x.style.setProperty("--popover-overflow-padding","".concat(A,"px"));let e={contextElement:M||void 0,getBoundingClientRect:()=>{let e=null==P?void 0:P(M);if(e||!M){if(!e)return la();let{x:t,y:r,width:n,height:i}=e;return la(t,r,n,i)}return M.getBoundingClientRect()}},r=async()=>{var r,n,i,a;if(!T)return;b||(R.current=R.current||document.createElement("div"));let o=b||R.current,g=[(r={gutter:m,shift:u},void 0===(n=e=>{var t;let{placement:n}=e,i=((null==o?void 0:o.clientHeight)||0)/2,a="number"==typeof r.gutter?r.gutter+i:null!=(t=r.gutter)?t:i;return{crossAxis:n.split("-")[1]?void 0:r.shift,mainAxis:a,alignmentAxis:r.shift}})&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:i,y:a,placement:o,middlewareData:s}=e,l=await sS(e,n);return o===(null==(t=s.offset)?void 0:t.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:o}}}}),function(e){var t;if(!1===e.flip)return;let r="string"==typeof e.flip?e.flip.split(" "):void 0;return iM(!r||r.every(lo),!1),{name:"flip",options:t={padding:e.overflowPadding,fallbackPlacements:r},async fn(e){var r,n,i,a,o;let{placement:s,middlewareData:l,rects:u,initialPlacement:c,platform:d,elements:f}=e,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:p,fallbackStrategy:A="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:B=!0,...C}=sl(t,e);if(null!=(r=l.arrow)&&r.alignmentOffset)return{};let y=su(s),b=sm(c),M=su(c)===c,E=await (null==d.isRTL?void 0:d.isRTL(f.floating)),x=p||(M||!B?[sC(c)]:function(e){let t=sC(e);return[sp(e),t,sp(t)]}(c)),F="none"!==g;!p&&F&&x.push(...function(e,t,r,n){let i=sc(e),a=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?sg:sA;return t?sA:sg;case"left":case"right":return t?sv:sB;default:return[]}}(su(e),"start"===r,n);return i&&(a=a.map(e=>e+"-"+i),t&&(a=a.concat(a.map(sp)))),a}(c,B,g,E));let S=[c,...x],T=await sx(e,C),w=[],R=(null==(n=l.flip)?void 0:n.overflows)||[];if(h&&w.push(T[y]),m){let e=function(e,t,r){void 0===r&&(r=!1);let n=sc(e),i=sd(sm(e)),a=sf(i),o="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=sC(o)),[o,sC(o)]}(s,u,E);w.push(T[e[0]],T[e[1]])}if(R=[...R,{placement:s,overflows:w}],!w.every(e=>e<=0)){let e=((null==(i=l.flip)?void 0:i.index)||0)+1,t=S[e];if(t&&("alignment"!==m||b===sm(t)||R.every(e=>sm(e.placement)!==b||e.overflows[0]>0)))return{data:{index:e,overflows:R},reset:{placement:t}};let r=null==(a=R.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(A){case"bestFit":{let e=null==(o=R.filter(e=>{if(F){let t=sm(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=c}if(s!==r)return{reset:{placement:r}}}return{}}}}({flip:l,overflowPadding:A}),function(e){if(e.slide||e.overlap){var t,r;return{name:"shift",options:r={mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:(void 0===t&&(t={}),{options:t,fn(e){let{x:r,y:n,placement:i,rects:a,middlewareData:o}=e,{offset:s=0,mainAxis:l=!0,crossAxis:u=!0}=sl(t,e),c={x:r,y:n},d=sm(i),f=sd(d),h=c[f],m=c[d],p=sl(s,e),A="number"==typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){let e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+A.mainAxis,r=a.reference[f]+a.reference[e]-A.mainAxis;hr&&(h=r)}if(u){var g,B;let e="y"===f?"width":"height",t=sF.has(su(i)),r=a.reference[d]-a.floating[e]+(t&&(null==(g=o.offset)?void 0:g[d])||0)+(t?0:A.crossAxis),n=a.reference[d]+a.reference[e]+(t?0:(null==(B=o.offset)?void 0:B[d])||0)-(t?A.crossAxis:0);mn&&(m=n)}return{[f]:h,[d]:m}}})},async fn(e){let{x:t,y:n,placement:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=sl(r,e),u={x:t,y:n},c=await sx(e,l),d=sm(su(i)),f=sd(d),h=u[f],m=u[d];if(a){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=h+c[e],n=h-c[t];h=sr(r,st(h,n))}if(o){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=m+c[e],n=m-c[t];m=sr(r,st(m,n))}let p=s.fn({...e,[f]:h,[d]:m});return{...p,data:{x:p.x-t,y:p.y-n,enabled:{[f]:a,[d]:o}}}}}}}({slide:c,shift:u,overlap:d,overflowPadding:A}),function(e,t){if(e){let r;return{name:"arrow",options:r={element:e,padding:t.arrowPadding},async fn(e){let{x:t,y:n,placement:i,rects:a,platform:o,elements:s,middlewareData:l}=e,{element:u,padding:c=0}=sl(r,e)||{};if(null==u)return{};let d=sy(c),f={x:t,y:n},h=sd(sm(i)),m=sf(h),p=await o.getDimensions(u),A="y"===h,g=A?"clientHeight":"clientWidth",B=a.reference[m]+a.reference[h]-f[h]-a.floating[m],C=f[h]-a.reference[h],y=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),b=y?y[g]:0;b&&await (null==o.isElement?void 0:o.isElement(y))||(b=s.floating[g]||a.floating[m]);let M=b/2-p[m]/2-1,E=st(d[A?"top":"left"],M),x=st(d[A?"bottom":"right"],M),F=b-p[m]-x,S=b/2-p[m]/2+(B/2-C/2),T=sr(E,st(S,F)),w=!l.arrow&&null!=sc(i)&&S!==T&&a.reference[m]/2-(S{},...d}=sl(a,e),f=await sx(e,d),h=su(o),m=sc(o),p="y"===sm(o),{width:A,height:g}=s.floating;"top"===h||"bottom"===h?(n=h,i=m===(await (null==l.isRTL?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(i=h,n="end"===m?"top":"bottom");let B=g-f.top-f.bottom,C=A-f.left-f.right,y=st(g-f[n],B),b=st(A-f[i],C),M=!e.middlewareData.shift,E=y,x=b;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(x=C),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(E=B),M&&!m){let e=sr(f.left,0),t=sr(f.right,0),r=sr(f.top,0),n=sr(f.bottom,0);p?x=A-2*(0!==e||0!==t?e+t:sr(f.left,f.right)):E=g-2*(0!==r||0!==n?r+n:sr(f.top,f.bottom))}await c({...e,availableWidth:x,availableHeight:E});let F=await l.getDimensions(u.floating);return A!==F.width||g!==F.height?{reset:{rects:!0}}:{}}}],B=await ((e,t,r)=>{let n=new Map,i={platform:ln,...r},a={...i.platform,_c:n};return sE(e,t,{...i,platform:a})})(e,x,{placement:S,strategy:s?"fixed":"absolute",middleware:g});null==t||t.setState("currentPlacement",B.placement),D(!0);let C=ls(B.x),y=ls(B.y);if(Object.assign(x.style,{top:"0",left:"0",transform:"translate3d(".concat(C,"px,").concat(y,"px,0)")}),o&&B.middlewareData.arrow){let{x:e,y:t}=B.middlewareData.arrow,r=B.placement.split("-")[0],n=o.clientWidth/2,i=o.clientHeight/2,a=null!=e?e+n:-n,s=null!=t?t+i:-i;x.style.setProperty("--popover-transform-origin",{top:"".concat(a,"px calc(100% + ").concat(i,"px)"),bottom:"".concat(a,"px ").concat(-i,"px"),left:"calc(100% + ".concat(n,"px) ").concat(s,"px"),right:"".concat(-n,"px ").concat(s,"px")}[r]),Object.assign(o.style,{left:null!=e?"".concat(e,"px"):"",top:null!=t?"".concat(t,"px"):"",[r]:"100%"})}},n=function(e,t,r,n){let i;void 0===n&&(n={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=s0(e),d=a||o?[...c?sZ(c):[],...sZ(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let f=c&&l?function(e,t){let r,n=null,i=sI(e);function a(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),a();let u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:h}=u;if(s||t(),!f||!h)return;let m=si(d),p=si(i.clientWidth-(c+f)),A={rootMargin:-m+"px "+-p+"px "+-si(i.clientHeight-(d+h))+"px "+-si(c)+"px",threshold:sr(0,st(1,l))||1},g=!0;function B(t){let n=t[0].intersectionRatio;if(n!==l){if(!g)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||li(u,e.getBoundingClientRect())||o(),g=!1}try{n=new IntersectionObserver(B,{...A,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(B,A)}n.observe(e)}(!0),a}(c,r):null,h=-1,m=null;s&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!u&&m.observe(c),m.observe(t));let p=u?s8(e):null;return u&&function t(){let n=s8(e);p&&!li(p,n)&&r(),p=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=m)||e.disconnect(),m=null,u&&cancelAnimationFrame(i)}}(e,x,async()=>{O?(await H({updatePosition:r}),D(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{D(!1),n()}},[t,w,x,b,M,x,S,T,L,s,l,u,c,d,f,h,m,p,A,P,O,H]),iJ(()=>{if(!T||!L||!(null==x?void 0:x.isConnected)||!(null==F?void 0:F.isConnected))return;let e=()=>{x.style.zIndex=getComputedStyle(F).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[T,L,x,F]);let k=s?"fixed":"absolute";return C=iq(C,e=>(0,es.jsx)("div",{...o,style:{position:k,top:0,left:0,width:"max-content",...null==o?void 0:o.style},ref:null==t?void 0:t.setPopoverElement,children:e}),[t,k,o]),C={"data-placing":!I||void 0,...C=iq(C,e=>(0,es.jsx)(aN,{value:t,children:e}),[t]),style:{position:"relative",...C.style}},C=o7({store:t,modal:r,portal:n,preserveTabOrder:i,preserveTabOrderAnchor:E||M,autoFocusOnShow:I&&a,...C,portalRef:G})});se(i2(function(e){return i3("div",ll(e))}),aj);var lu=i5(function(e){let{store:t,modal:r,tabIndex:n,alwaysVisible:i,autoFocusOnHide:a=!0,hideOnInteractOutside:o=!0,...s}=e,l=aq();iM(t=t||l,!1);let u=t.useState("baseElement"),c=(0,el.useRef)(!1),d=oh(t.tag,e=>null==e?void 0:e.renderedItems.length);return s=oS({store:t,alwaysVisible:i,...s}),s=ll({store:t,modal:r,alwaysVisible:i,backdrop:!1,autoFocusOnShow:!1,finalFocus:u,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:d,...s,getPersistentElements(){var e;let n=(null==(e=s.getPersistentElements)?void 0:e.call(s))||[];if(!r||!t)return n;let{contentElement:i,baseElement:a}=t.getState();if(!a)return n;let o=ie(a),l=[];if((null==i?void 0:i.id)&&l.push('[aria-controls~="'.concat(i.id,'"]')),(null==a?void 0:a.id)&&l.push('[aria-controls~="'.concat(a.id,'"]')),!l.length)return[...n,a];let u=l.join(",");return[...n,...o.querySelectorAll(u)]},autoFocusOnHide:e=>!iE(a,e)&&(!c.current||(c.current=!1,!1)),hideOnInteractOutside(e){var r,n;let i=null==t?void 0:t.getState(),a=null==(r=null==i?void 0:i.contentElement)?void 0:r.id,s=null==(n=null==i?void 0:i.baseElement)?void 0:n.id;if(function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n'[aria-controls~="'.concat(e,'"]')).join(", ");return!!t&&e.matches(t)}return!1}(e.target,a,s))return!1;let l="function"==typeof o?o(e):o;return l&&(c.current="click"===e.type),l}})}),lc=se(i2(function(e){return i3("div",lu(e))}),aq);(0,el.createContext)(null),(0,el.createContext)(null);var ld=i6([an],[ai]),lf=ld.useContext;ld.useScopedContext,ld.useProviderContext,ld.ContextProvider,ld.ScopedContextProvider;var lh={id:null};function lm(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function lp(e,t){return e.filter(e=>e.rowId===t)}function lA(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}function lg(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var lv=iI()&&iw();function lB(){let{tag:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=a4(t.store,function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:{},r=null==(e=t.store)?void 0:e.getState(),n=function(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a7(r,r.store);let n=null==(e=r.store)?void 0:e.getState(),i=iS(r.items,null==n?void 0:n.items,r.defaultItems,[]),a=new Map(i.map(e=>[e.id,e])),o={items:i,renderedItems:iS(null==n?void 0:n.renderedItems,[])},s=null==(t=r.store)?void 0:t.__unstablePrivateStore,l=a1({items:i,renderedItems:o.renderedItems},s),u=a1(o,r.store),c=e=>{let t=function(e,t){let r=e.map((e,t)=>[t,e]),n=!1;return(r.sort((e,r)=>{var i;let[a,o]=e,[s,l]=r,u=t(o),c=t(l);return u!==c&&u&&c?(i=u,c.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_PRECEDING)?(a>s&&(n=!0),-1):(a{let[t,r]=e;return r}):e}(e,e=>e.element);l.setState("renderedItems",t),u.setState("renderedItems",t)};a9(u,()=>a2(l)),a9(l,()=>a5(l,["items"],e=>{u.setState("items",e.items)})),a9(l,()=>a5(l,["renderedItems"],e=>{let t=!0,r=requestAnimationFrame(()=>{let{renderedItems:t}=u.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(r);let n=new IntersectionObserver(()=>{if(t){t=!1;return}cancelAnimationFrame(r),r=requestAnimationFrame(()=>c(e.renderedItems))},{root:function(e){var t;let r=e.find(e=>!!e.element),n=[...e].reverse().find(e=>!!e.element),i=null==(t=null==r?void 0:r.element)?void 0:t.parentElement;for(;i&&(null==n?void 0:n.element);){let e=i;if(n&&e.contains(n.element))return i;i=i.parentElement}return ie(i).body}(e.renderedItems)});for(let t of e.renderedItems)t.element&&n.observe(t.element);return()=>{cancelAnimationFrame(r),n.disconnect()}}));let d=function(e,t){let r,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t(t=>{let n=t.findIndex(t=>{let{id:r}=t;return r===e.id}),i=t.slice();if(-1!==n){let o={...r=t[n],...e};i[n]=o,a.set(e.id,o)}else i.push(e),a.set(e.id,e);return i}),()=>{t(t=>{if(!r)return n&&a.delete(e.id),t.filter(t=>{let{id:r}=t;return r!==e.id});let i=t.findIndex(t=>{let{id:r}=t;return r===e.id});if(-1===i)return t;let o=t.slice();return o[i]=r,a.set(e.id,r),o})}},f=e=>d(e,e=>l.setState("items",e),!0);return{...u,registerItem:f,renderItem:e=>iy(f(e),d(e,e=>l.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=a.get(e);if(!t){let{items:r}=l.getState();(t=r.find(t=>t.id===e))&&a.set(e,t)}return t||null},__unstablePrivateStore:l}}(t),i=iS(t.activeId,null==r?void 0:r.activeId,t.defaultActiveId),a=a1({...n.getState(),id:iS(t.id,null==r?void 0:r.id,"id-".concat(Math.random().toString(36).slice(2,8))),activeId:i,baseElement:iS(null==r?void 0:r.baseElement,null),includesBaseElement:iS(t.includesBaseElement,null==r?void 0:r.includesBaseElement,null===i),moves:iS(null==r?void 0:r.moves,0),orientation:iS(t.orientation,null==r?void 0:r.orientation,"both"),rtl:iS(t.rtl,null==r?void 0:r.rtl,!1),virtualFocus:iS(t.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:iS(t.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:iS(t.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:iS(t.focusShift,null==r?void 0:r.focusShift,!1)},n,t.store);a9(a,()=>a3(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=lm(e.renderedItems))?void 0:r.id})}));let o=function(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"next",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.getState(),{skip:o=0,activeId:s=i.activeId,focusShift:l=i.focusShift,focusLoop:u=i.focusLoop,focusWrap:c=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:f=i.renderedItems,rtl:h=i.rtl}=n,m="up"===r||"down"===r,p="next"===r||"down"===r,A=m?aT(function(e,t,r){let n=lg(e);for(let i of e)for(let e=0;ee.id===s);if(!g)return null==(t=lm(A))?void 0:t.id;let B=A.some(e=>e.rowId),C=A.indexOf(g),y=A.slice(C+1),b=lp(y,g.rowId);if(o){let e=b.filter(e=>s?!e.disabled&&e.id!==s:!e.disabled),t=e.slice(o)[0]||e[e.length-1];return null==t?void 0:t.id}let M=u&&(m?"horizontal"!==u:"vertical"!==u),E=B&&c&&(m?"horizontal"!==c:"vertical"!==c),x=p?(!B||m)&&M&&d:!!m&&d;if(M){let e=lm(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e.findIndex(e=>e.id===t);return[...e.slice(n+1),...r?[lh]:[],...e.slice(0,n)]}(E&&!x?A:lp(A,g.rowId),s,x),s);return null==e?void 0:e.id}if(E){let e=lm(x?b:y,s);return x?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let F=lm(b,s);return!F&&x?null:null==F?void 0:F.id};return{...n,...a,setBaseElement:e=>a.setState("baseElement",e),setActiveId:e=>a.setState("activeId",e),move:e=>{void 0!==e&&(a.setState("activeId",e),a.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=lm(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=lm(aw(a.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))}}({...t,activeId:a,includesBaseElement:iS(t.includesBaseElement,null==i?void 0:i.includesBaseElement,!0),orientation:iS(t.orientation,null==i?void 0:i.orientation,"vertical"),focusLoop:iS(t.focusLoop,null==i?void 0:i.focusLoop,!0),focusWrap:iS(t.focusWrap,null==i?void 0:i.focusWrap,!0),virtualFocus:iS(t.virtualFocus,null==i?void 0:i.virtualFocus,!0)}),s=function(){let{popover:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=a4(t.store,a6(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));a7(t,r);let n=null==r?void 0:r.getState(),i=o5({...t,store:r}),a=iS(t.placement,null==n?void 0:n.placement,"bottom"),o=a1({...i.getState(),placement:a,currentPlacement:a,anchorElement:iS(null==n?void 0:n.anchorElement,null),popoverElement:iS(null==n?void 0:n.popoverElement,null),arrowElement:iS(null==n?void 0:n.arrowElement,null),rendered:Symbol("rendered")},i,r);return{...i,...o,setAnchorElement:e=>o.setState("anchorElement",e),setPopoverElement:e=>o.setState("popoverElement",e),setArrowElement:e=>o.setState("arrowElement",e),render:()=>o.setState("rendered",Symbol("rendered"))}}({...t,placement:iS(t.placement,null==i?void 0:i.placement,"bottom-start")}),l=iS(t.value,null==i?void 0:i.value,t.defaultValue,""),u=iS(t.selectedValue,null==i?void 0:i.selectedValue,null==n?void 0:n.values,t.defaultSelectedValue,""),c=Array.isArray(u),d={...o.getState(),...s.getState(),value:l,selectedValue:u,resetValueOnSelect:iS(t.resetValueOnSelect,null==i?void 0:i.resetValueOnSelect,c),resetValueOnHide:iS(t.resetValueOnHide,null==i?void 0:i.resetValueOnHide,c&&!e),activeValue:null==i?void 0:i.activeValue},f=a1(d,o,s,r);return lv&&a9(f,()=>a3(f,["virtualFocus"],()=>{f.setState("virtualFocus",!1)})),a9(f,()=>{if(e)return iy(a3(f,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),a3(e,["values"],e=>{f.setState("selectedValue",e.values)}))}),a9(f,()=>a3(f,["resetValueOnHide","mounted"],e=>{e.resetValueOnHide&&(e.mounted||f.setState("value",l))})),a9(f,()=>a3(f,["open"],e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})),a9(f,()=>a3(f,["moves","activeId"],(e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})),a9(f,()=>a5(f,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;let{activeId:r}=f.getState(),n=o.item(r);f.setState("activeValue",null==n?void 0:n.value)})),{...s,...o,...f,tag:e,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",d.value),setSelectedValue:e=>f.setState("selectedValue",e)}}function lC(){var e,t,r,n,i,a;let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[s,l]=oA(lB,o=function(e){var t;let r=lf();return{id:iQ((t=e={...e,tag:void 0!==e.tag?e.tag:r}).id),...t}}(o));return iW(l,[(e=o).tag]),op(s,e,"value","setValue"),op(s,e,"selectedValue","setSelectedValue"),op(s,e,"resetValueOnHide"),op(s,e,"resetValueOnSelect"),Object.assign((n=s,iW(i=l,[(a=e).popover]),op(n,a,"placement"),t=o2(n,i,a),r=t,iW(l,[e.store]),op(r,e,"items","setItems"),op(t=r,e,"activeId","setActiveId"),op(t,e,"includesBaseElement"),op(t,e,"virtualFocus"),op(t,e,"orientation"),op(t,e,"rtl"),op(t,e,"focusLoop"),op(t,e,"focusWrap"),op(t,e,"focusShift"),t),{tag:e.tag})}function ly(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=lC(e);return(0,es.jsx)(aY,{value:t,children:e.children})}var lb=(0,el.createContext)(void 0),lM=i5(function(e){let[t,r]=(0,el.useState)();return iF(e={role:"group","aria-labelledby":t,...e=iq(e,e=>(0,es.jsx)(lb.Provider,{value:r,children:e}),[])})});i2(function(e){return i3("div",lM(e))});var lE=i5(function(e){let{store:t,...r}=e;return lM(r)});i2(function(e){return i3("div",lE(e))});var lx=i5(function(e){let{store:t,...r}=e,n=aX();return iM(t=t||n,!1),"grid"===ih(t.useState("contentElement"))&&(r={role:"rowgroup",...r}),r=lE({store:t,...r})}),lF=i2(function(e){return i3("div",lx(e))}),lS=i5(function(e){let t=(0,el.useContext)(lb),r=iQ(e.id);return iJ(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),iF(e={id:r,"aria-hidden":!0,...e})});i2(function(e){return i3("div",lS(e))});var lT=i5(function(e){let{store:t,...r}=e;return lS(r)});i2(function(e){return i3("div",lT(e))});var lw=i5(function(e){return lT(e)}),lR=i2(function(e){return i3("div",lw(e))}),lI=e.i(38360);let lD={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},lG=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function lL(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{keys:n,threshold:i=lD.MATCHES,baseSort:a=lG,sorter:o=e=>e.sort((e,t)=>(function(e,t,r){let{rank:n,keyIndex:i}=e,{rank:a,keyIndex:o}=t;return n!==a?n>a?-1:1:i===o?r(e,t):i{let{rank:n,rankedValue:i,keyIndex:a,keyThreshold:o}=e,{itemValue:s,attributes:l}=t,d=lP(s,u,c),f=i,{minRanking:h,maxRanking:m,threshold:p}=l;return d=lD.MATCHES?d=h:d>m&&(d=m),d>n&&(n=d,a=r,o=p,f=s),{rankedValue:f,rank:n,keyIndex:a,keyThreshold:o}},{rankedValue:s,rank:lD.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:s,rank:lP(s,u,c),keyIndex:-1,keyThreshold:c.threshold}),{rank:f,keyThreshold:h=i}=d;return f>=h&&e.push({...d,item:a,index:o}),e},[])).map(e=>{let{item:t}=e;return t})}function lP(e,t,r){if(e=lH(e,r),(t=lH(t,r)).length>e.length)return lD.NO_MATCH;if(e===t)return lD.CASE_SENSITIVE_EQUAL;let n=function*(e,t){let r=-1;for(;(r=e.indexOf(t,r+1))>-1;)yield r;return -1}(e=e.toLowerCase(),t=t.toLowerCase()),i=n.next(),a=i.value;if(e.length===t.length&&0===a)return lD.EQUAL;if(0===a)return lD.STARTS_WITH;let o=i;for(;!o.done;){if(o.value>0&&" "===e[o.value-1])return lD.WORD_STARTS_WITH;o=n.next()}return a>0?lD.CONTAINS:1===t.length?lD.NO_MATCH:(function(e){let t="",r=" ";for(let n=0;n-1))return lD.NO_MATCH;var o=n-a;let s=r/t.length;return lD.MATCHES+1/o*s}(e,t)}function lH(e,t){let{keepDiacritics:r}=t;return e="".concat(e),r||(e=(0,lI.default)(e)),e}lL.rankings=lD;let lO={maxRanking:1/0,minRanking:-1/0};var lk=e.i(29402);let l_=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),lU={"missions.vl2":"Official","TR2final105-client.vl2":"Team Rabbit 2","z_mappacks/CTF/Classic_maps_v1.vl2":"Classic","z_mappacks/CTF/DynamixFinalPack.vl2":"Official","z_mappacks/CTF/KryMapPack_b3EDIT.vl2":"KryMapPack","z_mappacks/CTF/S5maps.vl2":"S5","z_mappacks/CTF/S8maps.vl2":"S8","z_mappacks/CTF/TWL-MapPack.vl2":"TWL","z_mappacks/CTF/TWL-MapPackEDIT.vl2":"TWL","z_mappacks/CTF/TWL2-MapPack.vl2":"TWL2","z_mappacks/CTF/TWL2-MapPackEDIT.vl2":"TWL2","z_mappacks/TWL_T2arenaOfficialMaps.vl2":"Arena","z_mappacks/z_DMP2-V0.6.vl2":"DMP2 (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX.vl2":"DMP (Discord Map Pack)"},lj={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},lJ=(0,nw.getMissionList)().filter(e=>!l_.has(e)).map(e=>{var t,r;let n=(0,nw.getMissionInfo)(e),[i]=(0,nw.getSourceAndPath)(n.resourcePath),a=(e=>{let t=e.match(/^(.*)(\/[^/]+)$/);return t?t[1]:""})(i),o=null!=(r=null!=(t=lU[i])?t:lj[a])?r:null;return{resourcePath:n.resourcePath,missionName:e,displayName:n.displayName,sourcePath:i,groupName:o,missionTypes:n.missionTypes}}),lN=new Map(lJ.map(e=>[e.missionName,e])),lK=function(e){let t=new Map;for(let n of e){var r;let e=null!=(r=t.get(n.groupName))?r:[];e.push(n),t.set(n.groupName,e)}return t.forEach((e,r)=>{t.set(r,(0,lk.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,lk.default)(Array.from(t.entries()),[e=>{let[t]=e;return"Official"===t?0:null==t?2:1},e=>{let[t]=e;return t?t.toLowerCase():""}],["asc","asc"])}(lJ),lQ="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function lW(e){let{mission:t}=e;return(0,es.jsxs)(es.Fragment,{children:[(0,es.jsxs)("span",{className:"MissionSelect-itemHeader",children:[(0,es.jsx)("span",{className:"MissionSelect-itemName",children:t.displayName||t.missionName}),t.missionTypes.length>0&&(0,es.jsx)("span",{className:"MissionSelect-itemTypes",children:t.missionTypes.map(e=>(0,es.jsx)("span",{className:"MissionSelect-itemType",children:e},e))})]}),(0,es.jsx)("span",{className:"MissionSelect-itemMissionName",children:t.missionName})]})}function lV(e){let{value:t,onChange:r}=e,[n,i]=(0,el.useState)(""),a=(0,el.useRef)(null),o=lC({resetValueOnHide:!0,selectedValue:t,setSelectedValue:e=>{e&&r(e)},setValue:e=>{(0,el.startTransition)(()=>i(e))}});(0,el.useEffect)(()=>{let e=e=>{if("k"===e.key&&(e.metaKey||e.ctrlKey)){var t;e.preventDefault(),null==(t=a.current)||t.focus(),o.show()}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o]);let s=lN.get(t),l=(0,el.useMemo)(()=>n?{type:"flat",missions:lL(lJ,n,{keys:["displayName","missionName"]})}:{type:"grouped",groups:lK},[n]),u=s?s.displayName||s.missionName:t,c="flat"===l.type?0===l.missions.length:0===l.groups.length;return(0,es.jsxs)(ly,{store:o,children:[(0,es.jsxs)("div",{className:"MissionSelect-inputWrapper",children:[(0,es.jsx)(on,{ref:a,autoSelect:!0,placeholder:u,className:"MissionSelect-input",onFocus:()=>{document.exitPointerLock(),o.show()}}),(0,es.jsx)("kbd",{className:"MissionSelect-shortcut",children:lQ?"⌘K":"^K"})]}),(0,es.jsx)(lc,{gutter:4,fitViewport:!0,className:"MissionSelect-popover",children:(0,es.jsxs)(oT,{className:"MissionSelect-list",children:["flat"===l.type?l.missions.map(e=>(0,es.jsx)(oC,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,children:(0,es.jsx)(lW,{mission:e})},e.missionName)):l.groups.map(e=>{let[t,r]=e;return t?(0,es.jsxs)(lF,{className:"MissionSelect-group",children:[(0,es.jsx)(lR,{className:"MissionSelect-groupLabel",children:t}),r.map(e=>(0,es.jsx)(oC,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,children:(0,es.jsx)(lW,{mission:e})},e.missionName))]},t):(0,es.jsx)(el.Fragment,{children:r.map(e=>(0,es.jsx)(oC,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,children:(0,es.jsx)(lW,{mission:e})},e.missionName))},"ungrouped")}),c&&(0,es.jsx)("div",{className:"MissionSelect-noResults",children:"No missions found"})]})})]})}function lX(e){let{missionName:t,onChangeMission:r}=e,{fogEnabled:n,setFogEnabled:i,fov:a,setFov:o,audioEnabled:s,setAudioEnabled:l,animationEnabled:u,setAnimationEnabled:c}=(0,tD.useSettings)(),{speedMultiplier:d,setSpeedMultiplier:f}=(0,tD.useControls)(),{debugMode:h,setDebugMode:m}=(0,tD.useDebug)();return(0,es.jsxs)("div",{id:"controls",onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,es.jsx)(lV,{value:t,onChange:r}),(0,es.jsxs)("div",{className:"CheckboxField",children:[(0,es.jsx)("input",{id:"fogInput",type:"checkbox",checked:n,onChange:e=>{i(e.target.checked)}}),(0,es.jsx)("label",{htmlFor:"fogInput",children:"Fog?"})]}),(0,es.jsxs)("div",{className:"CheckboxField",children:[(0,es.jsx)("input",{id:"audioInput",type:"checkbox",checked:s,onChange:e=>{l(e.target.checked)}}),(0,es.jsx)("label",{htmlFor:"audioInput",children:"Audio?"})]}),(0,es.jsxs)("div",{className:"CheckboxField",children:[(0,es.jsx)("input",{id:"animationInput",type:"checkbox",checked:u,onChange:e=>{c(e.target.checked)}}),(0,es.jsx)("label",{htmlFor:"animationInput",children:"Animation?"})]}),(0,es.jsxs)("div",{className:"CheckboxField",children:[(0,es.jsx)("input",{id:"debugInput",type:"checkbox",checked:h,onChange:e=>{m(e.target.checked)}}),(0,es.jsx)("label",{htmlFor:"debugInput",children:"Debug?"})]}),(0,es.jsxs)("div",{className:"Field",children:[(0,es.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),(0,es.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:a,onChange:e=>o(parseInt(e.target.value))}),(0,es.jsx)("output",{htmlFor:"speedInput",children:a})]}),(0,es.jsxs)("div",{className:"Field",children:[(0,es.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),(0,es.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:d,onChange:e=>f(parseFloat(e.target.value))})]})]})}let lq=el.forwardRef((e,t)=>{let{envMap:r,resolution:n=256,frames:i=1/0,makeDefault:a,children:o,...s}=e,l=(0,tx.useThree)(e=>{let{set:t}=e;return t}),u=(0,tx.useThree)(e=>{let{camera:t}=e;return t}),c=(0,tx.useThree)(e=>{let{size:t}=e;return t}),d=el.useRef(null);el.useImperativeHandle(t,()=>d.current,[]);let f=el.useRef(null),h=function(e,t,r){let n=(0,tx.useThree)(e=>e.size),i=(0,tx.useThree)(e=>e.viewport),a="number"==typeof e?e:n.width*i.dpr,o=n.height*i.dpr,s=("number"==typeof e?void 0:e)||{},{samples:l=0,depth:u,...c}=s,d=null!=u?u:s.depthBuffer,f=el.useMemo(()=>{let e=new ef.WebGLRenderTarget(a,o,{minFilter:ef.LinearFilter,magFilter:ef.LinearFilter,type:ef.HalfFloatType,...c});return d&&(e.depthTexture=new ef.DepthTexture(a,o,ef.FloatType)),e.samples=l,e},[]);return el.useLayoutEffect(()=>{f.setSize(a,o),l&&(f.samples=l)},[l,f,a,o]),el.useEffect(()=>()=>f.dispose(),[]),f}(n);el.useLayoutEffect(()=>{s.manual||(d.current.aspect=c.width/c.height)},[c,s]),el.useLayoutEffect(()=>{d.current.updateProjectionMatrix()});let m=0,p=null,A="function"==typeof o;return(0,tE.useFrame)(e=>{A&&(i===1/0||m{if(a)return l(()=>({camera:d.current})),()=>l(()=>({camera:u}))},[d,a,l]),el.createElement(el.Fragment,null,el.createElement("perspectiveCamera",(0,tq.default)({ref:d},s),!A&&o),el.createElement("group",{ref:f},A&&o(h.texture)))});function lY(){let{fov:e}=(0,tD.useSettings)();return(0,es.jsx)(lq,{makeDefault:!0,position:[0,256,0],fov:e})}var lZ=e.i(51434),lz=e.i(81405);function l$(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function l0(e){let{showPanel:t=0,className:r,parent:n}=e,i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,[n,i]=el.useState();return el.useLayoutEffect(()=>{let t=e();return i(t),l$(r,t),()=>l$(r,null)},t),n}(()=>new lz.default,[]);return el.useEffect(()=>{if(i){let e=n&&n.current||document.body;i.showPanel(t),null==e||e.appendChild(i.dom);let a=(null!=r?r:"").split(" ").filter(e=>e);a.length&&i.dom.classList.add(...a);let o=(0,ec.j)(()=>i.begin()),s=(0,ec.k)(()=>i.end());return()=>{a.length&&i.dom.classList.remove(...a),null==e||e.removeChild(i.dom),o(),s()}}},[n,i,r,t]),null}var l1=e.i(60099);function l9(){let{debugMode:e}=(0,tD.useDebug)(),t=(0,el.useRef)(null);return(0,el.useEffect)(()=>{let e=t.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")}),e?(0,es.jsxs)(es.Fragment,{children:[(0,es.jsx)(l0,{className:"StatsPanel"}),(0,es.jsx)("axesHelper",{ref:t,args:[70],renderOrder:999,children:(0,es.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,es.jsx)(l1.Html,{position:[80,0,0],center:!0,children:(0,es.jsx)("span",{className:"AxisLabel","data-axis":"y",children:"Y"})}),(0,es.jsx)(l1.Html,{position:[0,80,0],center:!0,children:(0,es.jsx)("span",{className:"AxisLabel","data-axis":"z",children:"Z"})}),(0,es.jsx)(l1.Html,{position:[0,0,80],center:!0,children:(0,es.jsx)("span",{className:"AxisLabel","data-axis":"x",children:"X"})})]}):null}let l2=new nJ,l8={toneMapping:ef.NoToneMapping,outputColorSpace:ef.SRGBColorSpace};function l3(){let e=(0,eu.useSearchParams)(),t=(0,eu.useRouter)(),[r,n]=(0,el.useState)(e.get("mission")||"TWL2_WoodyMyrk"),[i,a]=(0,el.useState)(0),[o,s]=(0,el.useState)(!0),l=i<1;(0,el.useEffect)(()=>{if(l)s(!0);else{let e=setTimeout(()=>s(!1),500);return()=>clearTimeout(e)}},[l]),(0,el.useEffect)(()=>(window.setMissionName=n,window.getMissionList=nw.getMissionList,window.getMissionInfo=nw.getMissionInfo,()=>{delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}),[]),(0,el.useEffect)(()=>{let e=new URLSearchParams;e.set("mission",r),t.replace("?".concat(e.toString()),{scroll:!1})},[r,t]);let u=(0,el.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(t)},[]);return(0,es.jsx)(tA,{client:l2,children:(0,es.jsx)("main",{children:(0,es.jsxs)(tD.SettingsProvider,{children:[(0,es.jsxs)("div",{id:"canvasContainer",children:[o&&(0,es.jsxs)("div",{id:"loadingIndicator","data-complete":!l,children:[(0,es.jsx)("div",{className:"LoadingSpinner"}),(0,es.jsx)("div",{className:"LoadingProgress",children:(0,es.jsx)("div",{className:"LoadingProgress-bar",style:{width:"".concat(100*i,"%")}})}),(0,es.jsxs)("div",{className:"LoadingProgress-text",children:[Math.round(100*i),"%"]})]}),(0,es.jsx)(ev,{shadows:!0,frameloop:"always",gl:l8,children:(0,es.jsx)(nb,{children:(0,es.jsxs)(lZ.AudioProvider,{children:[(0,es.jsx)(nG,{name:r,onLoadingChange:u},r),(0,es.jsx)(lY,{}),(0,es.jsx)(l9,{}),(0,es.jsx)(n4,{})]})})})]}),(0,es.jsx)(lX,{missionName:r,onChangeMission:n})]})})})}function l5(){return(0,es.jsx)(el.Suspense,{children:(0,es.jsx)(l3,{})})}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/bd1dcee0b953cac2.js b/docs/_next/static/chunks/bd1dcee0b953cac2.js deleted file mode 100644 index 2f012e15..00000000 --- a/docs/_next/static/chunks/bd1dcee0b953cac2.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42585,e=>{"use strict";e.s(["WaterBlock",()=>p,"WaterMaterial",()=>v,"WaterSurfaceMaterial",()=>c],42585);var n=e.i(43476),a=e.i(71645),t=e.i(47071),i=e.i(5230),r=e.i(90072),o=e.i(12979),l=e.i(62395),s=e.i(75567),u=e.i(79123);function c(e){let{surfaceTexture:l,envMapTexture:c,opacity:v=.75,waveMagnitude:p=1,envMapIntensity:d=1,attach:f}=e,m=(0,o.textureToUrl)(l),g=(0,o.textureToUrl)(null!=c?c:"special/lush_env"),[h,T]=(0,t.useTexture)([m,g],e=>{(Array.isArray(e)?e:[e]).forEach(e=>{(0,s.setupColor)(e),e.wrapS=r.RepeatWrapping,e.wrapT=r.RepeatWrapping})}),{animationEnabled:x}=(0,u.useSettings)(),b=(0,a.useMemo)(()=>{var e,n,a,t,i,o;return e={opacity:v,waveMagnitude:p,envMapIntensity:d,baseTexture:h,envMapTexture:T},new r.ShaderMaterial({uniforms:{uTime:{value:0},uOpacity:{value:null!=(n=null==e?void 0:e.opacity)?n:.75},uWaveMagnitude:{value:null!=(a=null==e?void 0:e.waveMagnitude)?a:1},uEnvMapIntensity:{value:null!=(t=null==e?void 0:e.envMapIntensity)?t:1},uBaseTexture:{value:null!=(i=null==e?void 0:e.baseTexture)?i:null},uEnvMapTexture:{value:null!=(o=null==e?void 0:e.envMapTexture)?o:null},fogColor:{value:new r.Color},fogNear:{value:1},fogFar:{value:2e3}},vertexShader:"\n #include \n\n uniform float uTime;\n uniform float uWaveMagnitude;\n\n varying vec3 vWorldPosition;\n varying vec3 vViewVector;\n varying float vDistance;\n\n // Wave function matching Tribes 2 engine\n // Z = surfaceZ + (sin(X*0.05 + time) + sin(Y*0.05 + time)) * waveFactor\n // waveFactor = waveAmplitude * 0.25\n // Note: Using xz for Three.js Y-up (Torque uses XY with Z-up)\n float getWaveHeight(vec3 worldPos) {\n float waveFactor = uWaveMagnitude * 0.25;\n return (sin(worldPos.x * 0.05 + uTime) + sin(worldPos.z * 0.05 + uTime)) * waveFactor;\n }\n\n void main() {\n // Get world position for wave calculation\n vec4 worldPos = modelMatrix * vec4(position, 1.0);\n vWorldPosition = worldPos.xyz;\n\n // Apply wave displacement to Y (vertical axis in Three.js)\n vec3 displaced = position;\n displaced.y += getWaveHeight(worldPos.xyz);\n\n // Calculate view vector for environment mapping\n vViewVector = cameraPosition - worldPos.xyz;\n vDistance = length(vViewVector);\n\n vec4 mvPosition = viewMatrix * modelMatrix * vec4(displaced, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n #include \n }\n",fragmentShader:"\n #include \n\n uniform float uTime;\n uniform float uOpacity;\n uniform float uEnvMapIntensity;\n uniform sampler2D uBaseTexture;\n uniform sampler2D uEnvMapTexture;\n\n varying vec3 vWorldPosition;\n varying vec3 vViewVector;\n varying float vDistance;\n\n #define TWO_PI 6.283185307179586\n\n // Constants from Tribes 2 engine\n #define BASE_DRIFT_CYCLE_TIME 8.0\n #define BASE_DRIFT_RATE 0.02\n #define BASE_DRIFT_SCALAR 0.03\n #define TEXTURE_SCALE (1.0 / 48.0)\n\n // Environment map UV wobble constants\n #define Q1 150.0\n #define Q2 2.0\n #define Q3 0.01\n\n // Rotate UV coordinates\n vec2 rotateUV(vec2 uv, float angle) {\n float c = cos(angle);\n float s = sin(angle);\n return vec2(\n uv.x * c - uv.y * s,\n uv.x * s + uv.y * c\n );\n }\n\n void main() {\n // Calculate base texture UVs using world position (1/48 tiling)\n // Note: In Three.js Y-up coordinates, the water surface is on the XZ plane\n // Torque uses Z-up where the surface is XY, so we use xz here\n vec2 baseUV = vWorldPosition.xz * TEXTURE_SCALE;\n\n // Phase (time in radians for drift cycle)\n float phase = mod(uTime * (TWO_PI / BASE_DRIFT_CYCLE_TIME), TWO_PI);\n\n // Base texture drift\n float baseDriftX = uTime * BASE_DRIFT_RATE;\n float baseDriftY = cos(phase) * BASE_DRIFT_SCALAR;\n\n // === Phase 1a: First base texture pass (rotated 30 degrees) ===\n vec2 uv1a = rotateUV(baseUV, radians(30.0));\n\n // === Phase 1b: Second base texture pass (rotated 60 degrees total, with drift) ===\n // OpenGL matrix order: glRotatef(60) then glTranslatef(drift) means\n // the transform is R60 * T, so when applied to UV: R60 * (UV + drift)\n // Translation is applied first, then rotation.\n vec2 uv1b = rotateUV(baseUV + vec2(baseDriftX, baseDriftY), radians(60.0));\n\n // Calculate cross-fade swing value\n // From engine: A1 = cos((X/Q1 + time/Q2) * 6.0), A2 = sin((Y/Q1 + time/Q2) * 6.28)\n // Using xz for Three.js Y-up coordinate system\n float A1 = cos(((vWorldPosition.x / Q1) + (uTime / Q2)) * 6.0);\n float A2 = sin(((vWorldPosition.z / Q1) + (uTime / Q2)) * TWO_PI);\n float swing = (A1 + A2) * 0.15 + 0.5;\n\n // Cross-fade alpha calculation from engine\n // alpha1a = ((1-swing) * opacity) / (1 - (swing * opacity))\n // alpha1b = swing * opacity\n float alpha1a = ((1.0 - swing) * uOpacity) / max(1.0 - (swing * uOpacity), 0.001);\n float alpha1b = swing * uOpacity;\n\n // Sample base texture for both passes\n vec4 texColor1a = texture2D(uBaseTexture, uv1a);\n vec4 texColor1b = texture2D(uBaseTexture, uv1b);\n\n // Simulate multi-pass alpha accumulation (screen blend formula)\n // Pass 1a: framebuffer = tex1a * alpha1a + bg * (1 - alpha1a)\n // Pass 1b: framebuffer = tex1b * alpha1b + prev * (1 - alpha1b)\n // Combined alpha = 1 - (1 - alpha1a) * (1 - alpha1b)\n float combinedAlpha = 1.0 - (1.0 - alpha1a) * (1.0 - alpha1b);\n\n // Combined color (premultiplied then divided by combined alpha)\n // color = tex1b * alpha1b + tex1a * alpha1a * (1 - alpha1b)\n vec3 baseColor = (texColor1a.rgb * alpha1a * (1.0 - alpha1b) + texColor1b.rgb * alpha1b) / max(combinedAlpha, 0.001);\n\n // === Phase 3: Environment map / specular ===\n // Reflection UV calculation from engine (fluidQuadTree.cc lines 910-962)\n // Engine uses eye-to-point vector (point - eye), unnormalized.\n // vViewVector is camera - worldPos (point-to-eye), so we negate it.\n // Torque Z-up maps XY to UV; Three.js Y-up maps XZ to UV.\n vec3 reflectVec = -vViewVector;\n reflectVec.y = abs(reflectVec.y); // Y is vertical in Three.js (was Z in Torque)\n if (reflectVec.y < 0.001) reflectVec.y = 0.001;\n\n vec2 envUV;\n if (vDistance < 0.001) {\n envUV = vec2(0.0);\n } else {\n // Standard UV reflection mapping with adjustment to reduce edge emphasis\n float value = (vDistance - reflectVec.y) / (vDistance * vDistance);\n envUV.x = reflectVec.x * value;\n envUV.y = reflectVec.z * value; // Z maps to V in Three.js Y-up\n }\n\n // Convert from [-1,1] to [0,1]\n envUV = envUV * 0.5 + 0.5;\n\n // Add time-based wobble to environment map\n envUV.x += A1 * Q3;\n envUV.y += A2 * Q3;\n\n vec4 envColor = texture2D(uEnvMapTexture, envUV);\n\n // Blend environment map additively (GL_SRC_ALPHA, GL_ONE in original engine)\n // Engine uses GL_MODULATE with color (1,1,1,envMapIntensity), so texture alpha\n // is multiplied with intensity before additive blend.\n vec3 finalColor = baseColor + envColor.rgb * envColor.a * uEnvMapIntensity;\n\n gl_FragColor = vec4(finalColor, combinedAlpha);\n\n // Apply scene fog (integrated with Three.js fog system)\n #include \n }\n",transparent:!0,side:r.DoubleSide,depthWrite:!0,fog:!0})},[v,p,d,h,T]),y=(0,a.useRef)(0);return(0,i.useFrame)((e,n)=>{if(!x){y.current=0,b.uniforms.uTime.value=0;return}y.current+=n,b.uniforms.uTime.value=y.current}),(0,a.useEffect)(()=>()=>{b.dispose()},[b]),(0,n.jsx)("primitive",{object:b,attach:f})}function v(e){let{surfaceTexture:a,attach:i}=e,l=(0,o.textureToUrl)(a),u=(0,t.useTexture)(l,e=>(0,s.setupColor)(e));return(0,n.jsx)("meshStandardMaterial",{attach:i,map:u,transparent:!0,opacity:.8,side:r.DoubleSide})}let p=(0,a.memo)(function(e){var t,i,o,s;let{object:u}=e,v=(0,a.useMemo)(()=>(0,l.getPosition)(u),[u]),p=(0,a.useMemo)(()=>(0,l.getRotation)(u),[u]),[d,f,m]=(0,a.useMemo)(()=>(0,l.getScale)(u),[u]),g=null!=(t=(0,l.getProperty)(u,"surfaceTexture"))?t:"liquidTiles/BlueWater",h=(0,l.getProperty)(u,"envMapTexture"),T=parseFloat(null!=(i=(0,l.getProperty)(u,"surfaceOpacity"))?i:"0.75"),x=parseFloat(null!=(o=(0,l.getProperty)(u,"waveMagnitude"))?o:"1.0"),b=parseFloat(null!=(s=(0,l.getProperty)(u,"envMapIntensity"))?s:"1.0"),y=(0,a.useMemo)(()=>{let[e,n]=function(e,n){let a=e<=1024&&n<=1024?8:16;return[Math.max(4,Math.ceil(e/a)),Math.max(4,Math.ceil(n/a))]}(d,m),a=new r.PlaneGeometry(d,m,e,n);return a.rotateX(-Math.PI/2),a.translate(d/2,f,m/2),a},[d,f,m]);return(0,a.useEffect)(()=>()=>{y.dispose()},[y]),(0,n.jsx)("group",{position:v,quaternion:p,children:(0,n.jsx)("mesh",{geometry:y,children:(0,n.jsx)(a.Suspense,{fallback:(0,n.jsx)("meshStandardMaterial",{color:"blue",transparent:!0,opacity:.3,side:r.DoubleSide}),children:(0,n.jsx)(c,{attach:"material",surfaceTexture:g,envMapTexture:h,opacity:T,waveMagnitude:x,envMapIntensity:b})})})})})}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/d07990f13ea8bb98.js b/docs/_next/static/chunks/d07990f13ea8bb98.js deleted file mode 100644 index 7f520501..00000000 --- a/docs/_next/static/chunks/d07990f13ea8bb98.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,t,r)=>{t.exports=e.r(76562)},38360,(e,t,r)=>{var n={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},i=Object.keys(n).join("|"),a=RegExp(i,"g"),s=RegExp(i,"");function o(e){return n[e]}var l=function(e){return e.replace(a,o)};t.exports=l,t.exports.has=function(e){return!!e.match(s)},t.exports.remove=l},29402,(e,t,r)=>{var n,i,a="__lodash_hash_undefined__",s=1/0,o="[object Arguments]",l="[object Array]",u="[object Boolean]",c="[object Date]",d="[object Error]",f="[object Function]",h="[object Map]",p="[object Number]",m="[object Object]",g="[object Promise]",A="[object RegExp]",y="[object Set]",x="[object String]",B="[object Symbol]",C="[object WeakMap]",S="[object ArrayBuffer]",E="[object DataView]",T=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,b=/^\w*$/,D=/^\./,M=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,F=/^\[object .+?Constructor\]$/,R=/^(?:0|[1-9]\d*)$/,I={};I["[object Float32Array]"]=I["[object Float64Array]"]=I["[object Int8Array]"]=I["[object Int16Array]"]=I["[object Int32Array]"]=I["[object Uint8Array]"]=I["[object Uint8ClampedArray]"]=I["[object Uint16Array]"]=I["[object Uint32Array]"]=!0,I[o]=I[l]=I[S]=I[u]=I[E]=I[c]=I[d]=I[f]=I[h]=I[p]=I[m]=I[A]=I[y]=I[x]=I[C]=!1;var P=e.g&&e.g.Object===Object&&e.g,L="object"==typeof self&&self&&self.Object===Object&&self,U=P||L||Function("return this")(),G=r&&!r.nodeType&&r,O=G&&t&&!t.nodeType&&t,H=O&&O.exports===G&&P.process,N=function(){try{return H&&H.binding("util")}catch(e){}}(),k=N&&N.isTypedArray;function z(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1},eB.prototype.set=function(e,t){var r=this.__data__,n=eT(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},eC.prototype.clear=function(){this.__data__={hash:new ex,map:new(eo||eB),string:new ex}},eC.prototype.delete=function(e){return eP(this,e).delete(e)},eC.prototype.get=function(e){return eP(this,e).get(e)},eC.prototype.has=function(e){return eP(this,e).has(e)},eC.prototype.set=function(e,t){return eP(this,e).set(e,t),this},eS.prototype.add=eS.prototype.push=function(e){return this.__data__.set(e,a),this},eS.prototype.has=function(e){return this.__data__.has(e)},eE.prototype.clear=function(){this.__data__=new eB},eE.prototype.delete=function(e){return this.__data__.delete(e)},eE.prototype.get=function(e){return this.__data__.get(e)},eE.prototype.has=function(e){return this.__data__.has(e)},eE.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eB){var n=r.__data__;if(!eo||n.length<199)return n.push([e,t]),this;r=this.__data__=new eC(n)}return r.set(e,t),this};var eb=function(e,t){return function(r,n){if(null==r)return r;if(!eQ(r))return e(r,n);for(var i=r.length,a=-1,s=Object(r);(t?a--:++ao))return!1;var u=a.get(e);if(u&&a.get(t))return u==t;var c=-1,d=!0,f=1&i?new eS:void 0;for(a.set(e,t),a.set(t,e);++c-1&&e%1==0&&e-1&&e%1==0&&e<=0x1fffffffffffff}function eZ(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function eY(e){return!!e&&"object"==typeof e}function e_(e){return"symbol"==typeof e||eY(e)&&$.call(e)==B}var eq=k?j(k):function(e){return eY(e)&&eX(e.length)&&!!I[$.call(e)]};function e$(e){return eQ(e)?function(e,t){var r=eV(e)||eJ(e)?function(e,t){for(var r=-1,n=Array(e);++rt||a&&s&&l&&!o&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&e=o)return l;return l*("desc"==r[n]?-1:1)}}return e.index-t.index}(e,t,r)});l--;)o[l]=o[l].value;return o}(e,t,r))}},81405,(e,t,r)=>{e.e,t.exports=function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function r(e){for(var t=0;ts+1e3&&(l.update(1e3*o/(e-s),100),s=e,o=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:r}};return e.Panel=function(e,t,r){var n=1/0,i=0,a=Math.round,s=a(window.devicePixelRatio||1),o=80*s,l=48*s,u=3*s,c=2*s,d=3*s,f=15*s,h=74*s,p=30*s,m=document.createElement("canvas");m.width=o,m.height=l,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,u,c),g.fillRect(d,f,h,p),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(d,f,h,p),{dom:m,update:function(l,A){n=Math.min(n,l),i=Math.max(i,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,o,f),g.fillStyle=t,g.fillText(a(l)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),g.drawImage(m,d+s,f,h-s,p,d,f,h-s,p),g.fillRect(d+h-s,f,s,p),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(d+h-s,f,s,a((1-l/A)*p))}}},e}()},31713,e=>{"use strict";let t;e.s(["default",()=>du],31713);var r,n,i,a,s,o,l,u,c,d,f,h,p,m,g,A,y,x,B,C,S,E,T,b,D,M,w,F,R,I,P,L,U,G,O,H,N,k,z,j,K,J,V,Q,W,X,Z,Y,_,q,$,ee,et,er,en,ei,ea,es,eo,el,eu,ec,ed,ef,eh,ep,em,ev,eg,eA,ey,ex,eB,eC,eS,eE,eT,eb,eD,eM,ew,eF,eR,eI=e.i(43476),eP=e.i(71645),eL=e.i(18566),eU=e.i(46712);e.s(["ACESFilmicToneMapping",()=>eO.ACESFilmicToneMapping,"AddEquation",()=>eO.AddEquation,"AddOperation",()=>eO.AddOperation,"AdditiveAnimationBlendMode",()=>eO.AdditiveAnimationBlendMode,"AdditiveBlending",()=>eO.AdditiveBlending,"AgXToneMapping",()=>eO.AgXToneMapping,"AlphaFormat",()=>eO.AlphaFormat,"AlwaysCompare",()=>eO.AlwaysCompare,"AlwaysDepth",()=>eO.AlwaysDepth,"AlwaysStencilFunc",()=>eO.AlwaysStencilFunc,"AmbientLight",()=>eO.AmbientLight,"AnimationAction",()=>eO.AnimationAction,"AnimationClip",()=>eO.AnimationClip,"AnimationLoader",()=>eO.AnimationLoader,"AnimationMixer",()=>eO.AnimationMixer,"AnimationObjectGroup",()=>eO.AnimationObjectGroup,"AnimationUtils",()=>eO.AnimationUtils,"ArcCurve",()=>eO.ArcCurve,"ArrayCamera",()=>eO.ArrayCamera,"ArrowHelper",()=>eO.ArrowHelper,"AttachedBindMode",()=>eO.AttachedBindMode,"Audio",()=>eO.Audio,"AudioAnalyser",()=>eO.AudioAnalyser,"AudioContext",()=>eO.AudioContext,"AudioListener",()=>eO.AudioListener,"AudioLoader",()=>eO.AudioLoader,"AxesHelper",()=>eO.AxesHelper,"BackSide",()=>eO.BackSide,"BasicDepthPacking",()=>eO.BasicDepthPacking,"BasicShadowMap",()=>eO.BasicShadowMap,"BatchedMesh",()=>eO.BatchedMesh,"Bone",()=>eO.Bone,"BooleanKeyframeTrack",()=>eO.BooleanKeyframeTrack,"Box2",()=>eO.Box2,"Box3",()=>eO.Box3,"Box3Helper",()=>eO.Box3Helper,"BoxGeometry",()=>eO.BoxGeometry,"BoxHelper",()=>eO.BoxHelper,"BufferAttribute",()=>eO.BufferAttribute,"BufferGeometry",()=>eO.BufferGeometry,"BufferGeometryLoader",()=>eO.BufferGeometryLoader,"ByteType",()=>eO.ByteType,"Cache",()=>eO.Cache,"Camera",()=>eO.Camera,"CameraHelper",()=>eO.CameraHelper,"CanvasTexture",()=>eO.CanvasTexture,"CapsuleGeometry",()=>eO.CapsuleGeometry,"CatmullRomCurve3",()=>eO.CatmullRomCurve3,"CineonToneMapping",()=>eO.CineonToneMapping,"CircleGeometry",()=>eO.CircleGeometry,"ClampToEdgeWrapping",()=>eO.ClampToEdgeWrapping,"Clock",()=>eO.Clock,"Color",()=>eO.Color,"ColorKeyframeTrack",()=>eO.ColorKeyframeTrack,"ColorManagement",()=>eO.ColorManagement,"CompressedArrayTexture",()=>eO.CompressedArrayTexture,"CompressedCubeTexture",()=>eO.CompressedCubeTexture,"CompressedTexture",()=>eO.CompressedTexture,"CompressedTextureLoader",()=>eO.CompressedTextureLoader,"ConeGeometry",()=>eO.ConeGeometry,"ConstantAlphaFactor",()=>eO.ConstantAlphaFactor,"ConstantColorFactor",()=>eO.ConstantColorFactor,"Controls",()=>eO.Controls,"CubeCamera",()=>eO.CubeCamera,"CubeReflectionMapping",()=>eO.CubeReflectionMapping,"CubeRefractionMapping",()=>eO.CubeRefractionMapping,"CubeTexture",()=>eO.CubeTexture,"CubeTextureLoader",()=>eO.CubeTextureLoader,"CubeUVReflectionMapping",()=>eO.CubeUVReflectionMapping,"CubicBezierCurve",()=>eO.CubicBezierCurve,"CubicBezierCurve3",()=>eO.CubicBezierCurve3,"CubicInterpolant",()=>eO.CubicInterpolant,"CullFaceBack",()=>eO.CullFaceBack,"CullFaceFront",()=>eO.CullFaceFront,"CullFaceFrontBack",()=>eO.CullFaceFrontBack,"CullFaceNone",()=>eO.CullFaceNone,"Curve",()=>eO.Curve,"CurvePath",()=>eO.CurvePath,"CustomBlending",()=>eO.CustomBlending,"CustomToneMapping",()=>eO.CustomToneMapping,"CylinderGeometry",()=>eO.CylinderGeometry,"Cylindrical",()=>eO.Cylindrical,"Data3DTexture",()=>eO.Data3DTexture,"DataArrayTexture",()=>eO.DataArrayTexture,"DataTexture",()=>eO.DataTexture,"DataTextureLoader",()=>eO.DataTextureLoader,"DataUtils",()=>eO.DataUtils,"DecrementStencilOp",()=>eO.DecrementStencilOp,"DecrementWrapStencilOp",()=>eO.DecrementWrapStencilOp,"DefaultLoadingManager",()=>eO.DefaultLoadingManager,"DepthFormat",()=>eO.DepthFormat,"DepthStencilFormat",()=>eO.DepthStencilFormat,"DepthTexture",()=>eO.DepthTexture,"DetachedBindMode",()=>eO.DetachedBindMode,"DirectionalLight",()=>eO.DirectionalLight,"DirectionalLightHelper",()=>eO.DirectionalLightHelper,"DiscreteInterpolant",()=>eO.DiscreteInterpolant,"DodecahedronGeometry",()=>eO.DodecahedronGeometry,"DoubleSide",()=>eO.DoubleSide,"DstAlphaFactor",()=>eO.DstAlphaFactor,"DstColorFactor",()=>eO.DstColorFactor,"DynamicCopyUsage",()=>eO.DynamicCopyUsage,"DynamicDrawUsage",()=>eO.DynamicDrawUsage,"DynamicReadUsage",()=>eO.DynamicReadUsage,"EdgesGeometry",()=>eO.EdgesGeometry,"EllipseCurve",()=>eO.EllipseCurve,"EqualCompare",()=>eO.EqualCompare,"EqualDepth",()=>eO.EqualDepth,"EqualStencilFunc",()=>eO.EqualStencilFunc,"EquirectangularReflectionMapping",()=>eO.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>eO.EquirectangularRefractionMapping,"Euler",()=>eO.Euler,"EventDispatcher",()=>eO.EventDispatcher,"ExternalTexture",()=>eO.ExternalTexture,"ExtrudeGeometry",()=>eO.ExtrudeGeometry,"FileLoader",()=>eO.FileLoader,"Float16BufferAttribute",()=>eO.Float16BufferAttribute,"Float32BufferAttribute",()=>eO.Float32BufferAttribute,"FloatType",()=>eO.FloatType,"Fog",()=>eO.Fog,"FogExp2",()=>eO.FogExp2,"FramebufferTexture",()=>eO.FramebufferTexture,"FrontSide",()=>eO.FrontSide,"Frustum",()=>eO.Frustum,"FrustumArray",()=>eO.FrustumArray,"GLBufferAttribute",()=>eO.GLBufferAttribute,"GLSL1",()=>eO.GLSL1,"GLSL3",()=>eO.GLSL3,"GreaterCompare",()=>eO.GreaterCompare,"GreaterDepth",()=>eO.GreaterDepth,"GreaterEqualCompare",()=>eO.GreaterEqualCompare,"GreaterEqualDepth",()=>eO.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>eO.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>eO.GreaterStencilFunc,"GridHelper",()=>eO.GridHelper,"Group",()=>eO.Group,"HalfFloatType",()=>eO.HalfFloatType,"HemisphereLight",()=>eO.HemisphereLight,"HemisphereLightHelper",()=>eO.HemisphereLightHelper,"IcosahedronGeometry",()=>eO.IcosahedronGeometry,"ImageBitmapLoader",()=>eO.ImageBitmapLoader,"ImageLoader",()=>eO.ImageLoader,"ImageUtils",()=>eO.ImageUtils,"IncrementStencilOp",()=>eO.IncrementStencilOp,"IncrementWrapStencilOp",()=>eO.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>eO.InstancedBufferAttribute,"InstancedBufferGeometry",()=>eO.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>eO.InstancedInterleavedBuffer,"InstancedMesh",()=>eO.InstancedMesh,"Int16BufferAttribute",()=>eO.Int16BufferAttribute,"Int32BufferAttribute",()=>eO.Int32BufferAttribute,"Int8BufferAttribute",()=>eO.Int8BufferAttribute,"IntType",()=>eO.IntType,"InterleavedBuffer",()=>eO.InterleavedBuffer,"InterleavedBufferAttribute",()=>eO.InterleavedBufferAttribute,"Interpolant",()=>eO.Interpolant,"InterpolateDiscrete",()=>eO.InterpolateDiscrete,"InterpolateLinear",()=>eO.InterpolateLinear,"InterpolateSmooth",()=>eO.InterpolateSmooth,"InterpolationSamplingMode",()=>eO.InterpolationSamplingMode,"InterpolationSamplingType",()=>eO.InterpolationSamplingType,"InvertStencilOp",()=>eO.InvertStencilOp,"KeepStencilOp",()=>eO.KeepStencilOp,"KeyframeTrack",()=>eO.KeyframeTrack,"LOD",()=>eO.LOD,"LatheGeometry",()=>eO.LatheGeometry,"Layers",()=>eO.Layers,"LessCompare",()=>eO.LessCompare,"LessDepth",()=>eO.LessDepth,"LessEqualCompare",()=>eO.LessEqualCompare,"LessEqualDepth",()=>eO.LessEqualDepth,"LessEqualStencilFunc",()=>eO.LessEqualStencilFunc,"LessStencilFunc",()=>eO.LessStencilFunc,"Light",()=>eO.Light,"LightProbe",()=>eO.LightProbe,"Line",()=>eO.Line,"Line3",()=>eO.Line3,"LineBasicMaterial",()=>eO.LineBasicMaterial,"LineCurve",()=>eO.LineCurve,"LineCurve3",()=>eO.LineCurve3,"LineDashedMaterial",()=>eO.LineDashedMaterial,"LineLoop",()=>eO.LineLoop,"LineSegments",()=>eO.LineSegments,"LinearFilter",()=>eO.LinearFilter,"LinearInterpolant",()=>eO.LinearInterpolant,"LinearMipMapLinearFilter",()=>eO.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>eO.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>eO.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>eO.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>eO.LinearSRGBColorSpace,"LinearToneMapping",()=>eO.LinearToneMapping,"LinearTransfer",()=>eO.LinearTransfer,"Loader",()=>eO.Loader,"LoaderUtils",()=>eO.LoaderUtils,"LoadingManager",()=>eO.LoadingManager,"LoopOnce",()=>eO.LoopOnce,"LoopPingPong",()=>eO.LoopPingPong,"LoopRepeat",()=>eO.LoopRepeat,"MOUSE",()=>eO.MOUSE,"Material",()=>eO.Material,"MaterialLoader",()=>eO.MaterialLoader,"MathUtils",()=>eO.MathUtils,"Matrix2",()=>eO.Matrix2,"Matrix3",()=>eO.Matrix3,"Matrix4",()=>eO.Matrix4,"MaxEquation",()=>eO.MaxEquation,"Mesh",()=>eO.Mesh,"MeshBasicMaterial",()=>eO.MeshBasicMaterial,"MeshDepthMaterial",()=>eO.MeshDepthMaterial,"MeshDistanceMaterial",()=>eO.MeshDistanceMaterial,"MeshLambertMaterial",()=>eO.MeshLambertMaterial,"MeshMatcapMaterial",()=>eO.MeshMatcapMaterial,"MeshNormalMaterial",()=>eO.MeshNormalMaterial,"MeshPhongMaterial",()=>eO.MeshPhongMaterial,"MeshPhysicalMaterial",()=>eO.MeshPhysicalMaterial,"MeshStandardMaterial",()=>eO.MeshStandardMaterial,"MeshToonMaterial",()=>eO.MeshToonMaterial,"MinEquation",()=>eO.MinEquation,"MirroredRepeatWrapping",()=>eO.MirroredRepeatWrapping,"MixOperation",()=>eO.MixOperation,"MultiplyBlending",()=>eO.MultiplyBlending,"MultiplyOperation",()=>eO.MultiplyOperation,"NearestFilter",()=>eO.NearestFilter,"NearestMipMapLinearFilter",()=>eO.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>eO.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>eO.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>eO.NearestMipmapNearestFilter,"NeutralToneMapping",()=>eO.NeutralToneMapping,"NeverCompare",()=>eO.NeverCompare,"NeverDepth",()=>eO.NeverDepth,"NeverStencilFunc",()=>eO.NeverStencilFunc,"NoBlending",()=>eO.NoBlending,"NoColorSpace",()=>eO.NoColorSpace,"NoToneMapping",()=>eO.NoToneMapping,"NormalAnimationBlendMode",()=>eO.NormalAnimationBlendMode,"NormalBlending",()=>eO.NormalBlending,"NotEqualCompare",()=>eO.NotEqualCompare,"NotEqualDepth",()=>eO.NotEqualDepth,"NotEqualStencilFunc",()=>eO.NotEqualStencilFunc,"NumberKeyframeTrack",()=>eO.NumberKeyframeTrack,"Object3D",()=>eO.Object3D,"ObjectLoader",()=>eO.ObjectLoader,"ObjectSpaceNormalMap",()=>eO.ObjectSpaceNormalMap,"OctahedronGeometry",()=>eO.OctahedronGeometry,"OneFactor",()=>eO.OneFactor,"OneMinusConstantAlphaFactor",()=>eO.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>eO.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>eO.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>eO.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>eO.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>eO.OneMinusSrcColorFactor,"OrthographicCamera",()=>eO.OrthographicCamera,"PCFShadowMap",()=>eO.PCFShadowMap,"PCFSoftShadowMap",()=>eO.PCFSoftShadowMap,"PMREMGenerator",()=>eG.PMREMGenerator,"Path",()=>eO.Path,"PerspectiveCamera",()=>eO.PerspectiveCamera,"Plane",()=>eO.Plane,"PlaneGeometry",()=>eO.PlaneGeometry,"PlaneHelper",()=>eO.PlaneHelper,"PointLight",()=>eO.PointLight,"PointLightHelper",()=>eO.PointLightHelper,"Points",()=>eO.Points,"PointsMaterial",()=>eO.PointsMaterial,"PolarGridHelper",()=>eO.PolarGridHelper,"PolyhedronGeometry",()=>eO.PolyhedronGeometry,"PositionalAudio",()=>eO.PositionalAudio,"PropertyBinding",()=>eO.PropertyBinding,"PropertyMixer",()=>eO.PropertyMixer,"QuadraticBezierCurve",()=>eO.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>eO.QuadraticBezierCurve3,"Quaternion",()=>eO.Quaternion,"QuaternionKeyframeTrack",()=>eO.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>eO.QuaternionLinearInterpolant,"RED_GREEN_RGTC2_Format",()=>eO.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>eO.RED_RGTC1_Format,"REVISION",()=>eO.REVISION,"RGBADepthPacking",()=>eO.RGBADepthPacking,"RGBAFormat",()=>eO.RGBAFormat,"RGBAIntegerFormat",()=>eO.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>eO.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>eO.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>eO.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>eO.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>eO.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>eO.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>eO.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>eO.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>eO.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>eO.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>eO.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>eO.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>eO.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>eO.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>eO.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>eO.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>eO.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>eO.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>eO.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>eO.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>eO.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>eO.RGBDepthPacking,"RGBFormat",()=>eO.RGBFormat,"RGBIntegerFormat",()=>eO.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>eO.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>eO.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>eO.RGB_ETC1_Format,"RGB_ETC2_Format",()=>eO.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>eO.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>eO.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>eO.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>eO.RGDepthPacking,"RGFormat",()=>eO.RGFormat,"RGIntegerFormat",()=>eO.RGIntegerFormat,"RawShaderMaterial",()=>eO.RawShaderMaterial,"Ray",()=>eO.Ray,"Raycaster",()=>eO.Raycaster,"RectAreaLight",()=>eO.RectAreaLight,"RedFormat",()=>eO.RedFormat,"RedIntegerFormat",()=>eO.RedIntegerFormat,"ReinhardToneMapping",()=>eO.ReinhardToneMapping,"RenderTarget",()=>eO.RenderTarget,"RenderTarget3D",()=>eO.RenderTarget3D,"RepeatWrapping",()=>eO.RepeatWrapping,"ReplaceStencilOp",()=>eO.ReplaceStencilOp,"ReverseSubtractEquation",()=>eO.ReverseSubtractEquation,"RingGeometry",()=>eO.RingGeometry,"SIGNED_RED_GREEN_RGTC2_Format",()=>eO.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>eO.SIGNED_RED_RGTC1_Format,"SRGBColorSpace",()=>eO.SRGBColorSpace,"SRGBTransfer",()=>eO.SRGBTransfer,"Scene",()=>eO.Scene,"ShaderChunk",()=>eG.ShaderChunk,"ShaderLib",()=>eG.ShaderLib,"ShaderMaterial",()=>eO.ShaderMaterial,"ShadowMaterial",()=>eO.ShadowMaterial,"Shape",()=>eO.Shape,"ShapeGeometry",()=>eO.ShapeGeometry,"ShapePath",()=>eO.ShapePath,"ShapeUtils",()=>eO.ShapeUtils,"ShortType",()=>eO.ShortType,"Skeleton",()=>eO.Skeleton,"SkeletonHelper",()=>eO.SkeletonHelper,"SkinnedMesh",()=>eO.SkinnedMesh,"Source",()=>eO.Source,"Sphere",()=>eO.Sphere,"SphereGeometry",()=>eO.SphereGeometry,"Spherical",()=>eO.Spherical,"SphericalHarmonics3",()=>eO.SphericalHarmonics3,"SplineCurve",()=>eO.SplineCurve,"SpotLight",()=>eO.SpotLight,"SpotLightHelper",()=>eO.SpotLightHelper,"Sprite",()=>eO.Sprite,"SpriteMaterial",()=>eO.SpriteMaterial,"SrcAlphaFactor",()=>eO.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>eO.SrcAlphaSaturateFactor,"SrcColorFactor",()=>eO.SrcColorFactor,"StaticCopyUsage",()=>eO.StaticCopyUsage,"StaticDrawUsage",()=>eO.StaticDrawUsage,"StaticReadUsage",()=>eO.StaticReadUsage,"StereoCamera",()=>eO.StereoCamera,"StreamCopyUsage",()=>eO.StreamCopyUsage,"StreamDrawUsage",()=>eO.StreamDrawUsage,"StreamReadUsage",()=>eO.StreamReadUsage,"StringKeyframeTrack",()=>eO.StringKeyframeTrack,"SubtractEquation",()=>eO.SubtractEquation,"SubtractiveBlending",()=>eO.SubtractiveBlending,"TOUCH",()=>eO.TOUCH,"TangentSpaceNormalMap",()=>eO.TangentSpaceNormalMap,"TetrahedronGeometry",()=>eO.TetrahedronGeometry,"Texture",()=>eO.Texture,"TextureLoader",()=>eO.TextureLoader,"TextureUtils",()=>eO.TextureUtils,"Timer",()=>eO.Timer,"TimestampQuery",()=>eO.TimestampQuery,"TorusGeometry",()=>eO.TorusGeometry,"TorusKnotGeometry",()=>eO.TorusKnotGeometry,"Triangle",()=>eO.Triangle,"TriangleFanDrawMode",()=>eO.TriangleFanDrawMode,"TriangleStripDrawMode",()=>eO.TriangleStripDrawMode,"TrianglesDrawMode",()=>eO.TrianglesDrawMode,"TubeGeometry",()=>eO.TubeGeometry,"UVMapping",()=>eO.UVMapping,"Uint16BufferAttribute",()=>eO.Uint16BufferAttribute,"Uint32BufferAttribute",()=>eO.Uint32BufferAttribute,"Uint8BufferAttribute",()=>eO.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>eO.Uint8ClampedBufferAttribute,"Uniform",()=>eO.Uniform,"UniformsGroup",()=>eO.UniformsGroup,"UniformsLib",()=>eG.UniformsLib,"UniformsUtils",()=>eO.UniformsUtils,"UnsignedByteType",()=>eO.UnsignedByteType,"UnsignedInt101111Type",()=>eO.UnsignedInt101111Type,"UnsignedInt248Type",()=>eO.UnsignedInt248Type,"UnsignedInt5999Type",()=>eO.UnsignedInt5999Type,"UnsignedIntType",()=>eO.UnsignedIntType,"UnsignedShort4444Type",()=>eO.UnsignedShort4444Type,"UnsignedShort5551Type",()=>eO.UnsignedShort5551Type,"UnsignedShortType",()=>eO.UnsignedShortType,"VSMShadowMap",()=>eO.VSMShadowMap,"Vector2",()=>eO.Vector2,"Vector3",()=>eO.Vector3,"Vector4",()=>eO.Vector4,"VectorKeyframeTrack",()=>eO.VectorKeyframeTrack,"VideoFrameTexture",()=>eO.VideoFrameTexture,"VideoTexture",()=>eO.VideoTexture,"WebGL3DRenderTarget",()=>eO.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>eO.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>eO.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>eO.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>eO.WebGLRenderTarget,"WebGLRenderer",()=>eG.WebGLRenderer,"WebGLUtils",()=>eG.WebGLUtils,"WebGPUCoordinateSystem",()=>eO.WebGPUCoordinateSystem,"WebXRController",()=>eO.WebXRController,"WireframeGeometry",()=>eO.WireframeGeometry,"WrapAroundEnding",()=>eO.WrapAroundEnding,"ZeroCurvatureEnding",()=>eO.ZeroCurvatureEnding,"ZeroFactor",()=>eO.ZeroFactor,"ZeroSlopeEnding",()=>eO.ZeroSlopeEnding,"ZeroStencilOp",()=>eO.ZeroStencilOp,"createCanvasElement",()=>eO.createCanvasElement],32009);var eG=e.i(8560),eO=e.i(90072),eH=e.i(32009);function eN(e,t){let r;return function(){for(var n=arguments.length,i=Array(n),a=0;ae(...i),t)}}let ek=["x","y","top","bottom","left","right","width","height"];var ez=e.i(46791);function ej(e){let{ref:t,children:r,fallback:n,resize:i,style:a,gl:s,events:o=eU.f,eventSource:l,eventPrefix:u,shadows:c,linear:d,flat:f,legacy:h,orthographic:p,frameloop:m,dpr:g,performance:A,raycaster:y,camera:x,scene:B,onPointerMissed:C,onCreated:S,...E}=e;eP.useMemo(()=>(0,eU.e)(eH),[]);let T=(0,eU.u)(),[b,D]=function(){var e,t,r;let{debounce:n,scroll:i,polyfill:a,offsetSize:s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{debounce:0,scroll:!1,offsetSize:!1},o=a||("undefined"==typeof window?class{}:window.ResizeObserver);if(!o)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[l,u]=(0,eP.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=(0,eP.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l,orientationHandler:null}),d=n?"number"==typeof n?n:n.scroll:null,f=n?"number"==typeof n?n:n.resize:null,h=(0,eP.useRef)(!1);(0,eP.useEffect)(()=>(h.current=!0,()=>void(h.current=!1)));let[p,m,g]=(0,eP.useMemo)(()=>{let e=()=>{let e,t;if(!c.current.element)return;let{left:r,top:n,width:i,height:a,bottom:o,right:l,x:d,y:f}=c.current.element.getBoundingClientRect(),p={left:r,top:n,width:i,height:a,bottom:o,right:l,x:d,y:f};c.current.element instanceof HTMLElement&&s&&(p.height=c.current.element.offsetHeight,p.width=c.current.element.offsetWidth),Object.freeze(p),h.current&&(e=c.current.lastBounds,t=p,!ek.every(r=>e[r]===t[r]))&&u(c.current.lastBounds=p)};return[e,f?eN(e,f):e,d?eN(e,d):e]},[u,s,d,f]);function A(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function y(){c.current.element&&(c.current.resizeObserver=new o(g),c.current.resizeObserver.observe(c.current.element),i&&c.current.scrollContainers&&c.current.scrollContainers.forEach(e=>e.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}return e=g,t=!!i,(0,eP.useEffect)(()=>{if(t)return window.addEventListener("scroll",e,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",e,!0)},[e,t]),r=m,(0,eP.useEffect)(()=>(window.addEventListener("resize",r),()=>void window.removeEventListener("resize",r)),[r]),(0,eP.useEffect)(()=>{A(),y()},[i,g,m]),(0,eP.useEffect)(()=>A,[]),[e=>{e&&e!==c.current.element&&(A(),c.current.element=e,c.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),y())},l,p]}({scroll:!0,debounce:{scroll:50,resize:0},...i}),M=eP.useRef(null),w=eP.useRef(null);eP.useImperativeHandle(t,()=>M.current);let F=(0,eU.a)(C),[R,I]=eP.useState(!1),[P,L]=eP.useState(!1);if(R)throw R;if(P)throw P;let U=eP.useRef(null);(0,eU.b)(()=>{let e=M.current;D.width>0&&D.height>0&&e&&(U.current||(U.current=(0,eU.c)(e)),async function(){await U.current.configure({gl:s,scene:B,events:o,shadows:c,linear:d,flat:f,legacy:h,orthographic:p,frameloop:m,dpr:g,performance:A,raycaster:y,camera:x,size:D,onPointerMissed:function(){for(var e=arguments.length,t=Array(e),r=0;r{null==e.events.connect||e.events.connect(l?(0,eU.i)(l)?l.current:l:w.current),u&&e.setEvents({compute:(e,t)=>{let r=e[u+"X"],n=e[u+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(n/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==S||S(e)}}),U.current.render((0,eI.jsx)(T,{children:(0,eI.jsx)(eU.E,{set:L,children:(0,eI.jsx)(eP.Suspense,{fallback:(0,eI.jsx)(eU.B,{set:I}),children:null!=r?r:null})})}))}())}),eP.useEffect(()=>{let e=M.current;if(e)return()=>(0,eU.d)(e)},[]);let G=l?"none":"auto";return(0,eI.jsx)("div",{ref:w,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:G,...a},...E,children:(0,eI.jsx)("div",{ref:b,style:{width:"100%",height:"100%"},children:(0,eI.jsx)("canvas",{ref:M,style:{display:"block"},children:n})})})}function eK(e){return(0,eI.jsx)(ez.FiberProvider,{children:(0,eI.jsx)(ej,{...e})})}e.i(39695),e.i(98133),e.i(95087);var eJ=e.i(16096),eV=e.i(5230),eQ=e.i(80520),eW=eO,eX=class{get autoReset(){return this._autoReset}set autoReset(e){"undefined"!=typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=e)}get delta(){return .001*this._delta}get fixedDelta(){return .001*this._fixedDelta}set fixedDelta(e){this._fixedDelta=1e3*e}get elapsed(){return .001*this._elapsed}update(e){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(void 0!==e?e:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}getDelta(){return this.delta}getElapsed(){return this.elapsed}handleEvent(e){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}},eZ=(()=>{let e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]),r=new eW.BufferGeometry;return r.setAttribute("position",new eW.BufferAttribute(e,3)),r.setAttribute("uv",new eW.BufferAttribute(t,2)),r})(),eY=class e{static get fullscreenGeometry(){return eZ}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){let t=this.fullscreenMaterial;null!==t&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(t){let r=this.screen;null!==r?r.material=t:((r=new eW.Mesh(e.fullscreenGeometry,t)).frustumCulled=!1,null===this.scene&&(this.scene=new eW.Scene),this.scene.add(r),this.screen=r)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e){arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking}render(e,t,r,n,i){throw Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,r){}dispose(){for(let t of Object.keys(this)){let r=this[t];(r instanceof eW.WebGLRenderTarget||r instanceof eW.Material||r instanceof eW.Texture||r instanceof e)&&this[t].dispose()}null!==this.fullscreenMaterial&&this.fullscreenMaterial.dispose()}constructor(e="Pass",t=new eW.Scene,r=new eW.OrthographicCamera){this.name=e,this.renderer=null,this.scene=t,this.camera=r,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}},e_=class extends eY{render(e,t,r,n,i){let a=e.state.buffers.stencil;a.setLocked(!1),a.setTest(!1)}constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}},eq="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",e$=class extends eW.ShaderMaterial{get inputBuffer(){return this.uniforms.inputBuffer.value}set inputBuffer(e){let t=null!==e;this.colorWrite!==t&&(t?this.defines.COLOR_WRITE=!0:delete this.defines.COLOR_WRITE,this.colorWrite=t,this.needsUpdate=!0),this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){let t=null!==e;this.depthWrite!==t&&(t?this.defines.DEPTH_WRITE=!0:delete this.defines.DEPTH_WRITE,this.depthTest=t,this.depthWrite=t,this.needsUpdate=!0),this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}get channelWeights(){return this.uniforms.channelWeights.value}set channelWeights(e){null!==e?(this.defines.USE_WEIGHTS="1",this.uniforms.channelWeights.value=e):delete this.defines.USE_WEIGHTS,this.needsUpdate=!0}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}constructor(){super({name:"CopyMaterial",defines:{DEPTH_PACKING:"0",COLOR_WRITE:"1"},uniforms:{inputBuffer:new eW.Uniform(null),depthBuffer:new eW.Uniform(null),channelWeights:new eW.Uniform(null),opacity:new eW.Uniform(1)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef COLOR_WRITE\n#include \n#include \n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#endif\n#ifdef DEPTH_WRITE\n#include \n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}\n#endif\n#ifdef USE_WEIGHTS\nuniform vec4 channelWeights;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){\n#ifdef COLOR_WRITE\nvec4 texel=texture2D(inputBuffer,vUv);\n#ifdef USE_WEIGHTS\ntexel*=channelWeights;\n#endif\ngl_FragColor=opacity*texel;\n#ifdef COLOR_SPACE_CONVERSION\n#include \n#endif\n#include \n#else\ngl_FragColor=vec4(0.0);\n#endif\n#ifdef DEPTH_WRITE\ngl_FragDepth=readDepth(vUv);\n#endif\n}",vertexShader:eq}),this.depthFunc=eW.AlwaysDepth}},e0=class extends eY{get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,r,n,i){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,r){void 0!==r&&(this.renderTarget.texture.type=r,r!==eW.UnsignedByteType?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":null!==e&&e.outputColorSpace===eW.SRGBColorSpace&&(this.renderTarget.texture.colorSpace=eW.SRGBColorSpace))}constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new e$,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new eW.WebGLRenderTarget(1,1,{minFilter:eW.LinearFilter,magFilter:eW.LinearFilter,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}},e1=new eW.Color,e2=class extends eY{setClearFlags(e,t,r){this.color=e,this.depth=t,this.stencil=r}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,r,n,i){let a=this.overrideClearColor,s=this.overrideClearAlpha,o=e.getClearAlpha(),l=null!==a,u=s>=0;l?(e.getClearColor(e1),e.setClearColor(a,u?s:o)):u&&e.setClearAlpha(s),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(e1,o):u&&e.setClearAlpha(o)}constructor(e=!0,t=!0,r=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=r,this.overrideClearColor=null,this.overrideClearAlpha=-1}},e9=class extends eY{set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,r,n,i){let a=e.getContext(),s=e.state.buffers,o=this.scene,l=this.camera,u=this.clearPass,c=+!this.inverted;s.color.setMask(!1),s.depth.setMask(!1),s.color.setLocked(!0),s.depth.setLocked(!0),s.stencil.setTest(!0),s.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),s.stencil.setFunc(a.ALWAYS,c,0xffffffff),s.stencil.setClear(1-c),s.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?u.render(e,null):(u.render(e,t),u.render(e,r))),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),e.render(o,l),e.setRenderTarget(r)),e.render(o,l),s.color.setLocked(!1),s.depth.setLocked(!1),s.stencil.setLocked(!1),s.stencil.setFunc(a.EQUAL,1,0xffffffff),s.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),s.stencil.setLocked(!0)}constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new e2(!1,!1,!0),this.inverse=!1}},e3=class{get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){let t=this.inputBuffer,r=this.multisampling;r>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):r!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){let t=e.getSize(new eW.Vector2),r=e.getContext().getContextAttributes().alpha,n=this.inputBuffer.texture.type;for(let i of(n===eW.UnsignedByteType&&e.outputColorSpace===eW.SRGBColorSpace&&(this.inputBuffer.texture.colorSpace=eW.SRGBColorSpace,this.outputBuffer.texture.colorSpace=eW.SRGBColorSpace,this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height),this.passes))i.initialize(e,r,n)}}replaceRenderer(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=this.renderer,n=r.domElement.parentNode;return this.setRenderer(e),t&&null!==n&&(n.removeChild(r.domElement),n.appendChild(e.domElement)),r}createDepthTexture(){let e=this.depthTexture=new eW.DepthTexture;return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=eW.DepthStencilFormat,e.type=eW.UnsignedInt248Type):e.type=eW.UnsignedIntType,e}deleteDepthTexture(){if(null!==this.depthTexture)for(let e of(this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose(),this.passes))e.setDepthTexture(null)}createBuffer(e,t,r,n){let i=this.renderer,a=null===i?new eW.Vector2:i.getDrawingBufferSize(new eW.Vector2),s={minFilter:eW.LinearFilter,magFilter:eW.LinearFilter,stencilBuffer:t,depthBuffer:e,type:r},o=new eW.WebGLRenderTarget(a.width,a.height,s);return n>0&&(o.samples=n),r===eW.UnsignedByteType&&null!==i&&i.outputColorSpace===eW.SRGBColorSpace&&(o.texture.colorSpace=eW.SRGBColorSpace),o.texture.name="EffectComposer.Buffer",o.texture.generateMipmaps=!1,o}setMainScene(e){for(let t of this.passes)t.mainScene=e}setMainCamera(e){for(let t of this.passes)t.mainCamera=e}addPass(e,t){let r=this.passes,n=this.renderer,i=n.getDrawingBufferSize(new eW.Vector2),a=n.getContext().getContextAttributes().alpha,s=this.inputBuffer.texture.type;if(e.setRenderer(n),e.setSize(i.width,i.height),e.initialize(n,a,s),this.autoRenderToScreen&&(r.length>0&&(r[r.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?r.splice(t,0,e):r.push(e),this.autoRenderToScreen&&(r[r.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){let t=this.createDepthTexture();for(e of r)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}removePass(e){let t=this.passes,r=t.indexOf(e);-1!==r&&t.splice(r,1).length>0&&(null!==this.depthTexture&&(t.reduce((e,t)=>e||t.needsDepthTexture,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())),this.autoRenderToScreen&&r===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0)))}removeAllPasses(){let e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){let t,r,n,i=this.renderer,a=this.copyPass,s=this.inputBuffer,o=this.outputBuffer,l=!1;for(let u of(void 0===e&&(this.timer.update(),e=this.timer.getDelta()),this.passes))u.enabled&&(u.render(i,s,o,e,l),u.needsSwap&&(l&&(a.renderToScreen=u.renderToScreen,t=i.getContext(),(r=i.state.buffers.stencil).setFunc(t.NOTEQUAL,1,0xffffffff),a.render(i,s,o,e,l),r.setFunc(t.EQUAL,1,0xffffffff)),n=s,s=o,o=n),u instanceof e9?l=!0:u instanceof e_&&(l=!1))}setSize(e,t,r){let n=this.renderer,i=n.getSize(new eW.Vector2);(void 0===e||void 0===t)&&(e=i.width,t=i.height),(i.width!==e||i.height!==t)&&n.setSize(e,t,r);let a=n.getDrawingBufferSize(new eW.Vector2);for(let e of(this.inputBuffer.setSize(a.width,a.height),this.outputBuffer.setSize(a.width,a.height),this.passes))e.setSize(a.width,a.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(let e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),eY.fullscreenGeometry.dispose()}constructor(e=null,{depthBuffer:t=!0,stencilBuffer:r=!1,multisampling:n=0,frameBufferType:i}={}){this.renderer=null,this.inputBuffer=this.createBuffer(t,r,i,n),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new e0,this.depthTexture=null,this.passes=[],this.timer=new eX,this.autoRenderToScreen=!0,this.setRenderer(e)}},e4={NONE:0,DEPTH:1,CONVOLUTION:2},e8={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},e5=class{constructor(){this.shaderParts=new Map([[e8.FRAGMENT_HEAD,null],[e8.FRAGMENT_MAIN_UV,null],[e8.FRAGMENT_MAIN_IMAGE,null],[e8.VERTEX_HEAD,null],[e8.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=e4.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=eW.LinearSRGBColorSpace}},e6=!1,e7=class{cloneMaterial(e){if(!(e instanceof eW.ShaderMaterial))return e.clone();let t=e.uniforms,r=new Map;for(let e in t){let n=t[e].value;n.isRenderTargetTexture&&(t[e].value=null,r.set(e,n))}let n=e.clone();for(let e of r)t[e[0]].value=e[1],n.uniforms[e[0]].value=e[1];return n}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){let t=this.materials=[this.cloneMaterial(e),this.cloneMaterial(e),this.cloneMaterial(e)];for(let r of t)r.uniforms=Object.assign({},e.uniforms),r.side=eW.FrontSide;t[2].skinning=!0,this.materialsBackSide=t.map(t=>{let r=this.cloneMaterial(t);return r.uniforms=Object.assign({},e.uniforms),r.side=eW.BackSide,r}),this.materialsDoubleSide=t.map(t=>{let r=this.cloneMaterial(t);return r.uniforms=Object.assign({},e.uniforms),r.side=eW.DoubleSide,r}),this.materialsFlatShaded=t.map(t=>{let r=this.cloneMaterial(t);return r.uniforms=Object.assign({},e.uniforms),r.flatShading=!0,r}),this.materialsFlatShadedBackSide=t.map(t=>{let r=this.cloneMaterial(t);return r.uniforms=Object.assign({},e.uniforms),r.flatShading=!0,r.side=eW.BackSide,r}),this.materialsFlatShadedDoubleSide=t.map(t=>{let r=this.cloneMaterial(t);return r.uniforms=Object.assign({},e.uniforms),r.flatShading=!0,r.side=eW.DoubleSide,r})}}render(e,t,r){let n=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,e6){let n=this.originalMaterials;for(let i of(this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,r),n))i[0].material=i[1];this.meshCount!==n.size&&n.clear()}else{let n=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,r),t.overrideMaterial=n}e.shadowMap.enabled=n}disposeMaterials(){if(null!==this.material)for(let e of this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide))e.dispose()}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return e6}static set workaroundEnabled(e){e6=e}constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case eW.DoubleSide:t=this.materialsFlatShadedDoubleSide;break;case eW.BackSide:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case eW.DoubleSide:t=this.materialsDoubleSide;break;case eW.BackSide:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}},te=class extends eW.EventDispatcher{updateEffectiveSize(){let e=this.baseSize,t=this.preferredSize,r=this.effectiveSize,n=this.scale;-1!==t.width?r.width=t.width:-1!==t.height?r.width=Math.round(t.height*(e.width/Math.max(e.height,1))):r.width=Math.round(e.width*n),-1!==t.height?r.height=t.height:-1!==t.width?r.height=Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):r.height=Math.round(e.height*n)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar(-1),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){(this.baseSize.width!==e||this.baseSize.height!==t)&&(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){(this.preferredSize.width!==e||this.preferredSize.height!==t)&&(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return -1}constructor(e,t=-1,r=-1,n=1){super(),this.resizable=e,this.baseSize=new eW.Vector2(1,1),this.preferredSize=new eW.Vector2(t,r),this.target=this.preferredSize,this.s=n,this.effectiveSize=new eW.Vector2,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}},tt=new class{getNextId(){return this.nextId++}reset(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.nextId=e,this}constructor(e=0){this.nextId=e}}(2),tr=class extends Set{get layer(){return this._layer}set layer(e){let t=this._layer;for(let r of this)r.layers.disable(t),r.layers.enable(e);this._layer=e}getLayer(){return this.layer}setLayer(e){this.layer=e}isExclusive(){return this.exclusive}setExclusive(e){this.exclusive=e}clear(){let e=this.layer;for(let t of this)t.layers.disable(e);return super.clear()}set(e){for(let t of(this.clear(),e))this.add(t);return this}indexOf(e){return this.has(e)?0:-1}add(e){return this.exclusive?e.layers.set(this.layer):e.layers.enable(this.layer),super.add(e)}delete(e){return this.has(e)&&e.layers.disable(this.layer),super.delete(e)}toggle(e){let t;return this.has(e)?(this.delete(e),t=!1):(this.add(e),t=!0),t}setVisible(e){for(let t of this)e?t.layers.enable(0):t.layers.disable(0);return this}constructor(e,t=tt.getNextId()){super(),this.exclusive=!1,this._layer=t,(this._layer<1||this._layer>31)&&(console.warn("Layer out of range, resetting to 2"),tt.reset(2),this._layer=tt.getNextId()),void 0!==e&&this.set(e)}},tn={ADD:0,ALPHA:23,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},ti=new Map([[tn.ADD,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(x.rgb+y.rgb,y.a),y.a*opacity);}"],[tn.AVERAGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4((x.rgb+y.rgb)*0.5,y.a),y.a*opacity);}"],[tn.COLOR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.xy,xHSL.z));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.COLOR_BURN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 a=x.rgb,b=y.rgb;vec3 z=mix(step(0.0,b)*(1.0-min(vec3(1.0),(1.0-a)/b)),vec3(1.0),step(1.0,a));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.COLOR_DODGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 a=x.rgb,b=y.rgb;vec3 z=step(0.0,a)*mix(min(vec3(1.0),a/max(1.0-b,1e-9)),vec3(1.0),step(1.0,b));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.DARKEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(min(x.rgb,y.rgb),y.a),y.a*opacity);}"],[tn.DIFFERENCE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(abs(x.rgb-y.rgb),y.a),y.a*opacity);}"],[tn.DIVIDE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(x.rgb/max(y.rgb,1e-12),y.a),y.a*opacity);}"],[tn.DST,null],[tn.EXCLUSION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4((x.rgb+y.rgb-2.0*x.rgb*y.rgb),y.a),y.a*opacity);}"],[tn.HARD_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 a=min(x.rgb,1.0);vec3 b=min(y.rgb,1.0);vec3 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,b));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.HARD_MIX,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(step(1.0,x.rgb+y.rgb),y.a),y.a*opacity);}"],[tn.HUE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.x,xHSL.yz));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.INVERT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(1.0-y.rgb,y.a),y.a*opacity);}"],[tn.INVERT_RGB,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(y.rgb*(1.0-x.rgb),y.a),y.a*opacity);}"],[tn.LIGHTEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(max(x.rgb,y.rgb),y.a),y.a*opacity);}"],[tn.LINEAR_BURN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(clamp(y.rgb+x.rgb-1.0,0.0,1.0),y.a),y.a*opacity);}"],[tn.LINEAR_DODGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(min(x.rgb+y.rgb,1.0),y.a),y.a*opacity);}"],[tn.LINEAR_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(clamp(2.0*y.rgb+x.rgb-1.0,0.0,1.0),y.a),y.a*opacity);}"],[tn.LUMINOSITY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.xy,yHSL.z));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.MULTIPLY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(x.rgb*y.rgb,y.a),y.a*opacity);}"],[tn.NEGATION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(1.0-abs(1.0-x.rgb-y.rgb),y.a),y.a*opacity);}"],[tn.NORMAL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,y.a*opacity);}"],[tn.OVERLAY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 z=mix(2.0*y.rgb*x.rgb,1.0-2.0*(1.0-y.rgb)*(1.0-x.rgb),step(0.5,x.rgb));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.PIN_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 y2=2.0*y.rgb;vec3 z=mix(mix(y2,x.rgb,step(0.5*x.rgb,y.rgb)),max(y2-1.0,vec3(0.0)),step(x.rgb,y2-1.0));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.REFLECT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 z=mix(min(x.rgb*x.rgb/max(1.0-y.rgb,1e-12),1.0),y.rgb,step(1.0,y.rgb));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.SATURATION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.x,yHSL.y,xHSL.z));return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.SCREEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(x.rgb+y.rgb-min(x.rgb*y.rgb,1.0),y.a),y.a*opacity);}"],[tn.SOFT_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 a=x.rgb;vec3 b=y.rgb;vec3 y2=2.0*b;vec3 w=step(0.5,b);vec3 c=a-(1.0-y2)*a*(1.0-a);vec3 d=mix(a+(y2-1.0)*(sqrt(a)-a),a+(y2-1.0)*a*((16.0*a-12.0)*a+3.0),w*(1.0-step(0.25,a)));vec3 z=mix(c,d,w);return mix(x,vec4(z,y.a),y.a*opacity);}"],[tn.SRC,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}"],[tn.SUBTRACT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(max(x.rgb+y.rgb-1.0,0.0),y.a),y.a*opacity);}"],[tn.VIVID_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 z=mix(max(1.0-min((1.0-x.rgb)/(2.0*y.rgb),1.0),0.0),min(x.rgb/(2.0*(1.0-y.rgb)),1.0),step(0.5,y.rgb));return mix(x,vec4(z,y.a),y.a*opacity);}"]]),ta=class extends eW.EventDispatcher{getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return ti.get(this.blendFunction)}constructor(e,t=1){super(),this._blendFunction=e,this.opacity=new eW.Uniform(t)}};eW.CanvasTexture;var ts=class extends eW.EventDispatcher{get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(e){this._inputColorSpace=e,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e,this.setChanged()}set mainScene(e){}set mainCamera(e){}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e){arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking}update(e,t,r){}setSize(e,t){}initialize(e,t,r){}dispose(){for(let e of Object.keys(this)){let t=this[e];(t instanceof eW.WebGLRenderTarget||t instanceof eW.Material||t instanceof eW.Texture||t instanceof eY)&&this[e].dispose()}}constructor(e,t,{attributes:r=e4.NONE,blendFunction:n=tn.NORMAL,defines:i=new Map,uniforms:a=new Map,extensions:s=null,vertexShader:o=null}={}){super(),this.name=e,this.renderer=null,this.attributes=r,this.fragmentShader=t,this.vertexShader=o,this.defines=i,this.uniforms=a,this.extensions=s,this.blendMode=new ta(n),this.blendMode.addEventListener("change",e=>this.setChanged()),this._inputColorSpace=eW.LinearSRGBColorSpace,this._outputColorSpace=eW.NoColorSpace}},to={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3},tl=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],tu=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return tl[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,.5*e,.5*t)}setSize(e,t){let r=1/e,n=1/t;this.uniforms.texelSize.value.set(r,n,.5*r,.5*n)}constructor(e=new eW.Vector4){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new eW.Uniform(null),texelSize:new eW.Uniform(new eW.Vector4),scale:new eW.Uniform(1),kernel:new eW.Uniform(0)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include \n}",vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.setTexelSize(e.x,e.y),this.kernelSize=to.MEDIUM}},tc=class extends eY{getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,r,n,i){let a=this.scene,s=this.camera,o=this.renderTargetA,l=this.renderTargetB,u=this.blurMaterial,c=u.kernelSequence,d=t;this.fullscreenMaterial=u;for(let t=0,r=c.length;tthis.setSize(s.baseWidth,s.baseHeight)),this._blurMaterial=new tu,this._blurMaterial.kernelSize=e,this.copyMaterial=new e$}},td=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:eW.REVISION.replace(/\D+/g,"")},uniforms:{inputBuffer:new eW.Uniform(null),threshold:new eW.Uniform(0),smoothing:new eW.Uniform(1),range:new eW.Uniform(null)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);float mask=1.0;\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);mask=low*high;\n#elif defined(THRESHOLD)\nmask=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=texel*mask;\n#else\ngl_FragColor=vec4(l*mask);\n#endif\n}",vertexShader:eq}),this.colorOutput=e,this.luminanceRange=t}},tf=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new eW.Uniform(null),texelSize:new eW.Uniform(new eW.Vector2)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#define WEIGHT_INNER 0.125\n#define WEIGHT_OUTER 0.0555555\nvarying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;\n#include \n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}},th=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}set supportBuffer(e){this.uniforms.supportBuffer.value=e}get radius(){return this.uniforms.radius.value}set radius(e){this.uniforms.radius.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new eW.Uniform(null),supportBuffer:new eW.Uniform(null),texelSize:new eW.Uniform(new eW.Vector2),radius:new eW.Uniform(.85)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;\n#else\nuniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;\n#endif\nuniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);\n#include \n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}},tp={RED:0,GREEN:1,BLUE:2,ALPHA:3},tm={DISCARD:0,MULTIPLY_RGB_SET_ALPHA:2,MULTIPLY_RGB:3},tv=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}set cocBuffer(e){this.uniforms.cocBuffer.value=e}setCoCBuffer(e){this.uniforms.cocBuffer.value=e}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(e){return this.scale}setScale(e){this.scale=e}generateKernel(){let e=new Float64Array(128),t=new Float64Array(32),r=0,n=0;for(let i=0,a=Math.sqrt(80);i<80;++i){let s=2.39996323*i,o=Math.sqrt(i)/a,l=o*Math.cos(s),u=o*Math.sin(s);i%5==0?(t[n++]=l,t[n++]=u):(e[r++]=l,e[r++]=u)}this.uniforms.kernel64.value=e,this.uniforms.kernel16.value=t}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}constructor(e=!1,t=!1){super({name:"BokehMaterial",defines:{PASS:e?"2":"1"},uniforms:{inputBuffer:new eW.Uniform(null),cocBuffer:new eW.Uniform(null),texelSize:new eW.Uniform(new eW.Vector2),kernel64:new eW.Uniform(null),kernel16:new eW.Uniform(null),scale:new eW.Uniform(1)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#if PASS == 1\nuniform vec4 kernel64[32];\n#else\nuniform vec4 kernel16[8];\n#endif\nuniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;varying vec2 vUv;void main(){\n#ifdef FOREGROUND\nvec2 cocNearFar=texture2D(cocBuffer,vUv).rg*scale;float coc=cocNearFar.x;\n#else\nfloat coc=texture2D(cocBuffer,vUv).g*scale;\n#endif\nif(coc==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{\n#ifdef FOREGROUND\nvec2 step=texelSize*max(cocNearFar.x,cocNearFar.y);\n#else\nvec2 step=texelSize*coc;\n#endif\n#if PASS == 1\nvec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*kernel.xy+vUv;acc+=texture2D(inputBuffer,uv);uv=step*kernel.zw+vUv;acc+=texture2D(inputBuffer,uv);}gl_FragColor=acc/64.0;\n#else\nvec4 maxValue=texture2D(inputBuffer,vUv);for(int i=0;i<8;++i){vec4 kernel=kernel16[i];vec2 uv=step*kernel.xy+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);uv=step*kernel.zw+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);}gl_FragColor=maxValue;\n#endif\n}}",vertexShader:eq}),t&&(this.defines.FOREGROUND="1"),this.generateKernel()}},tg=class extends eW.ShaderMaterial{set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.depthBuffer=e,this.depthPacking=t}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(e){this.uniforms.focusDistance.value=e}get worldFocusDistance(){return this.focusDistance}set worldFocusDistance(e){this.focusDistance=e}getFocusDistance(e){this.uniforms.focusDistance.value=e}setFocusDistance(e){this.uniforms.focusDistance.value=e}get focalLength(){return this.focusRange}set focalLength(e){this.focusRange=e}get focusRange(){return this.uniforms.focusRange.value}set focusRange(e){this.uniforms.focusRange.value=e}get worldFocusRange(){return this.focusRange}set worldFocusRange(e){this.focusRange=e}getFocalLength(e){return this.focusRange}setFocalLength(e){this.focusRange=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){this.uniforms.projectionMatrix.value=e.projectionMatrix,this.uniforms.projectionMatrixInverse.value=e.projectionMatrixInverse,this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far;let t=void 0!==this.defines.PERSPECTIVE_CAMERA;e instanceof eW.PerspectiveCamera?t||(this.defines.PERSPECTIVE_CAMERA=!0,this.needsUpdate=!0):t&&(delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}constructor(e=null){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new eW.Uniform(null),projectionMatrix:new eW.Uniform(null),projectionMatrixInverse:new eW.Uniform(null),cameraNear:new eW.Uniform(.3),cameraFar:new eW.Uniform(1e3),focusDistance:new eW.Uniform(0),focusRange:new eW.Uniform(0)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#include \n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform mat4 projectionMatrix;uniform mat4 projectionMatrixInverse;uniform float cameraNear;uniform float cameraFar;uniform float focusDistance;uniform float focusRange;varying vec2 vUv;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nfloat depth=unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nfloat depth=texture2D(depthBuffer,uv).r;\n#endif\n#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)\nfloat d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;\n#elif defined(USE_REVERSED_DEPTH_BUFFER)\ndepth=1.0-depth;\n#endif\nreturn depth;}\n#ifdef PERSPECTIVE_CAMERA\n#define getViewZ(depth) perspectiveDepthToViewZ(depth, cameraNear, cameraFar)\n#else\n#define getViewZ(depth) orthographicDepthToViewZ(depth, cameraNear, cameraFar)\n#endif\nvec3 getViewPosition(const in vec2 screenPosition,const in float depth,const in float viewZ){vec4 clipPosition=vec4(vec3(screenPosition,depth)*2.0-1.0,1.0);float clipW=projectionMatrix[2][3]*viewZ+projectionMatrix[3][3];clipPosition*=clipW;return(projectionMatrixInverse*clipPosition).xyz;}vec3 getViewPosition(const in vec2 screenPosition,const in float depth){return getViewPosition(screenPosition,depth,getViewZ(depth));}\n#define getDistance(viewPosition) length(viewPosition)\nvoid main(){float depth=readDepth(vUv);vec3 viewPosition=getViewPosition(vUv,depth);float distance=getDistance(viewPosition);float signedDistance=distance-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}",vertexShader:eq}),this.uniforms.focalLength=this.uniforms.focusRange,null!==e&&this.copyCameraSettings(e)}},tA=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}set maskTexture(e){this.uniforms.maskTexture.value=e,delete this.defines.MASK_PRECISION_HIGH,e.type!==eW.UnsignedByteType&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}setMaskTexture(e){this.maskTexture=e}set colorChannel(e){this.defines.COLOR_CHANNEL=e.toFixed(0),this.needsUpdate=!0}setColorChannel(e){this.colorChannel=e}set maskFunction(e){this.defines.MASK_FUNCTION=e.toFixed(0),this.needsUpdate=!0}setMaskFunction(e){this.maskFunction=e}get inverted(){return void 0!==this.defines.INVERTED}set inverted(e){this.inverted&&!e?delete this.defines.INVERTED:e&&(this.defines.INVERTED="1"),this.needsUpdate=!0}isInverted(){return this.inverted}setInverted(e){this.inverted=e}get strength(){return this.uniforms.strength.value}set strength(e){this.uniforms.strength.value=e}getStrength(){return this.strength}setStrength(e){this.strength=e}constructor(e=null){super({name:"MaskMaterial",uniforms:{maskTexture:new eW.Uniform(e),inputBuffer:new eW.Uniform(null),strength:new eW.Uniform(1)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef MASK_PRECISION_HIGH\nuniform mediump sampler2D maskTexture;\n#else\nuniform lowp sampler2D maskTexture;\n#endif\n#if MASK_FUNCTION != 0\nuniform float strength;\n#endif\nvarying vec2 vUv;void main(){\n#if COLOR_CHANNEL == 0\nfloat mask=texture2D(maskTexture,vUv).r;\n#elif COLOR_CHANNEL == 1\nfloat mask=texture2D(maskTexture,vUv).g;\n#elif COLOR_CHANNEL == 2\nfloat mask=texture2D(maskTexture,vUv).b;\n#else\nfloat mask=texture2D(maskTexture,vUv).a;\n#endif\n#if MASK_FUNCTION == 0\n#ifdef INVERTED\nmask=(mask>0.0)?0.0:1.0;\n#else\nmask=(mask>0.0)?1.0:0.0;\n#endif\n#else\nmask=clamp(mask*strength,0.0,1.0);\n#ifdef INVERTED\nmask=1.0-mask;\n#endif\n#endif\n#if MASK_FUNCTION == 3\nvec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=vec4(mask*texel.rgb,texel.a);\n#elif MASK_FUNCTION == 2\ngl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask);\n#else\ngl_FragColor=mask*texture2D(inputBuffer,vUv);\n#endif\n}",vertexShader:eq}),this.colorChannel=tp.RED,this.maskFunction=tm.DISCARD}},ty=class extends eY{setInput(e){this.input=e}render(e,t,r,n,i){let a=this.fullscreenMaterial.uniforms;null!==t&&void 0!==a&&void 0!==a[this.input]&&(a[this.input].value=t.texture),e.setRenderTarget(this.renderToScreen?null:r),e.render(this.scene,this.camera)}initialize(e,t,r){void 0!==r&&r!==eW.UnsignedByteType&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}constructor(e,t="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=e,this.input=t}},tx=new eW.Vector3,tB=class extends ts{set mainCamera(e){this.camera=e,this.cocMaterial.copyCameraSettings(e)}get cocTexture(){return this.renderTargetCoC.texture}get maskFunction(){return this.maskPass.fullscreenMaterial.maskFunction}set maskFunction(e){this.maskFunction!==e&&(this.defines.set("MASK_FUNCTION",e.toFixed(0)),this.maskPass.fullscreenMaterial.maskFunction=e,this.setChanged())}get cocMaterial(){return this.cocPass.fullscreenMaterial}get circleOfConfusionMaterial(){return this.cocMaterial}getCircleOfConfusionMaterial(){return this.cocMaterial}getBlurPass(){return this.blurPass}getResolution(){return this.resolution}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(e){this.bokehNearBasePass.fullscreenMaterial.scale=e,this.bokehNearFillPass.fullscreenMaterial.scale=e,this.bokehFarBasePass.fullscreenMaterial.scale=e,this.bokehFarFillPass.fullscreenMaterial.scale=e,this.maskPass.fullscreenMaterial.strength=e,this.uniforms.get("scale").value=e}getBokehScale(){return this.bokehScale}setBokehScale(e){this.bokehScale=e}getTarget(){return this.target}setTarget(e){this.target=e}calculateFocusDistance(e){return this.camera.getWorldPosition(tx).distanceTo(e)}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.cocMaterial.depthBuffer=e,this.cocMaterial.depthPacking=t}update(e,t,r){let n=this.renderTarget,i=this.renderTargetCoC,a=this.renderTargetCoCBlurred,s=this.renderTargetMasked;if(null!==this.target){let e=this.calculateFocusDistance(this.target);this.cocMaterial.focusDistance=e}this.cocPass.render(e,null,i),this.blurPass.render(e,i,a),this.maskPass.render(e,t,s),this.bokehFarBasePass.render(e,s,n),this.bokehFarFillPass.render(e,n,this.renderTargetFar),this.bokehNearBasePass.render(e,t,n),this.bokehNearFillPass.render(e,n,this.renderTargetNear)}setSize(e,t){let r=this.resolution;r.setBaseSize(e,t);let n=r.width,i=r.height;this.cocPass.setSize(e,t),this.blurPass.setSize(e,t),this.maskPass.setSize(e,t),this.renderTargetFar.setSize(e,t),this.renderTargetCoC.setSize(e,t),this.renderTargetMasked.setSize(e,t),this.renderTarget.setSize(n,i),this.renderTargetNear.setSize(n,i),this.renderTargetCoCBlurred.setSize(n,i),this.bokehNearBasePass.fullscreenMaterial.setSize(e,t),this.bokehNearFillPass.fullscreenMaterial.setSize(e,t),this.bokehFarBasePass.fullscreenMaterial.setSize(e,t),this.bokehFarFillPass.fullscreenMaterial.setSize(e,t)}initialize(e,t,r){this.cocPass.initialize(e,t,r),this.maskPass.initialize(e,t,r),this.bokehNearBasePass.initialize(e,t,r),this.bokehNearFillPass.initialize(e,t,r),this.bokehFarBasePass.initialize(e,t,r),this.bokehFarFillPass.initialize(e,t,r),this.blurPass.initialize(e,t,eW.UnsignedByteType),e.capabilities.logarithmicDepthBuffer&&(this.cocPass.fullscreenMaterial.defines.LOG_DEPTH="1"),void 0!==r&&(this.renderTarget.texture.type=r,this.renderTargetNear.texture.type=r,this.renderTargetFar.texture.type=r,this.renderTargetMasked.texture.type=r,null!==e&&e.outputColorSpace===eW.SRGBColorSpace&&(this.renderTarget.texture.colorSpace=eW.SRGBColorSpace,this.renderTargetNear.texture.colorSpace=eW.SRGBColorSpace,this.renderTargetFar.texture.colorSpace=eW.SRGBColorSpace,this.renderTargetMasked.texture.colorSpace=eW.SRGBColorSpace))}constructor(e,{blendFunction:t,worldFocusDistance:r,worldFocusRange:n,focalLength:i,focusDistance:a=r||3,focusRange:s=n||i||2,bokehScale:o=1,resolutionScale:l=.5,width:u,height:c,resolutionX:d=u||te.AUTO_SIZE,resolutionY:f=c||te.AUTO_SIZE}={}){super("DepthOfFieldEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer;\n#else\nuniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer;\n#endif\n#if MASK_FUNCTION != 1 && MASK_FUNCTION != 2\nuniform lowp sampler2D farCoCBuffer;\n#endif\nuniform lowp sampler2D nearCoCBuffer;uniform float scale;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 colorNear=texture2D(nearColorBuffer,uv);vec4 colorFar=texture2D(farColorBuffer,uv);\n#if MASK_FUNCTION == 1 || MASK_FUNCTION == 2\nvec2 cocNearFar=vec2(texture2D(nearCoCBuffer,uv).r,colorFar.a);cocNearFar.x=min(cocNearFar.x*scale,1.0);\n#else\nvec2 cocNearFar=vec2(texture2D(nearCoCBuffer,uv).r,texture2D(farCoCBuffer,uv).g);cocNearFar=min(cocNearFar*scale,1.0);colorFar.a*=cocNearFar.y;\n#endif\nvec4 result=inputColor*(1.0-cocNearFar.y)+colorFar;result=mix(result,colorNear,cocNearFar.x);outputColor=result;}",{blendFunction:t,attributes:e4.DEPTH,uniforms:new Map([["nearColorBuffer",new eW.Uniform(null)],["farColorBuffer",new eW.Uniform(null)],["nearCoCBuffer",new eW.Uniform(null)],["farCoCBuffer",new eW.Uniform(null)],["scale",new eW.Uniform(1)]])}),this.camera=e,this.renderTarget=new eW.WebGLRenderTarget(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.name="DoF.CoC",this.uniforms.get("farCoCBuffer").value=this.renderTargetCoC.texture,this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new ty(new tg(e));let h=this.cocMaterial;h.focusDistance=a,h.focusRange=s,this.blurPass=new tc({resolutionScale:l,resolutionX:d,resolutionY:f,kernelSize:to.MEDIUM}),this.maskPass=new ty(new tA(this.renderTargetCoC.texture)),this.maskPass.fullscreenMaterial.colorChannel=tp.GREEN,this.maskFunction=tm.MULTIPLY_RGB,this.bokehNearBasePass=new ty(new tv(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new ty(new tv(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new ty(new tv(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new ty(new tv(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null;let p=this.resolution=new te(this,d,f,l);p.addEventListener("change",e=>this.setSize(p.baseWidth,p.baseHeight)),this.bokehScale=o}},tC=class extends eW.DataTexture{constructor(e,t,r=eW.RedFormat,n=eW.UnsignedByteType){super(function(e,t,r){let n,i=new Map([[eW.RedFormat,1],[eW.RGFormat,2],[eW.RGBAFormat,4]]);if(i.has(t)||console.error("Invalid noise texture format"),r===eW.UnsignedByteType){n=new Uint8Array(e*i.get(t));for(let e=0,t=n.length;e\n#include \n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform vec2 lightPosition;uniform float exposure;uniform float decay;uniform float density;uniform float weight;uniform float clampMax;varying vec2 vUv;void main(){vec2 coord=vUv;vec2 delta=lightPosition-coord;delta*=1.0/SAMPLES_FLOAT*density;float illuminationDecay=1.0;vec4 color=vec4(0.0);for(int i=0;i\n}",vertexShader:eq})}},tE=class extends eY{set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){let e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){let t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new e7(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,r,n,i){let a=this.scene,s=this.camera,o=this.selection,l=s.layers.mask,u=a.background,c=e.shadowMap.autoUpdate,d=this.renderToScreen?null:t;null!==o&&s.layers.set(o.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(a.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(d),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,a,s):e.render(a,s),s.layers.mask=l,a.background=u,e.shadowMap.autoUpdate=c}constructor(e,t,r=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new e2,this.overrideMaterialManager=null===r?null:new e7(r),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}},tT=new eW.Vector3,tb=new eW.Matrix4,tD={SCALE_UP:"lut.scaleup"};function tM(e,t,r){let n=document.createElement("canvas"),i=n.getContext("2d");if(n.width=e,n.height=t,r instanceof Image)i.drawImage(r,0,0);else{let n=i.createImageData(e,t);n.data.set(r),i.putImageData(n,0,0)}return n}var tw=class e{toCanvas(){return"undefined"==typeof document?null:tM(this.width,this.height,this.data)}static from(t){let r,{width:n,height:i}=t;if(t instanceof Image){let e=tM(n,i,t);null!==e&&(r=e.getContext("2d").getImageData(0,0,n,i).data)}else r=t.data;return new e(n,i,r)}constructor(e=0,t=0,r=null){this.width=e,this.height=t,this.data=r}},tF=new eW.Color,tR=class e extends eW.Data3DTexture{get isLookupTexture3D(){return!0}scaleUp(t){let r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.image;return t<=n.width?Promise.reject(Error("The target size must be greater than the current size")):new Promise((i,a)=>{let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var O={SCALE_UP:"lut.scaleup"};var _=[new Float32Array(3),new Float32Array(3)],n=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],Z=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];function d(a,t,r,m){let i=r[0]-t[0],e=r[1]-t[1],y=r[2]-t[2],h=a[0]-t[0],A=a[1]-t[1],w=a[2]-t[2],c=e*w-y*A,l=y*h-i*w,x=i*A-e*h,u=Math.sqrt(c*c+l*l+x*x),b=u*.5,s=c/u,F=l/u,f=x/u,p=-(a[0]*s+a[1]*F+a[2]*f),M=m[0]*s+m[1]*F+m[2]*f;return Math.abs(M+p)*b/3}function V(a,t,r,m,i,e){let y=(r+m*t+i*t*t)*4;e[0]=a[y+0],e[1]=a[y+1],e[2]=a[y+2]}function k(a,t,r,m,i,e){let y=r*(t-1),h=m*(t-1),A=i*(t-1),w=Math.floor(y),c=Math.floor(h),l=Math.floor(A),x=Math.ceil(y),u=Math.ceil(h),b=Math.ceil(A),s=y-w,F=h-c,f=A-l;if(w===y&&c===h&&l===A)V(a,t,y,h,A,e);else{let p;s>=F&&F>=f?p=Z[0]:s>=f&&f>=F?p=Z[1]:f>=s&&s>=F?p=Z[2]:F>=s&&s>=f?p=Z[3]:F>=f&&f>=s?p=Z[4]:f>=F&&F>=s&&(p=Z[5]);let[M,g,X,Y]=p,P=_[0];P[0]=s,P[1]=F,P[2]=f;let o=_[1],L=x-w,S=u-c,U=b-l;o[0]=L*M[0]+w,o[1]=S*M[1]+c,o[2]=U*M[2]+l,V(a,t,o[0],o[1],o[2],n[0]),o[0]=L*g[0]+w,o[1]=S*g[1]+c,o[2]=U*g[2]+l,V(a,t,o[0],o[1],o[2],n[1]),o[0]=L*X[0]+w,o[1]=S*X[1]+c,o[2]=U*X[2]+l,V(a,t,o[0],o[1],o[2],n[2]),o[0]=L*Y[0]+w,o[1]=S*Y[1]+c,o[2]=U*Y[2]+l,V(a,t,o[0],o[1],o[2],n[3]);let T=d(g,X,Y,P)*6,q=d(M,X,Y,P)*6,C=d(M,g,Y,P)*6,E=d(M,g,X,P)*6;n[0][0]*=T,n[0][1]*=T,n[0][2]*=T,n[1][0]*=q,n[1][1]*=q,n[1][2]*=q,n[2][0]*=C,n[2][1]*=C,n[2][2]*=C,n[3][0]*=E,n[3][1]*=E,n[3][2]*=E,e[0]=n[0][0]+n[1][0]+n[2][0]+n[3][0],e[1]=n[0][1]+n[1][1]+n[2][1]+n[3][1],e[2]=n[0][2]+n[1][2]+n[2][2]+n[3][2]}}var v=class{static expand(t,r){let m=Math.cbrt(t.length/4),i=new Float32Array(3),e=new t.constructor(r**3*4),y=t instanceof Uint8Array?255:1,h=r**2,A=1/(r-1);for(let w=0;w{let t=a.data,r=t.data;switch(t.operation){case O.SCALE_UP:r=v.expand(r,t.size);break}postMessage(r,[r.buffer]),close()});})();\n'],{type:"text/javascript"})),o=new Worker(s);o.addEventListener("error",e=>a(e.error)),o.addEventListener("message",r=>{let n=new e(r.data,t);this.colorSpace=n.colorSpace,n.type=this.type,n.name=this.name,URL.revokeObjectURL(s),i(n)});let l=r?[n.data.buffer]:[];o.postMessage({operation:tD.SCALE_UP,data:n.data,size:t},l)})}applyLUT(e){let t=this.image,r=e.image,n=Math.min(t.width,t.height,t.depth);if(n!==Math.min(r.width,r.height,r.depth))console.error("Size mismatch");else if(e.type!==eW.FloatType||this.type!==eW.FloatType)console.error("Both LUTs must be FloatType textures");else if(e.format!==eW.RGBAFormat||this.format!==eW.RGBAFormat)console.error("Both LUTs must be RGBA textures");else{let e=t.data,i=r.data,a=n**2,s=n-1;for(let t=0,r=n**3;ta){r=new Uint8Array(e.length);for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:eW.RGBADepthPacking;this.depthBuffer=e,this.depthPacking=t}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof eW.PerspectiveCamera?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}constructor(e=null,t){super({name:"DepthComparisonMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new eW.Uniform(null),cameraNear:new eW.Uniform(.3),cameraFar:new eW.Uniform(1e3)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#include \n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float cameraNear;uniform float cameraFar;centroid varying float vViewZ;centroid varying vec4 vProjTexCoord;void main(){\n#include \nvec2 projTexCoord=(vProjTexCoord.xy/vProjTexCoord.w)*0.5+0.5;\n#if DEPTH_PACKING == 3201\nfloat depth=unpackRGBAToDepth(texture2D(depthBuffer,projTexCoord));\n#else\nfloat depth=texture2D(depthBuffer,projTexCoord).r;\n#endif\n#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)\nfloat d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;\n#elif defined(USE_REVERSED_DEPTH_BUFFER)\ndepth=1.0-depth;\n#endif\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nfloat viewZ=orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\nfloat depthTest=(-vViewZ>-viewZ)?1.0:0.0;gl_FragColor.rg=vec2(0.0,depthTest);}",vertexShader:"#include \n#include \n#include \n#include \nvarying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include \n#include \n#include \n#include \n#include \nvViewZ=mvPosition.z;vProjTexCoord=gl_Position;\n#include \n}"}),this.depthBuffer=e,this.depthPacking=eW.RGBADepthPacking,this.copyCameraSettings(t)}},tG=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}constructor(e=new eW.Vector2){super({name:"OutlineMaterial",uniforms:{inputBuffer:new eW.Uniform(null),texelSize:new eW.Uniform(new eW.Vector2)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"uniform lowp sampler2D inputBuffer;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 c0=texture2D(inputBuffer,vUv0).rg;vec2 c1=texture2D(inputBuffer,vUv1).rg;vec2 c2=texture2D(inputBuffer,vUv2).rg;vec2 c3=texture2D(inputBuffer,vUv3).rg;float d0=(c0.x-c1.x)*0.5;float d1=(c2.x-c3.x)*0.5;float d=length(vec2(d0,d1));float a0=min(c0.y,c1.y);float a1=min(c2.y,c3.y);float visibilityFactor=min(a0,a1);gl_FragColor.rg=(1.0-visibilityFactor>0.001)?vec2(d,0.0):vec2(0.0,d);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=vec2(uv.x+texelSize.x,uv.y);vUv1=vec2(uv.x-texelSize.x,uv.y);vUv2=vec2(uv.x,uv.y+texelSize.y);vUv3=vec2(uv.x,uv.y-texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.uniforms.texelSize.value.set(e.x,e.y),this.uniforms.maskTexture=this.uniforms.inputBuffer}},tO=new eW.Vector3,tH=new eW.Vector3,tN=class extends eW.ShaderMaterial{set depthBuffer0(e){this.uniforms.depthBuffer0.value=e}set depthPacking0(e){this.defines.DEPTH_PACKING_0=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer0(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.depthBuffer0=e,this.depthPacking0=t}set depthBuffer1(e){this.uniforms.depthBuffer1.value=e}set depthPacking1(e){this.defines.DEPTH_PACKING_1=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer1(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.depthBuffer1=e,this.depthPacking1=t}get maxDepthStrategy(){return Number(this.defines.DEPTH_TEST_STRATEGY)}set maxDepthStrategy(e){this.defines.DEPTH_TEST_STRATEGY=e.toFixed(0),this.needsUpdate=!0}get keepFar(){return this.maxDepthStrategy}set keepFar(e){this.maxDepthStrategy=e?tP.KEEP_MAX_DEPTH:tP.DISCARD_MAX_DEPTH}getMaxDepthStrategy(){return this.maxDepthStrategy}setMaxDepthStrategy(e){this.maxDepthStrategy=e}get epsilon(){return Number(this.defines.DEPTH_EPSILON)}set epsilon(e){this.defines.DEPTH_EPSILON=e.toFixed(16),this.needsUpdate=!0}getEpsilon(){return this.epsilon}setEpsilon(e){this.epsilon=e}get depthMode(){return Number(this.defines.DEPTH_MODE)}set depthMode(e){let t;switch(e){case eW.NeverDepth:t="false";break;case eW.AlwaysDepth:t="true";break;case eW.EqualDepth:t="abs(d1 - d0) <= DEPTH_EPSILON";break;case eW.NotEqualDepth:t="abs(d1 - d0) > DEPTH_EPSILON";break;case eW.LessDepth:t="d0 > d1";break;case eW.LessEqualDepth:t="d0 >= d1";break;case eW.GreaterEqualDepth:t="d0 <= d1";break;case eW.GreaterDepth:default:t="d0 < d1"}this.defines.DEPTH_MODE=e.toFixed(0),this.defines["depthTest(d0, d1)"]=t,this.needsUpdate=!0}getDepthMode(){return this.depthMode}setDepthMode(e){this.depthMode=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNearFar.value.set(e.near,e.far),e instanceof eW.PerspectiveCamera?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}constructor(){super({name:"DepthMaskMaterial",defines:{DEPTH_EPSILON:"0.0001",DEPTH_PACKING_0:"0",DEPTH_PACKING_1:"0",DEPTH_TEST_STRATEGY:tP.KEEP_MAX_DEPTH},uniforms:{inputBuffer:new eW.Uniform(null),depthBuffer0:new eW.Uniform(null),depthBuffer1:new eW.Uniform(null),cameraNearFar:new eW.Uniform(new eW.Vector2(1,1))},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#include \n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer0;uniform highp sampler2D depthBuffer1;\n#else\nuniform mediump sampler2D depthBuffer0;uniform mediump sampler2D depthBuffer1;\n#endif\nuniform sampler2D inputBuffer;uniform vec2 cameraNearFar;float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#endif\n}varying vec2 vUv;void main(){vec2 depth;\n#if DEPTH_PACKING_0 == 3201\ndepth.x=unpackRGBAToDepth(texture2D(depthBuffer0,vUv));\n#else\ndepth.x=texture2D(depthBuffer0,vUv).r;\n#endif\n#if DEPTH_PACKING_1 == 3201\ndepth.y=unpackRGBAToDepth(texture2D(depthBuffer1,vUv));\n#else\ndepth.y=texture2D(depthBuffer1,vUv).r;\n#endif\n#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)\nfloat a=cameraNearFar.y/(cameraNearFar.y-cameraNearFar.x);float b=cameraNearFar.y*cameraNearFar.x/(cameraNearFar.x-cameraNearFar.y);float c=log2(cameraNearFar.y+1.0);float d=pow(2.0,depth.x*c)-1.0;depth.x=a+b/d;d=pow(2.0,depth.y*c)-1.0;depth.y=a+b/d;\n#elif defined(USE_REVERSED_DEPTH_BUFFER)\ndepth.x=1.0-depth.x;depth.y=1.0-depth.y;\n#endif\nbool isMaxDepth=(depth.x==1.0);\n#ifdef PERSPECTIVE_CAMERA\ndepth.x=viewZToOrthographicDepth(getViewZ(depth.x),cameraNearFar.x,cameraNearFar.y);depth.y=viewZToOrthographicDepth(getViewZ(depth.y),cameraNearFar.x,cameraNearFar.y);\n#endif\n#if DEPTH_TEST_STRATEGY == 0\nbool keep=depthTest(depth.x,depth.y);\n#elif DEPTH_TEST_STRATEGY == 1\nbool keep=isMaxDepth||depthTest(depth.x,depth.y);\n#else\nbool keep=!isMaxDepth&&depthTest(depth.x,depth.y);\n#endif\nif(keep){gl_FragColor=texture2D(inputBuffer,vUv);}else{discard;}}",vertexShader:eq}),this.depthMode=eW.LessDepth}},tk=class extends eW.ShaderMaterial{set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.depthBuffer=e,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(e){this.edgeDetectionMode=e}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(e){this.localContrastAdaptationFactor=e}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(e){this.edgeDetectionThreshold=e}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(e){this.predicationMode=e}set predicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(e){this.predicationThreshold=e}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(e){this.predicationScale=e}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(e){this.predicationStrength=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}constructor(e=new eW.Vector2,t=tL.COLOR){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:eW.REVISION.replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new eW.Uniform(null),depthBuffer:new eW.Uniform(null),predicationBuffer:new eW.Uniform(null),texelSize:new eW.Uniform(e)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include \n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 1\nfloat l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 2\nvec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).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))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.edgeDetectionMode=t}},tz=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(e){this.uniforms.searchTexture.value=e}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(e){this.uniforms.areaTexture.value=e}setLookupTextures(e,t){this.searchTexture=e,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(e){let t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(e){this.orthogonalSearchSteps=e}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(e){let t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){this.diagonalSearchSteps=e}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(e){this.diagonalDetection=e}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(e){let t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(e){this.cornerRounding=e}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(e){this.cornerDetection=e}setSize(e,t){let r=this.uniforms;r.texelSize.value.set(1/e,1/t),r.resolution.value.set(e,t)}constructor(e=new eW.Vector2,t=new eW.Vector2){super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new eW.Uniform(null),searchTexture:new eW.Uniform(null),areaTexture:new eW.Uniform(null),resolution:new eW.Uniform(t),texelSize:new eW.Uniform(e)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;iend&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;iend&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}",vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}"})}};function tj(e,t,r){return Math.min(Math.max((e+t)/(t-r),0),1)}var tK=class extends eW.ShaderMaterial{get near(){return this.uniforms.cameraNearFar.value.x}get far(){return this.uniforms.cameraNearFar.value.y}set normalDepthBuffer(e){this.uniforms.normalDepthBuffer.value=e,null!==e?this.defines.NORMAL_DEPTH="1":delete this.defines.NORMAL_DEPTH,this.needsUpdate=!0}setNormalDepthBuffer(e){this.normalDepthBuffer=e}set normalBuffer(e){this.uniforms.normalBuffer.value=e}setNormalBuffer(e){this.uniforms.normalBuffer.value=e}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.depthBuffer=e,this.depthPacking=t}set noiseTexture(e){this.uniforms.noiseTexture.value=e}setNoiseTexture(e){this.uniforms.noiseTexture.value=e}get samples(){return Number(this.defines.SAMPLES_INT)}set samples(e){this.defines.SAMPLES_INT=e.toFixed(0),this.defines.INV_SAMPLES_FLOAT=(1/e).toFixed(9),this.needsUpdate=!0}getSamples(){return this.samples}setSamples(e){this.samples=e}get rings(){return Number(this.defines.SPIRAL_TURNS)}set rings(e){this.defines.SPIRAL_TURNS=e.toFixed(1),this.needsUpdate=!0}getRings(){return this.rings}setRings(e){this.rings=e}get intensity(){return this.uniforms.intensity.value}set intensity(e){this.uniforms.intensity.value=e,void 0===this.defines.LEGACY_INTENSITY&&(this.defines.LEGACY_INTENSITY="1",this.needsUpdate=!0)}getIntensity(){return this.uniforms.intensity.value}setIntensity(e){this.uniforms.intensity.value=e}get fade(){return this.uniforms.fade.value}set fade(e){this.uniforms.fade.value=e}getFade(){return this.uniforms.fade.value}setFade(e){this.uniforms.fade.value=e}get bias(){return this.uniforms.bias.value}set bias(e){this.uniforms.bias.value=e}getBias(){return this.uniforms.bias.value}setBias(e){this.uniforms.bias.value=e}get minRadiusScale(){return this.uniforms.minRadiusScale.value}set minRadiusScale(e){this.uniforms.minRadiusScale.value=e}getMinRadiusScale(){return this.uniforms.minRadiusScale.value}setMinRadiusScale(e){this.uniforms.minRadiusScale.value=e}updateRadius(){let e=this.r*this.resolution.height;this.defines.RADIUS=e.toFixed(11),this.defines.RADIUS_SQ=(e*e).toFixed(11),this.needsUpdate=!0}get radius(){return this.r}set radius(e){this.r=Math.min(Math.max(e,1e-6),1),this.updateRadius()}getRadius(){return this.radius}setRadius(e){this.radius=e}get distanceScaling(){return!0}set distanceScaling(e){}isDistanceScalingEnabled(){return this.distanceScaling}setDistanceScalingEnabled(e){this.distanceScaling=e}get distanceThreshold(){return this.uniforms.distanceCutoff.value.x}set distanceThreshold(e){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.distanceFalloff,0),1))}get worldDistanceThreshold(){var e,t;return-(e=this.distanceThreshold,e*((t=this.near)-this.far)-t)}set worldDistanceThreshold(e){this.distanceThreshold=tj(-e,this.near,this.far)}get distanceFalloff(){return this.uniforms.distanceCutoff.value.y-this.distanceThreshold}set distanceFalloff(e){this.uniforms.distanceCutoff.value.y=Math.min(Math.max(this.distanceThreshold+e,0),1)}get worldDistanceFalloff(){var e,t;return-(e=this.distanceFalloff,e*((t=this.near)-this.far)-t)}set worldDistanceFalloff(e){this.distanceFalloff=tj(-e,this.near,this.far)}setDistanceCutoff(e,t){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}get proximityThreshold(){return this.uniforms.proximityCutoff.value.x}set proximityThreshold(e){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.proximityFalloff,0),1))}get worldProximityThreshold(){var e,t;return-(e=this.proximityThreshold,e*((t=this.near)-this.far)-t)}set worldProximityThreshold(e){this.proximityThreshold=tj(-e,this.near,this.far)}get proximityFalloff(){return this.uniforms.proximityCutoff.value.y-this.proximityThreshold}set proximityFalloff(e){this.uniforms.proximityCutoff.value.y=Math.min(Math.max(this.proximityThreshold+e,0),1)}get worldProximityFalloff(){var e,t;return-(e=this.proximityFalloff,e*((t=this.near)-this.far)-t)}set worldProximityFalloff(e){this.proximityFalloff=tj(-e,this.near,this.far)}setProximityCutoff(e,t){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNearFar.value.set(e.near,e.far),this.uniforms.projectionMatrix.value.copy(e.projectionMatrix),this.uniforms.inverseProjectionMatrix.value.copy(e.projectionMatrix).invert(),e instanceof eW.PerspectiveCamera?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){let r=this.uniforms,n=r.noiseTexture.value;null!==n&&r.noiseScale.value.set(e/n.image.width,t/n.image.height),r.texelSize.value.set(1/e,1/t),this.resolution.set(e,t),this.updateRadius()}constructor(e){super({name:"SSAOMaterial",defines:{SAMPLES_INT:"0",INV_SAMPLES_FLOAT:"0.0",SPIRAL_TURNS:"0.0",RADIUS:"1.0",RADIUS_SQ:"1.0",DISTANCE_SCALING:"1",DEPTH_PACKING:"0"},uniforms:{depthBuffer:new eW.Uniform(null),normalBuffer:new eW.Uniform(null),normalDepthBuffer:new eW.Uniform(null),noiseTexture:new eW.Uniform(null),inverseProjectionMatrix:new eW.Uniform(new eW.Matrix4),projectionMatrix:new eW.Uniform(new eW.Matrix4),texelSize:new eW.Uniform(new eW.Vector2),cameraNearFar:new eW.Uniform(new eW.Vector2),distanceCutoff:new eW.Uniform(new eW.Vector2),proximityCutoff:new eW.Uniform(new eW.Vector2),noiseScale:new eW.Uniform(new eW.Vector2),minRadiusScale:new eW.Uniform(.33),intensity:new eW.Uniform(1),fade:new eW.Uniform(.01),bias:new eW.Uniform(0)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#include \nuniform vec2 cameraNearFar;\n#define cameraNear cameraNearFar.x\n#define cameraFar cameraNearFar.y\n#ifdef NORMAL_DEPTH\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){float depth=texture2D(normalDepthBuffer,uv).a;\n#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)\nfloat d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;\n#endif\nreturn depth;}\n#else\nuniform lowp sampler2D normalBuffer;\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nfloat depth=unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nfloat depth=texture2D(depthBuffer,uv).r;\n#endif\n#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)\nfloat d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;\n#endif\nreturn depth;}\n#endif\nuniform lowp sampler2D noiseTexture;uniform mat4 inverseProjectionMatrix;uniform mat4 projectionMatrix;uniform vec2 texelSize;uniform float intensity;uniform float minRadiusScale;uniform float fade;uniform float bias;uniform vec2 distanceCutoff;uniform vec2 proximityCutoff;varying vec2 vUv;varying vec2 vUv2;float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 getViewPosition(const in vec2 screenPosition,const in float depth,const in float viewZ){vec4 clipPosition=vec4(vec3(screenPosition,depth)*2.0-1.0,1.0);float clipW=projectionMatrix[2][3]*viewZ+projectionMatrix[3][3];clipPosition*=clipW;return(inverseProjectionMatrix*clipPosition).xyz;}float getAmbientOcclusion(const in vec3 p,const in vec3 n,const in float depth,const in vec2 uv){float radiusScale=1.0-smoothstep(0.0,distanceCutoff.y,depth);radiusScale=radiusScale*(1.0-minRadiusScale)+minRadiusScale;float radius=RADIUS*radiusScale;float noise=texture2D(noiseTexture,vUv2).r;float baseAngle=noise*PI2;float rings=SPIRAL_TURNS*PI2;float occlusion=0.0;int taps=0;for(int i=0;i1.0||coords.t<0.0||coords.t>1.0){continue;}float sampleDepth=readDepth(coords);float viewZ=getViewZ(sampleDepth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearSampleDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar);\n#else\nfloat linearSampleDepth=sampleDepth;\n#endif\nfloat proximity=abs(depth-linearSampleDepth);if(proximity1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.depthBuffer=e,this.depthPacking=t}set normalBuffer(e){this.uniforms.normalBuffer.value=e,null!==e?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(e){this.normalBuffer=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new eW.Uniform(null),normalBuffer:new eW.Uniform(null),texelSize:new eW.Uniform(new eW.Vector2)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\n#ifdef DOWNSAMPLE_NORMALS\nuniform lowp sampler2D normalBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[4];distances[0]=abs(c-samples[0]);distances[1]=abs(c-samples[1]);distances[2]=abs(c-samples[2]);distances[3]=abs(c-samples[3]);float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t}render(e,t,r,n,i){e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){let r=this.resolution;r.setBaseSize(e,t),this.renderTarget.setSize(r.width,r.height),this.fullscreenMaterial.setSize(e,t)}initialize(e,t,r){let n=e.getContext();if(!(n.getExtension("EXT_color_buffer_float")||n.getExtension("EXT_color_buffer_half_float")))throw Error("Rendering to float texture is not supported.")}constructor({normalBuffer:e=null,resolutionScale:t=.5,width:r=te.AUTO_SIZE,height:n=te.AUTO_SIZE,resolutionX:i=r,resolutionY:a=n}={}){super("DepthDownsamplingPass");let s=new tJ;s.normalBuffer=e,this.fullscreenMaterial=s,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new eW.WebGLRenderTarget(1,1,{minFilter:eW.NearestFilter,magFilter:eW.NearestFilter,depthBuffer:!1,type:eW.FloatType}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;let o=this.resolution=new te(this,i,a,t);o.addEventListener("change",e=>this.setSize(o.baseWidth,o.baseHeight))}},tQ=class extends eW.ShaderMaterial{set luminanceBuffer0(e){this.uniforms.luminanceBuffer0.value=e}setLuminanceBuffer0(e){this.uniforms.luminanceBuffer0.value=e}set luminanceBuffer1(e){this.uniforms.luminanceBuffer1.value=e}setLuminanceBuffer1(e){this.uniforms.luminanceBuffer1.value=e}set mipLevel1x1(e){this.defines.MIP_LEVEL_1X1=e.toFixed(1),this.needsUpdate=!0}setMipLevel1x1(e){this.mipLevel1x1=e}set deltaTime(e){this.uniforms.deltaTime.value=e}setDeltaTime(e){this.uniforms.deltaTime.value=e}get minLuminance(){return this.uniforms.minLuminance.value}set minLuminance(e){this.uniforms.minLuminance.value=e}getMinLuminance(){return this.uniforms.minLuminance.value}setMinLuminance(e){this.uniforms.minLuminance.value=e}get adaptationRate(){return this.uniforms.tau.value}set adaptationRate(e){this.uniforms.tau.value=e}getAdaptationRate(){return this.uniforms.tau.value}setAdaptationRate(e){this.uniforms.tau.value=e}constructor(){super({name:"AdaptiveLuminanceMaterial",defines:{MIP_LEVEL_1X1:"0.0"},uniforms:{luminanceBuffer0:new eW.Uniform(null),luminanceBuffer1:new eW.Uniform(null),minLuminance:new eW.Uniform(.01),deltaTime:new eW.Uniform(0),tau:new eW.Uniform(1)},extensions:{shaderTextureLOD:!0},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\nuniform lowp sampler2D luminanceBuffer0;uniform lowp sampler2D luminanceBuffer1;uniform float minLuminance;uniform float deltaTime;uniform float tau;varying vec2 vUv;void main(){float l0=unpackRGBAToFloat(texture2D(luminanceBuffer0,vUv));\n#if __VERSION__ < 300\nfloat l1=texture2DLodEXT(luminanceBuffer1,vUv,MIP_LEVEL_1X1).r;\n#else\nfloat l1=textureLod(luminanceBuffer1,vUv,MIP_LEVEL_1X1).r;\n#endif\nl0=max(minLuminance,l0);l1=max(minLuminance,l1);float adaptedLum=l0+(l1-l0)*(1.0-exp(-deltaTime*tau));gl_FragColor=(adaptedLum==1.0)?vec4(1.0):packFloatToRGBA(adaptedLum);}",vertexShader:eq})}};eW.Loader,eW.Loader,eW.Loader,eW.ShaderMaterial;var tW=class extends eW.ShaderMaterial{get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set inputDepthPacking(e){this.defines.INPUT_DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}get outputDepthPacking(){return Number(this.defines.OUTPUT_DEPTH_PACKING)}set outputDepthPacking(e){this.defines.OUTPUT_DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.depthBuffer=e,this.inputDepthPacking=t}getInputDepthPacking(){return Number(this.defines.INPUT_DEPTH_PACKING)}setInputDepthPacking(e){this.defines.INPUT_DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}getOutputDepthPacking(){return Number(this.defines.OUTPUT_DEPTH_PACKING)}setOutputDepthPacking(e){this.defines.OUTPUT_DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}get texelPosition(){return this.uniforms.texelPosition.value}getTexelPosition(){return this.uniforms.texelPosition.value}setTexelPosition(e){this.uniforms.texelPosition.value=e}get mode(){return this.depthCopyMode}set mode(e){this.depthCopyMode=e,this.defines.DEPTH_COPY_MODE=e.toFixed(0),this.needsUpdate=!0}getMode(){return this.mode}setMode(e){this.mode=e}constructor(){super({name:"DepthCopyMaterial",defines:{INPUT_DEPTH_PACKING:"0",OUTPUT_DEPTH_PACKING:"0",DEPTH_COPY_MODE:"0"},uniforms:{depthBuffer:new eW.Uniform(null),texelPosition:new eW.Uniform(new eW.Vector2)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include \nvarying vec2 vUv;\n#ifdef NORMAL_DEPTH\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){return texture2D(normalDepthBuffer,uv).a;}\n#else\n#if INPUT_DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if INPUT_DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}\n#endif\nvoid main(){\n#if INPUT_DEPTH_PACKING == OUTPUT_DEPTH_PACKING\ngl_FragColor=texture2D(depthBuffer,vUv);\n#else\nfloat depth=readDepth(vUv);\n#if OUTPUT_DEPTH_PACKING == 3201\ngl_FragColor=(depth==1.0)?vec4(1.0):packDepthToRGBA(depth);\n#else\ngl_FragColor=vec4(vec3(depth),1.0);\n#endif\n#endif\n}",vertexShader:"varying vec2 vUv;\n#if DEPTH_COPY_MODE == 1\nuniform vec2 texelPosition;\n#endif\nvoid main(){\n#if DEPTH_COPY_MODE == 1\nvUv=texelPosition;\n#else\nvUv=position.xy*0.5+0.5;\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.depthCopyMode=tI.FULL}},tX=class extends eW.ShaderMaterial{set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;this.depthBuffer=e,this.depthPacking=t}setShaderData(e){this.setShaderParts(e.shaderParts),this.setDefines(e.defines),this.setUniforms(e.uniforms),this.setExtensions(e.extensions)}setShaderParts(e){return this.fragmentShader="#include \n#include \n#include \n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;vec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nfloat depth=unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nfloat depth=texture2D(depthBuffer,uv).r;\n#endif\n#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)\nfloat d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;\n#elif defined(USE_REVERSED_DEPTH_BUFFER)\ndepth=1.0-depth;\n#endif\nreturn depth;}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include \n#endif\n#include \n}".replace(e8.FRAGMENT_HEAD,e.get(e8.FRAGMENT_HEAD)||"").replace(e8.FRAGMENT_MAIN_UV,e.get(e8.FRAGMENT_MAIN_UV)||"").replace(e8.FRAGMENT_MAIN_IMAGE,e.get(e8.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}".replace(e8.VERTEX_HEAD,e.get(e8.VERTEX_HEAD)||"").replace(e8.VERTEX_MAIN_SUPPORT,e.get(e8.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(e){for(let t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(let t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){for(let t of(this.extensions={},e))this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof eW.PerspectiveCamera?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){let r=this.uniforms;r.resolution.value.set(e,t),r.texelSize.value.set(1/e,1/t),r.aspect.value=e/t}static get Section(){return e8}constructor(e,t,r,n,i=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:eW.REVISION.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new eW.Uniform(null),depthBuffer:new eW.Uniform(null),resolution:new eW.Uniform(new eW.Vector2),texelSize:new eW.Uniform(new eW.Vector2),cameraNear:new eW.Uniform(.3),cameraFar:new eW.Uniform(1e3),aspect:new eW.Uniform(1),time:new eW.Uniform(0)},blending:eW.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:i}),e&&this.setShaderParts(e),t&&this.setDefines(t),r&&this.setUniforms(r),this.copyCameraSettings(n)}};eW.ShaderMaterial;var tZ=Number(eW.REVISION.replace(/\D+/g,"")),tY=255/256,t_=new Float32Array([255/256/0x1000000,255/256/65536,255/256/256,255/256]),tq=new Float32Array([tY,tY/256,tY/65536,1/0x1000000]);function t$(e,t,r){for(let n of t){let t="$1"+e+n.charAt(0).toUpperCase()+n.slice(1),i=RegExp("([^\\.])(\\b"+n+"\\b)","g");for(let e of r.entries())null!==e[1]&&r.set(e[0],e[1].replace(i,t))}}var t0=class extends eY{set mainScene(e){for(let t of this.effects)t.mainScene=e}set mainCamera(e){for(let t of(this.fullscreenMaterial.copyCameraSettings(e),this.effects))t.mainCamera=e}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){let t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}setEffects(e){for(let e of this.effects)e.removeEventListener("change",this.listener);for(let t of(this.effects=e.sort((e,t)=>t.attributes-e.attributes),this.effects))t.addEventListener("change",this.listener)}updateMaterial(){let e=new e5,t=0;for(let r of this.effects)if(r.blendMode.blendFunction===tn.DST)e.attributes|=r.getAttributes()&e4.DEPTH;else if((e.attributes&r.getAttributes()&e4.CONVOLUTION)!=0)throw Error("Convolution effects cannot be merged (".concat(r.name,")"));else!function(e,t,r){let n=t.getFragmentShader(),i=t.getVertexShader(),a=void 0!==n&&/mainImage/.test(n),s=void 0!==n&&/mainUv/.test(n);if(r.attributes|=t.getAttributes(),void 0===n)throw Error("Missing fragment shader (".concat(t.name,")"));if(s&&(r.attributes&e4.CONVOLUTION)!=0)throw Error("Effects that transform UVs are incompatible with convolution effects (".concat(t.name,")"));if(a||s){let o=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,l=r.shaderParts,u=l.get(e8.FRAGMENT_HEAD)||"",c=l.get(e8.FRAGMENT_MAIN_UV)||"",d=l.get(e8.FRAGMENT_MAIN_IMAGE)||"",f=l.get(e8.VERTEX_HEAD)||"",h=l.get(e8.VERTEX_MAIN_SUPPORT)||"",p=new Set,m=new Set;if(s&&(c+=" ".concat(e,"MainUv(UV);\n"),r.uvTransformation=!0),null!==i&&/mainSupport/.test(i)){let t=/mainSupport *\([\w\s]*?uv\s*?\)/.test(i);for(let n of(h+=" ".concat(e,"MainSupport("),h+=t?"vUv);\n":");\n",i.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g)))for(let e of n[1].split(/\s*,\s*/))r.varyings.add(e),p.add(e),m.add(e);for(let e of i.matchAll(o))m.add(e[1])}for(let e of n.matchAll(o))m.add(e[1]);for(let e of t.defines.keys())m.add(e.replace(/\([\w\s,]*\)/g,""));for(let e of t.uniforms.keys())m.add(e);m.delete("while"),m.delete("for"),m.delete("if"),t.uniforms.forEach((t,n)=>r.uniforms.set(e+n.charAt(0).toUpperCase()+n.slice(1),t)),t.defines.forEach((t,n)=>r.defines.set(e+n.charAt(0).toUpperCase()+n.slice(1),t));let g=new Map([["fragment",n],["vertex",i]]);t$(e,m,r.defines),t$(e,m,g),n=g.get("fragment"),i=g.get("vertex");let A=t.blendMode;if(r.blendModes.set(A.blendFunction,A),a){null!==t.inputColorSpace&&t.inputColorSpace!==r.colorSpace&&(d+=t.inputColorSpace===eW.SRGBColorSpace?"color0 = sRGBTransferOETF(color0);\n ":"color0 = sRGBToLinear(color0);\n "),t.outputColorSpace!==eW.NoColorSpace?r.colorSpace=t.outputColorSpace:null!==t.inputColorSpace&&(r.colorSpace=t.inputColorSpace),d+="".concat(e,"MainImage(color0, UV, "),(r.attributes&e4.DEPTH)!=0&&/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/.test(n)&&(d+="depth, ",r.readDepth=!0),d+="color1);\n ";let i=e+"BlendOpacity";r.uniforms.set(i,A.opacity),d+="color0 = blend".concat(A.blendFunction,"(color0, color1, ").concat(i,");\n\n "),u+="uniform float ".concat(i,";\n\n")}if(u+=n+"\n",null!==i&&(f+=i+"\n"),l.set(e8.FRAGMENT_HEAD,u),l.set(e8.FRAGMENT_MAIN_UV,c),l.set(e8.FRAGMENT_MAIN_IMAGE,d),l.set(e8.VERTEX_HEAD,f),l.set(e8.VERTEX_MAIN_SUPPORT,h),null!==t.extensions)for(let e of t.extensions)r.extensions.add(e)}else throw Error("Could not find mainImage or mainUv function (".concat(t.name,")"))}("e"+t++,r,e);let r=e.shaderParts.get(e8.FRAGMENT_HEAD),n=e.shaderParts.get(e8.FRAGMENT_MAIN_IMAGE),i=e.shaderParts.get(e8.FRAGMENT_MAIN_UV),a=/\bblend\b/g;for(let t of e.blendModes.values())r+=t.getShaderCode().replace(a,"blend".concat(t.blendFunction))+"\n";for(let[t,a]of((e.attributes&e4.DEPTH)!=0?(e.readDepth&&(n="float depth = readDepth(UV);\n\n "+n),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,e.colorSpace===eW.SRGBColorSpace&&(n+="color0 = sRGBToLinear(color0);\n "),e.uvTransformation?(i="vec2 transformedUv = vUv;\n"+i,e.defines.set("UV","transformedUv")):e.defines.set("UV","vUv"),e.shaderParts.set(e8.FRAGMENT_HEAD,r),e.shaderParts.set(e8.FRAGMENT_MAIN_IMAGE,n),e.shaderParts.set(e8.FRAGMENT_MAIN_UV,i),e.shaderParts))null!==a&&e.shaderParts.set(t,a.trim().replace(/^#/,"\n#"));this.skipRendering=0===t,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eW.BasicDepthPacking;for(let r of(this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t,this.effects))r.setDepthTexture(e,t)}render(e,t,r,n,i){for(let r of this.effects)r.update(e,t,n);if(!this.skipRendering||this.renderToScreen){let i=this.fullscreenMaterial;i.inputBuffer=t.texture,i.time+=n*this.timeScale,e.setRenderTarget(this.renderToScreen?null:r),e.render(this.scene,this.camera)}}setSize(e,t){for(let r of(this.fullscreenMaterial.setSize(e,t),this.effects))r.setSize(e,t)}initialize(e,t,r){for(let n of(this.renderer=e,this.effects))n.initialize(e,t,r);this.updateMaterial(),void 0!==r&&r!==eW.UnsignedByteType&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){for(let e of(super.dispose(),this.effects))e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){"change"===e.type&&this.recompile()}constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new tX(null,null,null,e),this.listener=e=>this.handleEvent(e),this.effects=[],this.setEffects(t),this.skipRendering=!1,this.minTime=1,this.maxTime=1/0,this.timeScale=1}},t1=class extends eY{set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,r,n,i){let a=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,a,a)}setSize(e,t){let r=this.resolution;r.setBaseSize(e,t),this.renderTarget.setSize(r.width,r.height)}constructor(e,t,{renderTarget:r,resolutionScale:n=1,width:i=te.AUTO_SIZE,height:a=te.AUTO_SIZE,resolutionX:s=i,resolutionY:o=a}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new tE(e,t,new eW.MeshNormalMaterial);let l=this.renderPass;l.ignoreBackground=!0,l.skipShadowMapUpdate=!0;let u=l.getClearPass();u.overrideClearColor=new eW.Color(7829503),u.overrideClearAlpha=1,this.renderTarget=r,void 0===this.renderTarget&&(this.renderTarget=new eW.WebGLRenderTarget(1,1,{minFilter:eW.NearestFilter,magFilter:eW.NearestFilter}),this.renderTarget.texture.name="NormalPass.Target");let c=this.resolution=new te(this,s,o,n);c.addEventListener("change",e=>this.setSize(c.baseWidth,c.baseHeight))}};function t2(e,t,r,n){var i;return(i=e+(t-e)*.75)+(r+(n-r)*.75-i)*.875}function t9(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]),t2(0,0,0,0),new Float32Array([0,0,0,0]),t2(0,0,0,1),new Float32Array([0,0,0,1]),t2(0,0,1,0),new Float32Array([0,0,1,0]),t2(0,0,1,1),new Float32Array([0,0,1,1]),t2(0,1,0,0),new Float32Array([0,1,0,0]),t2(0,1,0,1),new Float32Array([0,1,0,1]),t2(0,1,1,0),new Float32Array([0,1,1,0]),t2(0,1,1,1),new Float32Array([0,1,1,1]),t2(1,0,0,0),new Float32Array([1,0,0,0]),t2(1,0,0,1),new Float32Array([1,0,0,1]),t2(1,0,1,0),new Float32Array([1,0,1,0]),t2(1,0,1,1),new Float32Array([1,0,1,1]),t2(1,1,0,0),new Float32Array([1,1,0,0]),t2(1,1,0,1),new Float32Array([1,1,0,1]),t2(1,1,1,0),new Float32Array([1,1,1,0]),t2(1,1,1,1),new Float32Array([1,1,1,1]);function t3(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&e<1&&(e*=65536),(e=Math.floor(e))<256&&(e|=e<<8);for(var t,r=0;r<256;r++)t=1&r?re[r]^255&e:re[r]^e>>8&255,rt[r]=rt[r+256]=t,rr[r]=rr[r+256]=t7[t%12]}(0);function rn(e){var t=function(e){if("number"==typeof e)e=Math.abs(e);else if("string"==typeof e){var t=e;e=0;for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:.25,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.01,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1/0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:ri,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:.001,l="velocity_"+t;if(void 0===e.__damp&&(e.__damp={}),void 0===e.__damp[l]&&(e.__damp[l]=0),Math.abs(e[t]-r)<=o)return e[t]=r,!1;var u=2/(n=Math.max(1e-4,n)),c=s(u*i),d=e[t]-r,f=r,h=a*n;d=Math.min(Math.max(d,-h),h),r=e[t]-d;var p=(e.__damp[l]+u*d)*i;e.__damp[l]=(e.__damp[l]-u*p)*c;var m=r+(d+p)*c;return f-e[t]>0==m>f&&(m=f,e.__damp[l]=(m-f)/i),e[t]=m,!0}function rs(e,t,r,n,i,a,s,o){var l,u,c,d;return ra(e,t,e[t]+(c=(l=r-e[t])-Math.floor(l/(u=2*Math.PI))*u,(d=Math.max(0,Math.min(u,c)))>Math.PI&&(d-=2*Math.PI),d),n,i,a,s,o)}var ro=new eO.Vector2,rl=new eO.Vector3;function ru(e,t,r,n,o,l,u){return"number"==typeof t?rl.setScalar(t):Array.isArray(t)?rl.set(t[0],t[1],t[2]):rl.copy(t),i=ra(e,"x",rl.x,r,n,o,l,u),a=ra(e,"y",rl.y,r,n,o,l,u),s=ra(e,"z",rl.z,r,n,o,l,u),i||a||s}var rc=new eO.Vector4,rd=new eO.Euler,rf=new eO.Color,rh=new eO.Quaternion,rp=new eO.Vector4,rm=new eO.Vector4,rv=new eO.Vector4;function rg(e,t,r,n,i,a,s){Array.isArray(t)?rh.set(t[0],t[1],t[2],t[3]):rh.copy(t);var o=e.dot(rh)>0?1:-1;return rh.x*=o,rh.y*=o,rh.z*=o,rh.w*=o,A=ra(e,"x",rh.x,r,n,i,a,s),y=ra(e,"y",rh.y,r,n,i,a,s),x=ra(e,"z",rh.z,r,n,i,a,s),B=ra(e,"w",rh.w,r,n,i,a,s),rp.set(e.x,e.y,e.z,e.w).normalize(),rm.set(e.__damp.velocity_x,e.__damp.velocity_y,e.__damp.velocity_z,e.__damp.velocity_w),rv.copy(rp).multiplyScalar(rm.dot(rp)/rp.dot(rp)),e.__damp.velocity_x-=rv.x,e.__damp.velocity_y-=rv.y,e.__damp.velocity_z-=rv.z,e.__damp.velocity_w-=rv.w,e.set(rp.x,rp.y,rp.z,rp.w),A||y||x||B}var rA=new eO.Spherical,ry=new eO.Matrix4,rx=new eO.Vector3,rB=new eO.Quaternion,rC=new eO.Vector3,rS=Object.freeze({__proto__:null,rsqw:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/(2*Math.PI);return r/Math.atan(1/t)*Math.atan(Math.sin(2*Math.PI*e*n)/t)},exp:ri,damp:ra,dampAngle:rs,damp2:function(e,t,i,a,s,o,l){return"number"==typeof t?ro.setScalar(t):Array.isArray(t)?ro.set(t[0],t[1]):ro.copy(t),r=ra(e,"x",ro.x,i,a,s,o,l),n=ra(e,"y",ro.y,i,a,s,o,l),r||n},damp3:ru,damp4:function(e,t,r,n,i,a,s){return"number"==typeof t?rc.setScalar(t):Array.isArray(t)?rc.set(t[0],t[1],t[2],t[3]):rc.copy(t),o=ra(e,"x",rc.x,r,n,i,a,s),l=ra(e,"y",rc.y,r,n,i,a,s),u=ra(e,"z",rc.z,r,n,i,a,s),c=ra(e,"w",rc.w,r,n,i,a,s),o||l||u||c},dampE:function(e,t,r,n,i,a,s){return Array.isArray(t)?rd.set(t[0],t[1],t[2],t[3]):rd.copy(t),d=rs(e,"x",rd.x,r,n,i,a,s),f=rs(e,"y",rd.y,r,n,i,a,s),h=rs(e,"z",rd.z,r,n,i,a,s),d||f||h},dampC:function(e,t,r,n,i,a,s){return t instanceof eO.Color?rf.copy(t):Array.isArray(t)?rf.setRGB(t[0],t[1],t[2]):rf.set(t),p=ra(e,"r",rf.r,r,n,i,a,s),m=ra(e,"g",rf.g,r,n,i,a,s),g=ra(e,"b",rf.b,r,n,i,a,s),p||m||g},dampQ:rg,dampS:function(e,t,r,n,i,a,s){return Array.isArray(t)?rA.set(t[0],t[1],t[2]):rA.copy(t),C=ra(e,"radius",rA.radius,r,n,i,a,s),S=rs(e,"phi",rA.phi,r,n,i,a,s),E=rs(e,"theta",rA.theta,r,n,i,a,s),C||S||E},dampM:function(e,t,r,n,i,a,s){return void 0===e.__damp&&(e.__damp={position:new eO.Vector3,rotation:new eO.Quaternion,scale:new eO.Vector3},e.decompose(e.__damp.position,e.__damp.rotation,e.__damp.scale)),Array.isArray(t)?ry.set.apply(ry,t8(t)):ry.copy(t),ry.decompose(rx,rB,rC),T=ru(e.__damp.position,rx,r,n,i,a,s),b=rg(e.__damp.rotation,rB,r,n,i,a,s),D=ru(e.__damp.scale,rC,r,n,i,a,s),e.compose(e.__damp.position,e.__damp.rotation,e.__damp.scale),T||b||D}});eO.BufferGeometry;var rE=e.i(99749),rT=eO,rb=eO;new rb.OrthographicCamera(-1,1,1,-1,0,1);class rD extends rb.BufferGeometry{constructor(){super(),this.setAttribute("position",new rb.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new rb.Float32BufferAttribute([0,2,0,0,2,0],2))}}new rD;class rM extends rT.BufferGeometry{computeBoundingSphere(){}constructor(){super(),(0,rE._)(this,"boundingSphere",new rT.Sphere),this.setAttribute("position",new rT.BufferAttribute(new Float32Array([-1,-1,3,-1,-1,3]),2)),this.setAttribute("uv",new rT.BufferAttribute(new Float32Array([0,0,2,0,0,2]),2))}}let rw=new rM,rF=new rT.OrthographicCamera;class rR{render(e){e.render(this._mesh,rF)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}dispose(){this._mesh.material.dispose(),this._mesh.geometry.dispose()}constructor(e){this._mesh=new rT.Mesh(rw,e),this._mesh.frustumCulled=!1}}let rI={uniforms:{sceneDiffuse:{value:null},sceneDepth:{value:null},sceneNormal:{value:null},projMat:{value:new rT.Matrix4},viewMat:{value:new rT.Matrix4},projViewMat:{value:new rT.Matrix4},projectionMatrixInv:{value:new rT.Matrix4},viewMatrixInv:{value:new rT.Matrix4},cameraPos:{value:new rT.Vector3},resolution:{value:new rT.Vector2},biasAdjustment:{value:new rT.Vector2},time:{value:0},samples:{value:[]},bluenoise:{value:null},distanceFalloff:{value:1},radius:{value:5},near:{value:.1},far:{value:1e3},ortho:{value:!1},screenSpaceRadius:{value:!1},frame:{value:0}},depthWrite:!1,depthTest:!1,vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n}",fragmentShader:"\n #define SAMPLES 16\n #define FSAMPLES 16.0\nuniform sampler2D sceneDiffuse;\nuniform highp sampler2D sceneNormal;\nuniform highp sampler2D sceneDepth;\nuniform mat4 projectionMatrixInv;\nuniform mat4 viewMatrixInv;\nuniform mat4 projMat;\nuniform mat4 viewMat;\nuniform mat4 projViewMat;\nuniform vec3 cameraPos;\nuniform vec2 resolution;\nuniform vec2 biasAdjustment;\nuniform float time;\nuniform vec3[SAMPLES] samples;\nuniform float radius;\nuniform float distanceFalloff;\nuniform float near;\nuniform float far;\nuniform float frame;\nuniform bool ortho;\nuniform bool screenSpaceRadius;\nuniform sampler2D bluenoise;\n varying vec2 vUv;\n highp float linearize_depth(highp float d, highp float zNear,highp float zFar)\n {\n return (zFar * zNear) / (zFar - d * (zFar - zNear));\n }\n highp float linearize_depth_ortho(highp float d, highp float nearZ, highp float farZ) {\n return nearZ + (farZ - nearZ) * d;\n }\n highp float linearize_depth_log(highp float d, highp float nearZ,highp float farZ) {\n float depth = pow(2.0, d * log2(farZ + 1.0)) - 1.0;\n float a = farZ / (farZ - nearZ);\n float b = farZ * nearZ / (nearZ - farZ);\n float linDepth = a + b / depth;\n /*return ortho ? linearize_depth_ortho(\n linDepth,\n nearZ,\n farZ\n ) :linearize_depth(linDepth, nearZ, farZ);*/\n #ifdef ORTHO\n\n return linearize_depth_ortho(d, nearZ, farZ);\n\n #else\n return linearize_depth(linDepth, nearZ, farZ);\n #endif\n }\n\n vec3 getWorldPosLog(vec3 posS) {\n vec2 uv = posS.xy;\n float z = posS.z;\n float nearZ =near;\n float farZ = far;\n float depth = pow(2.0, z * log2(farZ + 1.0)) - 1.0;\n float a = farZ / (farZ - nearZ);\n float b = farZ * nearZ / (nearZ - farZ);\n float linDepth = a + b / depth;\n vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;\n vec4 wpos = projectionMatrixInv * clipVec;\n return wpos.xyz / wpos.w;\n }\n vec3 getWorldPos(float depth, vec2 coord) {\n #ifdef LOGDEPTH\n #ifndef ORTHO\n return getWorldPosLog(vec3(coord, depth));\n #endif\n #endif\n float z = depth * 2.0 - 1.0;\n vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);\n vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;\n // Perspective division\n vec4 worldSpacePosition = viewSpacePosition;\n worldSpacePosition.xyz /= worldSpacePosition.w;\n return worldSpacePosition.xyz;\n }\n\n vec3 computeNormal(vec3 worldPos, vec2 vUv) {\n ivec2 p = ivec2(vUv * resolution);\n #ifdef REVERSEDEPTH\n float c0 = 1.0 - texelFetch(sceneDepth, p, 0).x;\n float l2 = 1.0 - texelFetch(sceneDepth, p - ivec2(2, 0), 0).x;\n float l1 = 1.0 - texelFetch(sceneDepth, p - ivec2(1, 0), 0).x;\n float r1 = 1.0 - texelFetch(sceneDepth, p + ivec2(1, 0), 0).x;\n float r2 = 1.0 - texelFetch(sceneDepth, p + ivec2(2, 0), 0).x;\n float b2 = 1.0 - texelFetch(sceneDepth, p - ivec2(0, 2), 0).x;\n float b1 = 1.0 - texelFetch(sceneDepth, p - ivec2(0, 1), 0).x;\n float t1 = 1.0 - texelFetch(sceneDepth, p + ivec2(0, 1), 0).x;\n float t2 = 1.0 - texelFetch(sceneDepth, p + ivec2(0, 2), 0).x;\n #else\n float c0 = texelFetch(sceneDepth, p, 0).x;\n float l2 = texelFetch(sceneDepth, p - ivec2(2, 0), 0).x;\n float l1 = texelFetch(sceneDepth, p - ivec2(1, 0), 0).x;\n float r1 = texelFetch(sceneDepth, p + ivec2(1, 0), 0).x;\n float r2 = texelFetch(sceneDepth, p + ivec2(2, 0), 0).x;\n float b2 = texelFetch(sceneDepth, p - ivec2(0, 2), 0).x;\n float b1 = texelFetch(sceneDepth, p - ivec2(0, 1), 0).x;\n float t1 = texelFetch(sceneDepth, p + ivec2(0, 1), 0).x;\n float t2 = texelFetch(sceneDepth, p + ivec2(0, 2), 0).x;\n #endif\n\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n\n vec3 ce = getWorldPos(c0, vUv).xyz;\n\n vec3 dpdx = (dl < dr) ? ce - getWorldPos(l1, (vUv - vec2(1.0 / resolution.x, 0.0))).xyz\n : -ce + getWorldPos(r1, (vUv + vec2(1.0 / resolution.x, 0.0))).xyz;\n vec3 dpdy = (db < dt) ? ce - getWorldPos(b1, (vUv - vec2(0.0, 1.0 / resolution.y))).xyz\n : -ce + getWorldPos(t1, (vUv + vec2(0.0, 1.0 / resolution.y))).xyz;\n\n return normalize(cross(dpdx, dpdy));\n}\n\nmat3 makeRotationZ(float theta) {\n float c = cos(theta);\n float s = sin(theta);\n return mat3(c, - s, 0,\n s, c, 0,\n 0, 0, 1);\n }\n\nvoid main() {\n vec4 diffuse = texture2D(sceneDiffuse, vUv);\n #ifdef REVERSEDEPTH\n float depth = 1.0 - texture2D(sceneDepth, vUv).x;\n #else\n float depth = texture2D(sceneDepth, vUv).x;\n #endif\n if (depth == 1.0) {\n gl_FragColor = vec4(vec3(1.0), 1.0);\n return;\n }\n vec3 worldPos = getWorldPos(depth, vUv);\n #ifdef HALFRES\n vec3 normal = texture2D(sceneNormal, vUv).rgb;\n #else\n vec3 normal = computeNormal(worldPos, vUv);\n #endif\n vec4 noise = texture2D(bluenoise, gl_FragCoord.xy / 128.0);\n vec2 harmoniousNumbers = vec2(\n 1.618033988749895,\n 1.324717957244746\n );\n noise.rg += harmoniousNumbers * frame;\n noise.rg = fract(noise.rg);\n vec3 helperVec = vec3(0.0, 1.0, 0.0);\n if (dot(helperVec, normal) > 0.99) {\n helperVec = vec3(1.0, 0.0, 0.0);\n }\n vec3 tangent = normalize(cross(helperVec, normal));\n vec3 bitangent = cross(normal, tangent);\n mediump mat3 tbn = mat3(tangent, bitangent, normal) * makeRotationZ( noise.r * 3.1415962 * 2.0) ;\n\n mediump float occluded = 0.0;\n mediump float totalWeight = 0.0;\n float radiusToUse = screenSpaceRadius ? distance(\n worldPos,\n getWorldPos(depth, vUv +\n vec2(radius, 0.0) / resolution)\n ) : radius;\n float distanceFalloffToUse =screenSpaceRadius ?\n radiusToUse * distanceFalloff\n : radiusToUse * distanceFalloff * 0.2;\n float bias = (min(\n 0.1,\n distanceFalloffToUse * 0.1\n ) / near) * fwidth(distance(worldPos, cameraPos)) / radiusToUse;\n bias = biasAdjustment.x + biasAdjustment.y * bias;\n mediump float offsetMove = noise.g;\n mediump float offsetMoveInv = 1.0 / FSAMPLES;\n float farTimesNear = far * near;\n float farMinusNear = far - near;\n \n for(int i = 0; i < SAMPLES; i++) {\n mediump vec3 sampleDirection = tbn * samples[i];\n\n float moveAmt = fract(offsetMove);\n offsetMove += offsetMoveInv;\n vec3 samplePos = worldPos + radiusToUse * moveAmt * sampleDirection;\n vec4 offset = projMat * vec4(samplePos, 1.0);\n offset.xyz /= offset.w;\n offset.xyz = offset.xyz * 0.5 + 0.5;\n \n if (all(greaterThan(offset.xyz * (1.0 - offset.xyz), vec3(0.0)))) {\n #ifdef REVERSEDEPTH\n float sampleDepth = 1.0 - textureLod(sceneDepth, offset.xy, 0.0).x;\n #else\n float sampleDepth = textureLod(sceneDepth, offset.xy, 0.0).x;\n #endif\n\n /*#ifdef LOGDEPTH\n float distSample = linearize_depth_log(sampleDepth, near, far);\n #else\n #ifdef ORTHO\n float distSample = near + farMinusNear * sampleDepth;\n #else\n float distSample = (farTimesNear) / (far - sampleDepth * farMinusNear);\n #endif\n #endif*/\n #ifdef ORTHO\n float distSample = near + sampleDepth * farMinusNear;\n #else\n #ifdef LOGDEPTH\n float distSample = linearize_depth_log(sampleDepth, near, far);\n #else\n float distSample = (farTimesNear) / (far - sampleDepth * farMinusNear);\n #endif\n #endif\n \n #ifdef ORTHO\n float distWorld = near + offset.z * farMinusNear;\n #else\n float distWorld = (farTimesNear) / (far - offset.z * farMinusNear);\n #endif\n \n mediump float rangeCheck = smoothstep(0.0, 1.0, distanceFalloffToUse / (abs(distSample - distWorld)));\n vec2 diff = gl_FragCoord.xy - floor(offset.xy * resolution);\n occluded += rangeCheck * float(distSample != distWorld) * float(sampleDepth != depth) * step(distSample + bias, distWorld) * step(\n 1.0,\n dot(diff, diff)\n );\n \n totalWeight ++;\n }\n }\n float occ = clamp(1.0 - occluded / (totalWeight == 0.0 ? 1.0 : totalWeight), 0.0, 1.0);\n gl_FragColor = vec4(occ, 0.5 + 0.5 * normal);\n}"},rP={uniforms:{sceneDiffuse:{value:null},sceneDepth:{value:null},tDiffuse:{value:null},transparencyDWFalse:{value:null},transparencyDWTrue:{value:null},transparencyDWTrueDepth:{value:null},transparencyAware:{value:!1},projMat:{value:new rT.Matrix4},viewMat:{value:new rT.Matrix4},projectionMatrixInv:{value:new rT.Matrix4},viewMatrixInv:{value:new rT.Matrix4},cameraPos:{value:new rT.Vector3},resolution:{value:new rT.Vector2},color:{value:new rT.Vector3(0,0,0)},blueNoise:{value:null},downsampledDepth:{value:null},time:{value:0},intensity:{value:10},renderMode:{value:0},gammaCorrection:{value:!1},ortho:{value:!1},near:{value:.1},far:{value:1e3},screenSpaceRadius:{value:!1},radius:{value:0},distanceFalloff:{value:1},fog:{value:!1},fogExp:{value:!1},fogDensity:{value:0},fogNear:{value:1/0},fogFar:{value:1/0},colorMultiply:{value:!0},aoTones:{value:0}},depthWrite:!1,depthTest:!1,vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }",fragmentShader:"\n uniform sampler2D sceneDiffuse;\n uniform highp sampler2D sceneDepth;\n uniform highp sampler2D downsampledDepth;\n uniform highp sampler2D transparencyDWFalse;\n uniform highp sampler2D transparencyDWTrue;\n uniform highp sampler2D transparencyDWTrueDepth;\n uniform sampler2D tDiffuse;\n uniform sampler2D blueNoise;\n uniform vec2 resolution;\n uniform vec3 color;\n uniform mat4 projectionMatrixInv;\n uniform mat4 viewMatrixInv;\n uniform float intensity;\n uniform float renderMode;\n uniform float near;\n uniform float far;\n uniform float aoTones;\n uniform bool gammaCorrection;\n uniform bool ortho;\n uniform bool screenSpaceRadius;\n uniform bool fog;\n uniform bool fogExp;\n uniform bool colorMultiply;\n uniform bool transparencyAware;\n uniform float fogDensity;\n uniform float fogNear;\n uniform float fogFar;\n uniform float radius;\n uniform float distanceFalloff;\n uniform vec3 cameraPos;\n varying vec2 vUv;\n highp float linearize_depth(highp float d, highp float zNear,highp float zFar)\n {\n return (zFar * zNear) / (zFar - d * (zFar - zNear));\n }\n highp float linearize_depth_ortho(highp float d, highp float nearZ, highp float farZ) {\n return nearZ + (farZ - nearZ) * d;\n }\n highp float linearize_depth_log(highp float d, highp float nearZ,highp float farZ) {\n float depth = pow(2.0, d * log2(farZ + 1.0)) - 1.0;\n float a = farZ / (farZ - nearZ);\n float b = farZ * nearZ / (nearZ - farZ);\n float linDepth = a + b / depth;\n return ortho ? linearize_depth_ortho(\n linDepth,\n nearZ,\n farZ\n ) :linearize_depth(linDepth, nearZ, farZ);\n }\n vec3 getWorldPosLog(vec3 posS) {\n vec2 uv = posS.xy;\n float z = posS.z;\n float nearZ =near;\n float farZ = far;\n float depth = pow(2.0, z * log2(farZ + 1.0)) - 1.0;\n float a = farZ / (farZ - nearZ);\n float b = farZ * nearZ / (nearZ - farZ);\n float linDepth = a + b / depth;\n vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;\n vec4 wpos = projectionMatrixInv * clipVec;\n return wpos.xyz / wpos.w;\n }\n vec3 getWorldPos(float depth, vec2 coord) {\n #ifdef LOGDEPTH\n #ifndef ORTHO\n return getWorldPosLog(vec3(coord, depth));\n #endif\n #endif\n // }\n float z = depth * 2.0 - 1.0;\n vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);\n vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;\n // Perspective division\n vec4 worldSpacePosition = viewSpacePosition;\n worldSpacePosition.xyz /= worldSpacePosition.w;\n return worldSpacePosition.xyz;\n }\n \n vec3 computeNormal(vec3 worldPos, vec2 vUv) {\n ivec2 p = ivec2(vUv * resolution);\n #ifdef REVERSEDEPTH\n float c0 = 1.0 - texelFetch(sceneDepth, p, 0).x;\n float l2 = 1.0 - texelFetch(sceneDepth, p - ivec2(2, 0), 0).x;\n float l1 = 1.0 - texelFetch(sceneDepth, p - ivec2(1, 0), 0).x;\n float r1 = 1.0 - texelFetch(sceneDepth, p + ivec2(1, 0), 0).x;\n float r2 = 1.0 - texelFetch(sceneDepth, p + ivec2(2, 0), 0).x;\n float b2 = 1.0 - texelFetch(sceneDepth, p - ivec2(0, 2), 0).x;\n float b1 = 1.0 - texelFetch(sceneDepth, p - ivec2(0, 1), 0).x;\n float t1 = 1.0 - texelFetch(sceneDepth, p + ivec2(0, 1), 0).x;\n float t2 = 1.0 - texelFetch(sceneDepth, p + ivec2(0, 2), 0).x;\n #else\n float c0 = texelFetch(sceneDepth, p, 0).x;\n float l2 = texelFetch(sceneDepth, p - ivec2(2, 0), 0).x;\n float l1 = texelFetch(sceneDepth, p - ivec2(1, 0), 0).x;\n float r1 = texelFetch(sceneDepth, p + ivec2(1, 0), 0).x;\n float r2 = texelFetch(sceneDepth, p + ivec2(2, 0), 0).x;\n float b2 = texelFetch(sceneDepth, p - ivec2(0, 2), 0).x;\n float b1 = texelFetch(sceneDepth, p - ivec2(0, 1), 0).x;\n float t1 = texelFetch(sceneDepth, p + ivec2(0, 1), 0).x;\n float t2 = texelFetch(sceneDepth, p + ivec2(0, 2), 0).x;\n #endif\n \n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n \n vec3 ce = getWorldPos(c0, vUv).xyz;\n \n vec3 dpdx = (dl < dr) ? ce - getWorldPos(l1, (vUv - vec2(1.0 / resolution.x, 0.0))).xyz\n : -ce + getWorldPos(r1, (vUv + vec2(1.0 / resolution.x, 0.0))).xyz;\n vec3 dpdy = (db < dt) ? ce - getWorldPos(b1, (vUv - vec2(0.0, 1.0 / resolution.y))).xyz\n : -ce + getWorldPos(t1, (vUv + vec2(0.0, 1.0 / resolution.y))).xyz;\n \n return normalize(cross(dpdx, dpdy));\n }\n\n #include \n #include \n void main() {\n //vec4 texel = texture2D(tDiffuse, vUv);//vec3(0.0);\n vec4 sceneTexel = texture2D(sceneDiffuse, vUv);\n #ifdef REVERSEDEPTH\n float depth = 1.0 - texture2D(sceneDepth, vUv).x;\n #else\n float depth = texture2D(sceneDepth, vUv).x;\n #endif\n #ifdef HALFRES \n vec4 texel;\n if (depth == 1.0) {\n texel = vec4(0.0, 0.0, 0.0, 1.0);\n } else {\n vec3 worldPos = getWorldPos(depth, vUv);\n vec3 normal = computeNormal(getWorldPos(depth, vUv), vUv);\n // vec4 texel = texture2D(tDiffuse, vUv);\n // Find closest depth;\n float totalWeight = 0.0;\n float radiusToUse = screenSpaceRadius ? distance(\n worldPos,\n getWorldPos(depth, vUv +\n vec2(radius, 0.0) / resolution)\n ) : radius;\n float distanceFalloffToUse =screenSpaceRadius ?\n radiusToUse * distanceFalloff\n : distanceFalloff;\n for(float x = -1.0; x <= 1.0; x++) {\n for(float y = -1.0; y <= 1.0; y++) {\n vec2 offset = vec2(x, y);\n ivec2 p = ivec2(\n (vUv * resolution * 0.5) + offset\n );\n vec2 pUv = vec2(p) / (resolution * 0.5);\n float sampleDepth = texelFetch(downsampledDepth,p, 0).x;\n vec4 sampleInfo = texelFetch(tDiffuse, p, 0);\n vec3 normalSample = sampleInfo.gba * 2.0 - 1.0;\n vec3 worldPosSample = getWorldPos(sampleDepth, pUv);\n float tangentPlaneDist = abs(dot(worldPosSample - worldPos, normal));\n float rangeCheck = exp(-1.0 * tangentPlaneDist * (1.0 / distanceFalloffToUse)) * max(dot(normal, normalSample), 0.0);\n float weight = rangeCheck;\n totalWeight += weight;\n texel += sampleInfo * weight;\n }\n }\n if (totalWeight == 0.0) {\n texel = texture2D(tDiffuse, vUv);\n } else {\n texel /= totalWeight;\n }\n }\n #else\n vec4 texel = texture2D(tDiffuse, vUv);\n #endif\n\n #ifdef LOGDEPTH\n texel.r = clamp(texel.r, 0.0, 1.0);\n if (texel.r == 0.0) {\n texel.r = 1.0;\n }\n #endif\n \n float finalAo = pow(texel.r, intensity);\n if (aoTones > 0.0) {\n finalAo = ceil(finalAo * aoTones) / aoTones;\n }\n float fogFactor;\n float fogDepth = distance(\n cameraPos,\n getWorldPos(depth, vUv)\n );\n if (fog) {\n if (fogExp) {\n fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n } else {\n fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n }\n }\n if (transparencyAware) {\n float transparencyDWOff = texture2D(transparencyDWFalse, vUv).a;\n float transparencyDWOn = texture2D(transparencyDWTrue, vUv).a;\n float adjustmentFactorOff = transparencyDWOff;\n #ifdef REVERSEDEPTH\n float depthSample = 1.0 - texture2D(sceneDepth, vUv).r;\n float trueDepthSample = 1.0 - texture2D(transparencyDWTrueDepth, vUv).r;\n #else\n float depthSample = texture2D(sceneDepth, vUv).r;\n float trueDepthSample = texture2D(transparencyDWTrueDepth, vUv).r;\n #endif\n float adjustmentFactorOn = (1.0 - transparencyDWOn) * (\n trueDepthSample == depthSample ? 1.0 : 0.0\n );\n float adjustmentFactor = max(adjustmentFactorOff, adjustmentFactorOn);\n finalAo = mix(finalAo, 1.0, adjustmentFactor);\n }\n finalAo = mix(finalAo, 1.0, fogFactor);\n vec3 aoApplied = color * mix(vec3(1.0), sceneTexel.rgb, float(colorMultiply));\n if (renderMode == 0.0) {\n gl_FragColor = vec4( mix(sceneTexel.rgb, aoApplied, 1.0 - finalAo), sceneTexel.a);\n } else if (renderMode == 1.0) {\n gl_FragColor = vec4( mix(vec3(1.0), aoApplied, 1.0 - finalAo), sceneTexel.a);\n } else if (renderMode == 2.0) {\n gl_FragColor = vec4( sceneTexel.rgb, sceneTexel.a);\n } else if (renderMode == 3.0) {\n if (vUv.x < 0.5) {\n gl_FragColor = vec4( sceneTexel.rgb, sceneTexel.a);\n } else if (abs(vUv.x - 0.5) < 1.0 / resolution.x) {\n gl_FragColor = vec4(1.0);\n } else {\n gl_FragColor = vec4( mix(sceneTexel.rgb, aoApplied, 1.0 - finalAo), sceneTexel.a);\n }\n } else if (renderMode == 4.0) {\n if (vUv.x < 0.5) {\n gl_FragColor = vec4( sceneTexel.rgb, sceneTexel.a);\n } else if (abs(vUv.x - 0.5) < 1.0 / resolution.x) {\n gl_FragColor = vec4(1.0);\n } else {\n gl_FragColor = vec4( mix(vec3(1.0), aoApplied, 1.0 - finalAo), sceneTexel.a);\n }\n }\n #include \n if (gammaCorrection) {\n gl_FragColor = sRGBTransferOETF(gl_FragColor);\n }\n }\n "},rL={uniforms:{sceneDiffuse:{value:null},sceneDepth:{value:null},tDiffuse:{value:null},projMat:{value:new rT.Matrix4},viewMat:{value:new rT.Matrix4},projectionMatrixInv:{value:new rT.Matrix4},viewMatrixInv:{value:new rT.Matrix4},cameraPos:{value:new rT.Vector3},resolution:{value:new rT.Vector2},time:{value:0},r:{value:5},blueNoise:{value:null},radius:{value:12},worldRadius:{value:5},index:{value:0},poissonDisk:{value:[]},distanceFalloff:{value:1},near:{value:.1},far:{value:1e3},screenSpaceRadius:{value:!1}},depthWrite:!1,depthTest:!1,vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1.0);\n }",fragmentShader:"\n uniform sampler2D sceneDiffuse;\n uniform highp sampler2D sceneDepth;\n uniform sampler2D tDiffuse;\n uniform sampler2D blueNoise;\n uniform mat4 projectionMatrixInv;\n uniform mat4 viewMatrixInv;\n uniform vec2 resolution;\n uniform float r;\n uniform float radius;\n uniform float worldRadius;\n uniform float index;\n uniform float near;\n uniform float far;\n uniform float distanceFalloff;\n uniform bool screenSpaceRadius;\n varying vec2 vUv;\n\n highp float linearize_depth(highp float d, highp float zNear,highp float zFar)\n {\n highp float z_n = 2.0 * d - 1.0;\n return 2.0 * zNear * zFar / (zFar + zNear - z_n * (zFar - zNear));\n }\n highp float linearize_depth_log(highp float d, highp float nearZ,highp float farZ) {\n float depth = pow(2.0, d * log2(farZ + 1.0)) - 1.0;\n float a = farZ / (farZ - nearZ);\n float b = farZ * nearZ / (nearZ - farZ);\n float linDepth = a + b / depth;\n return linearize_depth(linDepth, nearZ, farZ);\n }\n highp float linearize_depth_ortho(highp float d, highp float nearZ, highp float farZ) {\n return nearZ + (farZ - nearZ) * d;\n }\n vec3 getWorldPosLog(vec3 posS) {\n vec2 uv = posS.xy;\n float z = posS.z;\n float nearZ =near;\n float farZ = far;\n float depth = pow(2.0, z * log2(farZ + 1.0)) - 1.0;\n float a = farZ / (farZ - nearZ);\n float b = farZ * nearZ / (nearZ - farZ);\n float linDepth = a + b / depth;\n vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;\n vec4 wpos = projectionMatrixInv * clipVec;\n return wpos.xyz / wpos.w;\n }\n vec3 getWorldPos(float depth, vec2 coord) {\n #ifdef LOGDEPTH\n #ifndef ORTHO\n return getWorldPosLog(vec3(coord, depth));\n #endif\n #endif\n \n float z = depth * 2.0 - 1.0;\n vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);\n vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;\n // Perspective division\n vec4 worldSpacePosition = viewSpacePosition;\n worldSpacePosition.xyz /= worldSpacePosition.w;\n return worldSpacePosition.xyz;\n }\n #include \n #define NUM_SAMPLES 16\n uniform vec2 poissonDisk[NUM_SAMPLES];\n void main() {\n const float pi = 3.14159;\n vec2 texelSize = vec2(1.0 / resolution.x, 1.0 / resolution.y);\n vec2 uv = vUv;\n vec4 data = texture2D(tDiffuse, vUv);\n float occlusion = data.r;\n float baseOcc = data.r;\n vec3 normal = data.gba * 2.0 - 1.0;\n float count = 1.0;\n float d = texture2D(sceneDepth, vUv).x;\n if (d == 1.0) {\n gl_FragColor = data;\n return;\n }\n vec3 worldPos = getWorldPos(d, vUv);\n float size = radius;\n float angle;\n if (index == 0.0) {\n angle = texture2D(blueNoise, gl_FragCoord.xy / 128.0).w * PI2;\n } else if (index == 1.0) {\n angle = texture2D(blueNoise, gl_FragCoord.xy / 128.0).z * PI2;\n } else if (index == 2.0) {\n angle = texture2D(blueNoise, gl_FragCoord.xy / 128.0).y * PI2;\n } else {\n angle = texture2D(blueNoise, gl_FragCoord.xy / 128.0).x * PI2;\n }\n\n mat2 rotationMatrix = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n float radiusToUse = screenSpaceRadius ? distance(\n worldPos,\n getWorldPos(d, vUv +\n vec2(worldRadius, 0.0) / resolution)\n ) : worldRadius;\n float distanceFalloffToUse =screenSpaceRadius ?\n radiusToUse * distanceFalloff\n : radiusToUse * distanceFalloff * 0.2;\n\n float invDistance = (1.0 / distanceFalloffToUse);\n for(int i = 0; i < NUM_SAMPLES; i++) {\n vec2 offset = (rotationMatrix * poissonDisk[i]) * texelSize * size;\n vec4 dataSample = texture2D(tDiffuse, uv + offset);\n float occSample = dataSample.r;\n vec3 normalSample = dataSample.gba * 2.0 - 1.0;\n float dSample = texture2D(sceneDepth, uv + offset).x;\n vec3 worldPosSample = getWorldPos(dSample, uv + offset);\n float tangentPlaneDist = abs(dot(worldPosSample - worldPos, normal));\n float rangeCheck = float(dSample != 1.0) * exp(-1.0 * tangentPlaneDist * invDistance ) * max(dot(normal, normalSample), 0.0);\n occlusion += occSample * rangeCheck;\n count += rangeCheck;\n }\n if (count > 0.0) {\n occlusion /= count;\n }\n occlusion = clamp(occlusion, 0.0, 1.0);\n if (occlusion == 0.0) {\n occlusion = 1.0;\n }\n gl_FragColor = vec4(occlusion, 0.5 + 0.5 * normal);\n }\n "},rU={uniforms:{sceneDepth:{value:null},resolution:{value:new rT.Vector2},near:{value:.1},far:{value:1e3},viewMatrixInv:{value:new rT.Matrix4},projectionMatrixInv:{value:new rT.Matrix4},logDepth:{value:!1},ortho:{value:!1}},depthWrite:!1,depthTest:!1,vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }",fragmentShader:"\n uniform highp sampler2D sceneDepth;\n uniform vec2 resolution;\n uniform float near;\n uniform float far;\n uniform bool logDepth;\n uniform bool ortho;\n uniform mat4 viewMatrixInv;\n uniform mat4 projectionMatrixInv;\n varying vec2 vUv;\n layout(location = 1) out vec4 gNormal;\n vec3 getWorldPosLog(vec3 posS) {\n vec2 uv = posS.xy;\n float z = posS.z;\n float nearZ =near;\n float farZ = far;\n float depth = pow(2.0, z * log2(farZ + 1.0)) - 1.0;\n float a = farZ / (farZ - nearZ);\n float b = farZ * nearZ / (nearZ - farZ);\n float linDepth = a + b / depth;\n vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;\n vec4 wpos = projectionMatrixInv * clipVec;\n return wpos.xyz / wpos.w;\n }\n vec3 getWorldPos(float depth, vec2 coord) {\n if (logDepth && !ortho) {\n return getWorldPosLog(vec3(coord, depth));\n }\n float z = depth * 2.0 - 1.0;\n vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);\n vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;\n // Perspective division\n vec4 worldSpacePosition = viewSpacePosition;\n worldSpacePosition.xyz /= worldSpacePosition.w;\n return worldSpacePosition.xyz;\n }\n \n vec3 computeNormal(vec3 worldPos, vec2 vUv) {\n ivec2 p = ivec2(vUv * resolution);\n #ifdef REVERSEDEPTH\n float c0 = 1.0 - texelFetch(sceneDepth, p, 0).x;\n float l2 = 1.0 - texelFetch(sceneDepth, p - ivec2(2, 0), 0).x;\n float l1 = 1.0 - texelFetch(sceneDepth, p - ivec2(1, 0), 0).x;\n float r1 = 1.0 - texelFetch(sceneDepth, p + ivec2(1, 0), 0).x;\n float r2 = 1.0 - texelFetch(sceneDepth, p + ivec2(2, 0), 0).x;\n float b2 = 1.0 - texelFetch(sceneDepth, p - ivec2(0, 2), 0).x;\n float b1 = 1.0 - texelFetch(sceneDepth, p - ivec2(0, 1), 0).x;\n float t1 = 1.0 - texelFetch(sceneDepth, p + ivec2(0, 1), 0).x;\n float t2 = 1.0 - texelFetch(sceneDepth, p + ivec2(0, 2), 0).x;\n #else\n float c0 = texelFetch(sceneDepth, p, 0).x;\n float l2 = texelFetch(sceneDepth, p - ivec2(2, 0), 0).x;\n float l1 = texelFetch(sceneDepth, p - ivec2(1, 0), 0).x;\n float r1 = texelFetch(sceneDepth, p + ivec2(1, 0), 0).x;\n float r2 = texelFetch(sceneDepth, p + ivec2(2, 0), 0).x;\n float b2 = texelFetch(sceneDepth, p - ivec2(0, 2), 0).x;\n float b1 = texelFetch(sceneDepth, p - ivec2(0, 1), 0).x;\n float t1 = texelFetch(sceneDepth, p + ivec2(0, 1), 0).x;\n float t2 = texelFetch(sceneDepth, p + ivec2(0, 2), 0).x;\n #endif\n \n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n \n vec3 ce = getWorldPos(c0, vUv).xyz;\n \n vec3 dpdx = (dl < dr) ? ce - getWorldPos(l1, (vUv - vec2(1.0 / resolution.x, 0.0))).xyz\n : -ce + getWorldPos(r1, (vUv + vec2(1.0 / resolution.x, 0.0))).xyz;\n vec3 dpdy = (db < dt) ? ce - getWorldPos(b1, (vUv - vec2(0.0, 1.0 / resolution.y))).xyz\n : -ce + getWorldPos(t1, (vUv + vec2(0.0, 1.0 / resolution.y))).xyz;\n \n return normalize(cross(dpdx, dpdy));\n }\n void main() {\n vec2 uv = vUv - vec2(0.5) / resolution;\n vec2 pixelSize = vec2(1.0) / resolution;\n highp vec2[4] uvSamples;\n uvSamples[0] = uv;\n uvSamples[1] = uv + vec2(pixelSize.x, 0.0);\n uvSamples[2] = uv + vec2(0.0, pixelSize.y);\n uvSamples[3] = uv + pixelSize;\n #ifdef REVERSEDEPTH\n float depth00 = 1.0 - texture2D(sceneDepth, uvSamples[0]).r;\n float depth10 = 1.0 - texture2D(sceneDepth, uvSamples[1]).r;\n float depth01 = 1.0 - texture2D(sceneDepth, uvSamples[2]).r;\n float depth11 = 1.0 - texture2D(sceneDepth, uvSamples[3]).r;\n #else\n float depth00 = texture2D(sceneDepth, uvSamples[0]).r;\n float depth10 = texture2D(sceneDepth, uvSamples[1]).r;\n float depth01 = texture2D(sceneDepth, uvSamples[2]).r;\n float depth11 = texture2D(sceneDepth, uvSamples[3]).r;\n #endif\n float minDepth = min(min(depth00, depth10), min(depth01, depth11));\n float maxDepth = max(max(depth00, depth10), max(depth01, depth11));\n float targetDepth = minDepth;\n // Checkerboard pattern to avoid artifacts\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 2.0) > 0.5) { \n targetDepth = maxDepth;\n }\n int chosenIndex = 0;\n float[4] samples;\n samples[0] = depth00;\n samples[1] = depth10;\n samples[2] = depth01;\n samples[3] = depth11;\n for(int i = 0; i < 4; ++i) {\n if (samples[i] == targetDepth) {\n chosenIndex = i;\n break;\n }\n }\n gl_FragColor = vec4(samples[chosenIndex], 0.0, 0.0, 1.0);\n gNormal = vec4(computeNormal(\n getWorldPos(samples[chosenIndex], uvSamples[chosenIndex]), uvSamples[chosenIndex]\n ), 0.0);\n }"},rG=Uint8Array.from(atob("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"),e=>e.charCodeAt(0)),rO=parseInt(rT.REVISION.replace(/\D+/g,""))>=162?class extends rT.WebGLRenderTarget{get texture(){return this.textures}constructor(e=1,t=1,r=1,n={}){super(e,t,{...n,count:r}),this.isWebGLMultipleRenderTargets=!0}}:class extends rT.WebGLRenderTarget{setSize(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let n=0,i=this.texture.length;n{t.material&&t.material.transparent&&(e=!0)}),e&&(this.configuration.transparencyAware=!0)}}configureTransparencyTarget(){this.configuration.transparencyAware?(this.transparencyRenderTargetDWFalse=new rT.WebGLRenderTarget(this.width,this.height,{minFilter:rT.LinearFilter,magFilter:rT.NearestFilter,type:rT.HalfFloatType,format:rT.RGBAFormat}),this.transparencyRenderTargetDWTrue=new rT.WebGLRenderTarget(this.width,this.height,{minFilter:rT.LinearFilter,magFilter:rT.NearestFilter,type:rT.HalfFloatType,format:rT.RGBAFormat}),this.transparencyRenderTargetDWTrue.depthTexture=new rT.DepthTexture(this.width,this.height,rT.UnsignedIntType),this.depthCopyPass=new rR(new rT.ShaderMaterial({uniforms:{depthTexture:{value:this.depthTexture},reverseDepthBuffer:{value:this.configuration.depthBufferType===rN.Reverse}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }",fragmentShader:"\n uniform sampler2D depthTexture;\n uniform bool reverseDepthBuffer;\n varying vec2 vUv;\n void main() {\n if (reverseDepthBuffer) {\n float d = 1.0 - texture2D(depthTexture, vUv).r;\n \n d += 0.00001;\n gl_FragDepth = 1.0 - d;\n } else {\n float d = texture2D(depthTexture, vUv).r;\n d += 0.00001;\n gl_FragDepth = d;\n }\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n "}))):(this.transparencyRenderTargetDWFalse&&(this.transparencyRenderTargetDWFalse.dispose(),this.transparencyRenderTargetDWFalse=null),this.transparencyRenderTargetDWTrue&&(this.transparencyRenderTargetDWTrue.dispose(),this.transparencyRenderTargetDWTrue=null),this.depthCopyPass&&(this.depthCopyPass.dispose(),this.depthCopyPass=null))}renderTransparency(e){let t=this.scene.background,r=e.getClearColor(new rT.Color),n=e.getClearAlpha(),i=new Map,a=e.autoClearDepth;this.scene.traverse(e=>{i.set(e,e.visible)}),this.scene.background=null,e.autoClearDepth=!1,e.setClearColor(new rT.Color(0,0,0),0),this.depthCopyPass.material.uniforms.depthTexture.value=this.depthTexture,this.depthCopyPass.material.uniforms.reverseDepthBuffer.value=this.configuration.depthBufferType===rN.Reverse,e.setRenderTarget(this.transparencyRenderTargetDWFalse),this.scene.traverse(e=>{e.material&&(e.visible=i.get(e)&&(e.material.transparent&&!e.material.depthWrite&&!e.userData.treatAsOpaque||!!e.userData.cannotReceiveAO))}),e.clear(!0,!0,!0),this.depthCopyPass.render(e),e.render(this.scene,this.camera),e.setRenderTarget(this.transparencyRenderTargetDWTrue),this.scene.traverse(e=>{e.material&&(e.visible=i.get(e)&&e.material.transparent&&e.material.depthWrite&&!e.userData.treatAsOpaque)}),e.clear(!0,!0,!0),this.depthCopyPass.render(e),e.render(this.scene,this.camera),this.scene.traverse(e=>{e.visible=i.get(e)}),e.setClearColor(r,n),this.scene.background=t,e.autoClearDepth=a}configureSampleDependentPasses(){this.configureAOPass(this.configuration.depthBufferType,this.camera.isOrthographicCamera),this.configureDenoisePass(this.configuration.depthBufferType,this.camera.isOrthographicCamera)}configureAOPass(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rN.Default,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.firstFrame(),this.samples=this.generateHemisphereSamples(this.configuration.aoSamples);let r={...rI};r.fragmentShader=r.fragmentShader.replace("16",this.configuration.aoSamples).replace("16.0",this.configuration.aoSamples+".0"),e===rN.Log?r.fragmentShader="#define LOGDEPTH\n"+r.fragmentShader:e===rN.Reverse&&(r.fragmentShader="#define REVERSEDEPTH\n"+r.fragmentShader),t&&(r.fragmentShader="#define ORTHO\n"+r.fragmentShader),this.configuration.halfRes&&(r.fragmentShader="#define HALFRES\n"+r.fragmentShader),this.effectShaderQuad?(this.effectShaderQuad.material.dispose(),this.effectShaderQuad.material=new rT.ShaderMaterial(r)):this.effectShaderQuad=new rR(new rT.ShaderMaterial(r))}configureDenoisePass(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rN.Default,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.firstFrame(),this.samplesDenoise=this.generateDenoiseSamples(this.configuration.denoiseSamples,11);let r={...rL};r.fragmentShader=r.fragmentShader.replace("16",this.configuration.denoiseSamples),e===rN.Log?r.fragmentShader="#define LOGDEPTH\n"+r.fragmentShader:e===rN.Reverse&&(r.fragmentShader="#define REVERSEDEPTH\n"+r.fragmentShader),t&&(r.fragmentShader="#define ORTHO\n"+r.fragmentShader),this.poissonBlurQuad?(this.poissonBlurQuad.material.dispose(),this.poissonBlurQuad.material=new rT.ShaderMaterial(r)):this.poissonBlurQuad=new rR(new rT.ShaderMaterial(r))}configureEffectCompositer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rN.Default,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.firstFrame();let r={...rP};e===rN.Log?r.fragmentShader="#define LOGDEPTH\n"+r.fragmentShader:e===rN.Reverse&&(r.fragmentShader="#define REVERSEDEPTH\n"+r.fragmentShader),t&&(r.fragmentShader="#define ORTHO\n"+r.fragmentShader),this.configuration.halfRes&&this.configuration.depthAwareUpsampling&&(r.fragmentShader="#define HALFRES\n"+r.fragmentShader),this.effectCompositerQuad?(this.effectCompositerQuad.material.dispose(),this.effectCompositerQuad.material=new rT.ShaderMaterial(r)):this.effectCompositerQuad=new rR(new rT.ShaderMaterial(r))}generateHemisphereSamples(e){let t=[];for(let r=0;r{e(t,r,n)},1)}(a,n,this)),e.xr.enabled=s}enableDebugMode(){this.debugMode=!0}disableDebugMode(){this.debugMode=!1}setDisplayMode(e){this.configuration.renderMode=["Combined","AO","No AO","Split","Split AO"].indexOf(e)}setQualityMode(e){"Performance"===e?(this.configuration.aoSamples=8,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):"Low"===e?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):"Medium"===e?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=12):"High"===e?(this.configuration.aoSamples=64,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=6):"Ultra"===e&&(this.configuration.aoSamples=64,this.configuration.denoiseSamples=16,this.configuration.denoiseRadius=6)}constructor(e,t,r=512,n=512){super(),this.width=r,this.height=n,this.clear=!0,this.camera=t,this.scene=e,this.autosetGamma=!0,this.configuration=new Proxy({aoSamples:16,aoRadius:5,aoTones:0,denoiseSamples:8,denoiseRadius:12,distanceFalloff:1,intensity:5,denoiseIterations:2,renderMode:0,biasOffset:0,biasMultiplier:0,color:new rT.Color(0,0,0),gammaCorrection:!0,depthBufferType:rN.Default,screenSpaceRadius:!1,halfRes:!1,depthAwareUpsampling:!0,colorMultiply:!0,transparencyAware:!1,accumulate:!1},{set:(e,t,r)=>{let n=e[t];return e[t]=r,r.equals?r.equals(n)||this.firstFrame():n!==r&&this.firstFrame(),"aoSamples"===t&&n!==r&&this.configureAOPass(this.configuration.depthBufferType,this.camera.isOrthographicCamera),"denoiseSamples"===t&&n!==r&&this.configureDenoisePass(this.configuration.depthBufferType,this.camera.isOrthographicCamera),"halfRes"===t&&n!==r&&(this.configureAOPass(this.configuration.depthBufferType,this.camera.isOrthographicCamera),this.configureHalfResTargets(),this.configureEffectCompositer(this.configuration.depthBufferType,this.camera.isOrthographicCamera),this.setSize(this.width,this.height)),"depthAwareUpsampling"===t&&n!==r&&this.configureEffectCompositer(this.configuration.depthBufferType,this.camera.isOrthographicCamera),"gammaCorrection"===t&&(this.autosetGamma=!1),"transparencyAware"===t&&n!==r&&(this.autoDetectTransparency=!1,this.configureTransparencyTarget()),!0}}),this.samples=[],this.samplesDenoise=[],this.autoDetectTransparency=!0,this.frames=0,this.lastViewMatrix=new rT.Matrix4,this.lastProjectionMatrix=new rT.Matrix4,this.configureEffectCompositer(this.configuration.depthBufferType),this.configureSampleDependentPasses(),this.configureHalfResTargets(),this.detectTransparency(),this.configureTransparencyTarget(),this.copyQuad=new rR(new rT.ShaderMaterial({uniforms:{tDiffuse:{value:null}},depthWrite:!1,vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }\n ",fragmentShader:"\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n void main() {\n gl_FragColor = texture2D(tDiffuse, vUv);\n }\n "})),this.writeTargetInternal=new rT.WebGLRenderTarget(this.width,this.height,{minFilter:rT.LinearFilter,magFilter:rT.LinearFilter,depthBuffer:!1,format:rT.RGBAFormat}),this.readTargetInternal=new rT.WebGLRenderTarget(this.width,this.height,{minFilter:rT.LinearFilter,magFilter:rT.LinearFilter,depthBuffer:!1,format:rT.RGBAFormat}),this.outputTargetInternal=new rT.WebGLRenderTarget(this.width,this.height,{minFilter:rT.LinearFilter,magFilter:rT.LinearFilter,depthBuffer:!1}),this.accumulationRenderTarget=new rT.WebGLRenderTarget(this.width,this.height,{minFilter:rT.LinearFilter,magFilter:rT.LinearFilter,depthBuffer:!1,format:rT.RGBAFormat,type:rT.HalfFloatType,stencilBuffer:!1,depthBuffer:!1,alpha:!0}),this.accumulationQuad=new rR(new rT.ShaderMaterial({uniforms:{frame:{value:0},tDiffuse:{value:null}},transparent:!0,opacity:1,vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform float frame;\n varying vec2 vUv;\n void main() {\n vec4 color = texture2D(tDiffuse, vUv);\n gl_FragColor = vec4(color.rgb, 1.0 / (frame + 1.0));\n }\n "})),this.bluenoise=new rT.DataTexture(rG,128,128),this.bluenoise.colorSpace=rT.NoColorSpace,this.bluenoise.wrapS=rT.RepeatWrapping,this.bluenoise.wrapT=rT.RepeatWrapping,this.bluenoise.minFilter=rT.NearestFilter,this.bluenoise.magFilter=rT.NearestFilter,this.bluenoise.needsUpdate=!0,this.lastTime=0,this.timeRollingAverage=.99,this.needsDepthTexture=!0,this.needsSwap=!0,this._r=new rT.Vector2,this._c=new rT.Color}}let rN={Default:1,Log:2,Reverse:3},rk=(0,eP.createContext)(null),rz=e=>(2&e.getAttributes())==2,rj=(0,eP.memo)((0,eP.forwardRef)((e,t)=>{let{children:r,camera:n,scene:i,resolutionScale:a,enabled:s=!0,renderPriority:o=1,autoClear:l=!0,depthBuffer:u,enableNormalPass:c,stencilBuffer:d,multisampling:f=8,frameBufferType:h=eO.HalfFloatType}=e,{gl:p,scene:m,camera:g,size:A}=(0,eJ.useThree)(),y=i||m,x=n||g,[B,C,S]=(0,eP.useMemo)(()=>{let e=new e3(p,{depthBuffer:u,stencilBuffer:d,multisampling:f,frameBufferType:h});e.addPass(new tE(y,x));let t=null,r=null;return c&&((r=new t1(y,x)).enabled=!1,e.addPass(r),void 0!==a&&((t=new tV({normalBuffer:r.texture,resolutionScale:a})).enabled=!1,e.addPass(t))),[e,r,t]},[x,p,u,d,f,h,y,c,a]);(0,eP.useEffect)(()=>null==B?void 0:B.setSize(A.width,A.height),[B,A]),(0,eV.useFrame)((e,t)=>{if(s){let e=p.autoClear;p.autoClear=l,d&&!l&&p.clearStencil(),B.render(t),p.autoClear=e}},s?o:0);let E=(0,eP.useRef)(null);(0,eP.useLayoutEffect)(()=>{let e=[],t=E.current.__r3f;if(t&&B){let n=t.children;for(let t=0;t{for(let t of e)null==B||B.removePass(t);C&&(C.enabled=!1),S&&(S.enabled=!1)}},[B,r,x,C,S]),(0,eP.useEffect)(()=>{let e=p.toneMapping;return p.toneMapping=eO.NoToneMapping,()=>{p.toneMapping=e}},[p]);let T=(0,eP.useMemo)(()=>({composer:B,normalPass:C,downSamplingPass:S,resolutionScale:a,camera:x,scene:y}),[B,C,S,a,x,y]);return(0,eP.useImperativeHandle)(t,()=>B,[B]),(0,eI.jsx)(rk.Provider,{value:T,children:(0,eI.jsx)("group",{ref:E,children:r})})}));var rK=(e=>(e[e.Linear=0]="Linear",e[e.Radial=1]="Radial",e[e.MirroredLinear=2]="MirroredLinear",e))(rK||{});let rJ=(0,eP.forwardRef)((e,t)=>{let{halfRes:r,screenSpaceRadius:n,quality:i,depthAwareUpsampling:a=!0,aoRadius:s=5,aoSamples:o=16,denoiseSamples:l=4,denoiseRadius:u=12,distanceFalloff:c=1,intensity:d=1,color:f,renderMode:h=0}=e,{camera:p,scene:m}=(0,eJ.useThree)(),g=(0,eP.useMemo)(()=>new rH(m,p),[p,m]);return(0,eP.useLayoutEffect)(()=>{(0,eU.s)(g.configuration,{color:f,aoRadius:s,distanceFalloff:c,intensity:d,aoSamples:o,denoiseSamples:l,denoiseRadius:u,screenSpaceRadius:n,renderMode:h,halfRes:r,depthAwareUpsampling:a})},[n,f,s,c,d,o,l,u,h,r,a,g]),(0,eP.useLayoutEffect)(()=>{i&&g.setQualityMode(i.charAt(0).toUpperCase()+i.slice(1))},[g,i]),(0,eI.jsx)("primitive",{ref:t,object:g})});function rV(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function rQ(e,t){var r=rV(e,t,"get");return r.get?r.get.call(e):r.value}function rW(e,t){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object")}function rX(e,t,r){rW(e,t),t.set(e,r)}function rZ(e,t,r){var n=rV(e,t,"set");if(n.set)n.set.call(e,r);else{if(!n.writable)throw TypeError("attempted to set read only private field");n.value=r}return r}function rY(e,t,r){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return r}function r_(e,t){rW(e,t),t.add(e)}var rq=class{subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}};e.i(47167);var r$={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},r0=new(M=new WeakMap,w=new WeakMap,class{setTimeoutProvider(e){rZ(this,M,e)}setTimeout(e,t){return rQ(this,M).setTimeout(e,t)}clearTimeout(e){rQ(this,M).clearTimeout(e)}setInterval(e,t){return rQ(this,M).setInterval(e,t)}clearInterval(e){rQ(this,M).clearInterval(e)}constructor(){rX(this,M,{writable:!0,value:r$}),rX(this,w,{writable:!0,value:!1})}}),r1="undefined"==typeof window||"Deno"in globalThis;function r2(){}function r9(e){return"number"==typeof e&&e>=0&&e!==1/0}function r3(e,t){return Math.max(e+(t||0)-Date.now(),0)}function r4(e,t){return"function"==typeof e?e(t):e}function r8(e,t){return"function"==typeof e?e(t):e}function r5(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:a,queryKey:s,stale:o}=e;if(s){if(n){if(t.queryHash!==r7(s,t.options))return!1}else if(!nt(t.queryKey,s))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!i||i===t.state.fetchStatus)&&(!a||!!a(t))}function r6(e,t){let{exact:r,status:n,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(ne(t.options.mutationKey)!==ne(a))return!1}else if(!nt(t.options.mutationKey,a))return!1}return(!n||t.state.status===n)&&(!i||!!i(t))}function r7(e,t){return((null==t?void 0:t.queryKeyHashFn)||ne)(e)}function ne(e){return JSON.stringify(e,(e,t)=>na(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function nt(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>nt(e[r],t[r]))}var nr=Object.prototype.hasOwnProperty;function nn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function ni(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function na(e){if(!ns(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!ns(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function ns(e){return"[object Object]"===Object.prototype.toString.call(e)}function no(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r){if(t===r)return t;let n=ni(t)&&ni(r);if(!n&&!(na(t)&&na(r)))return r;let i=(n?t:Object.keys(t)).length,a=n?r:Object.keys(r),s=a.length,o=n?Array(s):{},l=0;for(let u=0;u2&&void 0!==arguments[2]?arguments[2]:0,n=[...e,t];return r&&n.length>r?n.slice(1):n}function nu(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var nc=Symbol();function nd(e,t){return!e.queryFn&&(null==t?void 0:t.initialPromise)?()=>t.initialPromise:e.queryFn&&e.queryFn!==nc?e.queryFn:()=>Promise.reject(Error("Missing queryFn: '".concat(e.queryHash,"'")))}var nf=new(F=new WeakMap,R=new WeakMap,I=new WeakMap,class extends rq{onSubscribe(){rQ(this,R)||this.setEventListener(rQ(this,I))}onUnsubscribe(){var e;this.hasListeners()||(null==(e=rQ(this,R))||e.call(this),rZ(this,R,void 0))}setEventListener(e){var t;rZ(this,I,e),null==(t=rQ(this,R))||t.call(this),rZ(this,R,e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()}))}setFocused(e){rQ(this,F)!==e&&(rZ(this,F,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return"boolean"==typeof rQ(this,F)?rQ(this,F):(null==(e=globalThis.document)?void 0:e.visibilityState)!=="hidden"}constructor(){super(),rX(this,F,{writable:!0,value:void 0}),rX(this,R,{writable:!0,value:void 0}),rX(this,I,{writable:!0,value:void 0}),rZ(this,I,e=>{if(!r1&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}}),nh=function(e){setTimeout(e,0)},np=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=nh,a=n=>{t?e.push(n):i(()=>{r(n)})};return{batch:a=>{let s;t++;try{s=a()}finally{--t||(()=>{let t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return s},batchCalls:e=>function(){for(var t=arguments.length,r=Array(t),n=0;n{e(...r)})},schedule:a,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}(),nm=new(P=new WeakMap,L=new WeakMap,U=new WeakMap,class extends rq{onSubscribe(){rQ(this,L)||this.setEventListener(rQ(this,U))}onUnsubscribe(){var e;this.hasListeners()||(null==(e=rQ(this,L))||e.call(this),rZ(this,L,void 0))}setEventListener(e){var t;rZ(this,U,e),null==(t=rQ(this,L))||t.call(this),rZ(this,L,e(this.setOnline.bind(this)))}setOnline(e){rQ(this,P)!==e&&(rZ(this,P,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return rQ(this,P)}constructor(){super(),rX(this,P,{writable:!0,value:!0}),rX(this,L,{writable:!0,value:void 0}),rX(this,U,{writable:!0,value:void 0}),rZ(this,U,e=>{if(!r1&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}});function nv(){let e,t,r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function ng(e){return Math.min(1e3*2**e,3e4)}function nA(e){return(null!=e?e:"online")!=="online"||nm.isOnline()}var ny=class extends Error{constructor(e){super("CancelledError"),this.revert=null==e?void 0:e.revert,this.silent=null==e?void 0:e.silent}};function nx(e){let t,r=!1,n=0,i=nv(),a=()=>nf.isFocused()&&("always"===e.networkMode||nm.isOnline())&&e.canRun(),s=()=>nA(e.networkMode)&&e.canRun(),o=e=>{"pending"===i.status&&(null==t||t(),i.resolve(e))},l=e=>{"pending"===i.status&&(null==t||t(),i.reject(e))},u=()=>new Promise(r=>{var n;t=e=>{("pending"!==i.status||a())&&r(e)},null==(n=e.onPause)||n.call(e)}).then(()=>{if(t=void 0,"pending"===i.status){var r;null==(r=e.onContinue)||r.call(e)}}),c=()=>{let t;if("pending"!==i.status)return;let s=0===n?e.initialPromise:void 0;try{t=null!=s?s:e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(o).catch(t=>{var s,o,d;if("pending"!==i.status)return;let f=null!=(o=e.retry)?o:3*!r1,h=null!=(d=e.retryDelay)?d:ng,p="function"==typeof h?h(n,t):h,m=!0===f||"number"==typeof f&&n{r0.setTimeout(e,p)}).then(()=>a()?void 0:u()).then(()=>{r?l(t):c()})})};return{promise:i,status:()=>i.status,cancel:t=>{if("pending"===i.status){var r;let n=new ny(t);l(n),null==(r=e.onCancel)||r.call(e,n)}},continue:()=>(null==t||t(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:s,start:()=>(s()?c():u().then(c),i)}}var nB=(G=new WeakMap,class{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),r9(this.gcTime)&&rZ(this,G,r0.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,null!=e?e:r1?1/0:3e5)}clearGcTimeout(){rQ(this,G)&&(r0.clearTimeout(rQ(this,G)),rZ(this,G,void 0))}constructor(){rX(this,G,{writable:!0,value:void 0})}}),nC=(O=new WeakMap,H=new WeakMap,N=new WeakMap,k=new WeakMap,z=new WeakMap,j=new WeakMap,K=new WeakMap,J=new WeakSet,class extends nB{get meta(){return this.options.meta}get promise(){var e;return null==(e=rQ(this,z))?void 0:e.promise}setOptions(e){if(this.options={...rQ(this,j),...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=nT(this.options);void 0!==e.data&&(this.setState(nE(e.data,e.dataUpdatedAt)),rZ(this,O,e))}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||rQ(this,N).remove(this)}setData(e,t){let r=no(this.state.data,e,this.options);return rY(this,J,nb).call(this,{data:r,type:"success",dataUpdatedAt:null==t?void 0:t.updatedAt,manual:null==t?void 0:t.manual}),r}setState(e,t){rY(this,J,nb).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var t,r;let n=null==(t=rQ(this,z))?void 0:t.promise;return null==(r=rQ(this,z))||r.cancel(e),n?n.then(r2).catch(r2):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(rQ(this,O))}isActive(){return this.observers.some(e=>!1!==r8(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===nc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===r4(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!r3(this.state.dataUpdatedAt,e))}onFocus(){var e;let t=this.observers.find(e=>e.shouldFetchOnWindowFocus());null==t||t.refetch({cancelRefetch:!1}),null==(e=rQ(this,z))||e.continue()}onOnline(){var e;let t=this.observers.find(e=>e.shouldFetchOnReconnect());null==t||t.refetch({cancelRefetch:!1}),null==(e=rQ(this,z))||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),rQ(this,N).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(rQ(this,z)&&(rQ(this,K)?rQ(this,z).cancel({revert:!0}):rQ(this,z).cancelRetry()),this.scheduleGc()),rQ(this,N).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||rY(this,J,nb).call(this,{type:"invalidate"})}async fetch(e,t){var r,n,i,a,s,o,l,u,c,d,f,h;if("idle"!==this.state.fetchStatus&&(null==(r=rQ(this,z))?void 0:r.status())!=="rejected"){if(void 0!==this.state.data&&(null==t?void 0:t.cancelRefetch))this.cancel({silent:!0});else if(rQ(this,z))return rQ(this,z).continueRetry(),rQ(this,z).promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let p=new AbortController,m=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(rZ(this,K,!0),p.signal)})},g=()=>{let e=nd(this.options,t),r=(()=>{let e={client:rQ(this,k),queryKey:this.queryKey,meta:this.meta};return m(e),e})();return(rZ(this,K,!1),this.options.persister)?this.options.persister(e,r,this):e(r)},A=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:rQ(this,k),state:this.state,fetchFn:g};return m(e),e})();null==(n=this.options.behavior)||n.onFetch(A,this),rZ(this,H,this.state),("idle"===this.state.fetchStatus||this.state.fetchMeta!==(null==(i=A.fetchOptions)?void 0:i.meta))&&rY(this,J,nb).call(this,{type:"fetch",meta:null==(a=A.fetchOptions)?void 0:a.meta}),rZ(this,z,nx({initialPromise:null==t?void 0:t.initialPromise,fn:A.fetchFn,onCancel:e=>{e instanceof ny&&e.revert&&this.setState({...rQ(this,H),fetchStatus:"idle"}),p.abort()},onFail:(e,t)=>{rY(this,J,nb).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{rY(this,J,nb).call(this,{type:"pause"})},onContinue:()=>{rY(this,J,nb).call(this,{type:"continue"})},retry:A.options.retry,retryDelay:A.options.retryDelay,networkMode:A.options.networkMode,canRun:()=>!0}));try{let e=await rQ(this,z).start();if(void 0===e)throw Error("".concat(this.queryHash," data is undefined"));return this.setData(e),null==(s=(o=rQ(this,N).config).onSuccess)||s.call(o,e,this),null==(l=(u=rQ(this,N).config).onSettled)||l.call(u,e,this.state.error,this),e}catch(e){if(e instanceof ny){if(e.silent)return rQ(this,z).promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw rY(this,J,nb).call(this,{type:"error",error:e}),null==(c=(d=rQ(this,N).config).onError)||c.call(d,e,this),null==(f=(h=rQ(this,N).config).onSettled)||f.call(h,this.state.data,e,this),e}finally{this.scheduleGc()}}constructor(e){var t;super(),r_(this,J),rX(this,O,{writable:!0,value:void 0}),rX(this,H,{writable:!0,value:void 0}),rX(this,N,{writable:!0,value:void 0}),rX(this,k,{writable:!0,value:void 0}),rX(this,z,{writable:!0,value:void 0}),rX(this,j,{writable:!0,value:void 0}),rX(this,K,{writable:!0,value:void 0}),rZ(this,K,!1),rZ(this,j,e.defaultOptions),this.setOptions(e.options),this.observers=[],rZ(this,k,e.client),rZ(this,N,rQ(this,k).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,rZ(this,O,nT(this.options)),this.state=null!=(t=e.state)?t:rQ(this,O),this.scheduleGc()}});function nS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:nA(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function nE(e,t){return{data:e,dataUpdatedAt:null!=t?t:Date.now(),error:null,isInvalidated:!1,status:"success"}}function nT(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?null!=n?n:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}function nb(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":var r;return{...t,...nS(t.data,this.options),fetchMeta:null!=(r=e.meta)?r:null};case"success":let n={...t,...nE(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return rZ(this,H,e.manual?n:void 0),n;case"error":let i=e.error;return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),np.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),rQ(this,N).notify({query:this,type:"updated",action:e})})}var nD=(V=new WeakMap,Q=new WeakMap,W=new WeakMap,X=new WeakMap,Z=new WeakMap,Y=new WeakMap,_=new WeakMap,q=new WeakMap,$=new WeakMap,ee=new WeakMap,et=new WeakMap,er=new WeakMap,en=new WeakMap,ei=new WeakMap,ea=new WeakMap,es=new WeakSet,eo=new WeakSet,el=new WeakSet,eu=new WeakSet,ec=new WeakSet,ed=new WeakSet,ef=new WeakSet,eh=new WeakSet,ep=new WeakSet,class extends rq{bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(rQ(this,Q).addObserver(this),nM(rQ(this,Q),this.options)?rY(this,es,nI).call(this):this.updateResult(),rY(this,ec,nG).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nw(rQ(this,Q),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nw(rQ(this,Q),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,rY(this,ed,nO).call(this),rY(this,ef,nH).call(this),rQ(this,Q).removeObserver(this)}setOptions(e){let t=this.options,r=rQ(this,Q);if(this.options=rQ(this,V).defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof r8(this.options.enabled,rQ(this,Q)))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");rY(this,eh,nN).call(this),rQ(this,Q).setOptions(this.options),t._defaulted&&!nn(this.options,t)&&rQ(this,V).getQueryCache().notify({type:"observerOptionsUpdated",query:rQ(this,Q),observer:this});let n=this.hasListeners();n&&nF(rQ(this,Q),r,this.options,t)&&rY(this,es,nI).call(this),this.updateResult(),n&&(rQ(this,Q)!==r||r8(this.options.enabled,rQ(this,Q))!==r8(t.enabled,rQ(this,Q))||r4(this.options.staleTime,rQ(this,Q))!==r4(t.staleTime,rQ(this,Q)))&&rY(this,eo,nP).call(this);let i=rY(this,el,nL).call(this);n&&(rQ(this,Q)!==r||r8(this.options.enabled,rQ(this,Q))!==r8(t.enabled,rQ(this,Q))||i!==rQ(this,ei))&&rY(this,eu,nU).call(this,i)}getOptimisticResult(e){var t,r;let n=rQ(this,V).getQueryCache().build(rQ(this,V),e),i=this.createResult(n,e);return t=this,r=i,nn(t.getCurrentResult(),r)||(rZ(this,X,i),rZ(this,Y,this.options),rZ(this,Z,rQ(this,Q).state)),i}getCurrentResult(){return rQ(this,X)}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),null==t||t(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==rQ(this,_).status||rQ(this,_).reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){rQ(this,ea).add(e)}getCurrentQuery(){return rQ(this,Q)}refetch(){let{...e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.fetch({...e})}fetchOptimistic(e){let t=rQ(this,V).defaultQueryOptions(e),r=rQ(this,V).getQueryCache().build(rQ(this,V),t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){var t;return rY(this,es,nI).call(this,{...e,cancelRefetch:null==(t=e.cancelRefetch)||t}).then(()=>(this.updateResult(),rQ(this,X)))}createResult(e,t){let r,n=rQ(this,Q),i=this.options,a=rQ(this,X),s=rQ(this,Z),o=rQ(this,Y),l=e!==n?e.state:rQ(this,W),{state:u}=e,c={...u},d=!1;if(t._optimisticResults){let r=this.hasListeners(),a=!r&&nM(e,t),s=r&&nF(e,n,t,i);(a||s)&&(c={...c,...nS(u.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:f,errorUpdatedAt:h,status:p}=c;r=c.data;let m=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===p){let e;if((null==a?void 0:a.isPlaceholderData)&&t.placeholderData===(null==o?void 0:o.placeholderData))e=a.data,m=!0;else{var g;e="function"==typeof t.placeholderData?t.placeholderData(null==(g=rQ(this,et))?void 0:g.state.data,rQ(this,et)):t.placeholderData}void 0!==e&&(p="success",r=no(null==a?void 0:a.data,e,t),d=!0)}if(t.select&&void 0!==r&&!m)if(a&&r===(null==s?void 0:s.data)&&t.select===rQ(this,$))r=rQ(this,ee);else try{rZ(this,$,t.select),r=t.select(r),r=no(null==a?void 0:a.data,r,t),rZ(this,ee,r),rZ(this,q,null)}catch(e){rZ(this,q,e)}rQ(this,q)&&(f=rQ(this,q),r=rQ(this,ee),h=Date.now(),p="error");let A="fetching"===c.fetchStatus,y="pending"===p,x="error"===p,B=y&&A,C=void 0!==r,S={status:p,fetchStatus:c.fetchStatus,isPending:y,isSuccess:"success"===p,isError:x,isInitialLoading:B,isLoading:B,data:r,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:A,isRefetching:A&&!y,isLoadingError:x&&!C,isPaused:"paused"===c.fetchStatus,isPlaceholderData:d,isRefetchError:x&&C,isStale:nR(e,t),refetch:this.refetch,promise:rQ(this,_),isEnabled:!1!==r8(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=e=>{"error"===S.status?e.reject(S.error):void 0!==S.data&&e.resolve(S.data)},r=()=>{t(rZ(this,_,S.promise=nv()))},i=rQ(this,_);switch(i.status){case"pending":e.queryHash===n.queryHash&&t(i);break;case"fulfilled":("error"===S.status||S.data!==i.value)&&r();break;case"rejected":("error"!==S.status||S.error!==i.reason)&&r()}}return S}updateResult(){let e=rQ(this,X),t=this.createResult(rQ(this,Q),this.options);if(rZ(this,Z,rQ(this,Q).state),rZ(this,Y,this.options),void 0!==rQ(this,Z).data&&rZ(this,et,rQ(this,Q)),nn(t,e))return;rZ(this,X,t);let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!rQ(this,ea).size)return!0;let n=new Set(null!=r?r:rQ(this,ea));return this.options.throwOnError&&n.add("error"),Object.keys(rQ(this,X)).some(t=>rQ(this,X)[t]!==e[t]&&n.has(t))};rY(this,ep,nk).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&rY(this,ec,nG).call(this)}constructor(e,t){super(),r_(this,es),r_(this,eo),r_(this,el),r_(this,eu),r_(this,ec),r_(this,ed),r_(this,ef),r_(this,eh),r_(this,ep),rX(this,V,{writable:!0,value:void 0}),rX(this,Q,{writable:!0,value:void 0}),rX(this,W,{writable:!0,value:void 0}),rX(this,X,{writable:!0,value:void 0}),rX(this,Z,{writable:!0,value:void 0}),rX(this,Y,{writable:!0,value:void 0}),rX(this,_,{writable:!0,value:void 0}),rX(this,q,{writable:!0,value:void 0}),rX(this,$,{writable:!0,value:void 0}),rX(this,ee,{writable:!0,value:void 0}),rX(this,et,{writable:!0,value:void 0}),rX(this,er,{writable:!0,value:void 0}),rX(this,en,{writable:!0,value:void 0}),rX(this,ei,{writable:!0,value:void 0}),rX(this,ea,{writable:!0,value:new Set}),this.options=t,rZ(this,V,e),rZ(this,q,null),rZ(this,_,nv()),this.bindMethods(),this.setOptions(t)}});function nM(e,t){return!1!==r8(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&nw(e,t,t.refetchOnMount)}function nw(e,t,r){if(!1!==r8(t.enabled,e)&&"static"!==r4(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&nR(e,t)}return!1}function nF(e,t,r,n){return(e!==t||!1===r8(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&nR(e,r)}function nR(e,t){return!1!==r8(t.enabled,e)&&e.isStaleByTime(r4(t.staleTime,e))}function nI(e){rY(this,eh,nN).call(this);let t=rQ(this,Q).fetch(this.options,e);return(null==e?void 0:e.throwOnError)||(t=t.catch(r2)),t}function nP(){rY(this,ed,nO).call(this);let e=r4(this.options.staleTime,rQ(this,Q));if(r1||rQ(this,X).isStale||!r9(e))return;let t=r3(rQ(this,X).dataUpdatedAt,e);rZ(this,er,r0.setTimeout(()=>{rQ(this,X).isStale||this.updateResult()},t+1))}function nL(){var e;return null!=(e="function"==typeof this.options.refetchInterval?this.options.refetchInterval(rQ(this,Q)):this.options.refetchInterval)&&e}function nU(e){rY(this,ef,nH).call(this),rZ(this,ei,e),!r1&&!1!==r8(this.options.enabled,rQ(this,Q))&&r9(rQ(this,ei))&&0!==rQ(this,ei)&&rZ(this,en,r0.setInterval(()=>{(this.options.refetchIntervalInBackground||nf.isFocused())&&rY(this,es,nI).call(this)},rQ(this,ei)))}function nG(){rY(this,eo,nP).call(this),rY(this,eu,nU).call(this,rY(this,el,nL).call(this))}function nO(){rQ(this,er)&&(r0.clearTimeout(rQ(this,er)),rZ(this,er,void 0))}function nH(){rQ(this,en)&&(r0.clearInterval(rQ(this,en)),rZ(this,en,void 0))}function nN(){let e=rQ(this,V).getQueryCache().build(rQ(this,V),this.options);if(e===rQ(this,Q))return;let t=rQ(this,Q);rZ(this,Q,e),rZ(this,W,e.state),this.hasListeners()&&(null==t||t.removeObserver(this),e.addObserver(this))}function nk(e){np.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(rQ(this,X))}),rQ(this,V).getQueryCache().notify({query:rQ(this,Q),type:"observerResultsUpdated"})})}var nz=eP.createContext(void 0),nj=e=>{let{client:t,children:r}=e;return eP.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,eI.jsx)(nz.Provider,{value:t,children:r})},nK=eP.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),nJ=eP.createContext(!1);nJ.Provider;var nV=(e,t)=>void 0===t.state.data,nQ=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function nW(e,t,r){var n,i,a,s,o;let l=eP.useContext(nJ),u=eP.useContext(nK),c=(e=>{let t=eP.useContext(nz);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t})(r),d=c.defaultQueryOptions(e);if(null==(i=c.getDefaultOptions().queries)||null==(n=i._experimental_beforeQuery)||n.call(i,d),d._optimisticResults=l?"isRestoring":"optimistic",d.suspense){let e=e=>"static"===e?e:Math.max(null!=e?e:1e3,1e3),t=d.staleTime;d.staleTime="function"==typeof t?function(){for(var r=arguments.length,n=Array(r),i=0;i{u.clearReset()},[u]);let f=!c.getQueryCache().get(d.queryHash),[h]=eP.useState(()=>new t(c,d)),p=h.getOptimisticResult(d),m=!l&&!1!==e.subscribed;if(eP.useSyncExternalStore(eP.useCallback(e=>{let t=m?h.subscribe(np.batchCalls(e)):r2;return h.updateResult(),t},[h,m]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),eP.useEffect(()=>{h.setOptions(d)},[d,h]),(null==d?void 0:d.suspense)&&p.isPending)throw nQ(d,h,u);if((e=>{var t,r;let{result:n,errorResetBoundary:i,throwOnError:a,query:s,suspense:o}=e;return n.isError&&!i.isReset()&&!n.isFetching&&s&&(o&&void 0===n.data||(t=a,r=[n.error,s],"function"==typeof t?t(...r):!!t))})({result:p,errorResetBoundary:u,throwOnError:d.throwOnError,query:c.getQueryCache().get(d.queryHash),suspense:d.suspense}))throw p.error;if(null==(s=c.getDefaultOptions().queries)||null==(a=s._experimental_afterQuery)||a.call(s,d,p),d.experimental_prefetchInRender&&!r1&&p.isLoading&&p.isFetching&&!l){let e=f?nQ(d,h,u):null==(o=c.getQueryCache().get(d.queryHash))?void 0:o.promise;null==e||e.catch(r2).finally(()=>{h.updateResult()})}return d.notifyOnChangeProps?p:h.trackResult(p)}var nX=e.i(54970),nZ=e.i(12979),nY=e.i(62395),n_=e.i(75567),nq=e.i(47071),n$=e.i(79123);let n0={0:32,1:32,2:32,3:32,4:32,5:32};function n1(e){let{displacementMap:t,visibilityMask:r,textureNames:n,alphaTextures:i,detailTextureName:a}=e,{debugMode:s}=(0,n$.useDebug)(),o=(0,nq.useTexture)(n.map(e=>(0,nZ.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,n_.setupColor)(e))}),l=a?(0,nZ.textureToUrl)(a):null,u=(0,nq.useTexture)(null!=l?l:nZ.FALLBACK_TEXTURE_URL,e=>{(0,n_.setupColor)(e)}),c=(0,eP.useCallback)(e=>{!function(e){let{shader:t,baseTextures:r,alphaTextures:n,visibilityMask:i,tiling:a,debugMode:s=!1,detailTexture:o=null}=e,l=r.length;if(r.forEach((e,r)=>{t.uniforms["albedo".concat(r)]={value:e}}),n.forEach((e,r)=>{r>0&&(t.uniforms["mask".concat(r)]={value:e})}),i&&(t.uniforms.visibilityMask={value:i}),r.forEach((e,r)=>{var n;t.uniforms["tiling".concat(r)]={value:null!=(n=a[r])?n:32}}),t.uniforms.debugMode={value:+!!s},o&&(t.uniforms.detailTexture={value:o},t.uniforms.detailTiling={value:64},t.uniforms.detailFadeDistance={value:150},t.vertexShader=t.vertexShader.replace("#include ","#include \nvarying vec3 vTerrainWorldPos;"),t.vertexShader=t.vertexShader.replace("#include ","#include \nvTerrainWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;")),t.fragmentShader="\nuniform sampler2D albedo0;\nuniform sampler2D albedo1;\nuniform sampler2D albedo2;\nuniform sampler2D albedo3;\nuniform sampler2D albedo4;\nuniform sampler2D albedo5;\nuniform sampler2D mask1;\nuniform sampler2D mask2;\nuniform sampler2D mask3;\nuniform sampler2D mask4;\nuniform sampler2D mask5;\nuniform float tiling0;\nuniform float tiling1;\nuniform float tiling2;\nuniform float tiling3;\nuniform float tiling4;\nuniform float tiling5;\nuniform float debugMode;\n".concat(i?"uniform sampler2D visibilityMask;":"","\n").concat(o?"uniform sampler2D detailTexture;\nuniform float detailTiling;\nuniform float detailFadeDistance;\nvarying vec3 vTerrainWorldPos;":"","\n\n// Wireframe edge detection for debug mode\nfloat getWireframe(vec2 uv, float gridSize, float lineWidth) {\n vec2 gridUv = uv * gridSize;\n vec2 grid = abs(fract(gridUv - 0.5) - 0.5);\n vec2 deriv = fwidth(gridUv);\n vec2 edge = smoothstep(vec2(0.0), deriv * lineWidth, grid);\n return 1.0 - min(edge.x, edge.y);\n}\n")+t.fragmentShader,i){let e="#include ";t.fragmentShader=t.fragmentShader.replace(e,"".concat(e,"\n // Early discard for invisible areas (before fog/lighting)\n float visibility = texture2D(visibilityMask, vMapUv).r;\n if (visibility < 0.5) {\n discard;\n }\n "))}t.fragmentShader=t.fragmentShader.replace("#include ","\n // Sample base albedo layers (sRGB textures auto-decoded to linear)\n vec2 baseUv = vMapUv;\n vec3 c0 = texture2D(albedo0, baseUv * vec2(tiling0)).rgb;\n ".concat(l>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":"","\n ").concat(l>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":"","\n ").concat(l>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":"","\n ").concat(l>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":"","\n ").concat(l>5?"vec3 c5 = texture2D(albedo5, baseUv * vec2(tiling5)).rgb;":"","\n\n // Sample linear masks (use R channel)\n float a1 = texture2D(mask1, baseUv).r;\n ").concat(l>1?"float a2 = texture2D(mask2, baseUv).r;":"","\n ").concat(l>2?"float a3 = texture2D(mask3, baseUv).r;":"","\n ").concat(l>3?"float a4 = texture2D(mask4, baseUv).r;":"","\n ").concat(l>4?"float a5 = texture2D(mask5, baseUv).r;":"","\n\n // Bottom-up compositing: each mask tells how much the higher layer replaces lower\n ").concat(l>1?"vec3 blended = mix(c0, c1, clamp(a1, 0.0, 1.0));":"","\n ").concat(l>2?"blended = mix(blended, c2, clamp(a2, 0.0, 1.0));":"","\n ").concat(l>3?"blended = mix(blended, c3, clamp(a3, 0.0, 1.0));":"","\n ").concat(l>4?"blended = mix(blended, c4, clamp(a4, 0.0, 1.0));":"","\n ").concat(l>5?"blended = mix(blended, c5, clamp(a5, 0.0, 1.0));":"","\n\n // Assign to diffuseColor before lighting\n vec3 textureColor = ").concat(l>1?"blended":"c0",";\n\n ").concat(o?"// Detail texture blending (Torque-style multiplicative blend)\n // Sample detail texture at high frequency tiling\n vec3 detailColor = texture2D(detailTexture, baseUv * detailTiling).rgb;\n\n // Calculate distance-based fade factor using world positions\n // Torque: distFactor = (zeroDetailDistance - distance) / zeroDetailDistance\n float distToCamera = distance(vTerrainWorldPos, cameraPosition);\n float detailFade = clamp(1.0 - distToCamera / detailFadeDistance, 0.0, 1.0);\n\n // Torque blending: dst * lerp(1.0, detailTexel, fadeFactor)\n // Detail textures are authored with bright values (~0.8 mean), not 0.5 gray\n // Direct multiplication adds subtle darkening for surface detail\n textureColor *= mix(vec3(1.0), detailColor, detailFade);":"","\n\n // Debug mode wireframe handling\n if (debugMode > 0.5) {\n // 256 grid cells across the terrain (matches terrain resolution)\n float wireframe = getWireframe(baseUv, 256.0, 1.0);\n vec3 wireColor = vec3(0.0, 0.8, 0.4); // Green wireframe\n\n if (gl_FrontFacing) {\n // Front face: show textures with barely visible wireframe overlay\n diffuseColor.rgb = mix(textureColor, wireColor, wireframe * 0.05);\n } else {\n // Back face: show only wireframe, discard non-wireframe pixels\n if (wireframe < 0.1) {\n discard;\n }\n diffuseColor.rgb = mix(vec3(0.0), wireColor, 0.25);\n }\n } else {\n diffuseColor.rgb = textureColor;\n }\n"))}({shader:e,baseTextures:o,alphaTextures:i,visibilityMask:r,tiling:n0,debugMode:s,detailTexture:l?u:null})},[o,i,r,s,u,l]),d="".concat(s?"debug":"normal","-").concat(l?"detail":"nodetail");return(0,eI.jsx)("meshLambertMaterial",{displacementMap:t,map:t,displacementScale:2048,depthWrite:!0,side:s?eO.DoubleSide:eO.FrontSide,onBeforeCompile:c},d)}function n2(e){let{displacementMap:t,visibilityMask:r,textureNames:n,alphaTextures:i,detailTextureName:a}=e;return(0,eI.jsx)(eP.Suspense,{fallback:(0,eI.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",displacementMap:t,displacementScale:2048,wireframe:!0}),children:(0,eI.jsx)(n1,{displacementMap:t,visibilityMask:r,textureNames:n,alphaTextures:i,detailTextureName:a})})}let n9=(0,eP.memo)(function(e){let{tileX:t,tileZ:r,blockSize:n,basePosition:i,textureNames:a,geometry:s,displacementMap:o,visibilityMask:l,alphaTextures:u,detailTextureName:c,visible:d=!0}=e,f=(0,eP.useMemo)(()=>[i.x+t*n+1024,0,i.z+r*n+1024],[t,r,n,i]);return(0,eI.jsx)("mesh",{position:f,geometry:s,receiveShadow:!0,castShadow:!0,visible:d,children:(0,eI.jsx)(n2,{displacementMap:o,visibilityMask:l,textureNames:a,alphaTextures:u,detailTextureName:c})})});var n3=e.i(77482);function n4(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,i=r>>16,a=256*n;for(let r=0;r0?r:null!=(e=(0,nY.getFloat)(t,"visibleDistance"))?e:600}(),l=(0,eJ.useThree)(e=>e.camera),u=(0,eP.useMemo)(()=>{let[e,,t]=(0,nY.getPosition)(r);return{x:e,z:t}},[r]),c=(0,eP.useMemo)(()=>{let e=(0,nY.getProperty)(r,"emptySquares");return e?e.split(" ").map(e=>parseInt(e,10)):[]},[r]),d=(0,eP.useMemo)(()=>{let e=256*i,t=new eO.PlaneGeometry(e,e,256,256);return t.rotateX(-Math.PI/2),t.rotateY(-Math.PI/2),t},[i]),{data:f}=nW({queryKey:["terrain",n],queryFn:()=>(0,nZ.loadTerrain)(n)},nD,void 0),h=(0,eP.useMemo)(()=>{if(!f)return null;let e=function(e){let t=new Float32Array(e.length);for(let r=0;rn4(c),[c]),m=(0,eP.useMemo)(()=>n4([]),[]),g=(0,eP.useMemo)(()=>f?f.alphaMaps.map(e=>(0,n_.setupMask)(e)):null,[f]),A=(0,eP.useMemo)(()=>{let e=2*Math.ceil(o/s)+1;return e*e-1},[o,s]),y=(0,eP.useMemo)(()=>Array.from({length:A},(e,t)=>t),[A]),[x,B]=(0,eP.useState)(()=>Array(A).fill(null)),C=(0,eP.useRef)({xStart:0,xEnd:0,zStart:0,zEnd:0});return((0,eV.useFrame)(()=>{let e=l.position.x-u.x,t=l.position.z-u.z,r=Math.floor((e-o)/s),n=Math.ceil((e+o)/s),i=Math.floor((t-o)/s),a=Math.ceil((t+o)/s),c=C.current;if(r===c.xStart&&n===c.xEnd&&i===c.zStart&&a===c.zEnd)return;c.xStart=r,c.xEnd=n,c.zStart=i,c.zEnd=a;let d=[];for(let e=r;e{var t,r;let n=x[e];return(0,eI.jsx)(n9,{tileX:null!=(t=null==n?void 0:n.tileX)?t:0,tileZ:null!=(r=null==n?void 0:n.tileZ)?r:0,blockSize:s,basePosition:u,textureNames:f.textureNames,geometry:d,displacementMap:h,visibilityMask:m,alphaTextures:g,detailTextureName:a,visible:null!==n},e)})]}):null}),n5=(0,eP.createContext)(null);function n6(){return(0,eP.useContext)(n5)}var n7=eP;let ie=(0,n7.createContext)(null),it={didCatch:!1,error:null};class ir extends n7.Component{static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,i=Array(n),a=0;a0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)){var i,a;null==(i=(a=this.props).onReset)||i.call(a,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(it)}}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:a}=this.state,s=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)s=t(e);else if(r)s=(0,n7.createElement)(r,e);else if(void 0!==n)s=n;else throw a}return(0,n7.createElement)(ie.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},s)}constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=it}}var ii=e.i(31067),ia=eO;function is(e,t){if(t===eO.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==eO.TriangleFanDrawMode&&t!==eO.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported."));return}let o=new i2(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});o.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}o.setExtensions(a),o.setPlugins(s),o.parse(r,n)}parseAsync(e,t){let r=this;return new Promise(function(n,i){r.parse(e,t,n,i)})}constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new iA(e)}),this.register(function(e){return new iy(e)}),this.register(function(e){return new iM(e)}),this.register(function(e){return new iw(e)}),this.register(function(e){return new iF(e)}),this.register(function(e){return new iB(e)}),this.register(function(e){return new iC(e)}),this.register(function(e){return new iS(e)}),this.register(function(e){return new iE(e)}),this.register(function(e){return new ig(e)}),this.register(function(e){return new iT(e)}),this.register(function(e){return new ix(e)}),this.register(function(e){return new iD(e)}),this.register(function(e){return new ib(e)}),this.register(function(e){return new im(e)}),this.register(function(e){return new iR(e)}),this.register(function(e){return new iI(e)})}}function ih(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let ip={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class im{_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,n=t.length;r=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,i.source,a)}constructor(e){this.parser=e,this.name=ip.KHR_TEXTURE_BASISU}}class iw{loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],s=n.images[a.source],o=r.textureLoader;if(s.uri){let e=r.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}constructor(e){this.parser=e,this.name=ip.EXT_TEXTURE_WEBP,this.isSupported=null}}class iF{loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],s=n.images[a.source],o=r.textureLoader;if(s.uri){let e=r.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}constructor(e){this.parser=e,this.name=ip.EXT_TEXTURE_AVIF,this.isSupported=null}}class iR{loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],n=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return n.then(function(t){let r=e.byteOffset||0,n=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,r,n);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*s);return i.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}}constructor(e){this.name=ip.EXT_MESHOPT_COMPRESSION,this.parser=e}}class iI{createNodeMesh(e){let t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;for(let e of t.meshes[r.mesh].primitives)if(e.mode!==ij.TRIANGLES&&e.mode!==ij.TRIANGLE_STRIP&&e.mode!==ij.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=r.extensions[this.name].attributes,i=[],a={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(a[e]=t,a[e])));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then(e=>{let t=e.pop(),r=t.isGroup?t.children:[t],n=e[0].count,i=[];for(let e of r){let t=new ia.Matrix4,r=new ia.Vector3,s=new ia.Quaternion,o=new ia.Vector3(1,1,1),l=new ia.InstancedMesh(e.geometry,e.material,n);for(let e=0;e=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},iX={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},iZ={CUBICSPLINE:void 0,LINEAR:ia.InterpolateLinear,STEP:ia.InterpolateDiscrete},iY={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function i_(e,t,r){for(let n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function iq(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function i$(e){let t="",r=Object.keys(e).sort();for(let n=0,i=r.length;n{let r=this.associations.get(e);for(let[n,a]of(null!=r&&this.associations.set(t,r),e.children.entries()))i(a,t.children[n])};return i(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&a.setY(t,d[e*o+1]),o>=3&&a.setZ(t,d[e*o+2]),o>=4&&a.setW(t,d[e*o+3]),o>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,r=this.options,n=t.textures[e].source,i=t.images[n],a=this.textureLoader;if(i.uri){let e=r.manager.getHandler(i.uri);null!==e&&(a=e)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,r){let n=this,i=this.json,a=i.textures[e],s=i.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);let r=(i.samplers||{})[a.sampler]||{};return t.magFilter=iJ[r.magFilter]||ia.LinearFilter,t.minFilter=iJ[r.minFilter]||ia.LinearMipmapLinearFilter,t.wrapS=iV[r.wrapS]||ia.RepeatWrapping,t.wrapT=iV[r.wrapT]||ia.RepeatWrapping,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let r=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=r.images[e],a=self.URL||self.webkitURL,s=i.uri||"",o=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then(function(e){o=!0;let t=new Blob([e],{type:i.mimeType});return s=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(s).then(function(e){return new Promise(function(r,i){let a=r;!0===t.isImageBitmapLoader&&(a=function(e){let t=new ia.Texture(e);t.needsUpdate=!0,r(t)}),t.load(ia.LoaderUtils.resolveURL(e,n.path),a,void 0,i)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),iq(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,r,n){let i=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((a=a.clone()).channel=r.texCoord),i.extensions[ip.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[ip.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[ip.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==n&&("number"==typeof n&&(n=3001===n?iu:ic),"colorSpace"in a?a.colorSpace=n:a.encoding=n===iu?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,r=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new ia.PointsMaterial,ia.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){let e="LineBasicMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new ia.LineBasicMaterial,ia.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(n||i||a){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return ia.MeshStandardMaterial}loadMaterial(e){let t,r=this,n=this.json,i=this.extensions,a=n.materials[e],s={},o=a.extensions||{},l=[];if(o[ip.KHR_MATERIALS_UNLIT]){let e=i[ip.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(s,a,r))}else{let n=a.pbrMetallicRoughness||{};if(s.color=new ia.Color(1,1,1),s.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],ic),s.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(r.assignTexture(s,"map",n.baseColorTexture,iu)),s.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,s.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(r.assignTexture(s,"metalnessMap",n.metallicRoughnessTexture)),l.push(r.assignTexture(s,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=ia.DoubleSide);let u=a.alphaMode||iY.OPAQUE;if(u===iY.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,u===iY.MASK&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==ia.MeshBasicMaterial&&(l.push(r.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new ia.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==ia.MeshBasicMaterial&&(l.push(r.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==ia.MeshBasicMaterial){let e=a.emissiveFactor;s.emissive=new ia.Color().setRGB(e[0],e[1],e[2],ic)}return void 0!==a.emissiveTexture&&t!==ia.MeshBasicMaterial&&l.push(r.assignTexture(s,"emissiveMap",a.emissiveTexture,iu)),Promise.all(l).then(function(){let n=new t(s);return a.name&&(n.name=a.name),iq(n,a),r.associations.set(n,{materials:e}),a.extensions&&i_(i,n,a),n})}createUniqueName(e){let t=ia.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,r=this.extensions,n=this.primitiveCache,i=[];for(let a=0,s=e.length;a0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,n=t.weights.length;r1?new ia.Group:1===t.length?t[0]:new ia.Object3D)!==t[0])for(let e=0,r=t.length;e{let t=new Map;for(let[e,r]of n.associations)(e instanceof ia.Material||e instanceof ia.Texture)&&t.set(e,r);return e.traverse(e=>{let r=n.associations.get(e);null!=r&&t.set(e,r)}),t})(i),i})}_createAnimationTracks(e,t,r,n,i){let a,s=[],o=e.name?e.name:e.uuid,l=[];switch(iX[i.path]===iX.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(o),iX[i.path]){case iX.weights:a=ia.NumberKeyframeTrack;break;case iX.rotation:a=ia.QuaternionKeyframeTrack;break;case iX.position:case iX.scale:a=ia.VectorKeyframeTrack;break;default:a=1===r.itemSize?ia.NumberKeyframeTrack:ia.VectorKeyframeTrack}let u=void 0!==n.interpolation?iZ[n.interpolation]:ia.InterpolateLinear,c=this._getArrayFromAccessor(r);for(let e=0,r=l.length;e-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||n&&i<98?this.textureLoader=new ia.TextureLoader(this.options.manager):this.textureLoader=new ia.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ia.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}}function i9(e,t,r){let n=t.attributes,i=[];for(let t in n){let a=iW[t]||t.toLowerCase();a in e.attributes||i.push(function(t,n){return r.getDependency("accessor",t).then(function(t){e.setAttribute(n,t)})}(n[t],a))}if(void 0!==t.indices&&!e.index){let n=r.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(n)}return iq(e,t),!function(e,t,r){let n=t.attributes,i=new ia.Box3;if(void 0===n.POSITION)return;{let e=r.json.accessors[n.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new ia.Vector3(t[0],t[1],t[2]),new ia.Vector3(a[0],a[1],a[2])),e.normalized){let t=i0(iK[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new ia.Vector3,t=new ia.Vector3;for(let n=0,i=a.length;n{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(n)},r,n)}decodeDracoFile(e,t,r,n){let i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let n=JSON.stringify(t);if(i4.has(e)){let t=i4.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(i,a).then(n=>(r=n,new Promise((n,a)=>{r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.catch(()=>!0).then(()=>{r&&i&&this._releaseTask(r,i)}),i4.set(e,{key:n,promise:s}),s}_createGeometry(e){let t=new i3.BufferGeometry;e.index&&t.setIndex(new i3.BufferAttribute(e.index.array,1));for(let r=0;r{r.load(e,t,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let n=i5.toString(),i=["/* draco decoder */",r,"\n/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtht._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{let t=e.draco,r=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(i),i.byteLength);try{let e=function(e,t,r,n){let i,a,s=n.attributeIDs,o=n.attributeTypes,l=t.GetEncodedGeometryType(r);if(l===e.TRIANGULAR_MESH)i=new e.Mesh,a=t.DecodeBufferToMesh(r,i);else if(l===e.POINT_CLOUD)i=new e.PointCloud,a=t.DecodeBufferToPointCloud(r,i);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!a.ok()||0===i.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());let u={index:null,attributes:[]};for(let r in s){let a,l,c=self[o[r]];if(n.useUniqueIDs)l=s[r],a=t.GetAttributeByUniqueId(i,l);else{if(-1===(l=t.GetAttributeId(i,e[s[r]])))continue;a=t.GetAttribute(i,l)}u.attributes.push(function(e,t,r,n,i,a){let s=a.num_components(),o=r.num_points()*s,l=o*i.BYTES_PER_ELEMENT,u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,a,u,l,c);let d=new i(e.HEAPF32.buffer,c,o).slice();return e._free(c),{name:n,array:d,itemSize:s}}(e,t,i,r,c,a))}return l===e.TRIANGULAR_MESH&&(u.index=function(e,t,r){let n=3*r.num_faces(),i=4*n,a=e._malloc(i);t.GetTrianglesUInt32Array(r,i,a);let s=new Uint32Array(e.HEAPF32.buffer,a,n).slice();return e._free(a),{array:s,itemSize:1}}(e,t,i)),e.destroy(i),u}(t,r,s,a),i=e.attributes.map(e=>e.array.buffer);e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(s),t.destroy(r)}})}}}let i6={clone:function(e){let t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(let i=0;i{let{isChild:r=!1,object:n,children:i,deep:a,castShadow:s,receiveShadow:o,inject:l,keys:u,...c}=e,d={keys:u,deep:a,inject:l,castShadow:s,receiveShadow:o};if(Array.isArray(n=eP.useMemo(()=>{if(!1===r&&!Array.isArray(n)){let e=!1;if(n.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return i6.clone(n)}return n},[n,r])))return eP.createElement("group",(0,ii.default)({},c,{ref:t}),n.map(e=>eP.createElement(i7,(0,ii.default)({key:e.uuid,object:e},d))),i);let{children:f,...h}=function(e,t){let{keys:r=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:n,inject:i,castShadow:a,receiveShadow:s}=t,o={};for(let t of r)o[t]=e[t];return n&&(o.geometry&&"materialsOnly"!==n&&(o.geometry=o.geometry.clone()),o.material&&"geometriesOnly"!==n&&(o.material=o.material.clone())),i&&(o="function"==typeof i?{...o,children:i(e)}:eP.isValidElement(i)?{...o,children:i}:{...o,...i}),e instanceof eO.Mesh&&(a&&(o.castShadow=!0),s&&(o.receiveShadow=!0)),o}(n,d),p=n.type[0].toLowerCase()+n.type.slice(1);return eP.createElement(p,(0,ii.default)({},h,c,{ref:t}),n.children.map(e=>"Bone"===e.type?eP.createElement("primitive",(0,ii.default)({key:e.uuid,object:e},d)):eP.createElement(i7,(0,ii.default)({key:e.uuid,object:e},d,{isChild:!0}))),i,f)}),ae=null,at="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function ar(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2?arguments[2]:void 0;return i=>{n&&n(i),e&&(ae||(ae=new i8),ae.setDecoderPath("string"==typeof e?e:at),i.setDRACOLoader(ae)),r&&i.setMeshoptDecoder((()=>{let e;if(t)return t;let r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let i="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";WebAssembly.validate(r)&&(i="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");let a=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let i=0;i{(e=t.instance).exports.__wasm_call_ctors()});function s(t,r,n,i,a,s){let o=e.exports.sbrk,l=n+3&-4,u=o(l*i),c=o(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,c);let f=t(u,n,i,c,a.length);if(0===f&&s&&s(u,l,i),r.set(d.subarray(u,u+n*i)),o(u-o(0)),0!==f)throw Error("Malformed buffer data: ".concat(f))}let o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return t={ready:a,supported:!0,decodeVertexBuffer(t,r,n,i,a){s(e.exports.meshopt_decodeVertexBuffer,t,r,n,i,e.exports[o[a]])},decodeIndexBuffer(t,r,n,i){s(e.exports.meshopt_decodeIndexBuffer,t,r,n,i)},decodeIndexSequence(t,r,n,i){s(e.exports.meshopt_decodeIndexSequence,t,r,n,i)},decodeGltfBuffer(t,r,n,i,a,u){s(e.exports[l[a]],t,r,n,i,e.exports[o[u]])}}})())}}let an=(e,t,r,n)=>(0,eQ.useLoader)(id,e,ar(t,r,n));an.preload=(e,t,r,n)=>eQ.useLoader.preload(id,e,ar(t,r,n)),an.clear=e=>eQ.useLoader.clear(id,e),an.setDecoderPath=e=>{at=e};var ai=e.i(89887);function aa(e){var t,r;let{materialName:n,material:i,lightMap:a}=e,s=(0,nZ.textureToUrl)(n),o=(0,nq.useTexture)(s,e=>(0,n_.setupColor)(e));return new Set(null!=(r=null==i||null==(t=i.userData)?void 0:t.flag_names)?r:[]).has("SelfIlluminating")?(0,eI.jsx)("meshBasicMaterial",{map:o,side:2,toneMapped:!1}):(0,eI.jsx)("meshLambertMaterial",{map:o,lightMap:null!=a?a:void 0,lightMapIntensity:a?4:void 0,side:2})}function as(e){var t;return e&&null!=(t=e.emissiveMap)?t:null}function ao(e){let{node:t}=e,r=(0,eP.useMemo)(()=>t.material?Array.isArray(t.material)?t.material.map(as):[as(t.material)]:[],[t.material]);return(0,eI.jsx)("mesh",{geometry:t.geometry,castShadow:!0,receiveShadow:!0,children:t.material?(0,eI.jsx)(eP.Suspense,{fallback:(0,eI.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(t.material)?t.material.map((e,t)=>(0,eI.jsx)(aa,{materialName:e.userData.resource_path,material:e,lightMap:r[t]},t)):(0,eI.jsx)(aa,{materialName:t.material.userData.resource_path,material:t.material,lightMap:r[0]})}):null})}let al=(0,eP.memo)(e=>{let{interiorFile:t}=e,{nodes:r}=an((0,nZ.interiorToUrl)(t)),{debugMode:n}=(0,n$.useDebug)();return(0,eI.jsxs)("group",{rotation:[0,-Math.PI/2,0],children:[Object.entries(r).filter(e=>{let[,t]=e;return t.isMesh}).map(e=>{let[t,r]=e;return(0,eI.jsx)(ao,{node:r},t)}),n?(0,eI.jsx)(ai.FloatingLabel,{children:t}):null]})});function au(e){let{color:t,label:r}=e;return(0,eI.jsxs)("mesh",{children:[(0,eI.jsx)("boxGeometry",{args:[10,10,10]}),(0,eI.jsx)("meshStandardMaterial",{color:t,wireframe:!0}),r?(0,eI.jsx)(ai.FloatingLabel,{color:t,children:r}):null]})}function ac(e){let{label:t}=e,{debugMode:r}=(0,n$.useDebug)();return r?(0,eI.jsx)(au,{color:"red",label:t}):null}let ad=(0,eP.memo)(function(e){let{object:t}=e,r=(0,nY.getProperty)(t,"interiorFile"),n=(0,eP.useMemo)(()=>(0,nY.getPosition)(t),[t]),i=(0,eP.useMemo)(()=>(0,nY.getScale)(t),[t]),a=(0,eP.useMemo)(()=>(0,nY.getRotation)(t),[t]);return(0,eI.jsx)("group",{position:n,quaternion:a,scale:i,children:(0,eI.jsx)(ir,{fallback:(0,eI.jsx)(ac,{label:r}),children:(0,eI.jsx)(eP.Suspense,{fallback:(0,eI.jsx)(au,{color:"orange"}),children:(0,eI.jsx)(al,{interiorFile:r})})})})});function af(e,t){let{path:r}=t,[n]=(0,eQ.useLoader)(eO.CubeTextureLoader,[e],e=>e.setPath(r));return n}af.preload=(e,t)=>{let{path:r}=t;return eQ.useLoader.preload(eO.CubeTextureLoader,[e],e=>e.setPath(r))};function ah(e){return e.wrapS=eO.RepeatWrapping,e.wrapT=eO.RepeatWrapping,e.minFilter=eO.LinearFilter,e.magFilter=eO.LinearFilter,e.colorSpace=eO.SRGBColorSpace,e.needsUpdate=!0,e}function ap(e){let{textureUrl:t,radius:r,heightPercent:n,speed:i,windDirection:a,layerIndex:s,debugMode:o,animationEnabled:l}=e,u=(0,eP.useRef)(null),c=(0,eP.useRef)(new eO.Vector2(0,0)),d=(0,nq.useTexture)(t,ah),f=(0,eP.useMemo)(()=>{let e=n-.05;return function(e,t,r,n){let i=new eO.BufferGeometry,a=new Float32Array(75),s=new Float32Array(50),o=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],l=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,i=-e+r*l,u=e-t*l,c=e*o[n];a[3*n]=i,a[3*n+1]=c,a[3*n+2]=u,s[2*n]=r/4,s[2*n+1]=t/4}!function(e){let t=t=>({x:e[3*t],y:e[3*t+1],z:e[3*t+2]}),r=(t,r,n,i)=>{e[3*t]=r,e[3*t+1]=n,e[3*t+2]=i},n=t(1),i=t(3),a=t(5),s=t(6),o=t(8),l=t(9),u=t(15),c=t(16),d=t(18),f=t(19),h=t(21),p=t(23),m=a.x+(n.x-a.x)*.5,g=a.y+(n.y-a.y)*.5,A=a.z+(n.z-a.z)*.5;r(0,s.x+(m-s.x)*2,s.y+(g-s.y)*2,s.z+(A-s.z)*2),m=l.x+(i.x-l.x)*.5,g=l.y+(i.y-l.y)*.5,A=l.z+(i.z-l.z)*.5,r(4,o.x+(m-o.x)*2,o.y+(g-o.y)*2,o.z+(A-o.z)*2),m=h.x+(u.x-h.x)*.5,g=h.y+(u.y-h.y)*.5,A=h.z+(u.z-h.z)*.5,r(20,c.x+(m-c.x)*2,c.y+(g-c.y)*2,c.z+(A-c.z)*2),m=p.x+(f.x-p.x)*.5,g=p.y+(f.y-p.y)*.5,A=p.z+(f.z-p.z)*.5,r(24,d.x+(m-d.x)*2,d.y+(g-d.y)*2,d.z+(A-d.z)*2)}(a);let u=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let i=e[3*n],a=e[3*n+2],s=1.3-Math.sqrt(i*i+a*a)/t;s<.4?s=0:s>.8&&(s=1),r[n]=s}return r}(a,e),c=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,i=r+5,a=i+1;c.push(r,i,a),c.push(r,a,n)}return i.setIndex(c),i.setAttribute("position",new eO.Float32BufferAttribute(a,3)),i.setAttribute("uv",new eO.Float32BufferAttribute(s,2)),i.setAttribute("alpha",new eO.Float32BufferAttribute(u,1)),i.computeBoundingSphere(),i}(r,n,e,0)},[r,n]),h=(0,eP.useMemo)(()=>new eO.ShaderMaterial({uniforms:{cloudTexture:{value:d},uvOffset:{value:new eO.Vector2(0,0)},debugMode:{value:+!!o},layerIndex:{value:s}},vertexShader:"\n attribute float alpha;\n\n uniform vec2 uvOffset;\n\n varying vec2 vUv;\n varying float vAlpha;\n\n void main() {\n // Apply UV offset for scrolling\n vUv = uv + uvOffset;\n vAlpha = alpha;\n\n vec4 pos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n // Set depth to far plane so clouds are always visible and behind other geometry\n gl_Position = pos.xyww;\n }\n",fragmentShader:"\n uniform sampler2D cloudTexture;\n uniform float debugMode;\n uniform int layerIndex;\n\n varying vec2 vUv;\n varying float vAlpha;\n\n void main() {\n vec4 texColor = texture2D(cloudTexture, vUv);\n\n // Debug mode: show layer-colored clouds (red, green, blue for layers 0, 1, 2)\n if (debugMode > 0.5) {\n vec3 debugColor;\n if (layerIndex == 0) {\n debugColor = vec3(1.0, 0.3, 0.3); // Red\n } else if (layerIndex == 1) {\n debugColor = vec3(0.3, 1.0, 0.3); // Green\n } else {\n debugColor = vec3(0.3, 0.3, 1.0); // Blue\n }\n // Use same alpha calculation as normal mode\n gl_FragColor = vec4(debugColor, texColor.a * vAlpha);\n return;\n }\n\n // Tribes 2 uses GL_MODULATE: final = texture × vertex color\n // Vertex color is white with varying alpha, so:\n // Final RGB = Texture RGB × 1.0 = Texture RGB\n // Final Alpha = Texture Alpha × Vertex Alpha\n float finalAlpha = texColor.a * vAlpha;\n\n // Output clouds with texture color and combined alpha\n gl_FragColor = vec4(texColor.rgb, finalAlpha);\n }\n",transparent:!0,depthWrite:!1,side:eO.DoubleSide}),[d,o,s]);return(0,eV.useFrame)((e,t)=>{if(!u.current||!l)return;let r=1e3*t/32;c.current.x+=a.x*i*r,c.current.y+=a.y*i*r,c.current.x=c.current.x-Math.floor(c.current.x),c.current.y=c.current.y-Math.floor(c.current.y),u.current.uniforms.uvOffset.value.copy(c.current)}),(0,eP.useEffect)(()=>()=>{f.dispose(),h.dispose()},[f,h]),(0,eI.jsx)("mesh",{geometry:f,frustumCulled:!1,renderOrder:10,children:(0,eI.jsx)("primitive",{ref:u,object:h,attach:"material"})})}function am(e){var t,r;let{object:n}=e,{debugMode:i}=(0,n$.useDebug)(),{animationEnabled:a}=(0,n$.useSettings)(),{data:s}=nW({queryKey:["detailMapList",r=(0,nY.getProperty)(n,"materialList")],queryFn:()=>(0,nZ.loadDetailMapList)(r),enabled:!!r},nD,void 0),o=.95*(null!=(t=(0,nY.getFloat)(n,"visibleDistance"))?t:500),l=(0,eP.useMemo)(()=>{var e,t,r;return[null!=(e=(0,nY.getFloat)(n,"cloudSpeed1"))?e:1e-4,null!=(t=(0,nY.getFloat)(n,"cloudSpeed2"))?t:2e-4,null!=(r=(0,nY.getFloat)(n,"cloudSpeed3"))?r:3e-4]},[n]),u=(0,eP.useMemo)(()=>{let e=[.35,.25,.2],t=[];for(let i=0;i<3;i++){var r;let a=null!=(r=(0,nY.getFloat)(n,"cloudHeightPer".concat(i)))?r:e[i];t.push(a)}return t},[n]),c=(0,eP.useMemo)(()=>{let e=(0,nY.getProperty)(n,"windVelocity");if(e){let[t,r]=e.split(" ").map(e=>parseFloat(e));if(0!==t||0!==r)return new eO.Vector2(t,r).normalize()}return new eO.Vector2(1,0)},[n]),d=(0,eP.useMemo)(()=>{if(!s)return[];let e=[];for(let n=7;n{let{camera:t}=e;f.current&&f.current.position.copy(t.position)}),d&&0!==d.length)?(0,eI.jsx)("group",{ref:f,children:d.map((e,t)=>{let r=(0,nZ.textureToUrl)(e.texture);return(0,eI.jsx)(eP.Suspense,{fallback:null,children:(0,eI.jsx)(ap,{textureUrl:r,radius:o,heightPercent:e.height,speed:e.speed,windDirection:c,layerIndex:t,debugMode:i,animationEnabled:a})},t)})}):null}let av="".concat(nZ.BASE_URL,"/black.png");function ag(e){if(!e)return;let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return[new eO.Color().setRGB(t,r,n),new eO.Color().setRGB(t,r,n).convertSRGBToLinear()]}function aA(e){let{materialList:t,fogColor:r}=e,{data:n}=nW({queryKey:["detailMapList",t],queryFn:()=>(0,nZ.loadDetailMapList)(t)},nD,void 0),i=af((0,eP.useMemo)(()=>n?[(0,nZ.textureToUrl)(n[1]),(0,nZ.textureToUrl)(n[3]),(0,nZ.textureToUrl)(n[4]),(0,nZ.textureToUrl)(n[5]),(0,nZ.textureToUrl)(n[0]),(0,nZ.textureToUrl)(n[2])]:[av,av,av,av,av,av],[n]),{path:""}),a=(0,eP.useRef)(null),s=(0,eP.useMemo)(()=>new eO.ShaderMaterial({uniforms:{skybox:{value:i},fogColor:{value:null!=r?r:new eO.Color(0,0,0)},enableFog:{value:!!r}},vertexShader:"\n varying vec3 vDirection;\n\n void main() {\n vDirection = position;\n vec4 pos = projectionMatrix * mat4(mat3(modelViewMatrix)) * vec4(position, 1.0);\n gl_Position = pos.xyww;\n }\n ",fragmentShader:"\n uniform samplerCube skybox;\n uniform vec3 fogColor;\n uniform bool enableFog;\n\n varying vec3 vDirection;\n\n void main() {\n vec3 direction = normalize(vDirection);\n // Swap X and Z, negate X to mirror across X axis\n direction = vec3(direction.z, direction.y, -direction.x);\n vec4 skyColor = textureCube(skybox, direction);\n\n if (enableFog) {\n // Fog increases toward and below horizon\n // direction.y: -1 = straight down, 0 = horizon, 1 = straight up\n // Use smoothstep for gradual transition (matches Three.js linear fog feel)\n float fogFactor = 1.0 - smoothstep(-0.1, 0.5, direction.y);\n vec3 finalColor = mix(skyColor.rgb, fogColor, fogFactor);\n gl_FragColor = vec4(finalColor, 1.0);\n } else {\n gl_FragColor = skyColor;\n }\n }\n ",side:eO.BackSide,depthWrite:!1}),[i,r]);return(0,eP.useEffect)(()=>{a.current&&(a.current.uniforms.skybox.value=i,a.current.uniforms.fogColor.value=null!=r?r:new eO.Color(0,0,0),a.current.uniforms.enableFog.value=!!r)},[i,r]),(0,eI.jsxs)("mesh",{scale:5e3,frustumCulled:!1,children:[(0,eI.jsx)("sphereGeometry",{args:[1,60,40]}),(0,eI.jsx)("primitive",{ref:a,object:s,attach:"material"})]})}let ay=/borg|xorg|porg|dorg|plant|tree|bush|fern|vine|grass|leaf|flower|frond|palm|foliage/i;function ax(e){return ay.test(e)}let aB=(0,eP.createContext)(null);function aC(e){let{children:t,shapeName:r,type:n}=e,i=(0,eP.useMemo)(()=>ax(r),[r]),a=(0,eP.useMemo)(()=>({shapeName:r,type:n,isOrganic:i}),[r,n,i]);return(0,eI.jsx)(aB.Provider,{value:a,children:t})}var aS=e.i(51475);let aE=new Map;function aT(e,t,r,n){let i=r.has("Translucent"),a=r.has("Additive"),s=r.has("SelfIlluminating");if(r.has("NeverEnvMap"),s)return new eO.MeshBasicMaterial({map:t,side:2,transparent:a,alphaTest:.5*!a,blending:a?eO.AdditiveBlending:void 0,fog:!0});if(n||i){let e={map:t,transparent:!1,alphaTest:.5,reflectivity:0};return[new eO.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),new eO.MeshLambertMaterial({...e,side:0})]}return new eO.MeshLambertMaterial({map:t,side:2,reflectivity:0})}let ab=(0,eP.memo)(function(e){var t;let{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:s=!1,receiveShadow:o=!1}=e,l=r.userData.resource_path,u=new Set(null!=(t=r.userData.flag_names)?t:[]),c=function(e){let{animationEnabled:t}=(0,n$.useSettings)(),{data:r}=nW({queryKey:["ifl",e],queryFn:()=>(0,nZ.loadImageFrameList)(e),enabled:!0,suspense:!0,throwOnError:nV,placeholderData:void 0},nD,void 0),n=(0,eP.useMemo)(()=>r.map(t=>(0,nZ.iflTextureToUrl)(t.name,e)),[r,e]),i=(0,nq.useTexture)(n),a=(0,eP.useMemo)(()=>{var t;let n,a=aE.get(e);return a||(a=function(e){let t=e[0].image.width,r=e[0].image.height,n=e.length,i=Math.ceil(Math.sqrt(n)),a=Math.ceil(n/i),s=document.createElement("canvas");s.width=t*i,s.height=r*a;let o=s.getContext("2d");e.forEach((e,n)=>{let a=Math.floor(n/i);o.drawImage(e.image,n%i*t,a*r)});let l=new eO.CanvasTexture(s);return l.colorSpace=eO.SRGBColorSpace,l.generateMipmaps=!1,l.minFilter=eO.NearestFilter,l.magFilter=eO.NearestFilter,l.wrapS=eO.ClampToEdgeWrapping,l.wrapT=eO.ClampToEdgeWrapping,l.repeat.set(1/i,1/a),{texture:l,columns:i,rows:a,frameCount:n,frameStartTicks:[],totalTicks:0,lastFrame:-1}}(i),aE.set(e,a)),n=0,(t=a).frameStartTicks=r.map(e=>{let t=n;return n+=e.frameCount,t}),t.totalTicks=n,a},[e,i,r]);return(0,aS.useTick)(e=>{let r=t?function(e,t){if(0===e.totalTicks)return 0;let r=t%e.totalTicks,{frameStartTicks:n}=e;for(let e=n.length-1;e>=0;e--)if(r>=n[e])return e;return 0}(a,e):0;!function(e,t){if(t===e.lastFrame)return;e.lastFrame=t;let r=t%e.columns,n=e.rows-1-Math.floor(t/e.columns);e.texture.offset.set(r/e.columns,n/e.rows)}(a,r)}),a.texture}("textures/".concat(l,".ifl")),d=n&&ax(n),f=(0,eP.useMemo)(()=>aT(r,c,u,d),[r,c,u,d]);return Array.isArray(f)?(0,eI.jsxs)(eI.Fragment,{children:[(0,eI.jsx)("mesh",{geometry:a||i,castShadow:s,receiveShadow:o,children:(0,eI.jsx)("primitive",{object:f[0],attach:"material"})}),(0,eI.jsx)("mesh",{geometry:i,castShadow:s,receiveShadow:o,children:(0,eI.jsx)("primitive",{object:f[1],attach:"material"})})]}):(0,eI.jsx)("mesh",{geometry:i,castShadow:s,receiveShadow:o,children:(0,eI.jsx)("primitive",{object:f,attach:"material"})})}),aD=(0,eP.memo)(function(e){var t;let{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:s=!1,receiveShadow:o=!1}=e,l=r.userData.resource_path,u=new Set(null!=(t=r.userData.flag_names)?t:[]),c=(0,eP.useMemo)(()=>(l||console.warn('No resource_path was found on "'.concat(n,'" - rendering fallback.')),l?(0,nZ.textureToUrl)(l):nZ.FALLBACK_TEXTURE_URL),[l,n]),d=n&&ax(n),f=u.has("Translucent"),h=(0,nq.useTexture)(c,e=>d||f?(0,n_.setupAlphaTestedTexture)(e):(0,n_.setupColor)(e)),p=(0,eP.useMemo)(()=>aT(r,h,u,d),[r,h,u,d]);return Array.isArray(p)?(0,eI.jsxs)(eI.Fragment,{children:[(0,eI.jsx)("mesh",{geometry:a||i,castShadow:s,receiveShadow:o,children:(0,eI.jsx)("primitive",{object:p[0],attach:"material"})}),(0,eI.jsx)("mesh",{geometry:i,castShadow:s,receiveShadow:o,children:(0,eI.jsx)("primitive",{object:p[1],attach:"material"})})]}):(0,eI.jsx)("mesh",{geometry:i,castShadow:s,receiveShadow:o,children:(0,eI.jsx)("primitive",{object:p,attach:"material"})})}),aM=(0,eP.memo)(function(e){var t;let{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:s=!1,receiveShadow:o=!1}=e,l=new Set(null!=(t=r.userData.flag_names)?t:[]).has("IflMaterial"),u=r.userData.resource_path;return l&&u?(0,eI.jsx)(ab,{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:s,receiveShadow:o}):r.name?(0,eI.jsx)(aD,{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:s,receiveShadow:o}):null});function aw(e){let{color:t,label:r}=e;return(0,eI.jsxs)("mesh",{children:[(0,eI.jsx)("boxGeometry",{args:[10,10,10]}),(0,eI.jsx)("meshStandardMaterial",{color:t,wireframe:!0}),r?(0,eI.jsx)(ai.FloatingLabel,{color:t,children:r}):null]})}function aF(e){let{color:t,label:r}=e,{debugMode:n}=(0,n$.useDebug)();return n?(0,eI.jsx)(aw,{color:t,label:r}):null}function aR(e){let{shapeName:t,loadingColor:r="yellow",children:n}=e;return t?(0,eI.jsx)(ir,{fallback:(0,eI.jsx)(aF,{color:"red",label:t}),children:(0,eI.jsxs)(eP.Suspense,{fallback:(0,eI.jsx)(aw,{color:r}),children:[(0,eI.jsx)(aI,{}),n]})}):(0,eI.jsx)(aF,{color:"orange"})}let aI=(0,eP.memo)(function(){let{shapeName:e,isOrganic:t}=(0,eP.useContext)(aB),{debugMode:r}=(0,n$.useDebug)(),{nodes:n}=an((0,nZ.shapeToUrl)(e)),i=(0,eP.useMemo)(()=>{let e=Object.values(n).filter(e=>e.skeleton);if(e.length>0){var t=e[0].skeleton;let r=new Set;return t.bones.forEach((e,t)=>{e.name.match(/^Hulk/i)&&r.add(t)}),r}return new Set},[n]),a=(0,eP.useMemo)(()=>Object.entries(n).filter(e=>{let[t,r]=e;return r.material&&"Unassigned"!==r.material.name&&!r.name.match(/^Hulk/i)}).map(e=>{let[r,n]=e,a=function(e,t){if(0===t.size||!e.attributes.skinIndex)return e;let r=e.attributes.skinIndex,n=e.attributes.skinWeight,i=e.index,a=Array(r.count).fill(!1);for(let e=0;e.01&&t.has(s)){a[e]=!0;break}}if(i){let t=[],r=i.array;for(let e=0;e1){let t=0,r=0,n=0;for(let a of e)t+=i[3*a],r+=i[3*a+1],n+=i[3*a+2];let a=Math.sqrt(t*t+r*r+n*n);for(let s of(a>0&&(t/=a,r/=a,n/=a),e))i[3*s]=t,i[3*s+1]=r,i[3*s+2]=n}if(r.needsUpdate=!0,t){let e=(s=a.clone()).attributes.normal,t=e.array;for(let e=0;e{let{node:r,geometry:n,backGeometry:i}=t;return(0,eI.jsx)(eP.Suspense,{fallback:(0,eI.jsx)("mesh",{geometry:n,children:(0,eI.jsx)("meshStandardMaterial",{color:"gray",wireframe:!0})}),children:r.material?Array.isArray(r.material)?r.material.map((t,r)=>(0,eI.jsx)(aM,{material:t,shapeName:e,geometry:n,backGeometry:i,castShadow:s,receiveShadow:s},r)):(0,eI.jsx)(aM,{material:r.material,shapeName:e,geometry:n,backGeometry:i,castShadow:s,receiveShadow:s}):null},r.id)}),r?(0,eI.jsx)(ai.FloatingLabel,{children:e}):null]})});var aP=e.i(6112);let aL={1:"Storm",2:"Inferno"},aU=(0,eP.createContext)(null);function aG(){let e=(0,eP.useContext)(aU);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function aO(e){let{children:t}=e,{camera:r}=(0,eJ.useThree)(),[n,i]=(0,eP.useState)(0),[a,s]=(0,eP.useState)({}),o=(0,eP.useCallback)(e=>{s(t=>({...t,[e.id]:e}))},[]),l=(0,eP.useCallback)(e=>{s(t=>{let{[e.id]:r,...n}=t;return n})},[]),u=Object.keys(a).length,c=(0,eP.useCallback)(()=>{i(e=>0===u?0:(e+1)%u)},[u]),d=(0,eP.useCallback)(e=>{e>=0&&e{if(n({registerCamera:o,unregisterCamera:l,nextCamera:c,setCameraIndex:d,cameraCount:u}),[o,l,c,d,u]);return(0,eI.jsx)(aU.Provider,{value:f,children:t})}let aH=(0,eP.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),aN={AudioEmitter:function(e){let{audioEnabled:t}=(0,n$.useSettings)();return t?(0,eI.jsx)(aH,{...e}):null},Camera:function(e){let{object:t}=e,{registerCamera:r,unregisterCamera:n}=aG(),i=(0,eP.useId)(),a=(0,nY.getProperty)(t,"dataBlock"),s=(0,eP.useMemo)(()=>(0,nY.getPosition)(t),[t]),o=(0,eP.useMemo)(()=>(0,nY.getRotation)(t),[t]);return(0,eP.useEffect)(()=>{if("Observer"===a){let e={id:i,position:new eO.Vector3(...s),rotation:o};return r(e),()=>{n(e)}}},[i,a,r,n,s,o]),null},ForceFieldBare:(0,eP.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:ad,Item:function(e){var t,r;let{object:n}=e,i=n6(),a=null!=(t=(0,nY.getProperty)(n,"dataBlock"))?t:"",s=(0,aP.useDatablock)(a),o=(0,eP.useMemo)(()=>(0,nY.getPosition)(n),[n]),l=(0,eP.useMemo)(()=>(0,nY.getScale)(n),[n]),u=(0,eP.useMemo)(()=>(0,nY.getRotation)(n),[n]),c=(0,nY.getProperty)(s,"shapeFile");c||console.error(" missing shape for datablock: ".concat(a));let d=(null==a?void 0:a.toLowerCase())==="flag",f=null!=(r=null==i?void 0:i.team)?r:null,h=f&&f>0?aL[f]:null,p=d&&h?"".concat(h," Flag"):null;return(0,eI.jsx)(aC,{shapeName:c,type:"Item",children:(0,eI.jsx)("group",{position:o,quaternion:u,scale:l,children:(0,eI.jsx)(aR,{shapeName:c,loadingColor:"pink",children:p?(0,eI.jsx)(ai.FloatingLabel,{opacity:.6,children:p}):null})})})},SimGroup:function(e){var t;let{object:r}=e,n=n6(),i=(0,eP.useMemo)(()=>{let e=null,t=!1;if(n&&n.hasTeams){if(t=!0,null!=n.team)e=n.team;else if(r._name){let t=r._name.match(/^team(\d+)$/i);t&&(e=parseInt(t[1],10))}}else r._name&&(t="teams"===r._name.toLowerCase());return{object:r,parent:n,hasTeams:t,team:e}},[r,n]);return(0,eI.jsx)(n5.Provider,{value:i,children:(null!=(t=r._children)?t:[]).map((e,t)=>ak(e,t))})},Sky:function(e){var t;let{object:r}=e,{fogEnabled:n}=(0,n$.useSettings)(),i=(0,nY.getProperty)(r,"materialList"),a=(0,eP.useMemo)(()=>ag((0,nY.getProperty)(r,"SkySolidColor")),[r]),s=null!=(t=(0,nY.getInt)(r,"useSkyTextures"))?t:1,o=(0,nY.getFloat)(r,"fogDistance"),l=(0,nY.getFloat)(r,"visibleDistance"),u=(0,nY.getFloat)(r,"high_fogDistance"),c=(0,nY.getFloat)(r,"high_visibleDistance"),d=(0,eP.useMemo)(()=>{let e=(0,nY.getProperty)(r,"fogVolume1");if(e){let[t,r,n]=e.split(" ").map(e=>parseFloat(e));if(t>0&&n>r)return{visibleDistance:t,minHeight:r,maxHeight:n}}return null},[r]),f=null!=u&&u>0?u:o,h=null!=c&&c>0?c:l,p=d?Math.min(null!=f?f:1/0,.25*d.visibleDistance):f,m=d?Math.min(null!=h?h:1/0,.9*d.visibleDistance):h,g=(0,eP.useMemo)(()=>ag((0,nY.getProperty)(r,"fogColor")),[r]),A=a||g,y=A?(0,eI.jsx)("color",{attach:"background",args:[A[0]]}):null,x=null!=p&&null!=m&&m>p;return(0,eI.jsxs)(eI.Fragment,{children:[i&&s?(0,eI.jsx)(eP.Suspense,{fallback:y,children:(0,eI.jsx)(aA,{materialList:i,fogColor:n&&x?null==g?void 0:g[1]:void 0})}):y,(0,eI.jsx)(eP.Suspense,{children:(0,eI.jsx)(am,{object:r})}),n&&x&&g?(0,eI.jsx)("fog",{attach:"fog",color:g[1],near:p,far:m}):null]})},StaticShape:function(e){var t;let{object:r}=e,n=null!=(t=(0,nY.getProperty)(r,"dataBlock"))?t:"",i=(0,aP.useDatablock)(n),a=(0,eP.useMemo)(()=>(0,nY.getPosition)(r),[r]),s=(0,eP.useMemo)(()=>(0,nY.getRotation)(r),[r]),o=(0,eP.useMemo)(()=>(0,nY.getScale)(r),[r]),l=(0,nY.getProperty)(i,"shapeFile");return l||console.error(" missing shape for datablock: ".concat(n)),(0,eI.jsx)(aC,{shapeName:l,type:"StaticShape",children:(0,eI.jsx)("group",{position:a,quaternion:s,scale:o,children:(0,eI.jsx)(aR,{shapeName:l})})})},Sun:function(e){let{object:t}=e,r=(0,eP.useMemo)(()=>{var e;let[r,n,i]=(null!=(e=(0,nY.getProperty)(t,"direction"))?e:"0.57735 0.57735 -0.57735").split(" ").map(e=>parseFloat(e)),a=Math.sqrt(r*r+i*i+n*n);return new eO.Vector3(r/a,i/a,n/a)},[t]),n=(0,eP.useMemo)(()=>new eO.Vector3(-(5e3*r.x),-(5e3*r.y),-(5e3*r.z)),[r]),i=(0,eP.useMemo)(()=>{var e;let[r,n,i]=(null!=(e=(0,nY.getProperty)(t,"color"))?e:"0.7 0.7 0.7 1").split(" ").map(e=>parseFloat(e));return new eO.Color(r,n,i)},[t]),a=(0,eP.useMemo)(()=>{var e;let[r,n,i]=(null!=(e=(0,nY.getProperty)(t,"ambient"))?e:"0.5 0.5 0.5 1").split(" ").map(e=>parseFloat(e));return new eO.Color(r,n,i)},[t]);return(0,eI.jsxs)(eI.Fragment,{children:[(0,eI.jsx)("directionalLight",{position:n,color:i,intensity:1.8,castShadow:!0,"shadow-mapSize-width":4096,"shadow-mapSize-height":4096,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-.001}),(0,eI.jsx)("ambientLight",{color:a,intensity:1})]})},TerrainBlock:n8,TSStatic:function(e){let{object:t}=e,r=(0,nY.getProperty)(t,"shapeName"),n=(0,eP.useMemo)(()=>(0,nY.getPosition)(t),[t]),i=(0,eP.useMemo)(()=>(0,nY.getRotation)(t),[t]),a=(0,eP.useMemo)(()=>(0,nY.getScale)(t),[t]);return r||console.error(" missing shapeName for object",t),(0,eI.jsx)(aC,{shapeName:r,type:"TSStatic",children:(0,eI.jsx)("group",{position:n,quaternion:i,scale:a,children:(0,eI.jsx)(aR,{shapeName:r})})})},Turret:function(e){var t;let{object:r}=e,n=null!=(t=(0,nY.getProperty)(r,"dataBlock"))?t:"",i=(0,nY.getProperty)(r,"initialBarrel"),a=(0,aP.useDatablock)(n),s=(0,aP.useDatablock)(i),o=(0,eP.useMemo)(()=>(0,nY.getPosition)(r),[r]),l=(0,eP.useMemo)(()=>(0,nY.getRotation)(r),[r]),u=(0,eP.useMemo)(()=>(0,nY.getScale)(r),[r]),c=(0,nY.getProperty)(a,"shapeFile"),d=(0,nY.getProperty)(s,"shapeFile");return c||console.error(" missing shape for datablock: ".concat(n)),i&&!d&&console.error(" missing shape for barrel datablock: ".concat(i)),(0,eI.jsx)(aC,{shapeName:c,type:"Turret",children:(0,eI.jsxs)("group",{position:o,quaternion:l,scale:u,children:[(0,eI.jsx)(aR,{shapeName:c}),d?(0,eI.jsx)(aC,{shapeName:d,type:"Turret",children:(0,eI.jsx)("group",{position:[0,1.5,0],children:(0,eI.jsx)(aR,{shapeName:d})})}):null]})})},WaterBlock:(0,eP.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function(e){let{object:t}=e;n6();let r=(0,eP.useMemo)(()=>(0,nY.getPosition)(t),[t]),n=(0,nY.getProperty)(t,"name");return n?(0,eI.jsx)(ai.FloatingLabel,{position:r,opacity:.6,children:n}):null}};function ak(e,t){let r=aN[e._className];return r?(0,eI.jsx)(eP.Suspense,{children:(0,eI.jsx)(r,{object:e})},t):null}var az=e.i(86608),aj=e.i(38433),aK=e.i(33870),aJ=e.i(91996);let aV=async e=>{let t;try{t=(0,nZ.getUrlForPath)(e)}catch(t){return console.warn("Script not in manifest: ".concat(e," (").concat(t,")")),null}try{let r=await fetch(t);if(!r.ok)return console.error("Script fetch failed: ".concat(e," (").concat(r.status,")")),null;return await r.text()}catch(t){return console.error("Script fetch error: ".concat(e)),console.error(t),null}},aQ=(0,aK.createScriptCache)(),aW={findFiles:e=>{let t=(0,nX.default)(e,{nocase:!0});return(0,aJ.getResourceList)().filter(e=>t(e)).map(e=>{let[t,r]=(0,aJ.getSourceAndPath)(e);return r})},isFile:e=>null!=(0,aJ.getResourceMap)()[(0,aJ.getResourceKey)(e)]},aX=(0,eP.memo)(function(e){let{name:t,onLoadingChange:r}=e,{data:n}=nW({queryKey:["parsedMission",t],queryFn:()=>(0,nZ.loadMission)(t)},nD,void 0),{missionGroup:i,runtime:a,progress:s}=function(e,t){let[r,n]=(0,eP.useState)({missionGroup:void 0,runtime:void 0,progress:0});return(0,eP.useEffect)(()=>{if(!t)return;let r=new AbortController,i=t.missionTypes[0],a=(0,aj.createProgressTracker)(),s=()=>{n(e=>({...e,progress:a.progress}))};a.on("update",s);let{runtime:o}=(0,az.runServer)({missionName:e,missionType:i,runtimeOptions:{loadScript:aV,fileSystem:aW,cache:aQ,signal:r.signal,progress:a,ignoreScripts:["scripts/admin.cs","scripts/ai.cs","scripts/aiBotProfiles.cs","scripts/aiBountyGame.cs","scripts/aiChat.cs","scripts/aiCnH.cs","scripts/aiCTF.cs","scripts/aiDeathMatch.cs","scripts/aiDebug.cs","scripts/aiDefaultTasks.cs","scripts/aiDnD.cs","scripts/aiHumanTasks.cs","scripts/aiHunters.cs","scripts/aiInventory.cs","scripts/aiObjectiveBuilder.cs","scripts/aiObjectives.cs","scripts/aiRabbit.cs","scripts/aiSiege.cs","scripts/aiTDM.cs","scripts/aiTeamHunters.cs","scripts/deathMessages.cs","scripts/graphBuild.cs","scripts/navGraph.cs","scripts/serverTasks.cs","scripts/spdialog.cs"]},onMissionLoadDone:()=>{n({missionGroup:o.getObjectByName("MissionGroup"),runtime:o,progress:1})}});return()=>{a.off("update",s),r.abort(),o.destroy()}},[e,t]),r}(t,n),o=!i||!a;return((0,eP.useEffect)(()=>{null==r||r(o,s)},[o,s,r]),o)?null:(0,eI.jsx)(n3.RuntimeProvider,{runtime:a,children:ak(i)})});function aZ(e,t){var r=rV(e,t,"update");if(r.set){if(!r.get)throw TypeError("attempted to read set only private field");return"__destrWrapper"in r||(r.__destrWrapper={set value(v){r.set.call(e,v)},get value(){return r.get.call(e)}}),r.__destrWrapper}if(!r.writable)throw TypeError("attempted to set read only private field");return r}var aY=(em=new WeakMap,class extends rq{build(e,t,r){var n;let i=t.queryKey,a=null!=(n=t.queryHash)?n:r7(i,t),s=this.get(a);return s||(s=new nC({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){rQ(this,em).has(e.queryHash)||(rQ(this,em).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=rQ(this,em).get(e.queryHash);t&&(e.destroy(),t===e&&rQ(this,em).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){np.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return rQ(this,em).get(e)}getAll(){return[...rQ(this,em).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>r5(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.getAll();return Object.keys(e).length>0?t.filter(t=>r5(e,t)):t}notify(e){np.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){np.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){np.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}constructor(e={}){super(),rX(this,em,{writable:!0,value:void 0}),this.config=e,rZ(this,em,new Map)}}),a_=(ev=new WeakMap,eg=new WeakMap,eA=new WeakMap,ey=new WeakMap,ex=new WeakSet,class extends nB{setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){rQ(this,eg).includes(e)||(rQ(this,eg).push(e),this.clearGcTimeout(),rQ(this,eA).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){rZ(this,eg,rQ(this,eg).filter(t=>t!==e)),this.scheduleGc(),rQ(this,eA).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){rQ(this,eg).length||("pending"===this.state.status?this.scheduleGc():rQ(this,eA).remove(this))}continue(){var e,t;return null!=(t=null==(e=rQ(this,ey))?void 0:e.continue())?t:this.execute(this.state.variables)}async execute(e){var t,r,n,i,a,s,o,l,u,c,d,f,h,p,m,g,A,y,x,B,C;let S=()=>{rY(this,ex,aq).call(this,{type:"continue"})},E={client:rQ(this,ev),meta:this.options.meta,mutationKey:this.options.mutationKey};rZ(this,ey,nx({fn:()=>this.options.mutationFn?this.options.mutationFn(e,E):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{rY(this,ex,aq).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{rY(this,ex,aq).call(this,{type:"pause"})},onContinue:S,retry:null!=(t=this.options.retry)?t:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>rQ(this,eA).canRun(this)}));let T="pending"===this.state.status,b=!rQ(this,ey).canStart();try{if(T)S();else{rY(this,ex,aq).call(this,{type:"pending",variables:e,isPaused:b}),await (null==(c=(d=rQ(this,eA).config).onMutate)?void 0:c.call(d,e,this,E));let t=await (null==(f=(h=this.options).onMutate)?void 0:f.call(h,e,E));t!==this.state.context&&rY(this,ex,aq).call(this,{type:"pending",context:t,variables:e,isPaused:b})}let t=await rQ(this,ey).start();return await (null==(r=(n=rQ(this,eA).config).onSuccess)?void 0:r.call(n,t,e,this.state.context,this,E)),await (null==(i=(a=this.options).onSuccess)?void 0:i.call(a,t,e,this.state.context,E)),await (null==(s=(o=rQ(this,eA).config).onSettled)?void 0:s.call(o,t,null,this.state.variables,this.state.context,this,E)),await (null==(l=(u=this.options).onSettled)?void 0:l.call(u,t,null,e,this.state.context,E)),rY(this,ex,aq).call(this,{type:"success",data:t}),t}catch(t){try{throw await (null==(p=(m=rQ(this,eA).config).onError)?void 0:p.call(m,t,e,this.state.context,this,E)),await (null==(g=(A=this.options).onError)?void 0:g.call(A,t,e,this.state.context,E)),await (null==(y=(x=rQ(this,eA).config).onSettled)?void 0:y.call(x,void 0,t,this.state.variables,this.state.context,this,E)),await (null==(B=(C=this.options).onSettled)?void 0:B.call(C,void 0,t,e,this.state.context,E)),t}finally{rY(this,ex,aq).call(this,{type:"error",error:t})}}finally{rQ(this,eA).runNext(this)}}constructor(e){super(),r_(this,ex),rX(this,ev,{writable:!0,value:void 0}),rX(this,eg,{writable:!0,value:void 0}),rX(this,eA,{writable:!0,value:void 0}),rX(this,ey,{writable:!0,value:void 0}),rZ(this,ev,e.client),this.mutationId=e.mutationId,rZ(this,eA,e.mutationCache),rZ(this,eg,[]),this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}});function aq(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),np.batch(()=>{rQ(this,eg).forEach(t=>{t.onMutationUpdate(e)}),rQ(this,eA).notify({mutation:this,type:"updated",action:e})})}var a$=(eB=new WeakMap,eC=new WeakMap,eS=new WeakMap,class extends rq{build(e,t,r){let n=new a_({client:e,mutationCache:this,mutationId:++aZ(this,eS).value,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){rQ(this,eB).add(e);let t=a0(e);if("string"==typeof t){let r=rQ(this,eC).get(t);r?r.push(e):rQ(this,eC).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(rQ(this,eB).delete(e)){let t=a0(e);if("string"==typeof t){let r=rQ(this,eC).get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&rQ(this,eC).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=a0(e);if("string"!=typeof t)return!0;{let r=rQ(this,eC).get(t),n=null==r?void 0:r.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=a0(e);if("string"!=typeof t)return Promise.resolve();{var r,n;let i=null==(r=rQ(this,eC).get(t))?void 0:r.find(t=>t!==e&&t.state.isPaused);return null!=(n=null==i?void 0:i.continue())?n:Promise.resolve()}}clear(){np.batch(()=>{rQ(this,eB).forEach(e=>{this.notify({type:"removed",mutation:e})}),rQ(this,eB).clear(),rQ(this,eC).clear()})}getAll(){return Array.from(rQ(this,eB))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>r6(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getAll().filter(t=>r6(e,t))}notify(e){np.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return np.batch(()=>Promise.all(e.map(e=>e.continue().catch(r2))))}constructor(e={}){super(),rX(this,eB,{writable:!0,value:void 0}),rX(this,eC,{writable:!0,value:void 0}),rX(this,eS,{writable:!0,value:void 0}),this.config=e,rZ(this,eB,new Set),rZ(this,eC,new Map),rZ(this,eS,0)}});function a0(e){var t;return null==(t=e.options.scope)?void 0:t.id}function a1(e){return{onFetch:(t,r)=>{var n,i,a,s,o;let l=t.options,u=null==(a=t.fetchOptions)||null==(i=a.meta)||null==(n=i.fetchMore)?void 0:n.direction,c=(null==(s=t.state.data)?void 0:s.pages)||[],d=(null==(o=t.state.data)?void 0:o.pageParams)||[],f={pages:[],pageParams:[]},h=0,p=async()=>{let r=!1,n=nd(t.options,t.fetchOptions),i=async(e,i,a)=>{if(r)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);let s=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:i,direction:a?"backward":"forward",meta:t.options.meta};return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)}),e})(),o=await n(s),{maxPages:l}=t.options,u=a?nu:nl;return{pages:u(e.pages,o,l),pageParams:u(e.pageParams,i,l)}};if(u&&c.length){let e="backward"===u,t={pages:c,pageParams:d},r=(e?function(e,t){var r;let{pages:n,pageParams:i}=t;return n.length>0?null==(r=e.getPreviousPageParam)?void 0:r.call(e,n[0],n,i[0],i):void 0}:a2)(l,t);f=await i(t,r,e)}else{let t=null!=e?e:c.length;do{var a;let e=0===h?null!=(a=d[0])?a:l.initialPageParam:a2(l,f);if(h>0&&null==e)break;f=await i(f,e),h++}while(h{var e,n;return null==(e=(n=t.options).persister)?void 0:e.call(n,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=p}}}function a2(e,t){let{pages:r,pageParams:n}=t,i=r.length-1;return r.length>0?e.getNextPageParam(r[i],r,n[i],n):void 0}var a9=(eE=new WeakMap,eT=new WeakMap,eb=new WeakMap,eD=new WeakMap,eM=new WeakMap,ew=new WeakMap,eF=new WeakMap,eR=new WeakMap,class{mount(){aZ(this,ew).value++,1===rQ(this,ew)&&(rZ(this,eF,nf.subscribe(async e=>{e&&(await this.resumePausedMutations(),rQ(this,eE).onFocus())})),rZ(this,eR,nm.subscribe(async e=>{e&&(await this.resumePausedMutations(),rQ(this,eE).onOnline())})))}unmount(){var e,t;aZ(this,ew).value--,0===rQ(this,ew)&&(null==(e=rQ(this,eF))||e.call(this),rZ(this,eF,void 0),null==(t=rQ(this,eR))||t.call(this),rZ(this,eR,void 0))}isFetching(e){return rQ(this,eE).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return rQ(this,eT).findAll({...e,status:"pending"}).length}getQueryData(e){var t;let r=this.defaultQueryOptions({queryKey:e});return null==(t=rQ(this,eE).get(r.queryHash))?void 0:t.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=rQ(this,eE).build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(r4(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return rQ(this,eE).findAll(e).map(e=>{let{queryKey:t,state:r}=e;return[t,r.data]})}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),i=rQ(this,eE).get(n.queryHash),a=null==i?void 0:i.state.data,s="function"==typeof t?t(a):t;if(void 0!==s)return rQ(this,eE).build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return np.batch(()=>rQ(this,eE).findAll(e).map(e=>{let{queryKey:n}=e;return[n,this.setQueryData(n,t,r)]}))}getQueryState(e){var t;let r=this.defaultQueryOptions({queryKey:e});return null==(t=rQ(this,eE).get(r.queryHash))?void 0:t.state}removeQueries(e){let t=rQ(this,eE);np.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=rQ(this,eE);return np.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={revert:!0,...t};return Promise.all(np.batch(()=>rQ(this,eE).findAll(e).map(e=>e.cancel(r)))).then(r2).catch(r2)}invalidateQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return np.batch(()=>{var r,n;return(rQ(this,eE).findAll(e).forEach(e=>{e.invalidate()}),(null==e?void 0:e.refetchType)==="none")?Promise.resolve():this.refetchQueries({...e,type:null!=(n=null!=(r=null==e?void 0:e.refetchType)?r:null==e?void 0:e.type)?n:"active"},t)})}refetchQueries(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={...r,cancelRefetch:null==(t=r.cancelRefetch)||t};return Promise.all(np.batch(()=>rQ(this,eE).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(r2)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(r2)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=rQ(this,eE).build(this,t);return r.isStaleByTime(r4(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(r2).catch(r2)}fetchInfiniteQuery(e){return e.behavior=a1(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(r2).catch(r2)}ensureInfiniteQueryData(e){return e.behavior=a1(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return nm.isOnline()?rQ(this,eT).resumePausedMutations():Promise.resolve()}getQueryCache(){return rQ(this,eE)}getMutationCache(){return rQ(this,eT)}getDefaultOptions(){return rQ(this,eb)}setDefaultOptions(e){rZ(this,eb,e)}setQueryDefaults(e,t){rQ(this,eD).set(ne(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...rQ(this,eD).values()],r={};return t.forEach(t=>{nt(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){rQ(this,eM).set(ne(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...rQ(this,eM).values()],r={};return t.forEach(t=>{nt(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...rQ(this,eb).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=r7(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===nc&&(t.enabled=!1),t}defaultMutationOptions(e){return(null==e?void 0:e._defaulted)?e:{...rQ(this,eb).mutations,...(null==e?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){rQ(this,eE).clear(),rQ(this,eT).clear()}constructor(e={}){rX(this,eE,{writable:!0,value:void 0}),rX(this,eT,{writable:!0,value:void 0}),rX(this,eb,{writable:!0,value:void 0}),rX(this,eD,{writable:!0,value:void 0}),rX(this,eM,{writable:!0,value:void 0}),rX(this,ew,{writable:!0,value:void 0}),rX(this,eF,{writable:!0,value:void 0}),rX(this,eR,{writable:!0,value:void 0}),rZ(this,eE,e.queryCache||new aY),rZ(this,eT,e.mutationCache||new a$),rZ(this,eb,e.defaultOptions||{}),rZ(this,eD,new Map),rZ(this,eM,new Map),rZ(this,ew,0)}}),a3=e.i(8155);let a4=e=>e,a8=e=>{let t=(0,a3.createStore)(e),r=e=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a4,r=eP.default.useSyncExternalStore(e.subscribe,eP.default.useCallback(()=>t(e.getState()),[e,t]),eP.default.useCallback(()=>t(e.getInitialState()),[e,t]));return eP.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},a5=eP.createContext(null);function a6(e){let{map:t,children:r,onChange:n,domElement:i}=e,a=t.map(e=>e.name+e.keys).join("-"),s=eP.useMemo(()=>{let e,r;return e=()=>t.reduce((e,t)=>({...e,[t.name]:!1}),{}),(r=(t,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let a=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,s=e(n.getState());a=r=>{let n=e(r);if(!i(s,n)){let e=s;t(s=n,e)}},(null==r?void 0:r.fireImmediately)&&t(s,s)}return i(a)},e(t,r,n)})?a8(r):a8},[a]),o=eP.useMemo(()=>[s.subscribe,s.getState,s],[a]),l=s.setState;return eP.useEffect(()=>{let e=t.map(e=>{let{name:t,keys:r,up:i}=e;return{keys:r,up:i,fn:e=>{l({[t]:e}),n&&n(t,e,o[1]())}}}).reduce((e,t)=>{let{keys:r,fn:n,up:i=!0}=t;return r.forEach(t=>e[t]={fn:n,pressed:!1,up:i}),e},{}),r=t=>{let{key:r,code:n}=t,i=e[r]||e[n];if(!i)return;let{fn:a,pressed:s,up:o}=i;i.pressed=!0,(o||!s)&&a(!0)},a=t=>{let{key:r,code:n}=t,i=e[r]||e[n];if(!i)return;let{fn:a,up:s}=i;i.pressed=!1,s&&a(!1)},s=i||window;return s.addEventListener("keydown",r,{passive:!0}),s.addEventListener("keyup",a,{passive:!0}),()=>{s.removeEventListener("keydown",r),s.removeEventListener("keyup",a)}},[i,a]),eP.createElement(a5.Provider,{value:o,children:r})}var a7=Object.defineProperty;class se{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,n=r.length;t((e,t,r)=>t in e?a7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r))(this,"_listeners")}}var st=Object.defineProperty,sr=(e,t,r)=>(((e,t,r)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),r);let sn=new eO.Euler(0,0,0,"YXZ"),si=new eO.Vector3,sa={type:"change"},ss={type:"lock"},so={type:"unlock"},sl=Math.PI/2;class su extends se{constructor(e,t){super(),sr(this,"camera"),sr(this,"domElement"),sr(this,"isLocked"),sr(this,"minPolarAngle"),sr(this,"maxPolarAngle"),sr(this,"pointerSpeed"),sr(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(sn.setFromQuaternion(this.camera.quaternion),sn.y-=.002*e.movementX*this.pointerSpeed,sn.x-=.002*e.movementY*this.pointerSpeed,sn.x=Math.max(sl-this.maxPolarAngle,Math.min(sl-this.minPolarAngle,sn.x)),this.camera.quaternion.setFromEuler(sn),this.dispatchEvent(sa))}),sr(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(ss),this.isLocked=!0):(this.dispatchEvent(so),this.isLocked=!1))}),sr(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),sr(this,"connect",e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),sr(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),sr(this,"dispose",()=>{this.disconnect()}),sr(this,"getObject",()=>this.camera),sr(this,"direction",new eO.Vector3(0,0,-1)),sr(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),sr(this,"moveForward",e=>{si.setFromMatrixColumn(this.camera.matrix,0),si.crossVectors(this.camera.up,si),this.camera.position.addScaledVector(si,e)}),sr(this,"moveRight",e=>{si.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(si,e)}),sr(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),sr(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}var sc=function(e){return e.forward="forward",e.backward="backward",e.left="left",e.right="right",e.up="up",e.down="down",e.camera1="camera1",e.camera2="camera2",e.camera3="camera3",e.camera4="camera4",e.camera5="camera5",e.camera6="camera6",e.camera7="camera7",e.camera8="camera8",e.camera9="camera9",e}(sc||{});function sd(){let{speedMultiplier:e,setSpeedMultiplier:t}=(0,n$.useControls)(),[r,n]=function(e){let[t,r,n]=eP.useContext(a5);return[t,r]}(),{camera:i,gl:a}=(0,eJ.useThree)(),{nextCamera:s,setCameraIndex:o,cameraCount:l}=aG(),u=(0,eP.useRef)(null),c=(0,eP.useRef)(new eO.Vector3),d=(0,eP.useRef)(new eO.Vector3),f=(0,eP.useRef)(new eO.Vector3);return(0,eP.useEffect)(()=>{let e=new su(i,a.domElement);u.current=e;let t=t=>{e.isLocked?s():t.target===a.domElement&&e.lock()};return document.addEventListener("click",t),()=>{document.removeEventListener("click",t),e.dispose()}},[i,a,s]),(0,eP.useEffect)(()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return r(t=>{for(let r=0;r{let e=e=>{e.preventDefault();let r=e.deltaY>0?-1:1,n=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*r;t(e=>Math.max(.1,Math.min(5,Math.round((e+n)*20)/20)))},r=a.domElement;return r.addEventListener("wheel",e,{passive:!1}),()=>{r.removeEventListener("wheel",e)}},[a]),(0,eV.useFrame)((t,r)=>{let{forward:a,backward:s,left:o,right:l,up:u,down:h}=n();(a||s||o||l||u||h)&&(i.getWorldDirection(c.current),c.current.normalize(),d.current.crossVectors(i.up,c.current).normalize(),f.current.set(0,0,0),a&&f.current.add(c.current),s&&f.current.sub(c.current),o&&f.current.add(d.current),l&&f.current.sub(d.current),u&&(f.current.y+=1),h&&(f.current.y-=1),f.current.lengthSq()>0&&(f.current.normalize().multiplyScalar(80*e*r),i.position.add(f.current)))}),null}let sf=[{name:"forward",keys:["KeyW"]},{name:"backward",keys:["KeyS"]},{name:"left",keys:["KeyA"]},{name:"right",keys:["KeyD"]},{name:"up",keys:["Space"]},{name:"down",keys:["ShiftLeft","ShiftRight"]},{name:"camera1",keys:["Digit1"]},{name:"camera2",keys:["Digit2"]},{name:"camera3",keys:["Digit3"]},{name:"camera4",keys:["Digit4"]},{name:"camera5",keys:["Digit5"]},{name:"camera6",keys:["Digit6"]},{name:"camera7",keys:["Digit7"]},{name:"camera8",keys:["Digit8"]},{name:"camera9",keys:["Digit9"]}];function sh(){return(0,eP.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()};return window.addEventListener("keydown",e,{capture:!0}),window.addEventListener("keyup",e,{capture:!0}),()=>{window.removeEventListener("keydown",e,{capture:!0}),window.removeEventListener("keyup",e,{capture:!0})}},[]),(0,eI.jsx)(a6,{map:sf,children:(0,eI.jsx)(sd,{})})}var sp=function(){var e;return"undefined"!=typeof window&&!!(null==(e=window.document)?void 0:e.createElement)}();function sm(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function sv(e){return e?"self"in e?e.self:sm(e).defaultView||window:self}function sg(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{activeElement:r}=sm(e);if(!(null==r?void 0:r.nodeName))return null;if(sy(r)&&r.contentDocument)return sg(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=sm(r).getElementById(e);if(t)return t}}return r}function sA(e,t){return e===t||e.contains(t)}function sy(e){return"IFRAME"===e.tagName}function sx(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==sB.indexOf(e.type)}var sB=["button","color","file","image","reset","submit"];function sC(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function sS(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function sE(e){return e.isContentEditable||sS(e)}function sT(e){let t=0,r=0;if(sS(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let n=sm(e).getSelection();if((null==n?void 0:n.rangeCount)&&n.anchorNode&&sA(e,n.anchorNode)&&n.focusNode&&sA(e,n.focusNode)){let i=n.getRangeAt(0),a=i.cloneRange();a.selectNodeContents(e),a.setEnd(i.startContainer,i.startOffset),t=a.toString().length,a.setEnd(i.endContainer,i.endOffset),r=a.toString().length}}return{start:t,end:r}}function sb(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function sD(e){if(!e)return null;let t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){let{overflowY:r}=getComputedStyle(e);if(t(r))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){let{overflowX:r}=getComputedStyle(e);if(t(r))return e}return sD(e.parentElement)||document.scrollingElement||document.body}function sM(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n1?t-1:0),n=1;n{if(n){let t=setTimeout(e,n);return()=>clearTimeout(t)}let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,a,!0),r()}),a=()=>{i(),r()};return e.addEventListener(t,a,{once:!0,capture:!0}),i}function s_(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window,i=[];try{for(let a of(n.document.addEventListener(e,t,r),Array.from(n.frames)))i.push(s_(e,t,r,a))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,r)}catch(e){}for(let e of i)e()}}var sq={...eP},s$=sq.useId;sq.useDeferredValue;var s0=sq.useInsertionEffect,s1=sp?eP.useLayoutEffect:eP.useEffect;function s2(e){let t=(0,eP.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return s0?s0(()=>{t.current=e}):t.current=e,(0,eP.useCallback)(function(){for(var e,r=arguments.length,n=Array(r),i=0;i{if(t.some(Boolean))return e=>{for(let r of t)sz(r,e)}},t)}function s3(e){if(s$){let t=s$();return e||t}let[t,r]=(0,eP.useState)(e);return s1(()=>{if(e||t)return;let n=Math.random().toString(36).slice(2,8);r("id-".concat(n))},[e,t]),e||t}function s4(e,t){let r=(0,eP.useRef)(!1);(0,eP.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,eP.useEffect)(()=>()=>{r.current=!1},[])}function s8(){return(0,eP.useReducer)(()=>[],[])}function s5(e){return s2("function"==typeof e?e:()=>e)}function s6(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=(0,eP.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:n}}function s7(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,[r,n]=(0,eP.useState)(null);return{portalRef:s9(n,t),portalNode:r,domReady:!e||r}}var oe=!1,ot=!1,or=0,on=0;function oi(e){(function(e){let t=e.movementX||e.screenX-or,r=e.movementY||e.screenY-on;return or=e.screenX,on=e.screenY,t||r||!1})(e)&&(ot=!0)}function oa(){ot=!1}function os(e){let t=eP.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function oo(e,t){return eP.memo(e,t)}function ol(e,t){let r,{wrapElement:n,render:i,...a}=t,s=s9(t.ref,i&&(0,eP.isValidElement)(i)&&("ref"in i.props||"ref"in i)?({...i.props}).ref||i.ref:null);if(eP.isValidElement(i)){let e={...i.props,ref:s};r=eP.cloneElement(i,function(e,t){let r={...e};for(let n in t){if(!sP(t,n))continue;if("className"===n){let n="className";r[n]=e[n]?"".concat(e[n]," ").concat(t[n]):t[n];continue}if("style"===n){let n="style";r[n]=e[n]?{...e[n],...t[n]}:t[n];continue}let i=t[n];if("function"==typeof i&&n.startsWith("on")){let t=e[n];if("function"==typeof t){r[n]=function(){for(var e=arguments.length,r=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return e(t)};return t.displayName=e.name,t}function oc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=eP.createContext(void 0),n=eP.createContext(void 0),i=()=>eP.useContext(r),a=t=>e.reduceRight((e,r)=>(0,eI.jsx)(r,{...t,children:e}),(0,eI.jsx)(r.Provider,{...t}));return{context:r,scopedContext:n,useContext:i,useScopedContext:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=eP.useContext(n),r=i();return e?t:t||r},useProviderContext:()=>{let e=eP.useContext(n),t=i();if(!e||e!==t)return t},ContextProvider:a,ScopedContextProvider:e=>(0,eI.jsx)(a,{...e,children:t.reduceRight((t,r)=>(0,eI.jsx)(r,{...e,children:t}),(0,eI.jsx)(n.Provider,{...e}))})}}var od=oc(),of=od.useContext;od.useScopedContext,od.useProviderContext;var oh=oc([od.ContextProvider],[od.ScopedContextProvider]),op=oh.useContext;oh.useScopedContext;var om=oh.useProviderContext,ov=oh.ContextProvider,og=oh.ScopedContextProvider,oA=(0,eP.createContext)(void 0),oy=(0,eP.createContext)(void 0),ox=(0,eP.createContext)(!0),oB="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function oC(e){return!(!e.matches(oB)||!sC(e)||e.closest("[inert]"))}function oS(e){if(!oC(e)||0>Number.parseInt(e.getAttribute("tabindex")||"0",10))return!1;if(!("form"in e)||!e.form||e.checked||"radio"!==e.type)return!0;let t=e.form.elements.namedItem(e.name);if(!t||!("length"in t))return!0;let r=sg(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function oE(e,t){let r=Array.from(e.querySelectorAll(oB));t&&r.unshift(e);let n=r.filter(oC);return n.forEach((e,t)=>{if(sy(e)&&e.contentDocument){let r=e.contentDocument.body;n.splice(t,1,...oE(r))}}),n}function oT(e,t,r){let n=Array.from(e.querySelectorAll(oB)),i=n.filter(oS);return(t&&oS(e)&&i.unshift(e),i.forEach((e,t)=>{if(sy(e)&&e.contentDocument){let n=oT(e.contentDocument.body,!1,r);i.splice(t,1,...n)}}),!i.length&&r)?n:i}function ob(e,t){return function(e,t,r,n){let i=sg(e),a=oE(e,t),s=a.indexOf(i),o=a.slice(s+1);return o.find(oS)||(r?a.find(oS):null)||(n?o[0]:null)||null}(document.body,!1,e,t)}function oD(e,t){return function(e,t,r,n){let i=sg(e),a=oE(e,t).reverse(),s=a.indexOf(i),o=a.slice(s+1);return o.find(oS)||(r?a.find(oS):null)||(n?o[0]:null)||null}(document.body,!1,e,t)}function oM(e){let t=sg(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function ow(e){let t=sg(e);if(!t)return!1;if(sA(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector("#".concat(CSS.escape(r))))}function oF(e){!ow(e)&&oC(e)&&e.focus()}var oR=sJ(),oI=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],oP=Symbol("safariFocusAncestor");function oL(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function oU(e,t){return s2(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var oG=!1,oO=!0;function oH(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(oO=!1)}function oN(e){e.metaKey||e.ctrlKey||e.altKey||(oO=!0)}var ok=ou(function(e){var t,r,n,i,a;let{focusable:s=!0,accessibleWhenDisabled:o,autoFocus:l,onFocusVisible:u,...c}=e,d=(0,eP.useRef)(null);(0,eP.useEffect)(()=>{s&&(oG||(s_("mousedown",oH,!0),s_("keydown",oN,!0),oG=!0))},[s]),oR&&(0,eP.useEffect)(()=>{if(!s)return;let e=d.current;if(!e||!oL(e))return;let t="labels"in e?e.labels:null;if(!t)return;let r=()=>queueMicrotask(()=>e.focus());for(let e of t)e.addEventListener("mouseup",r);return()=>{for(let e of t)e.removeEventListener("mouseup",r)}},[s]);let f=s&&sH(c),h=!!f&&!o,[p,m]=(0,eP.useState)(!1);(0,eP.useEffect)(()=>{s&&h&&p&&m(!1)},[s,h,p]),(0,eP.useEffect)(()=>{if(!s||!p)return;let e=d.current;if(!e||"undefined"==typeof IntersectionObserver)return;let t=new IntersectionObserver(()=>{oC(e)||m(!1)});return t.observe(e),()=>t.disconnect()},[s,p]);let g=oU(c.onKeyPressCapture,f),A=oU(c.onMouseDownCapture,f),y=oU(c.onClickCapture,f),x=c.onMouseDown,B=s2(e=>{if(null==x||x(e),e.defaultPrevented||!s)return;let t=e.currentTarget;if(!oR||sV(e)||!sx(t)&&!oL(t))return;let r=!1,n=()=>{r=!0};t.addEventListener("focusin",n,{capture:!0,once:!0});let i=function(e){for(;e&&!oC(e);)e=e.closest(oB);return e||null}(t.parentElement);i&&(i[oP]=!0),sY(t,"mouseup",()=>{t.removeEventListener("focusin",n,!0),i&&(i[oP]=!1),r||oF(t)})}),C=(e,t)=>{if(t&&(e.currentTarget=t),!s)return;let r=e.currentTarget;r&&oM(r)&&(null==u||u(e),e.defaultPrevented||(r.dataset.focusVisible="true",m(!0)))},S=c.onKeyDownCapture,E=s2(e=>{if(null==S||S(e),e.defaultPrevented||!s||p||e.metaKey||e.altKey||e.ctrlKey||!sQ(e))return;let t=e.currentTarget;sY(t,"focusout",()=>C(e,t))}),T=c.onFocusCapture,b=s2(e=>{if(null==T||T(e),e.defaultPrevented||!s)return;if(!sQ(e))return void m(!1);let t=e.currentTarget;oO||function(e){let{tagName:t,readOnly:r,type:n}=e;return"TEXTAREA"===t&&!r||"SELECT"===t&&!r||("INPUT"!==t||r?!!e.isContentEditable||"combobox"===e.getAttribute("role")&&!!e.dataset.name:oI.includes(n))}(e.target)?sY(e.target,"focusout",()=>C(e,t)):m(!1)}),D=c.onBlur,M=s2(e=>{null==D||D(e),s&&sZ(e)&&(e.currentTarget.removeAttribute("data-focus-visible"),m(!1))}),w=(0,eP.useContext)(ox),F=s2(e=>{s&&l&&e&&w&&queueMicrotask(()=>{!oM(e)&&oC(e)&&e.focus()})}),R=function(e,t){let r=e=>{if("string"==typeof e)return e},[n,i]=(0,eP.useState)(()=>r(void 0));return s1(()=>{let t=e&&"current"in e?e.current:e;i((null==t?void 0:t.tagName.toLowerCase())||r(void 0))},[e,t]),n}(d),I=s&&(!R||"button"===R||"summary"===R||"input"===R||"select"===R||"textarea"===R||"a"===R),P=s&&(!R||"button"===R||"input"===R||"select"===R||"textarea"===R),L=c.style,U=(0,eP.useMemo)(()=>h?{pointerEvents:"none",...L}:L,[h,L]);return c={"data-focus-visible":s&&p||void 0,"data-autofocus":l||void 0,"aria-disabled":f||void 0,...c,ref:s9(d,F,c.ref),style:U,tabIndex:(t=s,r=h,n=I,i=P,a=c.tabIndex,t?r?n&&!i?-1:void 0:n?a:a||0:a),disabled:!!P&&!!h||void 0,contentEditable:f?void 0:c.contentEditable,onKeyPressCapture:g,onClickCapture:y,onMouseDownCapture:A,onMouseDown:B,onKeyDownCapture:E,onFocusCapture:b,onBlur:M},sN(c)});function oz(e){let t=[];for(let r of e)t.push(...r);return t}function oj(e){return e.slice().reverse()}function oK(e,t,r){return s2(n=>{var i;if(null==t||t(n),n.defaultPrevented||n.isPropagationStopped()||!sQ(n)||"Shift"===n.key||"Control"===n.key||"Alt"===n.key||"Meta"===n.key||function(e){let t=e.target;return(!t||!!sS(t))&&1===e.key.length&&!e.ctrlKey&&!e.metaKey}(n))return;let a=e.getState(),s=null==(i=sw(e,a.activeId))?void 0:i.element;if(!s)return;let{view:o,...l}=n;s!==(null==r?void 0:r.current)&&s.focus(),!function(e,t,r){let n=new KeyboardEvent(t,r);return e.dispatchEvent(n)}(s,n.type,l)&&n.preventDefault(),n.currentTarget.contains(s)&&n.stopPropagation()})}os(function(e){return ol("div",ok(e))});var oJ=ou(function(e){let{store:t,composite:r=!0,focusOnMove:n=r,moveOnKeyPress:i=!0,...a}=e,s=om();sG(t=t||s,!1);let o=(0,eP.useRef)(null),l=(0,eP.useRef)(null),u=function(e){let[t,r]=(0,eP.useState)(!1),n=(0,eP.useCallback)(()=>r(!0),[]),i=e.useState(t=>sw(e,t.activeId));return(0,eP.useEffect)(()=>{let e=null==i?void 0:i.element;t&&e&&(r(!1),e.focus({preventScroll:!0}))},[i,t]),n}(t),c=t.useState("moves"),[,d]=function(e){let[t,r]=(0,eP.useState)(null);return s1(()=>{if(null==t||!e)return;let r=null;return e(e=>(r=e,t)),()=>{e(r)}},[t,e]),[t,r]}(r?t.setBaseElement:null);(0,eP.useEffect)(()=>{var e;if(!t||!c||!r||!n)return;let{activeId:i}=t.getState(),a=null==(e=sw(t,i))?void 0:e.element;a&&("scrollIntoView"in a?(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",inline:"nearest",...void 0})):a.focus())},[t,c,r,n]),s1(()=>{if(!t||!c||!r)return;let{baseElement:e,activeId:n}=t.getState();if(null!==n||!e)return;let i=l.current;l.current=null,i&&sW(i,{relatedTarget:e}),oM(e)||e.focus()},[t,c,r]);let f=t.useState("activeId"),h=t.useState("virtualFocus");s1(()=>{var e;if(!t||!r||!h)return;let n=l.current;if(l.current=null,!n)return;let i=(null==(e=sw(t,f))?void 0:e.element)||sg(n);i!==n&&sW(n,{relatedTarget:i})},[t,f,h,r]);let p=oK(t,a.onKeyDownCapture,l),m=oK(t,a.onKeyUpCapture,l),g=a.onFocusCapture,A=s2(e=>{if(null==g||g(e),e.defaultPrevented||!t)return;let{virtualFocus:r}=t.getState();if(!r)return;let n=e.relatedTarget,i=function(e){let t=e[sF];return delete e[sF],t}(e.currentTarget);sQ(e)&&i&&(e.stopPropagation(),l.current=n)}),y=a.onFocus,x=s2(e=>{if(null==y||y(e),e.defaultPrevented||!r||!t)return;let{relatedTarget:n}=e,{virtualFocus:i}=t.getState();i?sQ(e)&&!sR(t,n)&&queueMicrotask(u):sQ(e)&&t.setActiveId(null)}),B=a.onBlurCapture,C=s2(e=>{var r;if(null==B||B(e),e.defaultPrevented||!t)return;let{virtualFocus:n,activeId:i}=t.getState();if(!n)return;let a=null==(r=sw(t,i))?void 0:r.element,s=e.relatedTarget,o=sR(t,s),u=l.current;l.current=null,sQ(e)&&o?(s===a?u&&u!==s&&sW(u,e):a?sW(a,e):u&&sW(u,e),e.stopPropagation()):!sR(t,e.target)&&a&&sW(a,e)}),S=a.onKeyDown,E=s5(i),T=s2(e=>{var r;if(null==S||S(e),e.nativeEvent.isComposing||e.defaultPrevented||!t||!sQ(e))return;let{orientation:n,renderedItems:i,activeId:a}=t.getState(),s=sw(t,a);if(null==(r=null==s?void 0:s.element)?void 0:r.isConnected)return;let o="horizontal"!==n,l="vertical"!==n,u=i.some(e=>!!e.rowId);if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&sS(e.currentTarget))return;let c={ArrowUp:(u||o)&&(()=>{if(u){let e=oz(oj(function(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}(i))).find(e=>!e.disabled);return null==e?void 0:e.id}return null==t?void 0:t.last()}),ArrowRight:(u||l)&&t.first,ArrowDown:(u||o)&&t.first,ArrowLeft:(u||l)&&t.last,Home:t.first,End:t.last,PageUp:t.first,PageDown:t.last}[e.key];if(c){let r=c();if(void 0!==r){if(!E(e))return;e.preventDefault(),t.move(r)}}});return a=s6(a,e=>(0,eI.jsx)(ov,{value:t,children:e}),[t]),a={"aria-activedescendant":t.useState(e=>{var n;if(t&&r&&e.virtualFocus)return null==(n=sw(t,e.activeId))?void 0:n.id}),...a,ref:s9(o,d,a.ref),onKeyDownCapture:p,onKeyUpCapture:m,onFocusCapture:A,onFocus:x,onBlurCapture:C,onKeyDown:T},a=ok({focusable:t.useState(e=>r&&(e.virtualFocus||null===e.activeId)),...a})});os(function(e){return ol("div",oJ(e))});var oV=oc();oV.useContext,oV.useScopedContext;var oQ=oV.useProviderContext,oW=oc([oV.ContextProvider],[oV.ScopedContextProvider]);oW.useContext,oW.useScopedContext;var oX=oW.useProviderContext,oZ=oW.ContextProvider,oY=oW.ScopedContextProvider,o_=(0,eP.createContext)(void 0),oq=(0,eP.createContext)(void 0),o$=oc([oZ],[oY]);o$.useContext,o$.useScopedContext;var o0=o$.useProviderContext,o1=o$.ContextProvider,o2=o$.ScopedContextProvider,o9=ou(function(e){let{store:t,...r}=e,n=o0();return t=t||n,r={...r,ref:s9(null==t?void 0:t.setAnchorElement,r.ref)}});os(function(e){return ol("div",o9(e))});var o3=(0,eP.createContext)(void 0),o4=oc([o1,ov],[o2,og]),o8=o4.useContext,o5=o4.useScopedContext,o6=o4.useProviderContext,o7=o4.ContextProvider,le=o4.ScopedContextProvider,lt=(0,eP.createContext)(void 0),lr=(0,eP.createContext)(!1);function ln(e,t){let r=e.__unstableInternals;return sG(r,"Invalid store"),r[t]}function li(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n2&&void 0!==arguments[2]?arguments[2]:d;return r.add(t),p.set(t,e),()=>{var e;null==(e=h.get(t))||e(),h.delete(t),p.delete(t),r.delete(t)}},g=function(e,t){var n,o;let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!sP(i,e))return;let c=(o=i[e],"function"==typeof t?t("function"==typeof o?o():o):t);if(c===i[e])return;if(!l)for(let t of r)null==(n=null==t?void 0:t.setState)||n.call(t,e,c);let m=i;i={...i,[e]:c};let g=Symbol();s=g,u.add(e);let A=(t,r,n)=>{var a;let s=p.get(t);(!s||s.some(t=>n?n.has(t):t===e))&&(null==(a=h.get(t))||a(),h.set(t,t(i,r)))};for(let e of d)A(e,m);queueMicrotask(()=>{if(s!==g)return;let e=i;for(let e of f)A(e,a,u);a=e,u.clear()})},A={getState:()=>i,setState:g,__unstableInternals:{setup:e=>(c.add(e),()=>c.delete(e)),init:()=>{let e=l.size,t=Symbol();l.add(t);let n=()=>{l.delete(t),l.size||o()};if(e)return n;let a=Object.keys(i).map(e=>sL(...r.map(t=>{var r;let n=null==(r=null==t?void 0:t.getState)?void 0:r.call(t);if(n&&sP(n,e))return ll(t,[e],t=>{g(e,t[e],!0)})}))),s=[];for(let e of c)s.push(e());return o=sL(...a,...s,...r.map(ls)),n},subscribe:(e,t)=>m(e,t),sync:(e,t)=>(h.set(t,t(i,i)),m(e,t)),batch:(e,t)=>(h.set(t,t(i,a)),m(e,t,f)),pick:e=>li(function(e,t){let r={};for(let n of t)sP(e,n)&&(r[n]=e[n]);return r}(i,e),A),omit:e=>li(function(e,t){let r={...e};for(let e of t)sP(r,e)&&delete r[e];return r}(i,e),A)}};return A}function la(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n!e.disabled&&e.value);return(null==n?void 0:n.value)===t}function lp(e,t){return!!t&&null!=e&&(e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}var lm=ou(function(e){let{store:t,focusable:r=!0,autoSelect:n=!1,getAutoSelectId:i,setValueOnChange:a,showMinLength:s=0,showOnChange:o,showOnMouseDown:l,showOnClick:u=l,showOnKeyDown:c,showOnKeyPress:d=c,blurActiveItemOnClick:f,setValueOnClick:h=!0,moveOnKeyPress:p=!0,autoComplete:m="list",...g}=e,A=o6();sG(t=t||A,!1);let y=(0,eP.useRef)(null),[x,B]=s8(),C=(0,eP.useRef)(!1),S=(0,eP.useRef)(!1),E=t.useState(e=>e.virtualFocus&&n),T="inline"===m||"both"===m,[b,D]=(0,eP.useState)(T);!function(e,t){let r=(0,eP.useRef)(!1);s1(()=>{if(r.current)return e();r.current=!0},t),s1(()=>()=>{r.current=!1},[])}(()=>{T&&D(!0)},[T]);let M=t.useState("value"),w=(0,eP.useRef)();(0,eP.useEffect)(()=>ll(t,["selectedValue","activeId"],(e,t)=>{w.current=t.selectedValue}),[]);let F=t.useState(e=>{var t;if(T&&b){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=w.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),R=t.useState("renderedItems"),I=t.useState("open"),P=t.useState("contentElement"),L=(0,eP.useMemo)(()=>{if(!T||!b)return M;if(lh(R,F,E)){if(lp(M,F)){let e=(null==F?void 0:F.slice(M.length))||"";return M+e}return M}return F||M},[T,b,R,F,E,M]);(0,eP.useEffect)(()=>{let e=y.current;if(!e)return;let t=()=>D(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,eP.useEffect)(()=>{if(!T||!b||!F||!lh(R,F,E)||!lp(M,F))return;let e=sI;return queueMicrotask(()=>{let t=y.current;if(!t)return;let{start:r,end:n}=sT(t),i=M.length,a=F.length;sM(t,i,a),e=()=>{if(!oM(t))return;let{start:e,end:s}=sT(t);e===i&&s===a&&sM(t,r,n)}}),()=>e()},[x,T,b,F,R,E,M]);let U=(0,eP.useRef)(null),G=s2(i),O=(0,eP.useRef)(null);(0,eP.useEffect)(()=>{if(!I||!P)return;let e=sD(P);if(!e)return;U.current=e;let r=()=>{C.current=!1},n=()=>{if(!t||!C.current)return;let{activeId:e}=t.getState();null!==e&&e!==O.current&&(C.current=!1)},i={passive:!0,capture:!0};return e.addEventListener("wheel",r,i),e.addEventListener("touchmove",r,i),e.addEventListener("scroll",n,i),()=>{e.removeEventListener("wheel",r,!0),e.removeEventListener("touchmove",r,!0),e.removeEventListener("scroll",n,!0)}},[I,P,t]),s1(()=>{M&&(S.current||(C.current=!0))},[M]),s1(()=>{"always"!==E&&I||(C.current=I)},[E,I]);let H=t.useState("resetValueOnSelect");s4(()=>{var e,r;let n=C.current;if(!t||!I||!n&&!H)return;let{baseElement:i,contentElement:a,activeId:s}=t.getState();if(!i||oM(i)){if(null==a?void 0:a.hasAttribute("data-placing")){let e=new MutationObserver(B);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(E&&n){let r=G(R),n=void 0!==r?r:null!=(e=function(e){let t=e.find(e=>{var t;return!e.disabled&&(null==(t=e.element)?void 0:t.getAttribute("role"))!=="tab"});return null==t?void 0:t.id}(R))?e:t.first();O.current=n,t.move(null!=n?n:null)}else{let e=null==(r=t.item(s||t.first()))?void 0:r.element;e&&"scrollIntoView"in e&&e.scrollIntoView({block:"nearest",inline:"nearest"})}}},[t,I,x,M,E,H,G,R]),(0,eP.useEffect)(()=>{if(!T)return;let e=y.current;if(!e)return;let r=[e,P].filter(e=>!!e),n=e=>{r.every(t=>sZ(e,t))&&(null==t||t.setValue(L))};for(let e of r)e.addEventListener("focusout",n);return()=>{for(let e of r)e.removeEventListener("focusout",n)}},[T,P,t,L]);let N=e=>e.currentTarget.value.length>=s,k=g.onChange,z=s5(null!=o?o:N),j=s5(null!=a?a:!t.tag),K=s2(e=>{if(null==k||k(e),e.defaultPrevented||!t)return;let r=e.currentTarget,{value:n,selectionStart:i,selectionEnd:a}=r,s=e.nativeEvent;if(C.current=!0,"input"===s.type&&(s.isComposing&&(C.current=!1,S.current=!0),T)){let e="insertText"===s.inputType||"insertCompositionText"===s.inputType,t=i===n.length;D(e&&t)}if(j(e)){let e=n===t.getState().value;t.setValue(n),queueMicrotask(()=>{sM(r,i,a)}),T&&E&&e&&B()}z(e)&&t.show(),E&&C.current||t.setActiveId(null)}),J=g.onCompositionEnd,V=s2(e=>{C.current=!0,S.current=!1,null==J||J(e),!e.defaultPrevented&&E&&B()}),Q=g.onMouseDown,W=s5(null!=f?f:()=>!!(null==t?void 0:t.getState().includesBaseElement)),X=s5(h),Z=s5(null!=u?u:N),Y=s2(e=>{null==Q||Q(e),e.defaultPrevented||e.button||e.ctrlKey||t&&(W(e)&&t.setActiveId(null),X(e)&&t.setValue(L),Z(e)&&sY(e.currentTarget,"mouseup",t.show))}),_=g.onKeyDown,q=s5(null!=d?d:N),$=s2(e=>{if(null==_||_(e),e.repeat||(C.current=!1),e.defaultPrevented||e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||!t)return;let{open:r}=t.getState();!r&&("ArrowUp"===e.key||"ArrowDown"===e.key)&&q(e)&&(e.preventDefault(),t.show())}),ee=g.onBlur,et=s2(e=>{if(C.current=!1,null==ee||ee(e),e.defaultPrevented)return}),er=s3(g.id),en=t.useState(e=>null===e.activeId);return g={id:er,role:"combobox","aria-autocomplete":"inline"===m||"list"===m||"both"===m||"none"===m?m:void 0,"aria-haspopup":sb(P,"listbox"),"aria-expanded":I,"aria-controls":null==P?void 0:P.id,"data-active-item":en||void 0,value:L,...g,ref:s9(y,g.ref),onChange:K,onCompositionEnd:V,onMouseDown:Y,onKeyDown:$,onBlur:et},g=oJ({store:t,focusable:r,...g,moveOnKeyPress:e=>!sO(p,e)&&(T&&D(!0),!0)}),{autoComplete:"off",...g=o9({store:t,...g})}}),lv=os(function(e){return ol("input",lm(e))});function lg(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var lA=Symbol("composite-hover"),ly=ou(function(e){let{store:t,focusOnHover:r=!0,blurOnHoverEnd:n=!!r,...i}=e,a=op();sG(t=t||a,!1);let s=((0,eP.useEffect)(()=>{oe||(s_("mousemove",oi,!0),s_("mousedown",oa,!0),s_("mouseup",oa,!0),s_("keydown",oa,!0),s_("scroll",oa,!0),oe=!0)},[]),s2(()=>ot)),o=i.onMouseMove,l=s5(r),u=s2(e=>{if((null==o||o(e),!e.defaultPrevented&&s())&&l(e)){if(!ow(e.currentTarget)){let e=null==t?void 0:t.getState().baseElement;e&&!oM(e)&&e.focus()}null==t||t.setActiveId(e.currentTarget.id)}}),c=i.onMouseLeave,d=s5(n),f=s2(e=>{var r;null==c||c(e),!(e.defaultPrevented||!s()||function(e){let t=lg(e);return!!t&&sA(e.currentTarget,t)}(e)||function(e){let t=lg(e);if(!t)return!1;do{if(sP(t,lA)&&t[lA])return!0;t=t.parentElement}while(t)return!1}(e))&&l(e)&&d(e)&&(null==t||t.setActiveId(null),null==(r=null==t?void 0:t.getState().baseElement)||r.focus())}),h=(0,eP.useCallback)(e=>{e&&(e[lA]=!0)},[]);return sN(i={...i,ref:s9(h,i.ref),onMouseMove:u,onMouseLeave:f})});oo(os(function(e){return ol("div",ly(e))}));var lx=ou(function(e){let{store:t,shouldRegisterItem:r=!0,getItem:n=sU,element:i,...a}=e,s=of();t=t||s;let o=s3(a.id),l=(0,eP.useRef)(i);return(0,eP.useEffect)(()=>{let e=l.current;if(!o||!e||!r)return;let i=n({id:o,element:e});return null==t?void 0:t.renderItem(i)},[o,r,n,t]),sN(a={...a,ref:s9(l,a.ref)})});function lB(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?sx(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(sx(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}os(function(e){return ol("div",lx(e))});var lC=Symbol("command"),lS=ou(function(e){let{clickOnEnter:t=!0,clickOnSpace:r=!0,...n}=e,i=(0,eP.useRef)(null),[a,s]=(0,eP.useState)(!1);(0,eP.useEffect)(()=>{i.current&&s(sx(i.current))},[]);let[o,l]=(0,eP.useState)(!1),u=(0,eP.useRef)(!1),c=sH(n),[d,f]=function(e,t,r){let n=e.onLoadedMetadataCapture,i=(0,eP.useMemo)(()=>Object.assign(()=>{},{...n,[t]:r}),[n,t,r]);return[null==n?void 0:n[t],{onLoadedMetadataCapture:i}]}(n,lC,!0),h=n.onKeyDown,p=s2(e=>{null==h||h(e);let n=e.currentTarget;if(e.defaultPrevented||d||c||!sQ(e)||sS(n)||n.isContentEditable)return;let i=t&&"Enter"===e.key,a=r&&" "===e.key,s="Enter"===e.key&&!t,o=" "===e.key&&!r;if(s||o)return void e.preventDefault();if(i||a){let t=lB(e);if(i){if(!t){e.preventDefault();let{view:t,...r}=e,i=()=>sX(n,r);sp&&/firefox\//i.test(navigator.userAgent)?sY(n,"keyup",i):queueMicrotask(i)}}else a&&(u.current=!0,t||(e.preventDefault(),l(!0)))}}),m=n.onKeyUp,g=s2(e=>{if(null==m||m(e),e.defaultPrevented||d||c||e.metaKey)return;let t=r&&" "===e.key;if(u.current&&t&&(u.current=!1,!lB(e))){e.preventDefault(),l(!1);let t=e.currentTarget,{view:r,...n}=e;queueMicrotask(()=>sX(t,n))}});return ok(n={"data-active":o||void 0,type:a?"button":void 0,...f,...n,ref:s9(i,n.ref),onKeyDown:p,onKeyUp:g})});os(function(e){return ol("button",lS(e))});var{useSyncExternalStore:lE}=e.i(2239).default,lT=()=>()=>{};function lb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sU,r=eP.useCallback(t=>e?lo(e,null,t):lT(),[e]),n=()=>{let r="string"==typeof t?t:null,n="function"==typeof t?t:null,i=null==e?void 0:e.getState();return n?n(i):i&&r&&sP(i,r)?i[r]:void 0};return lE(r,n,n)}function lD(e,t){let r=eP.useRef({}),n=eP.useCallback(t=>e?lo(e,null,t):lT(),[e]),i=()=>{let n=null==e?void 0:e.getState(),i=!1,a=r.current;for(let e in t){let r=t[e];if("function"==typeof r){let t=r(n);t!==a[e]&&(a[e]=t,i=!0)}if("string"==typeof r){if(!n||!sP(n,r))continue;let t=n[r];t!==a[e]&&(a[e]=t,i=!0)}}return i&&(r.current={...a}),r.current};return lE(n,i,i)}function lM(e,t,r,n){let i=sP(t,r)?t[r]:void 0,a=function(e){let t=(0,eP.useRef)(e);return s1(()=>{t.current=e}),t}({value:i,setValue:n?t[n]:void 0});s1(()=>ll(e,[r],(e,t)=>{let{value:n,setValue:i}=a.current;i&&e[r]!==t[r]&&e[r]!==n&&i(e[r])}),[e,r]),s1(()=>{if(void 0!==i)return e.setState(r,i),lu(e,[r],()=>{void 0!==i&&e.setState(r,i)})})}function lw(e,t){let[r,n]=eP.useState(()=>e(t));s1(()=>ls(r),[r]);let i=eP.useCallback(e=>lb(r,e),[r]);return[eP.useMemo(()=>({...r,useState:i}),[r,i]),s2(()=>{n(r=>e({...t,...r.getState()}))})]}function lF(e,t,r){var n;let i,a,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!t||!r)return;let{renderedItems:o}=t.getState(),l=sD(e);if(!l)return;let u=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.clientHeight,{top:n}=e.getBoundingClientRect(),i=1.5*Math.max(.875*r,r-40),a=t?r-i+n:i+n;return"HTML"===e.tagName?a+e.scrollTop:a}(l,s);for(let e=0;e1&&void 0!==arguments[1]&&arguments[1],{top:r}=e.getBoundingClientRect();return t?r+e.clientHeight:r}(l,s)-u,d=Math.abs(c);if(s&&c<=0||!s&&c>=0){void 0!==a&&ar||(e&&(null==h?void 0:h.baseElement)&&h.baseElement===e.baseElement?h.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===d,ariaSetSize:e=>null!=o?o:e&&(null==h?void 0:h.ariaSetSize)&&h.baseElement===e.baseElement?h.ariaSetSize:void 0,ariaPosInSet(e){if(null!=l)return l;if(!e||!(null==h?void 0:h.ariaPosInSet)||h.baseElement!==e.baseElement)return;let t=e.renderedItems.filter(e=>e.rowId===m);return h.ariaPosInSet+t.findIndex(e=>e.id===d)},isTabbable(e){if(!(null==e?void 0:e.renderedItems.length))return!0;if(e.virtualFocus)return!1;if(a)return!0;if(null===e.activeId)return!1;let r=null==t?void 0:t.item(e.activeId);return null!=r&&!!r.disabled||null==r||!r.element||e.activeId===d}}),C=(0,eP.useCallback)(e=>{var t;let r={...e,id:d||e.id,rowId:m,disabled:!!p,children:null==(t=e.element)?void 0:t.textContent};return s?s(r):r},[d,m,p,s]),S=u.onFocus,E=(0,eP.useRef)(!1),T=s2(e=>{var r,n;if(null==S||S(e),e.defaultPrevented||sV(e)||!d||!t||(r=t,!sQ(e)&&sR(r,e.target)))return;let{virtualFocus:i,baseElement:a}=t.getState();if(t.setActiveId(d),sE(e.currentTarget)&&function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(sS(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=sm(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(e.currentTarget),i&&sQ(e))!sE(n=e.currentTarget)&&("INPUT"!==n.tagName||sx(n))&&(null==a?void 0:a.isConnected)&&((sJ()&&e.currentTarget.hasAttribute("data-autofocus")&&e.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),E.current=!0,e.relatedTarget===a||sR(t,e.relatedTarget))?(a[sF]=!0,a.focus({preventScroll:!0})):a.focus())}),b=u.onBlurCapture,D=s2(e=>{if(null==b||b(e),e.defaultPrevented)return;let r=null==t?void 0:t.getState();(null==r?void 0:r.virtualFocus)&&E.current&&(E.current=!1,e.preventDefault(),e.stopPropagation())}),M=u.onKeyDown,w=s5(n),F=s5(i),R=s2(e=>{if(null==M||M(e),e.defaultPrevented||!sQ(e)||!t)return;let{currentTarget:r}=e,n=t.getState(),i=t.item(d),a=!!(null==i?void 0:i.rowId),s="horizontal"!==n.orientation,o="vertical"!==n.orientation,l=()=>!(!a&&!o&&n.baseElement&&sS(n.baseElement)),u={ArrowUp:(a||s)&&t.up,ArrowRight:(a||o)&&t.next,ArrowDown:(a||s)&&t.down,ArrowLeft:(a||o)&&t.previous,Home:()=>{if(l())return!a||e.ctrlKey?null==t?void 0:t.first():null==t?void 0:t.previous(-1)},End:()=>{if(l())return!a||e.ctrlKey?null==t?void 0:t.last():null==t?void 0:t.next(-1)},PageUp:()=>lF(r,t,null==t?void 0:t.up,!0),PageDown:()=>lF(r,t,null==t?void 0:t.down)}[e.key];if(u){if(sE(r)){let t=sT(r),n=o&&"ArrowLeft"===e.key,i=o&&"ArrowRight"===e.key,a=s&&"ArrowUp"===e.key,l=s&&"ArrowDown"===e.key;if(i||l){let{length:e}=function(e){if(sS(e))return e.value;if(e.isContentEditable){let t=sm(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(r);if(t.end!==e)return}else if((n||a)&&0!==t.start)return}let n=u();if(w(e)||void 0!==n){if(!F(e))return;e.preventDefault(),t.move(n)}}}),I=(0,eP.useMemo)(()=>({id:d,baseElement:g}),[d,g]);return u={id:d,"data-active-item":A||void 0,...u=s6(u,e=>(0,eI.jsx)(oA.Provider,{value:I,children:e}),[I]),ref:s9(f,u.ref),tabIndex:B?u.tabIndex:-1,onFocus:T,onBlurCapture:D,onKeyDown:R},u=lS(u),sN({...u=lx({store:t,...u,getItem:C,shouldRegisterItem:!!d&&u.shouldRegisterItem}),"aria-setsize":y,"aria-posinset":x})});oo(os(function(e){return ol("button",lR(e))}));var lI=ou(function(e){var t,r;let{store:n,value:i,hideOnClick:a,setValueOnClick:s,selectValueOnClick:o=!0,resetValueOnSelect:l,focusOnHover:u=!1,moveOnKeyPress:c=!0,getItem:d,...f}=e,h=o5();sG(n=n||h,!1);let{resetValueOnSelectState:p,multiSelectable:m,selected:g}=lD(n,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>(function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)})(e.selectedValue,i)}),A=(0,eP.useCallback)(e=>{let t={...e,value:i};return d?d(t):t},[i,d]);s=null!=s?s:!m,a=null!=a?a:null!=i&&!m;let y=f.onClick,x=s5(s),B=s5(o),C=s5(null!=(t=null!=l?l:p)?t:m),S=s5(a),E=s2(e=>{null==y||y(e),!(e.defaultPrevented||function(e){let t=e.currentTarget;if(!t)return!1;let r=t.tagName.toLowerCase();return!!e.altKey&&("a"===r||"button"===r&&"submit"===t.type||"input"===r&&"submit"===t.type)}(e))&&!function(e){let t=e.currentTarget;if(!t)return!1;let r=sK();if(r&&!e.metaKey||!r&&!e.ctrlKey)return!1;let n=t.tagName.toLowerCase();return"a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type}(e)&&(null!=i&&(B(e)&&(C(e)&&(null==n||n.resetValue()),null==n||n.setSelectedValue(e=>Array.isArray(e)?e.includes(i)?e.filter(e=>e!==i):[...e,i]:i)),x(e)&&(null==n||n.setValue(i))),S(e)&&(null==n||n.hide()))}),T=f.onKeyDown,b=s2(e=>{if(null==T||T(e),e.defaultPrevented)return;let t=null==n?void 0:n.getState().baseElement;!(!t||oM(t))&&(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask(()=>t.focus()),sS(t)&&(null==n||n.setValue(t.value)))});m&&null!=g&&(f={"aria-selected":g,...f}),f=s6(f,e=>(0,eI.jsx)(lt.Provider,{value:i,children:(0,eI.jsx)(lr.Provider,{value:null!=g&&g,children:e})}),[i,g]),f={role:null!=(r=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,eP.useContext)(o3)])?r:"option",children:i,...f,onClick:E,onKeyDown:b};let D=s5(c);return f=lR({store:n,...f,getItem:A,moveOnKeyPress:e=>{if(!D(e))return!1;let t=new Event("combobox-item-move"),r=null==n?void 0:n.getState().baseElement;return null==r||r.dispatchEvent(t),!0}}),f=ly({store:n,focusOnHover:u,...f})}),lP=oo(os(function(e){return ol("div",lI(e))})),lL=e.i(74080);function lU(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function lG(){for(var e=arguments.length,t=Array(e),r=0;r{let r=t.endsWith("ms")?1:1e3,n=Number.parseFloat(t||"0s")*r;return n>e?n:e},0)}function lO(e,t,r){return!r&&!1!==t&&(!e||!!t)}var lH=ou(function(e){let{store:t,alwaysVisible:r,...n}=e,i=oQ();sG(t=t||i,!1);let a=(0,eP.useRef)(null),s=s3(n.id),[o,l]=(0,eP.useState)(null),u=t.useState("open"),c=t.useState("mounted"),d=t.useState("animated"),f=t.useState("contentElement"),h=lb(t.disclosure,"contentElement");s1(()=>{a.current&&(null==t||t.setContentElement(a.current))},[t]),s1(()=>{let e;return null==t||t.setState("animated",t=>(e=t,!0)),()=>{void 0!==e&&(null==t||t.setState("animated",e))}},[t]),s1(()=>{if(d){var e;let t;return(null==f?void 0:f.isConnected)?(e=()=>{l(u?"enter":c?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void l(null)}},[d,f,u,c]),s1(()=>{if(!t||!d||!o||!f)return;let e=()=>null==t?void 0:t.setState("animating",!1),r=()=>(0,lL.flushSync)(e);if("leave"===o&&u||"enter"===o&&!u)return;if("number"==typeof d)return lU(d,r);let{transitionDuration:n,animationDuration:i,transitionDelay:a,animationDelay:s}=getComputedStyle(f),{transitionDuration:l="0",animationDuration:c="0",transitionDelay:p="0",animationDelay:m="0"}=h?getComputedStyle(h):{},g=lG(a,s,p,m)+lG(n,i,l,c);if(!g){"enter"===o&&t.setState("animated",!1),e();return}return lU(Math.max(g-1e3/60,0),r)},[t,d,f,h,u,o]);let p=lO(c,(n=s6(n,e=>(0,eI.jsx)(oY,{value:t,children:e}),[t])).hidden,r),m=n.style,g=(0,eP.useMemo)(()=>p?{...m,display:"none"}:m,[p,m]);return sN(n={id:s,"data-open":u||void 0,"data-enter":"enter"===o||void 0,"data-leave":"leave"===o||void 0,hidden:p,...n,ref:s9(s?t.setContentElement:null,a,n.ref),style:g})}),lN=os(function(e){return ol("div",lH(e))});os(function(e){let{unmountOnHide:t,...r}=e,n=oQ();return!1===lb(r.store||n,e=>!t||(null==e?void 0:e.mounted))?null:(0,eI.jsx)(lN,{...r})});var lk=ou(function(e){let{store:t,alwaysVisible:r,...n}=e,i=o5(!0),a=o8(),s=!!(t=t||a)&&t===i;sG(t,!1);let o=(0,eP.useRef)(null),l=s3(n.id),u=t.useState("mounted"),c=lO(u,n.hidden,r),d=c?{...n.style,display:"none"}:n.style,f=t.useState(e=>Array.isArray(e.selectedValue)),h=function(e,t,r){let n=function(e){let[t]=(0,eP.useState)(e);return t}(r),[i,a]=(0,eP.useState)(n);return(0,eP.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r)return;let i=()=>{let e=r.getAttribute(t);a(null==e?n:e)},s=new MutationObserver(i);return s.observe(r,{attributeFilter:[t]}),i(),()=>s.disconnect()},[e,t,n]),i}(o,"role",n.role),p="listbox"===h||"tree"===h||"grid"===h,[m,g]=(0,eP.useState)(!1),A=t.useState("contentElement");s1(()=>{if(!u)return;let e=o.current;if(!e||A!==e)return;let t=()=>{g(!!e.querySelector("[role='listbox']"))},r=new MutationObserver(t);return r.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>r.disconnect()},[u,A]),m||(n={role:"listbox","aria-multiselectable":p&&f||void 0,...n}),n=s6(n,e=>(0,eI.jsx)(le,{value:t,children:(0,eI.jsx)(o3.Provider,{value:h,children:e})}),[t,h]);let y=!l||i&&s?null:t.setContentElement;return sN(n={id:l,hidden:c,...n,ref:s9(y,o,n.ref),style:d})}),lz=os(function(e){return ol("div",lk(e))}),lj=(0,eP.createContext)(null),lK=ou(function(e){return{...e,style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px",...e.style}}});os(function(e){return ol("span",lK(e))});var lJ=ou(function(e){return lK(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),lV=os(function(e){return ol("span",lJ(e))});function lQ(e){queueMicrotask(()=>{null==e||e.focus()})}var lW=ou(function(e){let{preserveTabOrder:t,preserveTabOrderAnchor:r,portalElement:n,portalRef:i,portal:a=!0,...s}=e,o=(0,eP.useRef)(null),l=s9(o,s.ref),u=(0,eP.useContext)(lj),[c,d]=(0,eP.useState)(null),[f,h]=(0,eP.useState)(null),p=(0,eP.useRef)(null),m=(0,eP.useRef)(null),g=(0,eP.useRef)(null),A=(0,eP.useRef)(null);return s1(()=>{let e=o.current;if(!e||!a)return void d(null);let t=n?"function"==typeof n?n(e):n:sm(e).createElement("div");if(!t)return void d(null);let r=t.isConnected;if(r||(u||sm(e).body).appendChild(t),t.id||(t.id=e.id?"portal/".concat(e.id):function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";return"".concat(e?"".concat(e,"-"):"").concat(Math.random().toString(36).slice(2,8))}()),d(t),sz(i,t),!r)return()=>{t.remove(),sz(i,null)}},[a,n,u,i]),s1(()=>{if(!a||!t||!r)return;let e=sm(r).createElement("span");return e.style.position="fixed",r.insertAdjacentElement("afterend",e),h(e),()=>{e.remove(),h(null)}},[a,t,r]),(0,eP.useEffect)(()=>{if(!c||!t)return;let e=0,r=t=>{if(!sZ(t))return;let r="focusin"===t.type;if(cancelAnimationFrame(e),r){let e=c.querySelectorAll("[data-tabindex]"),t=e=>{let t=e.getAttribute("data-tabindex");e.removeAttribute("data-tabindex"),t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")};for(let r of(c.hasAttribute("data-tabindex")&&t(c),e))t(r);return}e=requestAnimationFrame(()=>{for(let e of oT(c,!0))!function(e){var t;let r=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",r),e.setAttribute("tabindex","-1")}(e)})};return c.addEventListener("focusin",r,!0),c.addEventListener("focusout",r,!0),()=>{cancelAnimationFrame(e),c.removeEventListener("focusin",r,!0),c.removeEventListener("focusout",r,!0)}},[c,t]),s={...s=s6(s,e=>{if(e=(0,eI.jsx)(lj.Provider,{value:c||u,children:e}),!a)return e;if(!c)return(0,eI.jsx)("span",{ref:l,id:s.id,style:{position:"fixed"},hidden:!0});e=(0,eI.jsxs)(eI.Fragment,{children:[t&&c&&(0,eI.jsx)(lV,{ref:m,"data-focus-trap":s.id,className:"__focus-trap-inner-before",onFocus:e=>{sZ(e,c)?lQ(ob()):lQ(p.current)}}),e,t&&c&&(0,eI.jsx)(lV,{ref:g,"data-focus-trap":s.id,className:"__focus-trap-inner-after",onFocus:e=>{sZ(e,c)?lQ(oD()):lQ(A.current)}})]}),c&&(e=(0,lL.createPortal)(e,c));let r=(0,eI.jsxs)(eI.Fragment,{children:[t&&c&&(0,eI.jsx)(lV,{ref:p,"data-focus-trap":s.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==A.current&&sZ(e,c)?lQ(m.current):lQ(oD())}}),t&&(0,eI.jsx)("span",{"aria-owns":null==c?void 0:c.id,style:{position:"fixed"}}),t&&c&&(0,eI.jsx)(lV,{ref:A,"data-focus-trap":s.id,className:"__focus-trap-outer-after",onFocus:e=>{if(sZ(e,c))lQ(g.current);else{let e=ob();if(e===m.current)return void requestAnimationFrame(()=>{var e;return null==(e=ob())?void 0:e.focus()});lQ(e)}}})]});return f&&t&&(r=(0,lL.createPortal)(r,f)),(0,eI.jsxs)(eI.Fragment,{children:[r,e]})},[c,u,a,s.id,t,f]),ref:l}});os(function(e){return ol("div",lW(e))});var lX=(0,eP.createContext)(0);function lZ(e){let{level:t,children:r}=e,n=(0,eP.useContext)(lX),i=Math.max(Math.min(t||n+1,6),1);return(0,eI.jsx)(lX.Provider,{value:i,children:r})}var lY=ou(function(e){let{autoFocusOnShow:t=!0,...r}=e;return s6(r,e=>(0,eI.jsx)(ox.Provider,{value:t,children:e}),[t])});os(function(e){return ol("div",lY(e))});var l_=new WeakMap;function lq(e,t,r){l_.has(e)||l_.set(e,new Map);let n=l_.get(e),i=n.get(t);if(!i)return n.set(t,r()),()=>{var e;null==(e=n.get(t))||e(),n.delete(t)};let a=r(),s=()=>{a(),i(),n.delete(t)};return n.set(t,s),()=>{n.get(t)===s&&(a(),n.set(t,i))}}function l$(e,t,r){return lq(e,t,()=>{let n=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)}})}function l0(e,t,r){return lq(e,t,()=>{let n=t in e,i=e[t];return e[t]=r,()=>{n?e[t]=i:delete e[t]}})}function l1(e,t){return e?lq(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var l2=["SCRIPT","STYLE"];function l9(e){return"__ariakit-dialog-snapshot-".concat(e)}function l3(e,t,r,n){for(let i of t){if(!(null==i?void 0:i.isConnected))continue;let a=t.some(e=>!!e&&e!==i&&e.contains(i)),s=sm(i),o=i;for(;i.parentElement&&i!==s.body;){if(null==n||n(i.parentElement,o),!a)for(let n of i.parentElement.children)(function(e,t,r){return!l2.includes(t.tagName)&&!!function(e,t){let r=sm(t),n=l9(e);if(!r.body[n])return!0;for(;;){if(t===r.body)return!1;if(t[n])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!r.some(e=>e&&sA(t,e))})(e,n,t)&&r(n,o);i=i.parentElement}}}function l4(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;ni===e))}function l8(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"__ariakit-dialog-".concat(t?"ancestor":"outside").concat(e?"-".concat(e):"")}function l5(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return sL(l0(e,l8("",!0),!0),l0(e,l8(t,!0),!0))}function l6(e,t){if(e[l8(t,!0)])return!0;let r=l8(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function l7(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return l3(e,t,t=>{l4(t,...n)||r.unshift(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return sL(l0(e,l8(),!0),l0(e,l8(t),!0))}(t,e))},(t,n)=>{n.hasAttribute("data-dialog")&&n.id!==e||r.unshift(l5(t,e))}),()=>{for(let e of r)e()}}function ue(e){let{store:t,type:r,listener:n,capture:i,domReady:a}=e,s=s2(n),o=lb(t,"open"),l=(0,eP.useRef)(!1);s1(()=>{if(!o||!a)return;let{contentElement:e}=t.getState();if(!e)return;let r=()=>{l.current=!0};return e.addEventListener("focusin",r,!0),()=>e.removeEventListener("focusin",r,!0)},[t,o,a]),(0,eP.useEffect)(()=>{if(o)return s_(r,e=>{let{contentElement:r,disclosureElement:n}=t.getState(),i=e.target;if(r&&i)!(!("HTML"===i.tagName||sA(sm(i).body,i))||sA(r,i)||function(e,t){if(!e)return!1;if(sA(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=sm(e).getElementById(r);if(t)return sA(e,t)}return!1}(n,i)||i.hasAttribute("data-focus-trap")||function(e,t){if(!("clientY"in e))return!1;let r=t.getBoundingClientRect();return 0!==r.width&&0!==r.height&&r.top<=e.clientY&&e.clientY<=r.top+r.height&&r.left<=e.clientX&&e.clientX<=r.left+r.width}(e,r))&&(!l.current||l6(i,r.id))&&(i&&i[oP]||s(e))},i)},[o,i])}function ut(e,t){return"function"==typeof e?e(t):!!e}var ur=(0,eP.createContext)({});function un(){return"inert"in HTMLElement.prototype}function ui(e,t){if(!("style"in e))return sI;if(un())return l0(e,"inert",!0);let r=oT(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&sA(t,e)))return sI;let r=lq(e,"focus",()=>(e.focus=sI,()=>{delete e.focus}));return sL(l$(e,"tabindex","-1"),r)});return sL(...r,l$(e,"aria-hidden","true"),l1(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function ua(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=ld(e.store,lc(e.disclosure,["contentElement","disclosureElement"]));lf(e,t);let r=null==t?void 0:t.getState(),n=sk(e.open,null==r?void 0:r.open,e.defaultOpen,!1),i=sk(e.animated,null==r?void 0:r.animated,!1),a=li({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:sk(null==r?void 0:r.contentElement,null),disclosureElement:sk(null==r?void 0:r.disclosureElement,null)},t);return la(a,()=>ll(a,["animated","animating"],e=>{e.animated||a.setState("animating",!1)})),la(a,()=>lo(a,["open"],()=>{a.getState().animated&&a.setState("animating",!0)})),la(a,()=>ll(a,["open","animating"],e=>{a.setState("mounted",e.open||e.animating)})),{...a,disclosure:e.disclosure,setOpen:e=>a.setState("open",e),show:()=>a.setState("open",!0),hide:()=>a.setState("open",!1),toggle:()=>a.setState("open",e=>!e),stopAnimation:()=>a.setState("animating",!1),setContentElement:e=>a.setState("contentElement",e),setDisclosureElement:e=>a.setState("disclosureElement",e)}}function us(e,t,r){return s4(t,[r.store,r.disclosure]),lM(e,r,"open","setOpen"),lM(e,r,"mounted","setMounted"),lM(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}ou(function(e){return e});var uo=os(function(e){return ol("div",e)});function ul(e){let{store:t,backdrop:r,alwaysVisible:n,hidden:i}=e,a=(0,eP.useRef)(null),s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[t,r]=lw(ua,e);return us(t,r,e)}({disclosure:t}),o=lb(t,"contentElement");(0,eP.useEffect)(()=>{let e=a.current;e&&o&&(e.style.zIndex=getComputedStyle(o).zIndex)},[o]),s1(()=>{let e=null==o?void 0:o.id;if(!e)return;let t=a.current;if(t)return l5(t,e)},[o]);let l=lH({ref:a,store:s,role:"presentation","data-backdrop":(null==o?void 0:o.id)||"",alwaysVisible:n,hidden:null!=i?i:void 0,style:{position:"fixed",top:0,right:0,bottom:0,left:0}});if(!r)return null;if((0,eP.isValidElement)(r))return(0,eI.jsx)(uo,{...l,render:r});let u="boolean"!=typeof r?r:"div";return(0,eI.jsx)(uo,{...l,render:(0,eI.jsx)(u,{})})}function uu(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ua(e)}Object.assign(uo,["a","button","details","dialog","div","form","h1","h2","h3","h4","h5","h6","header","img","input","label","li","nav","ol","p","section","select","span","summary","textarea","ul","svg"].reduce((e,t)=>(e[t]=os(function(e){return ol(t,e)}),e),{}));var uc=sJ();function ud(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;let r="current"in e?e.current:e;return r?t?oC(r)?r:null:r:null}var uf=ou(function(e){let{store:t,open:r,onClose:n,focusable:i=!0,modal:a=!0,portal:s=!!a,backdrop:o=!!a,hideOnEscape:l=!0,hideOnInteractOutside:u=!0,getPersistentElements:c,preventBodyScroll:d=!!a,autoFocusOnShow:f=!0,autoFocusOnHide:h=!0,initialFocus:p,finalFocus:m,unmountOnHide:g,unstable_treeSnapshotKey:A,...y}=e,x=oX(),B=(0,eP.useRef)(null),C=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[t,r]=lw(uu,e);return us(t,r,e)}({store:t||x,open:r,setOpen(e){if(e)return;let t=B.current;if(!t)return;let r=new Event("close",{bubbles:!1,cancelable:!0});n&&t.addEventListener("close",n,{once:!0}),t.dispatchEvent(r),r.defaultPrevented&&C.setOpen(!0)}}),{portalRef:S,domReady:E}=s7(s,y.portalRef),T=y.preserveTabOrder,b=lb(C,e=>T&&!a&&e.mounted),D=s3(y.id),M=lb(C,"open"),w=lb(C,"mounted"),F=lb(C,"contentElement"),R=lO(w,y.hidden,y.alwaysVisible),I=function(e){let{attribute:t,contentId:r,contentElement:n,enabled:i}=e,[a,s]=s8(),o=(0,eP.useCallback)(()=>{if(!i||!n)return!1;let{body:e}=sm(n),a=e.getAttribute(t);return!a||a===r},[a,i,n,t,r]);return(0,eP.useEffect)(()=>{if(!i||!r||!n)return;let{body:e}=sm(n);if(o())return e.setAttribute(t,r),()=>e.removeAttribute(t);let a=new MutationObserver(()=>(0,lL.flushSync)(s));return a.observe(e,{attributeFilter:[t]}),()=>a.disconnect()},[a,i,r,n,o,t]),o}({attribute:"data-dialog-prevent-body-scroll",contentElement:F,contentId:D,enabled:d&&!R});(0,eP.useEffect)(()=>{var e,t;if(!I()||!F)return;let r=sm(F),n=sv(F),{documentElement:i,body:a}=r,s=i.style.getPropertyValue("--scrollbar-width"),o=s?Number.parseInt(s,10):n.innerWidth-i.clientWidth,l=Math.round(i.getBoundingClientRect().left)+i.scrollLeft?"paddingLeft":"paddingRight",u=sK()&&!(sp&&navigator.platform.startsWith("Mac")&&!sj());return sL((e="--scrollbar-width",t="".concat(o,"px"),i?lq(i,e,()=>{let r=i.style.getPropertyValue(e);return i.style.setProperty(e,t),()=>{r?i.style.setProperty(e,r):i.style.removeProperty(e)}}):()=>{}),u?(()=>{var e,t;let{scrollX:r,scrollY:i,visualViewport:s}=n,u=null!=(e=null==s?void 0:s.offsetLeft)?e:0,c=null!=(t=null==s?void 0:s.offsetTop)?t:0,d=l1(a,{position:"fixed",overflow:"hidden",top:"".concat(-(i-Math.floor(c)),"px"),left:"".concat(-(r-Math.floor(u)),"px"),right:"0",[l]:"".concat(o,"px")});return()=>{d(),n.scrollTo({left:r,top:i,behavior:"instant"})}})():l1(a,{overflow:"hidden",[l]:"".concat(o,"px")}))},[I,F]);let P=function(e){let t=(0,eP.useRef)();return(0,eP.useEffect)(()=>{if(!e){t.current=null;return}return s_("mousedown",e=>{t.current=e.target},!0)},[e]),t}(lb(C,"open")),L={store:C,domReady:E,capture:!0};ue({...L,type:"click",listener:e=>{let{contentElement:t}=C.getState(),r=P.current;r&&sC(r)&&l6(r,null==t?void 0:t.id)&&ut(u,e)&&C.hide()}}),ue({...L,type:"focusin",listener:e=>{let{contentElement:t}=C.getState();t&&e.target!==sm(t)&&ut(u,e)&&C.hide()}}),ue({...L,type:"contextmenu",listener:e=>{ut(u,e)&&C.hide()}});let{wrapElement:U,nestedDialogs:G}=function(e){let t=(0,eP.useContext)(ur),[r,n]=(0,eP.useState)([]),i=(0,eP.useCallback)(e=>{var r;return n(t=>[...t,e]),sL(null==(r=t.add)?void 0:r.call(t,e),()=>{n(t=>t.filter(t=>t!==e))})},[t]);s1(()=>ll(e,["open","contentElement"],r=>{var n;if(r.open&&r.contentElement)return null==(n=t.add)?void 0:n.call(t,e)}),[e,t]);let a=(0,eP.useMemo)(()=>({store:e,add:i}),[e,i]);return{wrapElement:(0,eP.useCallback)(e=>(0,eI.jsx)(ur.Provider,{value:a,children:e}),[a]),nestedDialogs:r}}(C);y=s6(y,U,[U]),s1(()=>{if(!M)return;let e=B.current,t=sg(e,!0);t&&"BODY"!==t.tagName&&(e&&sA(e,t)||C.setDisclosureElement(t))},[C,M]),uc&&(0,eP.useEffect)(()=>{if(!w)return;let{disclosureElement:e}=C.getState();if(!e||!sx(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),sY(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||oF(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[C,w]),(0,eP.useEffect)(()=>{if(!w||!E)return;let e=B.current;if(!e)return;let t=sv(e),r=t.visualViewport||t,n=()=>{var r,n;let i=null!=(n=null==(r=t.visualViewport)?void 0:r.height)?n:t.innerHeight;e.style.setProperty("--dialog-viewport-height","".concat(i,"px"))};return n(),r.addEventListener("resize",n),()=>{r.removeEventListener("resize",n)}},[w,E]),(0,eP.useEffect)(()=>{if(!a||!w||!E)return;let e=B.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t=C.hide;let r=sm(e).createElement("button");return r.type="button",r.tabIndex=-1,r.textContent="Dismiss popup",Object.assign(r.style,{border:"0px",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0px",position:"absolute",whiteSpace:"nowrap",width:"1px"}),r.addEventListener("click",t),e.prepend(r),()=>{r.removeEventListener("click",t),r.remove()}}},[C,a,w,E]),s1(()=>{if(!un()||M||!w||!E)return;let e=B.current;if(e)return ui(e)},[M,w,E]);let O=M&&E;s1(()=>{if(!D||!O)return;var e=[B.current];let{body:t}=sm(e[0]),r=[];return l3(D,e,e=>{r.push(l0(e,l9(D),!0))}),sL(l0(t,l9(D),!0),()=>{for(let e of r)e()})},[D,O,A]);let H=s2(c);s1(()=>{if(!D||!O)return;let{disclosureElement:e}=C.getState(),t=[B.current,...H()||[],...G.map(e=>e.getState().contentElement)];return a?sL(l7(D,t),function(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return l3(e,t,e=>{l4(e,...n)||!function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;ni===e))}(e,...n)&&r.unshift(ui(e,t))},e=>{e.hasAttribute("role")&&(t.some(t=>t&&sA(t,e))||r.unshift(l$(e,"role","none")))}),()=>{for(let e of r)e()}}(D,t)):l7(D,[e,...t])},[D,C,O,H,G,a,A]);let N=!!f,k=s5(f),[z,j]=(0,eP.useState)(!1);(0,eP.useEffect)(()=>{if(!M||!N||!E||!(null==F?void 0:F.isConnected))return;let e=ud(p,!0)||F.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[n]=oT(e,t,r);return n||null}(F,!0,s&&b)||F,t=oC(e);k(t?e:null)&&(j(!0),queueMicrotask(()=>{e.focus(),uc&&t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[M,N,E,F,p,s,b,k]);let K=!!h,J=s5(h),[V,Q]=(0,eP.useState)(!1);(0,eP.useEffect)(()=>{if(M)return Q(!0),()=>Q(!1)},[M]);let W=(0,eP.useCallback)(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],{disclosureElement:r}=C.getState();if(function(e){let t=sg();return!(!t||e&&sA(e,t))&&!!oC(t)}(e))return;let n=ud(m)||r;if(null==n?void 0:n.id){let e=sm(n),t='[aria-activedescendant="'.concat(n.id,'"]'),r=e.querySelector(t);r&&(n=r)}if(n&&!oC(n)){let e=n.closest("[data-dialog]");if(null==e?void 0:e.id){let t=sm(e),r='[aria-controls~="'.concat(e.id,'"]'),i=t.querySelector(r);i&&(n=i)}}let i=n&&oC(n);if(!i&&t)return void requestAnimationFrame(()=>W(e,!1));J(i?n:null)&&i&&(null==n||n.focus({preventScroll:!0}))},[C,m,J]),X=(0,eP.useRef)(!1);s1(()=>{if(M||!V||!K)return;let e=B.current;X.current=!0,W(e)},[M,V,E,K,W]),(0,eP.useEffect)(()=>{if(!V||!K)return;let e=B.current;return()=>{if(X.current){X.current=!1;return}W(e)}},[V,K,W]);let Z=s5(l);(0,eP.useEffect)(()=>{if(E&&w)return s_("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=B.current;if(!t||l6(t))return;let r=e.target;if(!r)return;let{disclosureElement:n}=C.getState();("BODY"===r.tagName||sA(t,r)||!n||sA(n,r))&&Z(e)&&C.hide()},!0)},[C,E,w,Z]);let Y=(y=s6(y,e=>(0,eI.jsx)(lZ,{level:a?1:void 0,children:e}),[a])).hidden,_=y.alwaysVisible;y=s6(y,e=>o?(0,eI.jsxs)(eI.Fragment,{children:[(0,eI.jsx)(ul,{store:C,backdrop:o,hidden:Y,alwaysVisible:_}),e]}):e,[C,o,Y,_]);let[q,$]=(0,eP.useState)(),[ee,et]=(0,eP.useState)();return y=lY({...y={id:D,"data-dialog":"",role:"dialog",tabIndex:i?-1:void 0,"aria-labelledby":q,"aria-describedby":ee,...y=s6(y,e=>(0,eI.jsx)(oY,{value:C,children:(0,eI.jsx)(o_.Provider,{value:$,children:(0,eI.jsx)(oq.Provider,{value:et,children:e})})}),[C]),ref:s9(B,y.ref)},autoFocusOnShow:z}),y=lW({portal:s,...y=ok({...y=lH({store:C,...y}),focusable:i}),portalRef:S,preserveTabOrder:b})});function uh(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oX;return os(function(r){let n=t();return lb(r.store||n,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,eI.jsx)(e,{...r}):null})}uh(os(function(e){return ol("div",uf(e))}),oX);let up=Math.min,um=Math.max,uv=Math.round,ug=Math.floor,uA=e=>({x:e,y:e}),uy={left:"right",right:"left",bottom:"top",top:"bottom"},ux={start:"end",end:"start"};function uB(e,t){return"function"==typeof e?e(t):e}function uC(e){return e.split("-")[0]}function uS(e){return e.split("-")[1]}function uE(e){return"x"===e?"y":"x"}function uT(e){return"y"===e?"height":"width"}let ub=new Set(["top","bottom"]);function uD(e){return ub.has(uC(e))?"y":"x"}function uM(e){return e.replace(/start|end/g,e=>ux[e])}let uw=["left","right"],uF=["right","left"],uR=["top","bottom"],uI=["bottom","top"];function uP(e){return e.replace(/left|right|bottom|top/g,e=>uy[e])}function uL(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function uU(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function uG(e,t,r){let n,{reference:i,floating:a}=e,s=uD(t),o=uE(uD(t)),l=uT(o),u=uC(t),c="y"===s,d=i.x+i.width/2-a.width/2,f=i.y+i.height/2-a.height/2,h=i[l]/2-a[l]/2;switch(u){case"top":n={x:d,y:i.y-a.height};break;case"bottom":n={x:d,y:i.y+i.height};break;case"right":n={x:i.x+i.width,y:f};break;case"left":n={x:i.x-a.width,y:f};break;default:n={x:i.x,y:i.y}}switch(uS(t)){case"start":n[o]-=h*(r&&c?-1:1);break;case"end":n[o]+=h*(r&&c?-1:1)}return n}let uO=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:s}=r,o=a.filter(Boolean),l=await (null==s.isRTL?void 0:s.isRTL(t)),u=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=uG(u,n,l),f=n,h={},p=0;for(let r=0;r{try{return e.matches(t)}catch(e){return!1}})}let u0=["transform","translate","scale","rotate","perspective"],u1=["transform","translate","scale","rotate","perspective","filter"],u2=["paint","layout","strict","content"];function u9(e){let t=u3(),r=uQ(e)?u5(e):e;return u0.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||u1.some(e=>(r.willChange||"").includes(e))||u2.some(e=>(r.contain||"").includes(e))}function u3(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let u4=new Set(["html","body","#document"]);function u8(e){return u4.has(uj(e))}function u5(e){return uK(e).getComputedStyle(e)}function u6(e){return uQ(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function u7(e){if("html"===uj(e))return e;let t=e.assignedSlot||e.parentNode||uX(e)&&e.host||uJ(e);return uX(t)?t.host:t}function ce(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=u7(t);return u8(r)?t.ownerDocument?t.ownerDocument.body:t.body:uW(r)&&uY(r)?r:e(r)}(e),a=i===(null==(n=e.ownerDocument)?void 0:n.body),s=uK(i);if(a){let e=ct(s);return t.concat(s,s.visualViewport||[],uY(i)?i:[],e&&r?ce(e):[])}return t.concat(i,ce(i,[],r))}function ct(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cr(e){let t=u5(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=uW(e),a=i?e.offsetWidth:r,s=i?e.offsetHeight:n,o=uv(r)!==a||uv(n)!==s;return o&&(r=a,n=s),{width:r,height:n,$:o}}function cn(e){return uQ(e)?e:e.contextElement}function ci(e){let t=cn(e);if(!uW(t))return uA(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:a}=cr(t),s=(a?uv(r.width):r.width)/n,o=(a?uv(r.height):r.height)/i;return s&&Number.isFinite(s)||(s=1),o&&Number.isFinite(o)||(o=1),{x:s,y:o}}let ca=uA(0);function cs(e){let t=uK(e);return u3()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ca}function co(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),s=cn(e),o=uA(1);t&&(n?uQ(n)&&(o=ci(n)):o=ci(e));let l=(void 0===(i=r)&&(i=!1),n&&(!i||n===uK(s))&&i)?cs(s):uA(0),u=(a.left+l.x)/o.x,c=(a.top+l.y)/o.y,d=a.width/o.x,f=a.height/o.y;if(s){let e=uK(s),t=n&&uQ(n)?uK(n):n,r=e,i=ct(r);for(;i&&n&&t!==r;){let e=ci(i),t=i.getBoundingClientRect(),n=u5(i),a=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,f*=e.y,u+=a,c+=s,i=ct(r=uK(i))}}return uU({width:d,height:f,x:u,y:c})}function cl(e,t){let r=u6(e).scrollLeft;return t?t.left+r:co(uJ(e)).left+r}function cu(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-cl(e,r),y:r.top+t.scrollTop}}let cc=new Set(["absolute","fixed"]);function cd(e,t,r){let n;if("viewport"===t)n=function(e,t){let r=uK(e),n=uJ(e),i=r.visualViewport,a=n.clientWidth,s=n.clientHeight,o=0,l=0;if(i){a=i.width,s=i.height;let e=u3();(!e||e&&"fixed"===t)&&(o=i.offsetLeft,l=i.offsetTop)}let u=cl(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,s=Math.abs(n.clientWidth-t.clientWidth-i);s<=25&&(a-=s)}else u<=25&&(a+=u);return{width:a,height:s,x:o,y:l}}(e,r);else if("document"===t)n=function(e){let t=uJ(e),r=u6(e),n=e.ownerDocument.body,i=um(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=um(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),s=-r.scrollLeft+cl(e),o=-r.scrollTop;return"rtl"===u5(n).direction&&(s+=um(t.clientWidth,n.clientWidth)-i),{width:i,height:a,x:s,y:o}}(uJ(e));else if(uQ(t))n=function(e,t){let r=co(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,a=uW(e)?ci(e):uA(1),s=e.clientWidth*a.x,o=e.clientHeight*a.y;return{width:s,height:o,x:i*a.x,y:n*a.y}}(t,r);else{let r=cs(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return uU(n)}function cf(e){return"static"===u5(e).position}function ch(e,t){if(!uW(e)||"fixed"===u5(e).position)return null;if(t)return t(e);let r=e.offsetParent;return uJ(e)===r&&(r=r.ownerDocument.body),r}function cp(e,t){var r;let n=uK(e);if(u$(e))return n;if(!uW(e)){let t=u7(e);for(;t&&!u8(t);){if(uQ(t)&&!cf(t))return t;t=u7(t)}return n}let i=ch(e,t);for(;i&&(r=i,u_.has(uj(r)))&&cf(i);)i=ch(i,t);return i&&u8(i)&&cf(i)&&!u9(i)?n:i||function(e){let t=u7(e);for(;uW(t)&&!u8(t);){if(u9(t))return t;if(u$(t))break;t=u7(t)}return null}(e)||n}let cm=async function(e){let t=this.getOffsetParent||cp,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=uW(t),i=uJ(t),a="fixed"===r,s=co(e,!0,a,t),o={scrollLeft:0,scrollTop:0},l=uA(0);if(n||!n&&!a)if(("body"!==uj(t)||uY(i))&&(o=u6(t)),n){let e=co(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=cl(i));a&&!n&&i&&(l.x=cl(i));let u=!i||n||a?uA(0):cu(i,o);return{x:s.left+o.scrollLeft-l.x-u.x,y:s.top+o.scrollTop-l.y-u.y,width:s.width,height:s.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},cv={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,a="fixed"===i,s=uJ(n),o=!!t&&u$(t.floating);if(n===s||o&&a)return r;let l={scrollLeft:0,scrollTop:0},u=uA(1),c=uA(0),d=uW(n);if((d||!d&&!a)&&(("body"!==uj(n)||uY(s))&&(l=u6(n)),uW(n))){let e=co(n);u=ci(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let f=!s||d||a?uA(0):cu(s,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:r.y*u.y-l.scrollTop*u.y+c.y+f.y}},getDocumentElement:uJ,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?u$(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=ce(e,[],!1).filter(e=>uQ(e)&&"body"!==uj(e)),i=null,a="fixed"===u5(e).position,s=a?u7(e):e;for(;uQ(s)&&!u8(s);){let t=u5(s),r=u9(s);r||"fixed"!==t.position||(i=null),(a?!r&&!i:!r&&"static"===t.position&&!!i&&cc.has(i.position)||uY(s)&&!r&&function e(t,r){let n=u7(t);return!(n===r||!uQ(n)||u8(n))&&("fixed"===u5(n).position||e(n,r))}(e,s))?n=n.filter(e=>e!==s):i=t,s=u7(s)}return t.set(e,n),n}(t,this._c):[].concat(r),n],s=a[0],o=a.reduce((e,r)=>{let n=cd(t,r,i);return e.top=um(n.top,e.top),e.right=up(n.right,e.right),e.bottom=up(n.bottom,e.bottom),e.left=um(n.left,e.left),e},cd(t,s,i));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}},getOffsetParent:cp,getElementRects:cm,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=cr(e);return{width:t,height:r}},getScale:ci,isElement:uQ,isRTL:function(e){return"rtl"===u5(e).direction}};function cg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cA(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if("function"==typeof DOMRect)return new DOMRect(e,t,r,n);let i={x:e,y:t,width:r,height:n,top:t,right:e+r,bottom:t+n,left:e};return{...i,toJSON:()=>i}}function cy(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function cx(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var cB=ou(function(e){let{store:t,modal:r=!1,portal:n=!!r,preserveTabOrder:i=!0,autoFocusOnShow:a=!0,wrapperProps:s,fixed:o=!1,flip:l=!0,shift:u=0,slide:c=!0,overlap:d=!1,sameWidth:f=!1,fitViewport:h=!1,gutter:p,arrowPadding:m=4,overflowPadding:g=8,getAnchorRect:A,updatePosition:y,...x}=e,B=o0();sG(t=t||B,!1);let C=t.useState("arrowElement"),S=t.useState("anchorElement"),E=t.useState("disclosureElement"),T=t.useState("popoverElement"),b=t.useState("contentElement"),D=t.useState("placement"),M=t.useState("mounted"),w=t.useState("rendered"),F=(0,eP.useRef)(null),[R,I]=(0,eP.useState)(!1),{portalRef:P,domReady:L}=s7(n,x.portalRef),U=s2(A),G=s2(y),O=!!y;s1(()=>{if(!(null==T?void 0:T.isConnected))return;T.style.setProperty("--popover-overflow-padding","".concat(g,"px"));let e={contextElement:S||void 0,getBoundingClientRect:()=>{let e=null==U?void 0:U(S);if(e||!S){if(!e)return cA();let{x:t,y:r,width:n,height:i}=e;return cA(t,r,n,i)}return S.getBoundingClientRect()}},r=async()=>{var r,n,i,a;if(!M)return;C||(F.current=F.current||document.createElement("div"));let s=C||F.current,A=[(r={gutter:p,shift:u},void 0===(n=e=>{var t;let{placement:n}=e,i=((null==s?void 0:s.clientHeight)||0)/2,a="number"==typeof r.gutter?r.gutter+i:null!=(t=r.gutter)?t:i;return{crossAxis:n.split("-")[1]?void 0:r.shift,mainAxis:a,alignmentAxis:r.shift}})&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:i,y:a,placement:s,middlewareData:o}=e,l=await uk(e,n);return s===(null==(t=o.offset)?void 0:t.placement)&&null!=(r=o.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:s}}}}),function(e){var t;if(!1===e.flip)return;let r="string"==typeof e.flip?e.flip.split(" "):void 0;return sG(!r||r.every(cy),!1),{name:"flip",options:t={padding:e.overflowPadding,fallbackPlacements:r},async fn(e){var r,n,i,a,s;let{placement:o,middlewareData:l,rects:u,initialPlacement:c,platform:d,elements:f}=e,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:y=!0,...x}=uB(t,e);if(null!=(r=l.arrow)&&r.alignmentOffset)return{};let B=uC(o),C=uD(c),S=uC(c)===c,E=await (null==d.isRTL?void 0:d.isRTL(f.floating)),T=m||(S||!y?[uP(c)]:function(e){let t=uP(e);return[uM(e),t,uM(t)]}(c)),b="none"!==A;!m&&b&&T.push(...function(e,t,r,n){let i=uS(e),a=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?uF:uw;return t?uw:uF;case"left":case"right":return t?uR:uI;default:return[]}}(uC(e),"start"===r,n);return i&&(a=a.map(e=>e+"-"+i),t&&(a=a.concat(a.map(uM)))),a}(c,y,A,E));let D=[c,...T],M=await uH(e,x),w=[],F=(null==(n=l.flip)?void 0:n.overflows)||[];if(h&&w.push(M[B]),p){let e=function(e,t,r){void 0===r&&(r=!1);let n=uS(e),i=uE(uD(e)),a=uT(i),s="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[a]>t.floating[a]&&(s=uP(s)),[s,uP(s)]}(o,u,E);w.push(M[e[0]],M[e[1]])}if(F=[...F,{placement:o,overflows:w}],!w.every(e=>e<=0)){let e=((null==(i=l.flip)?void 0:i.index)||0)+1,t=D[e];if(t&&("alignment"!==p||C===uD(t)||F.every(e=>uD(e.placement)!==C||e.overflows[0]>0)))return{data:{index:e,overflows:F},reset:{placement:t}};let r=null==(a=F.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(g){case"bestFit":{let e=null==(s=F.filter(e=>{if(b){let t=uD(e.placement);return t===C||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(r=e);break}case"initialPlacement":r=c}if(o!==r)return{reset:{placement:r}}}return{}}}}({flip:l,overflowPadding:g}),function(e){if(e.slide||e.overlap){var t,r;return{name:"shift",options:r={mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:(void 0===t&&(t={}),{options:t,fn(e){let{x:r,y:n,placement:i,rects:a,middlewareData:s}=e,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=uB(t,e),c={x:r,y:n},d=uD(i),f=uE(d),h=c[f],p=c[d],m=uB(o,e),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){let e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+g.mainAxis,r=a.reference[f]+a.reference[e]-g.mainAxis;hr&&(h=r)}if(u){var A,y;let e="y"===f?"width":"height",t=uN.has(uC(i)),r=a.reference[d]-a.floating[e]+(t&&(null==(A=s.offset)?void 0:A[d])||0)+(t?0:g.crossAxis),n=a.reference[d]+a.reference[e]+(t?0:(null==(y=s.offset)?void 0:y[d])||0)-(t?g.crossAxis:0);pn&&(p=n)}return{[f]:h,[d]:p}}})},async fn(e){let{x:t,y:n,placement:i}=e,{mainAxis:a=!0,crossAxis:s=!1,limiter:o={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=uB(r,e),u={x:t,y:n},c=await uH(e,l),d=uD(uC(i)),f=uE(d),h=u[f],p=u[d];if(a){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=h+c[e],n=h-c[t];h=um(r,up(h,n))}if(s){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=p+c[e],n=p-c[t];p=um(r,up(p,n))}let m=o.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-t,y:m.y-n,enabled:{[f]:a,[d]:s}}}}}}}({slide:c,shift:u,overlap:d,overflowPadding:g}),function(e,t){if(e){let r;return{name:"arrow",options:r={element:e,padding:t.arrowPadding},async fn(e){let{x:t,y:n,placement:i,rects:a,platform:s,elements:o,middlewareData:l}=e,{element:u,padding:c=0}=uB(r,e)||{};if(null==u)return{};let d=uL(c),f={x:t,y:n},h=uE(uD(i)),p=uT(h),m=await s.getDimensions(u),g="y"===h,A=g?"clientHeight":"clientWidth",y=a.reference[p]+a.reference[h]-f[h]-a.floating[p],x=f[h]-a.reference[h],B=await (null==s.getOffsetParent?void 0:s.getOffsetParent(u)),C=B?B[A]:0;C&&await (null==s.isElement?void 0:s.isElement(B))||(C=o.floating[A]||a.floating[p]);let S=C/2-m[p]/2-1,E=up(d[g?"top":"left"],S),T=up(d[g?"bottom":"right"],S),b=C-m[p]-T,D=C/2-m[p]/2+(y/2-x/2),M=um(E,up(D,b)),w=!l.arrow&&null!=uS(i)&&D!==M&&a.reference[p]/2-(D{},...d}=uB(a,e),f=await uH(e,d),h=uC(s),p=uS(s),m="y"===uD(s),{width:g,height:A}=o.floating;"top"===h||"bottom"===h?(n=h,i=p===(await (null==l.isRTL?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(i=h,n="end"===p?"top":"bottom");let y=A-f.top-f.bottom,x=g-f.left-f.right,B=up(A-f[n],y),C=up(g-f[i],x),S=!e.middlewareData.shift,E=B,T=C;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(T=x),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(E=y),S&&!p){let e=um(f.left,0),t=um(f.right,0),r=um(f.top,0),n=um(f.bottom,0);m?T=g-2*(0!==e||0!==t?e+t:um(f.left,f.right)):E=A-2*(0!==r||0!==n?r+n:um(f.top,f.bottom))}await c({...e,availableWidth:T,availableHeight:E});let b=await l.getDimensions(u.floating);return g!==b.width||A!==b.height?{reset:{rects:!0}}:{}}}],y=await ((e,t,r)=>{let n=new Map,i={platform:cv,...r},a={...i.platform,_c:n};return uO(e,t,{...i,platform:a})})(e,T,{placement:D,strategy:o?"fixed":"absolute",middleware:A});null==t||t.setState("currentPlacement",y.placement),I(!0);let x=cx(y.x),B=cx(y.y);if(Object.assign(T.style,{top:"0",left:"0",transform:"translate3d(".concat(x,"px,").concat(B,"px,0)")}),s&&y.middlewareData.arrow){let{x:e,y:t}=y.middlewareData.arrow,r=y.placement.split("-")[0],n=s.clientWidth/2,i=s.clientHeight/2,a=null!=e?e+n:-n,o=null!=t?t+i:-i;T.style.setProperty("--popover-transform-origin",{top:"".concat(a,"px calc(100% + ").concat(i,"px)"),bottom:"".concat(a,"px ").concat(-i,"px"),left:"calc(100% + ".concat(n,"px) ").concat(o,"px"),right:"".concat(-n,"px ").concat(o,"px")}[r]),Object.assign(s.style,{left:null!=e?"".concat(e,"px"):"",top:null!=t?"".concat(t,"px"):"",[r]:"100%"})}},n=function(e,t,r,n){let i;void 0===n&&(n={});let{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=cn(e),d=a||s?[...c?ce(c):[],...ce(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),s&&e.addEventListener("resize",r)});let f=c&&l?function(e,t){let r,n=null,i=uJ(e);function a(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function s(o,l){void 0===o&&(o=!1),void 0===l&&(l=1),a();let u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:h}=u;if(o||t(),!f||!h)return;let p=ug(d),m=ug(i.clientWidth-(c+f)),g={rootMargin:-p+"px "+-m+"px "+-ug(i.clientHeight-(d+h))+"px "+-ug(c)+"px",threshold:um(0,up(1,l))||1},A=!0;function y(t){let n=t[0].intersectionRatio;if(n!==l){if(!A)return s();n?s(!1,n):r=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==n||cg(u,e.getBoundingClientRect())||s(),A=!1}try{n=new IntersectionObserver(y,{...g,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(y,g)}n.observe(e)}(!0),a}(c,r):null,h=-1,p=null;o&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),c&&!u&&p.observe(c),p.observe(t));let m=u?co(e):null;return u&&function t(){let n=co(e);m&&!cg(m,n)&&r(),m=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),s&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=p)||e.disconnect(),p=null,u&&cancelAnimationFrame(i)}}(e,T,async()=>{O?(await G({updatePosition:r}),I(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{I(!1),n()}},[t,w,T,C,S,T,D,M,L,o,l,u,c,d,f,h,p,m,g,U,O,G]),s1(()=>{if(!M||!L||!(null==T?void 0:T.isConnected)||!(null==b?void 0:b.isConnected))return;let e=()=>{T.style.zIndex=getComputedStyle(b).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[M,L,T,b]);let H=o?"fixed":"absolute";return x=s6(x,e=>(0,eI.jsx)("div",{...s,style:{position:H,top:0,left:0,width:"max-content",...null==s?void 0:s.style},ref:null==t?void 0:t.setPopoverElement,children:e}),[t,H,s]),x={"data-placing":!R||void 0,...x=s6(x,e=>(0,eI.jsx)(o2,{value:t,children:e}),[t]),style:{position:"relative",...x.style}},x=uf({store:t,modal:r,portal:n,preserveTabOrder:i,preserveTabOrderAnchor:E||S,autoFocusOnShow:R&&a,...x,portalRef:P})});uh(os(function(e){return ol("div",cB(e))}),o0);var cC=ou(function(e){let{store:t,modal:r,tabIndex:n,alwaysVisible:i,autoFocusOnHide:a=!0,hideOnInteractOutside:s=!0,...o}=e,l=o6();sG(t=t||l,!1);let u=t.useState("baseElement"),c=(0,eP.useRef)(!1),d=lb(t.tag,e=>null==e?void 0:e.renderedItems.length);return o=lk({store:t,alwaysVisible:i,...o}),o=cB({store:t,modal:r,alwaysVisible:i,backdrop:!1,autoFocusOnShow:!1,finalFocus:u,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:d,...o,getPersistentElements(){var e;let n=(null==(e=o.getPersistentElements)?void 0:e.call(o))||[];if(!r||!t)return n;let{contentElement:i,baseElement:a}=t.getState();if(!a)return n;let s=sm(a),l=[];if((null==i?void 0:i.id)&&l.push('[aria-controls~="'.concat(i.id,'"]')),(null==a?void 0:a.id)&&l.push('[aria-controls~="'.concat(a.id,'"]')),!l.length)return[...n,a];let u=l.join(",");return[...n,...s.querySelectorAll(u)]},autoFocusOnHide:e=>!sO(a,e)&&(!c.current||(c.current=!1,!1)),hideOnInteractOutside(e){var r,n;let i=null==t?void 0:t.getState(),a=null==(r=null==i?void 0:i.contentElement)?void 0:r.id,o=null==(n=null==i?void 0:i.baseElement)?void 0:n.id;if(function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n'[aria-controls~="'.concat(e,'"]')).join(", ");return!!t&&e.matches(t)}return!1}(e.target,a,o))return!1;let l="function"==typeof s?s(e):s;return l&&(c.current="click"===e.type),l}})}),cS=uh(os(function(e){return ol("div",cC(e))}),o6);(0,eP.createContext)(null),(0,eP.createContext)(null);var cE=oc([ov],[og]),cT=cE.useContext;cE.useScopedContext,cE.useProviderContext,cE.ContextProvider,cE.ScopedContextProvider;var cb={id:null};function cD(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function cM(e,t){return e.filter(e=>e.rowId===t)}function cw(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}function cF(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var cR=sJ()&&sj();function cI(){let{tag:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=ld(t.store,function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:{},r=null==(e=t.store)?void 0:e.getState(),n=function(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};lf(r,r.store);let n=null==(e=r.store)?void 0:e.getState(),i=sk(r.items,null==n?void 0:n.items,r.defaultItems,[]),a=new Map(i.map(e=>[e.id,e])),s={items:i,renderedItems:sk(null==n?void 0:n.renderedItems,[])},o=null==(t=r.store)?void 0:t.__unstablePrivateStore,l=li({items:i,renderedItems:s.renderedItems},o),u=li(s,r.store),c=e=>{let t=function(e,t){let r=e.map((e,t)=>[t,e]),n=!1;return(r.sort((e,r)=>{var i;let[a,s]=e,[o,l]=r,u=t(s),c=t(l);return u!==c&&u&&c?(i=u,c.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_PRECEDING)?(a>o&&(n=!0),-1):(a{let[t,r]=e;return r}):e}(e,e=>e.element);l.setState("renderedItems",t),u.setState("renderedItems",t)};la(u,()=>ls(l)),la(l,()=>lu(l,["items"],e=>{u.setState("items",e.items)})),la(l,()=>lu(l,["renderedItems"],e=>{let t=!0,r=requestAnimationFrame(()=>{let{renderedItems:t}=u.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(r);let n=new IntersectionObserver(()=>{if(t){t=!1;return}cancelAnimationFrame(r),r=requestAnimationFrame(()=>c(e.renderedItems))},{root:function(e){var t;let r=e.find(e=>!!e.element),n=[...e].reverse().find(e=>!!e.element),i=null==(t=null==r?void 0:r.element)?void 0:t.parentElement;for(;i&&(null==n?void 0:n.element);){let e=i;if(n&&e.contains(n.element))return i;i=i.parentElement}return sm(i).body}(e.renderedItems)});for(let t of e.renderedItems)t.element&&n.observe(t.element);return()=>{cancelAnimationFrame(r),n.disconnect()}}));let d=function(e,t){let r,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t(t=>{let n=t.findIndex(t=>{let{id:r}=t;return r===e.id}),i=t.slice();if(-1!==n){let s={...r=t[n],...e};i[n]=s,a.set(e.id,s)}else i.push(e),a.set(e.id,e);return i}),()=>{t(t=>{if(!r)return n&&a.delete(e.id),t.filter(t=>{let{id:r}=t;return r!==e.id});let i=t.findIndex(t=>{let{id:r}=t;return r===e.id});if(-1===i)return t;let s=t.slice();return s[i]=r,a.set(e.id,r),s})}},f=e=>d(e,e=>l.setState("items",e),!0);return{...u,registerItem:f,renderItem:e=>sL(f(e),d(e,e=>l.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=a.get(e);if(!t){let{items:r}=l.getState();(t=r.find(t=>t.id===e))&&a.set(e,t)}return t||null},__unstablePrivateStore:l}}(t),i=sk(t.activeId,null==r?void 0:r.activeId,t.defaultActiveId),a=li({...n.getState(),id:sk(t.id,null==r?void 0:r.id,"id-".concat(Math.random().toString(36).slice(2,8))),activeId:i,baseElement:sk(null==r?void 0:r.baseElement,null),includesBaseElement:sk(t.includesBaseElement,null==r?void 0:r.includesBaseElement,null===i),moves:sk(null==r?void 0:r.moves,0),orientation:sk(t.orientation,null==r?void 0:r.orientation,"both"),rtl:sk(t.rtl,null==r?void 0:r.rtl,!1),virtualFocus:sk(t.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:sk(t.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:sk(t.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:sk(t.focusShift,null==r?void 0:r.focusShift,!1)},n,t.store);la(a,()=>ll(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=cD(e.renderedItems))?void 0:r.id})}));let s=function(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"next",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.getState(),{skip:s=0,activeId:o=i.activeId,focusShift:l=i.focusShift,focusLoop:u=i.focusLoop,focusWrap:c=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:f=i.renderedItems,rtl:h=i.rtl}=n,p="up"===r||"down"===r,m="next"===r||"down"===r,g=p?oz(function(e,t,r){let n=cF(e);for(let i of e)for(let e=0;ee.id===o);if(!A)return null==(t=cD(g))?void 0:t.id;let y=g.some(e=>e.rowId),x=g.indexOf(A),B=g.slice(x+1),C=cM(B,A.rowId);if(s){let e=C.filter(e=>o?!e.disabled&&e.id!==o:!e.disabled),t=e.slice(s)[0]||e[e.length-1];return null==t?void 0:t.id}let S=u&&(p?"horizontal"!==u:"vertical"!==u),E=y&&c&&(p?"horizontal"!==c:"vertical"!==c),T=m?(!y||p)&&S&&d:!!p&&d;if(S){let e=cD(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e.findIndex(e=>e.id===t);return[...e.slice(n+1),...r?[cb]:[],...e.slice(0,n)]}(E&&!T?g:cM(g,A.rowId),o,T),o);return null==e?void 0:e.id}if(E){let e=cD(T?C:B,o);return T?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let b=cD(C,o);return!b&&T?null:null==b?void 0:b.id};return{...n,...a,setBaseElement:e=>a.setState("baseElement",e),setActiveId:e=>a.setState("activeId",e),move:e=>{void 0!==e&&(a.setState("activeId",e),a.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=cD(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=cD(oj(a.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("up",e))}}({...t,activeId:a,includesBaseElement:sk(t.includesBaseElement,null==i?void 0:i.includesBaseElement,!0),orientation:sk(t.orientation,null==i?void 0:i.orientation,"vertical"),focusLoop:sk(t.focusLoop,null==i?void 0:i.focusLoop,!0),focusWrap:sk(t.focusWrap,null==i?void 0:i.focusWrap,!0),virtualFocus:sk(t.virtualFocus,null==i?void 0:i.virtualFocus,!0)}),o=function(){let{popover:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=ld(t.store,lc(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));lf(t,r);let n=null==r?void 0:r.getState(),i=uu({...t,store:r}),a=sk(t.placement,null==n?void 0:n.placement,"bottom"),s=li({...i.getState(),placement:a,currentPlacement:a,anchorElement:sk(null==n?void 0:n.anchorElement,null),popoverElement:sk(null==n?void 0:n.popoverElement,null),arrowElement:sk(null==n?void 0:n.arrowElement,null),rendered:Symbol("rendered")},i,r);return{...i,...s,setAnchorElement:e=>s.setState("anchorElement",e),setPopoverElement:e=>s.setState("popoverElement",e),setArrowElement:e=>s.setState("arrowElement",e),render:()=>s.setState("rendered",Symbol("rendered"))}}({...t,placement:sk(t.placement,null==i?void 0:i.placement,"bottom-start")}),l=sk(t.value,null==i?void 0:i.value,t.defaultValue,""),u=sk(t.selectedValue,null==i?void 0:i.selectedValue,null==n?void 0:n.values,t.defaultSelectedValue,""),c=Array.isArray(u),d={...s.getState(),...o.getState(),value:l,selectedValue:u,resetValueOnSelect:sk(t.resetValueOnSelect,null==i?void 0:i.resetValueOnSelect,c),resetValueOnHide:sk(t.resetValueOnHide,null==i?void 0:i.resetValueOnHide,c&&!e),activeValue:null==i?void 0:i.activeValue},f=li(d,s,o,r);return cR&&la(f,()=>ll(f,["virtualFocus"],()=>{f.setState("virtualFocus",!1)})),la(f,()=>{if(e)return sL(ll(f,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),ll(e,["values"],e=>{f.setState("selectedValue",e.values)}))}),la(f,()=>ll(f,["resetValueOnHide","mounted"],e=>{e.resetValueOnHide&&(e.mounted||f.setState("value",l))})),la(f,()=>ll(f,["open"],e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})),la(f,()=>ll(f,["moves","activeId"],(e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})),la(f,()=>lu(f,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;let{activeId:r}=f.getState(),n=s.item(r);f.setState("activeValue",null==n?void 0:n.value)})),{...o,...s,...f,tag:e,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",d.value),setSelectedValue:e=>f.setState("selectedValue",e)}}function cP(){var e,t,r,n,i,a;let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[o,l]=lw(cI,s=function(e){var t;let r=cT();return{id:s3((t=e={...e,tag:void 0!==e.tag?e.tag:r}).id),...t}}(s));return s4(l,[(e=s).tag]),lM(o,e,"value","setValue"),lM(o,e,"selectedValue","setSelectedValue"),lM(o,e,"resetValueOnHide"),lM(o,e,"resetValueOnSelect"),Object.assign((n=o,s4(i=l,[(a=e).popover]),lM(n,a,"placement"),t=us(n,i,a),r=t,s4(l,[e.store]),lM(r,e,"items","setItems"),lM(t=r,e,"activeId","setActiveId"),lM(t,e,"includesBaseElement"),lM(t,e,"virtualFocus"),lM(t,e,"orientation"),lM(t,e,"rtl"),lM(t,e,"focusLoop"),lM(t,e,"focusWrap"),lM(t,e,"focusShift"),t),{tag:e.tag})}function cL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=cP(e);return(0,eI.jsx)(o7,{value:t,children:e.children})}var cU=(0,eP.createContext)(void 0),cG=ou(function(e){let[t,r]=(0,eP.useState)();return sN(e={role:"group","aria-labelledby":t,...e=s6(e,e=>(0,eI.jsx)(cU.Provider,{value:r,children:e}),[])})});os(function(e){return ol("div",cG(e))});var cO=ou(function(e){let{store:t,...r}=e;return cG(r)});os(function(e){return ol("div",cO(e))});var cH=ou(function(e){let{store:t,...r}=e,n=o5();return sG(t=t||n,!1),"grid"===sb(t.useState("contentElement"))&&(r={role:"rowgroup",...r}),r=cO({store:t,...r})}),cN=os(function(e){return ol("div",cH(e))}),ck=ou(function(e){let t=(0,eP.useContext)(cU),r=s3(e.id);return s1(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),sN(e={id:r,"aria-hidden":!0,...e})});os(function(e){return ol("div",ck(e))});var cz=ou(function(e){let{store:t,...r}=e;return ck(r)});os(function(e){return ol("div",cz(e))});var cj=ou(function(e){return cz(e)}),cK=os(function(e){return ol("div",cj(e))}),cJ=e.i(38360);let cV={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},cQ=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function cW(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{keys:n,threshold:i=cV.MATCHES,baseSort:a=cQ,sorter:s=e=>e.sort((e,t)=>(function(e,t,r){let{rank:n,keyIndex:i}=e,{rank:a,keyIndex:s}=t;return n!==a?n>a?-1:1:i===s?r(e,t):i{let{rank:n,rankedValue:i,keyIndex:a,keyThreshold:s}=e,{itemValue:o,attributes:l}=t,d=cX(o,u,c),f=i,{minRanking:h,maxRanking:p,threshold:m}=l;return d=cV.MATCHES?d=h:d>p&&(d=p),d>n&&(n=d,a=r,s=m,f=o),{rankedValue:f,rank:n,keyIndex:a,keyThreshold:s}},{rankedValue:o,rank:cV.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:o,rank:cX(o,u,c),keyIndex:-1,keyThreshold:c.threshold}),{rank:f,keyThreshold:h=i}=d;return f>=h&&e.push({...d,item:a,index:s}),e},[])).map(e=>{let{item:t}=e;return t})}function cX(e,t,r){if(e=cZ(e,r),(t=cZ(t,r)).length>e.length)return cV.NO_MATCH;if(e===t)return cV.CASE_SENSITIVE_EQUAL;let n=function*(e,t){let r=-1;for(;(r=e.indexOf(t,r+1))>-1;)yield r;return -1}(e=e.toLowerCase(),t=t.toLowerCase()),i=n.next(),a=i.value;if(e.length===t.length&&0===a)return cV.EQUAL;if(0===a)return cV.STARTS_WITH;let s=i;for(;!s.done;){if(s.value>0&&" "===e[s.value-1])return cV.WORD_STARTS_WITH;s=n.next()}return a>0?cV.CONTAINS:1===t.length?cV.NO_MATCH:(function(e){let t="",r=" ";for(let n=0;n-1))return cV.NO_MATCH;var s=n-a;let o=r/t.length;return cV.MATCHES+1/s*o}(e,t)}function cZ(e,t){let{keepDiacritics:r}=t;return e="".concat(e),r||(e=(0,cJ.default)(e)),e}cW.rankings=cV;let cY={maxRanking:1/0,minRanking:-1/0};var c_=e.i(29402);let cq=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),c$={"missions.vl2":"Official","TR2final105-client.vl2":"Team Rabbit 2","z_mappacks/CTF/Classic_maps_v1.vl2":"Classic","z_mappacks/CTF/DynamixFinalPack.vl2":"Official","z_mappacks/CTF/KryMapPack_b3EDIT.vl2":"KryMapPack","z_mappacks/CTF/S5maps.vl2":"S5","z_mappacks/CTF/S8maps.vl2":"S8","z_mappacks/CTF/TWL-MapPack.vl2":"TWL","z_mappacks/CTF/TWL-MapPackEDIT.vl2":"TWL","z_mappacks/CTF/TWL2-MapPack.vl2":"TWL2","z_mappacks/CTF/TWL2-MapPackEDIT.vl2":"TWL2","z_mappacks/TWL_T2arenaOfficialMaps.vl2":"Arena","z_mappacks/z_DMP2-V0.6.vl2":"DMP2 (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX.vl2":"DMP (Discord Map Pack)"},c0={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},c1=(0,aJ.getMissionList)().filter(e=>!cq.has(e)).map(e=>{var t,r;let n=(0,aJ.getMissionInfo)(e),[i]=(0,aJ.getSourceAndPath)(n.resourcePath),a=(e=>{let t=e.match(/^(.*)(\/[^/]+)$/);return t?t[1]:""})(i),s=null!=(r=null!=(t=c$[i])?t:c0[a])?r:null;return{resourcePath:n.resourcePath,missionName:e,displayName:n.displayName,sourcePath:i,groupName:s,missionTypes:n.missionTypes}}),c2=new Map(c1.map(e=>[e.missionName,e])),c9=function(e){let t=new Map;for(let n of e){var r;let e=null!=(r=t.get(n.groupName))?r:[];e.push(n),t.set(n.groupName,e)}return t.forEach((e,r)=>{t.set(r,(0,c_.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,c_.default)(Array.from(t.entries()),[e=>{let[t]=e;return"Official"===t?0:null==t?2:1},e=>{let[t]=e;return t?t.toLowerCase():""}],["asc","asc"])}(c1),c3="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function c4(e){let{mission:t}=e;return(0,eI.jsxs)(eI.Fragment,{children:[(0,eI.jsxs)("span",{className:"MissionSelect-itemHeader",children:[(0,eI.jsx)("span",{className:"MissionSelect-itemName",children:t.displayName||t.missionName}),t.missionTypes.length>0&&(0,eI.jsx)("span",{className:"MissionSelect-itemTypes",children:t.missionTypes.map(e=>(0,eI.jsx)("span",{className:"MissionSelect-itemType",children:e},e))})]}),(0,eI.jsx)("span",{className:"MissionSelect-itemMissionName",children:t.missionName})]})}function c8(e){let{value:t,onChange:r}=e,[n,i]=(0,eP.useState)(""),a=(0,eP.useRef)(null),s=cP({resetValueOnHide:!0,selectedValue:t,setSelectedValue:e=>{e&&r(e)},setValue:e=>{(0,eP.startTransition)(()=>i(e))}});(0,eP.useEffect)(()=>{let e=e=>{if("k"===e.key&&(e.metaKey||e.ctrlKey)){var t;e.preventDefault(),null==(t=a.current)||t.focus(),s.show()}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s]);let o=c2.get(t),l=(0,eP.useMemo)(()=>n?{type:"flat",missions:cW(c1,n,{keys:["displayName","missionName"]})}:{type:"grouped",groups:c9},[n]),u=o?o.displayName||o.missionName:t,c="flat"===l.type?0===l.missions.length:0===l.groups.length;return(0,eI.jsxs)(cL,{store:s,children:[(0,eI.jsxs)("div",{className:"MissionSelect-inputWrapper",children:[(0,eI.jsx)(lv,{ref:a,autoSelect:!0,placeholder:u,className:"MissionSelect-input",onFocus:()=>{document.exitPointerLock(),s.show()}}),(0,eI.jsx)("kbd",{className:"MissionSelect-shortcut",children:c3?"⌘K":"^K"})]}),(0,eI.jsx)(cS,{gutter:4,fitViewport:!0,className:"MissionSelect-popover",children:(0,eI.jsxs)(lz,{className:"MissionSelect-list",children:["flat"===l.type?l.missions.map(e=>(0,eI.jsx)(lP,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,children:(0,eI.jsx)(c4,{mission:e})},e.missionName)):l.groups.map(e=>{let[t,r]=e;return t?(0,eI.jsxs)(cN,{className:"MissionSelect-group",children:[(0,eI.jsx)(cK,{className:"MissionSelect-groupLabel",children:t}),r.map(e=>(0,eI.jsx)(lP,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,children:(0,eI.jsx)(c4,{mission:e})},e.missionName))]},t):(0,eI.jsx)(eP.Fragment,{children:r.map(e=>(0,eI.jsx)(lP,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,children:(0,eI.jsx)(c4,{mission:e})},e.missionName))},"ungrouped")}),c&&(0,eI.jsx)("div",{className:"MissionSelect-noResults",children:"No missions found"})]})})]})}function c5(e){let{missionName:t,onChangeMission:r}=e,{fogEnabled:n,setFogEnabled:i,fov:a,setFov:s,audioEnabled:o,setAudioEnabled:l,animationEnabled:u,setAnimationEnabled:c}=(0,n$.useSettings)(),{speedMultiplier:d,setSpeedMultiplier:f}=(0,n$.useControls)(),{debugMode:h,setDebugMode:p}=(0,n$.useDebug)();return(0,eI.jsxs)("div",{id:"controls",onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,eI.jsx)(c8,{value:t,onChange:r}),(0,eI.jsxs)("div",{className:"CheckboxField",children:[(0,eI.jsx)("input",{id:"fogInput",type:"checkbox",checked:n,onChange:e=>{i(e.target.checked)}}),(0,eI.jsx)("label",{htmlFor:"fogInput",children:"Fog?"})]}),(0,eI.jsxs)("div",{className:"CheckboxField",children:[(0,eI.jsx)("input",{id:"audioInput",type:"checkbox",checked:o,onChange:e=>{l(e.target.checked)}}),(0,eI.jsx)("label",{htmlFor:"audioInput",children:"Audio?"})]}),(0,eI.jsxs)("div",{className:"CheckboxField",children:[(0,eI.jsx)("input",{id:"animationInput",type:"checkbox",checked:u,onChange:e=>{c(e.target.checked)}}),(0,eI.jsx)("label",{htmlFor:"animationInput",children:"Animation?"})]}),(0,eI.jsxs)("div",{className:"CheckboxField",children:[(0,eI.jsx)("input",{id:"debugInput",type:"checkbox",checked:h,onChange:e=>{p(e.target.checked)}}),(0,eI.jsx)("label",{htmlFor:"debugInput",children:"Debug?"})]}),(0,eI.jsxs)("div",{className:"Field",children:[(0,eI.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),(0,eI.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:a,onChange:e=>s(parseInt(e.target.value))}),(0,eI.jsx)("output",{htmlFor:"speedInput",children:a})]}),(0,eI.jsxs)("div",{className:"Field",children:[(0,eI.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),(0,eI.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:d,onChange:e=>f(parseFloat(e.target.value))})]})]})}let c6=eP.forwardRef((e,t)=>{let{envMap:r,resolution:n=256,frames:i=1/0,makeDefault:a,children:s,...o}=e,l=(0,eJ.useThree)(e=>{let{set:t}=e;return t}),u=(0,eJ.useThree)(e=>{let{camera:t}=e;return t}),c=(0,eJ.useThree)(e=>{let{size:t}=e;return t}),d=eP.useRef(null);eP.useImperativeHandle(t,()=>d.current,[]);let f=eP.useRef(null),h=function(e,t,r){let n=(0,eJ.useThree)(e=>e.size),i=(0,eJ.useThree)(e=>e.viewport),a="number"==typeof e?e:n.width*i.dpr,s=n.height*i.dpr,o=("number"==typeof e?void 0:e)||{},{samples:l=0,depth:u,...c}=o,d=null!=u?u:o.depthBuffer,f=eP.useMemo(()=>{let e=new eO.WebGLRenderTarget(a,s,{minFilter:eO.LinearFilter,magFilter:eO.LinearFilter,type:eO.HalfFloatType,...c});return d&&(e.depthTexture=new eO.DepthTexture(a,s,eO.FloatType)),e.samples=l,e},[]);return eP.useLayoutEffect(()=>{f.setSize(a,s),l&&(f.samples=l)},[l,f,a,s]),eP.useEffect(()=>()=>f.dispose(),[]),f}(n);eP.useLayoutEffect(()=>{o.manual||(d.current.aspect=c.width/c.height)},[c,o]),eP.useLayoutEffect(()=>{d.current.updateProjectionMatrix()});let p=0,m=null,g="function"==typeof s;return(0,eV.useFrame)(e=>{g&&(i===1/0||p{if(a)return l(()=>({camera:d.current})),()=>l(()=>({camera:u}))},[d,a,l]),eP.createElement(eP.Fragment,null,eP.createElement("perspectiveCamera",(0,ii.default)({ref:d},o),!g&&s),eP.createElement("group",{ref:f},g&&s(h.texture)))});function c7(){let{fov:e}=(0,n$.useSettings)();return(0,eI.jsx)(c6,{makeDefault:!0,position:[0,256,0],fov:e})}var de=e.i(51434),dt=e.i(81405);function dr(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function dn(e){let{showPanel:t=0,className:r,parent:n}=e,i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,[n,i]=eP.useState();return eP.useLayoutEffect(()=>{let t=e();return i(t),dr(r,t),()=>dr(r,null)},t),n}(()=>new dt.default,[]);return eP.useEffect(()=>{if(i){let e=n&&n.current||document.body;i.showPanel(t),null==e||e.appendChild(i.dom);let a=(null!=r?r:"").split(" ").filter(e=>e);a.length&&i.dom.classList.add(...a);let s=(0,eU.j)(()=>i.begin()),o=(0,eU.k)(()=>i.end());return()=>{a.length&&i.dom.classList.remove(...a),null==e||e.removeChild(i.dom),s(),o()}}},[n,i,r,t]),null}var di=e.i(60099);function da(){let{debugMode:e}=(0,n$.useDebug)(),t=(0,eP.useRef)(null);return(0,eP.useEffect)(()=>{let e=t.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")}),e?(0,eI.jsxs)(eI.Fragment,{children:[(0,eI.jsx)(dn,{className:"StatsPanel"}),(0,eI.jsx)("axesHelper",{ref:t,args:[70],renderOrder:999,children:(0,eI.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,eI.jsx)(di.Html,{position:[80,0,0],center:!0,children:(0,eI.jsx)("span",{className:"AxisLabel","data-axis":"y",children:"Y"})}),(0,eI.jsx)(di.Html,{position:[0,80,0],center:!0,children:(0,eI.jsx)("span",{className:"AxisLabel","data-axis":"z",children:"Z"})}),(0,eI.jsx)(di.Html,{position:[0,0,80],center:!0,children:(0,eI.jsx)("span",{className:"AxisLabel","data-axis":"x",children:"X"})})]}):null}let ds=new a9;function dl(){let e=(0,eL.useSearchParams)(),t=(0,eL.useRouter)(),[r,n]=(0,eP.useState)(e.get("mission")||"TWL2_WoodyMyrk"),[i,a]=(0,eP.useState)(0),[s,o]=(0,eP.useState)(!0),l=i<1;(0,eP.useEffect)(()=>{if(l)o(!0);else{let e=setTimeout(()=>o(!1),500);return()=>clearTimeout(e)}},[l]),(0,eP.useEffect)(()=>(window.setMissionName=n,window.getMissionList=aJ.getMissionList,window.getMissionInfo=aJ.getMissionInfo,()=>{delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}),[]),(0,eP.useEffect)(()=>{let e=new URLSearchParams;e.set("mission",r),t.replace("?".concat(e.toString()),{scroll:!1})},[r,t]);let u=(0,eP.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(t)},[]);return(0,eI.jsx)(nj,{client:ds,children:(0,eI.jsx)("main",{children:(0,eI.jsxs)(n$.SettingsProvider,{children:[(0,eI.jsxs)("div",{id:"canvasContainer",children:[s&&(0,eI.jsxs)("div",{id:"loadingIndicator","data-complete":!l,children:[(0,eI.jsx)("div",{className:"LoadingSpinner"}),(0,eI.jsx)("div",{className:"LoadingProgress",children:(0,eI.jsx)("div",{className:"LoadingProgress-bar",style:{width:"".concat(100*i,"%")}})}),(0,eI.jsxs)("div",{className:"LoadingProgress-text",children:[Math.round(100*i),"%"]})]}),(0,eI.jsxs)(eK,{shadows:!0,frameloop:"always",children:[(0,eI.jsx)(aO,{children:(0,eI.jsxs)(de.AudioProvider,{children:[(0,eI.jsx)(aX,{name:r,onLoadingChange:u},r),(0,eI.jsx)(c7,{}),(0,eI.jsx)(da,{}),(0,eI.jsx)(sh,{})]})}),(0,eI.jsx)(rj,{children:(0,eI.jsx)(rJ,{intensity:3,aoRadius:3,quality:"performance"})})]})]}),(0,eI.jsx)(c5,{missionName:r,onChangeMission:n})]})})})}function du(){return(0,eI.jsx)(eP.Suspense,{children:(0,eI.jsx)(dl,{})})}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/f863efae27259b81.js b/docs/_next/static/chunks/f863efae27259b81.js new file mode 100644 index 00000000..4d520adb --- /dev/null +++ b/docs/_next/static/chunks/f863efae27259b81.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42585,e=>{"use strict";e.s(["WaterBlock",()=>m,"WaterMaterial",()=>p,"WaterSurfaceMaterial",()=>d],42585);var n=e.i(43476),a=e.i(71645),t=e.i(47071),o=e.i(5230),i=e.i(90072),r=e.i(12979),l=e.i(62395),s=e.i(75567),u=e.i(48066),c=e.i(47021);let v="\n #include \n\n // Enable volumetric fog (must be defined before fog uniforms)\n #ifdef USE_FOG\n #define USE_VOLUMETRIC_FOG\n #define USE_FOG_WORLD_POSITION\n #endif\n\n uniform float uTime;\n uniform float uOpacity;\n uniform float uEnvMapIntensity;\n uniform sampler2D uBaseTexture;\n uniform sampler2D uEnvMapTexture;\n\n // Volumetric fog uniforms\n #ifdef USE_FOG\n uniform float fogVolumeData[12];\n uniform float cameraHeight;\n varying vec3 vFogWorldPosition;\n #endif\n\n varying vec3 vWorldPosition;\n varying vec3 vViewVector;\n varying float vDistance;\n\n #define TWO_PI 6.283185307179586\n\n // Constants from Tribes 2 engine\n #define BASE_DRIFT_CYCLE_TIME 8.0\n #define BASE_DRIFT_RATE 0.02\n #define BASE_DRIFT_SCALAR 0.03\n #define TEXTURE_SCALE (1.0 / 48.0)\n\n // Environment map UV wobble constants\n #define Q1 150.0\n #define Q2 2.0\n #define Q3 0.01\n\n // Rotate UV coordinates\n vec2 rotateUV(vec2 uv, float angle) {\n float c = cos(angle);\n float s = sin(angle);\n return vec2(\n uv.x * c - uv.y * s,\n uv.x * s + uv.y * c\n );\n }\n\n void main() {\n // Calculate base texture UVs using world position (1/48 tiling)\n vec2 baseUV = vWorldPosition.xz * TEXTURE_SCALE;\n\n // Phase (time in radians for drift cycle)\n float phase = mod(uTime * (TWO_PI / BASE_DRIFT_CYCLE_TIME), TWO_PI);\n\n // Base texture drift\n float baseDriftX = uTime * BASE_DRIFT_RATE;\n float baseDriftY = cos(phase) * BASE_DRIFT_SCALAR;\n\n // === Phase 1a: First base texture pass (rotated 30 degrees) ===\n vec2 uv1a = rotateUV(baseUV, radians(30.0));\n\n // === Phase 1b: Second base texture pass (rotated 60 degrees total, with drift) ===\n vec2 uv1b = rotateUV(baseUV + vec2(baseDriftX, baseDriftY), radians(60.0));\n\n // Calculate cross-fade swing value\n float A1 = cos(((vWorldPosition.x / Q1) + (uTime / Q2)) * 6.0);\n float A2 = sin(((vWorldPosition.z / Q1) + (uTime / Q2)) * TWO_PI);\n float swing = (A1 + A2) * 0.15 + 0.5;\n\n // Cross-fade alpha calculation from engine\n float alpha1a = ((1.0 - swing) * uOpacity) / max(1.0 - (swing * uOpacity), 0.001);\n float alpha1b = swing * uOpacity;\n\n // Sample base texture for both passes\n vec4 texColor1a = texture2D(uBaseTexture, uv1a);\n vec4 texColor1b = texture2D(uBaseTexture, uv1b);\n\n // Combined alpha and color\n float combinedAlpha = 1.0 - (1.0 - alpha1a) * (1.0 - alpha1b);\n vec3 baseColor = (texColor1a.rgb * alpha1a * (1.0 - alpha1b) + texColor1b.rgb * alpha1b) / max(combinedAlpha, 0.001);\n\n // === Phase 3: Environment map / specular ===\n vec3 reflectVec = -vViewVector;\n reflectVec.y = abs(reflectVec.y);\n if (reflectVec.y < 0.001) reflectVec.y = 0.001;\n\n vec2 envUV;\n if (vDistance < 0.001) {\n envUV = vec2(0.0);\n } else {\n float value = (vDistance - reflectVec.y) / (vDistance * vDistance);\n envUV.x = reflectVec.x * value;\n envUV.y = reflectVec.z * value;\n }\n\n envUV = envUV * 0.5 + 0.5;\n envUV.x += A1 * Q3;\n envUV.y += A2 * Q3;\n\n vec4 envColor = texture2D(uEnvMapTexture, envUV);\n vec3 finalColor = baseColor + envColor.rgb * envColor.a * uEnvMapIntensity;\n\n // Note: Tribes 2 water does NOT use lighting - Phase 2 (lightmap) is disabled\n // in the original engine. Water colors come directly from textures.\n\n gl_FragColor = vec4(finalColor, combinedAlpha);\n\n // Apply volumetric fog using shared Torque-style fog shader\n ".concat(c.fogFragmentShader,"\n }\n");var f=e.i(79123);function d(e){let{surfaceTexture:l,envMapTexture:c,opacity:d=.75,waveMagnitude:p=1,envMapIntensity:m=1,attach:g}=e,h=(0,r.textureToUrl)(l),x=(0,r.textureToUrl)(null!=c?c:"special/lush_env"),[T,y]=(0,t.useTexture)([h,x],e=>{(Array.isArray(e)?e:[e]).forEach(e=>{(0,s.setupColor)(e),e.colorSpace=i.NoColorSpace,e.wrapS=i.RepeatWrapping,e.wrapT=i.RepeatWrapping})}),{animationEnabled:b}=(0,f.useSettings)(),w=(0,a.useMemo)(()=>{var e,n,a,t,o,r;return e={opacity:d,waveMagnitude:p,envMapIntensity:m,baseTexture:T,envMapTexture:y},new i.ShaderMaterial({uniforms:{uTime:{value:0},uOpacity:{value:null!=(n=null==e?void 0:e.opacity)?n:.75},uWaveMagnitude:{value:null!=(a=null==e?void 0:e.waveMagnitude)?a:1},uEnvMapIntensity:{value:null!=(t=null==e?void 0:e.envMapIntensity)?t:1},uBaseTexture:{value:null!=(o=null==e?void 0:e.baseTexture)?o:null},uEnvMapTexture:{value:null!=(r=null==e?void 0:e.envMapTexture)?r:null},fogColor:{value:new i.Color},fogNear:{value:1},fogFar:{value:2e3},fogVolumeData:u.globalFogUniforms.fogVolumeData,cameraHeight:u.globalFogUniforms.cameraHeight},vertexShader:"\n #include \n\n #ifdef USE_FOG\n #define USE_FOG_WORLD_POSITION\n varying vec3 vFogWorldPosition;\n #endif\n\n uniform float uTime;\n uniform float uWaveMagnitude;\n\n varying vec3 vWorldPosition;\n varying vec3 vViewVector;\n varying float vDistance;\n\n // Wave function matching Tribes 2 engine\n // Z = surfaceZ + (sin(X*0.05 + time) + sin(Y*0.05 + time)) * waveFactor\n // waveFactor = waveAmplitude * 0.25\n // Note: Using xz for Three.js Y-up (Torque uses XY with Z-up)\n float getWaveHeight(vec3 worldPos) {\n float waveFactor = uWaveMagnitude * 0.25;\n return (sin(worldPos.x * 0.05 + uTime) + sin(worldPos.z * 0.05 + uTime)) * waveFactor;\n }\n\n void main() {\n // Get world position for wave calculation\n vec4 worldPos = modelMatrix * vec4(position, 1.0);\n vWorldPosition = worldPos.xyz;\n\n // Apply wave displacement to Y (vertical axis in Three.js)\n vec3 displaced = position;\n displaced.y += getWaveHeight(worldPos.xyz);\n\n // Calculate final world position after displacement for fog\n #ifdef USE_FOG\n vec4 displacedWorldPos = modelMatrix * vec4(displaced, 1.0);\n vFogWorldPosition = displacedWorldPos.xyz;\n #endif\n\n // Calculate view vector for environment mapping\n vViewVector = cameraPosition - worldPos.xyz;\n vDistance = length(vViewVector);\n\n vec4 mvPosition = viewMatrix * modelMatrix * vec4(displaced, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n // Set fog depth (distance from camera) - normally done by fog_vertex include\n // but we can't use that include because it references 'transformed' which we don't have\n #ifdef USE_FOG\n vFogDepth = length(mvPosition.xyz);\n #endif\n }\n",fragmentShader:v,transparent:!0,side:i.DoubleSide,depthWrite:!0,fog:!0})},[d,p,m,T,y]),P=(0,a.useRef)(0);return(0,o.useFrame)((e,n)=>{if(!b){P.current=0,w.uniforms.uTime.value=0;return}P.current+=n,w.uniforms.uTime.value=P.current}),(0,a.useEffect)(()=>()=>{w.dispose()},[w]),(0,n.jsx)("primitive",{object:w,attach:g})}function p(e){let{surfaceTexture:a,attach:o}=e,l=(0,r.textureToUrl)(a),u=(0,t.useTexture)(l,e=>(0,s.setupColor)(e));return(0,n.jsx)("meshStandardMaterial",{attach:o,map:u,transparent:!0,opacity:.8,side:i.DoubleSide})}let m=(0,a.memo)(function(e){var t,o,r,s;let{object:u}=e,c=(0,a.useMemo)(()=>(0,l.getPosition)(u),[u]),v=(0,a.useMemo)(()=>(0,l.getRotation)(u),[u]),[f,p,m]=(0,a.useMemo)(()=>(0,l.getScale)(u),[u]),g=null!=(t=(0,l.getProperty)(u,"surfaceTexture"))?t:"liquidTiles/BlueWater",h=(0,l.getProperty)(u,"envMapTexture"),x=parseFloat(null!=(o=(0,l.getProperty)(u,"surfaceOpacity"))?o:"0.75"),T=parseFloat(null!=(r=(0,l.getProperty)(u,"waveMagnitude"))?r:"1.0"),y=parseFloat(null!=(s=(0,l.getProperty)(u,"envMapIntensity"))?s:"1.0"),b=(0,a.useMemo)(()=>{let[e,n]=function(e,n){let a=e<=1024&&n<=1024?8:16;return[Math.max(4,Math.ceil(e/a)),Math.max(4,Math.ceil(n/a))]}(f,m),a=new i.PlaneGeometry(f,m,e,n);return a.rotateX(-Math.PI/2),a.translate(f/2,p,m/2),a},[f,p,m]);return(0,a.useEffect)(()=>()=>{b.dispose()},[b]),(0,n.jsx)("group",{position:c,quaternion:v,children:(0,n.jsx)("mesh",{geometry:b,children:(0,n.jsx)(a.Suspense,{fallback:(0,n.jsx)("meshStandardMaterial",{color:"blue",transparent:!0,opacity:.3,side:i.DoubleSide}),children:(0,n.jsx)(d,{attach:"material",surfaceTexture:g,envMapTexture:h,opacity:x,waveMagnitude:T,envMapIntensity:y})})})})})}]); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 5df073a6..28766509 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -MapGenius – Explore maps for Tribes 2 \ No newline at end of file +MapGenius – Explore maps for Tribes 2 \ No newline at end of file diff --git a/docs/index.txt b/docs/index.txt index 9f6df24e..da85293c 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -2,7 +2,7 @@ 2:I[39756,["/t2-mapper/_next/static/chunks/060f9a97930f3d04.js"],"default"] 3:I[37457,["/t2-mapper/_next/static/chunks/060f9a97930f3d04.js"],"default"] 4:I[47257,["/t2-mapper/_next/static/chunks/060f9a97930f3d04.js"],"ClientPageRoot"] -5:I[31713,["/t2-mapper/_next/static/chunks/544fd4f09b7df0da.js","/t2-mapper/_next/static/chunks/32ef0c8650712240.js","/t2-mapper/_next/static/chunks/d07990f13ea8bb98.js","/t2-mapper/_next/static/chunks/b70f08013a69708a.js"],"default"] +5:I[31713,["/t2-mapper/_next/static/chunks/a99c02adf7563d85.js","/t2-mapper/_next/static/chunks/bce28defe6a29ff5.js","/t2-mapper/_next/static/chunks/32ef0c8650712240.js","/t2-mapper/_next/static/chunks/49f75d30e4f6ac74.js"],"default"] 8:I[97367,["/t2-mapper/_next/static/chunks/060f9a97930f3d04.js"],"OutletBoundary"] a:I[11533,["/t2-mapper/_next/static/chunks/060f9a97930f3d04.js"],"AsyncMetadataOutlet"] c:I[97367,["/t2-mapper/_next/static/chunks/060f9a97930f3d04.js"],"ViewportBoundary"] @@ -10,7 +10,7 @@ e:I[97367,["/t2-mapper/_next/static/chunks/060f9a97930f3d04.js"],"MetadataBounda f:"$Sreact.suspense" 11:I[68027,[],"default"] :HL["/t2-mapper/_next/static/chunks/15b04c9d2ba2c4cf.css","style"] -0:{"P":null,"b":"phNqOyvmceJswVwTPTCoJ","p":"/t2-mapper","c":["",""],"i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/15b04c9d2ba2c4cf.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","searchParams":{},"params":{},"promises":["$@6","$@7"]}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/544fd4f09b7df0da.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/32ef0c8650712240.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/d07990f13ea8bb98.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/b70f08013a69708a.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$L9",["$","$La",null,{"promise":"$@b"}]]}]]}],{},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$Lc",null,{"children":"$Ld"}],null],["$","$Le",null,{"children":["$","div",null,{"hidden":true,"children":["$","$f",null,{"fallback":null,"children":"$L10"}]}]}]]}],false]],"m":"$undefined","G":["$11",[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/15b04c9d2ba2c4cf.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]]],"s":false,"S":true} +0:{"P":null,"b":"Z2orC9Oxj30KOCL7Wakqt","p":"/t2-mapper","c":["",""],"i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/15b04c9d2ba2c4cf.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","searchParams":{},"params":{},"promises":["$@6","$@7"]}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/a99c02adf7563d85.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/bce28defe6a29ff5.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/32ef0c8650712240.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/49f75d30e4f6ac74.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$L9",["$","$La",null,{"promise":"$@b"}]]}]]}],{},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$Lc",null,{"children":"$Ld"}],null],["$","$Le",null,{"children":["$","div",null,{"hidden":true,"children":["$","$f",null,{"fallback":null,"children":"$L10"}]}]}]]}],false]],"m":"$undefined","G":["$11",[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/15b04c9d2ba2c4cf.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]]],"s":false,"S":true} 6:{} 7:"$0:f:0:1:2:children:1:props:children:0:props:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]] diff --git a/package-lock.json b/package-lock.json index 7e31121a..8c035329 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ "express": "^5.2.0", "peggy": "^5.0.6", "prettier": "^3.7.1", + "puppeteer": "^24.32.0", "rimraf": "^6.0.1", "tsx": "^4.20.5", "typescript": "5.9.2", @@ -80,6 +81,31 @@ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/runtime": { "version": "7.28.4", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", @@ -1203,6 +1229,41 @@ "node": ">=20.8" } }, + "node_modules/@puppeteer/browsers": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.11.0.tgz", + "integrity": "sha512-n6oQX6mYkG8TRPuPXmbPidkUbsSRalhmaaVAQxvH1IkQy63cwsH+kOjB3e4cpCDHg0aSvsiX9bQ4s2VB6mGWUQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.4.3", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.5.0", + "semver": "^7.7.3", + "tar-fs": "^3.1.1", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@puppeteer/browsers/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@react-three/drei": { "version": "10.7.6", "resolved": "https://registry.npmjs.org/@react-three/drei/-/drei-10.7.6.tgz", @@ -1676,6 +1737,13 @@ "react": "^18 || ^19" } }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "dev": true, + "license": "MIT" + }, "node_modules/@tweenjs/tween.js": { "version": "23.1.3", "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz", @@ -1917,6 +1985,17 @@ "integrity": "sha512-GPe4AsfOSpqWd3xA/0gwoKod13ChcfV67trvxaW2krUbgb9gxQjnCx8zGshzMl8LSHZlNH5gQ8LNScsDuc7nGQ==", "license": "MIT" }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@use-gesture/core": { "version": "10.3.1", "resolved": "https://registry.npmjs.org/@use-gesture/core/-/core-10.3.1.tgz", @@ -2066,6 +2145,16 @@ "node": ">= 0.6" } }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/ansi-regex": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", @@ -2092,6 +2181,13 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", @@ -2102,6 +2198,131 @@ "node": ">=12" } }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/b4a": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz", + "integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } + }, + "node_modules/bare-events": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz", + "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "bare-abort-controller": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + } + } + }, + "node_modules/bare-fs": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.5.2.tgz", + "integrity": "sha512-veTnRzkb6aPHOvSKIOy60KzURfBdUflr5VReI+NSaPL6xf+XLdONQgZgpYvUuZLVQ8dCqxpBAudaOM1+KpAUxw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bare-events": "^2.5.4", + "bare-path": "^3.0.0", + "bare-stream": "^2.6.4", + "bare-url": "^2.2.2", + "fast-fifo": "^1.3.2" + }, + "engines": { + "bare": ">=1.16.0" + }, + "peerDependencies": { + "bare-buffer": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + } + } + }, + "node_modules/bare-os": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.6.2.tgz", + "integrity": "sha512-T+V1+1srU2qYNBmJCXZkUY5vQ0B4FSlL3QDROnKQYOqeiQR8UbjNHlPa+TIbM4cuidiN9GaTaOZgSEgsvPbh5A==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "engines": { + "bare": ">=1.14.0" + } + }, + "node_modules/bare-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.0.0.tgz", + "integrity": "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bare-os": "^3.0.1" + } + }, + "node_modules/bare-stream": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.7.0.tgz", + "integrity": "sha512-oyXQNicV1y8nc2aKffH+BUHFRXmx6VrPzlnaEvMhram0nPBrKcEdcyBg5r08D0i8VxngHFAiVyn1QKXpSG0B8A==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "streamx": "^2.21.0" + }, + "peerDependencies": { + "bare-buffer": "*", + "bare-events": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + }, + "bare-events": { + "optional": true + } + } + }, + "node_modules/bare-url": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.3.2.tgz", + "integrity": "sha512-ZMq4gd9ngV5aTMa5p9+UfY0b3skwhHELaDkhEHetMdX0LRkW9kzaym4oo/Eh+Ghm0CCDuMTsRIGM/ytUc1ZYmw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bare-path": "^3.0.0" + } + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -2122,6 +2343,16 @@ ], "license": "MIT" }, + "node_modules/basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/bidi-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", @@ -2186,6 +2417,16 @@ "ieee754": "^1.2.1" } }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -2227,6 +2468,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/camera-controls": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/camera-controls/-/camera-controls-3.1.0.tgz", @@ -2270,12 +2521,120 @@ "node": ">=18" } }, + "node_modules/chromium-bidi": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-11.0.0.tgz", + "integrity": "sha512-cM3DI+OOb89T3wO8cpPSro80Q9eKYJ7hGVXoGS3GkDPxnYSqiv+6xwpIf6XERyJ9Tdsl09hmNmY94BkgZdVekw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "mitt": "^3.0.1", + "zod": "^3.24.1" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", "license": "MIT" }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/color": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", @@ -2381,6 +2740,33 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "license": "MIT" }, + "node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -2419,6 +2805,16 @@ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", "license": "MIT" }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -2437,6 +2833,21 @@ } } }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -2466,6 +2877,14 @@ "node": ">=8" } }, + "node_modules/devtools-protocol": { + "version": "0.0.1534754", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1534754.tgz", + "integrity": "sha512-26T91cV5dbOYnXdJi5qQHoTtUoNEqwkHcAyu/IKtjIAxiEqPMrDiRkDOPWVsGfNZGmlQVHQbZRSjD8sxagWVsQ==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true + }, "node_modules/draco3d": { "version": "1.5.7", "resolved": "https://registry.npmjs.org/draco3d/-/draco3d-1.5.7.tgz", @@ -2527,6 +2946,43 @@ "node": ">= 0.8" } }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/error-ex/node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, "node_modules/es-define-property": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", @@ -2609,6 +3065,16 @@ "@esbuild/win32-x64": "0.25.9" } }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -2616,6 +3082,52 @@ "dev": true, "license": "MIT" }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", @@ -2626,6 +3138,16 @@ "@types/estree": "^1.0.0" } }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -2636,6 +3158,16 @@ "node": ">= 0.6" } }, + "node_modules/events-universal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", + "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.7.0" + } + }, "node_modules/expect-type": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.2.tgz", @@ -2690,6 +3222,44 @@ "url": "https://opencollective.com/express" } }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2812,6 +3382,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -2851,6 +3431,22 @@ "node": ">= 0.4" } }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-tsconfig": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz", @@ -2864,6 +3460,21 @@ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, + "node_modules/get-uri": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", + "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/glob": { "version": "11.0.3", "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", @@ -2966,6 +3577,34 @@ "url": "https://opencollective.com/express" } }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/iconv-lite": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", @@ -3018,12 +3657,39 @@ "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", "license": "MIT" }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, + "node_modules/ip-address": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -3106,6 +3772,33 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, "node_modules/jsonfile": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", @@ -3127,6 +3820,13 @@ "immediate": "~3.0.5" } }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.orderby": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.orderby/-/lodash.orderby-4.6.0.tgz", @@ -3274,6 +3974,13 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "dev": true, + "license": "MIT" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -3319,6 +4026,16 @@ "node": ">= 0.6" } }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/next": { "version": "15.5.2", "resolved": "https://registry.npmjs.org/next/-/next-15.5.2.tgz", @@ -3424,6 +4141,40 @@ "wrappy": "1" } }, + "node_modules/pac-proxy-agent": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", + "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.6", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dev": true, + "license": "MIT", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/package-json-from-dist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", @@ -3431,6 +4182,38 @@ "dev": true, "license": "BlueOak-1.0.0" }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -3503,6 +4286,13 @@ "node": ">=20" } }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -3588,6 +4378,16 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "license": "MIT" }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/promise-worker-transferable": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/promise-worker-transferable/-/promise-worker-transferable-1.0.4.tgz", @@ -3612,6 +4412,95 @@ "node": ">= 0.10" } }, + "node_modules/proxy-agent": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz", + "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.6", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.1.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true, + "license": "MIT" + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/puppeteer": { + "version": "24.32.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-24.32.0.tgz", + "integrity": "sha512-exyxHPV5DSsigIhM/pzLcyzl5XU4Dp5lNP+APwIeStDxAdYqpMnJ1qN0QHXghjJx+cQJczby+ySH5rgv/5GQLw==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@puppeteer/browsers": "2.11.0", + "chromium-bidi": "11.0.0", + "cosmiconfig": "^9.0.0", + "devtools-protocol": "0.0.1534754", + "puppeteer-core": "24.32.0", + "typed-query-selector": "^2.12.0" + }, + "bin": { + "puppeteer": "lib/cjs/puppeteer/node/cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-core": { + "version": "24.32.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.32.0.tgz", + "integrity": "sha512-MqzLLeJjqjtHK9J44+KE3kjtXXhFpPvg+AvXl/oy/jB8MeeNH66/4MNotOTqGZ6MPaxWi51YJ1ASga6OIff6xw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@puppeteer/browsers": "2.11.0", + "chromium-bidi": "11.0.0", + "debug": "^4.4.3", + "devtools-protocol": "0.0.1534754", + "typed-query-selector": "^2.12.0", + "webdriver-bidi-protocol": "0.3.9", + "ws": "^8.18.3" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/qs": { "version": "6.14.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", @@ -3746,6 +4635,16 @@ "integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==", "license": "MIT" }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -3755,6 +4654,16 @@ "node": ">=0.10.0" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", @@ -4099,6 +5008,58 @@ "is-arrayish": "^0.3.1" } }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", + "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ip-address": "^10.0.1", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-generator": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/source-map-generator/-/source-map-generator-2.0.2.tgz", @@ -4168,6 +5129,18 @@ "dev": true, "license": "MIT" }, + "node_modules/streamx": { + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz", + "integrity": "sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "events-universal": "^1.0.0", + "fast-fifo": "^1.3.2", + "text-decoder": "^1.1.0" + } + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -4313,6 +5286,43 @@ "react": ">=17.0" } }, + "node_modules/tar-fs": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.1.tgz", + "integrity": "sha512-LZA0oaPOc2fVo82Txf3gw+AkEd38szODlptMYejQUhndHMLQ9M059uXR+AfS7DNo0NpINvSqDsvyaCrBVkptWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^4.0.1", + "bare-path": "^3.0.0" + } + }, + "node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "node_modules/text-decoder": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.3.tgz", + "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.6.4" + } + }, "node_modules/three": { "version": "0.180.0", "resolved": "https://registry.npmjs.org/three/-/three-0.180.0.tgz", @@ -4512,12 +5522,20 @@ "node": ">= 0.6" } }, + "node_modules/typed-query-selector": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", + "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==", + "dev": true, + "license": "MIT" + }, "node_modules/typescript": { "version": "5.9.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -4782,6 +5800,13 @@ } } }, + "node_modules/webdriver-bidi-protocol": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.3.9.tgz", + "integrity": "sha512-uIYvlRQ0PwtZR1EzHlTMol1G0lAlmOe6wPykF9a77AK3bkpvZHzIVxRE2ThOx5vjy2zISe0zhwf5rzuUfbo1PQ==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/webgl-constants": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/webgl-constants/-/webgl-constants-1.1.1.tgz", @@ -4930,6 +5955,133 @@ "dev": true, "license": "ISC" }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/zustand": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.8.tgz", diff --git a/package.json b/package.json index beb6b360..3d8757ae 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "express": "^5.2.0", "peggy": "^5.0.6", "prettier": "^3.7.1", + "puppeteer": "^24.32.0", "rimraf": "^6.0.1", "tsx": "^4.20.5", "typescript": "5.9.2", diff --git a/reference/Tribes2_Fog_System.md b/reference/Tribes2_Fog_System.md new file mode 100644 index 00000000..56eb48fc --- /dev/null +++ b/reference/Tribes2_Fog_System.md @@ -0,0 +1,1004 @@ +# Tribes 2 Engine Fog System + +This document describes the fog rendering system used in Tribes 2 (based on the V12/Torque engine circa 2001). It provides enough detail to reimplement the system in another renderer such as Three.js. + +**Important Note**: The version of Torque used by Tribes 2 does **NOT** use `fogDensity` or the later `VolumetricFog` object. Instead, it uses a combination of distance-based "haze" and height-based "fog volumes." + +## Table of Contents + +1. [Overview](#overview) +2. [Mission File Parameters](#mission-file-parameters) +3. [Haze (Distance-Based Fog)](#haze-distance-based-fog) +4. [Fog Volumes (Height-Based Fog)](#fog-volumes-height-based-fog) +5. [Combined Fog Calculation](#combined-fog-calculation) +6. [Fog Application by Object Type](#fog-application-by-object-type) +7. [The Fog Texture](#the-fog-texture) +8. [Three.js Implementation Guide](#threejs-implementation-guide) +9. [Additional Notes](#additional-notes) + - [Sky Fog Bans (Horizon Fog Gradient)](#sky-fog-bans-horizon-fog-gradient) + - [Storm Fog](#storm-fog) + - [Visibility Distance Modifier](#visibility-distance-modifier-smvisibledistancemod) + - [Object Culling](#object-culling) +10. [The `$specialFog` Console Variable](#the-specialfog-console-variable) + +--- + +## Overview + +The Tribes 2 fog system has two independent components that are combined: + +1. **Haze**: Distance-based fog with a quadratic falloff curve. Applies uniformly regardless of height. +2. **Fog Volumes**: Up to three height-bounded fog layers that add additional fog based on how much of the ray from camera to object passes through each volume. + +The final fog value is the sum of haze and fog volume contributions, clamped to [0, 1]. + +--- + +## Mission File Parameters + +These parameters are defined on the `Sky` object in `.mis` files: + +### Core Parameters + +| Parameter | Type | Description | +| ----------------- | ------------- | --------------------------------------------------------------------------- | +| `visibleDistance` | Float | Maximum view distance in world units. Objects beyond this are fully fogged. | +| `fogDistance` | Float | Distance where fog begins. No fog closer than this. | +| `fogColor` | ColorF (RGBA) | Color of the distance-based haze (0.0-1.0 per channel). | + +### Fog Volume Parameters + +Each volume is defined by two fields: + +| Parameter | Type | Description | +| ----------------- | ------- | ------------------------------------------------------ | +| `fogVolume1` | Point3F | `(visibleDistance, minHeight, maxHeight)` for volume 1 | +| `fogVolume2` | Point3F | `(visibleDistance, minHeight, maxHeight)` for volume 2 | +| `fogVolume3` | Point3F | `(visibleDistance, minHeight, maxHeight)` for volume 3 | +| `fogVolumeColor1` | ColorF | Color for fog volume 1 **(see note below)** | +| `fogVolumeColor2` | ColorF | Color for fog volume 2 **(see note below)** | +| `fogVolumeColor3` | ColorF | Color for fog volume 3 **(see note below)** | + +> **⚠️ IMPORTANT: Per-Volume Colors Are Ignored by Default** +> +> Despite being defined in mission files, `fogVolumeColor1/2/3` are **NOT used** by the +> default renderer. The engine has two fog texture building code paths controlled by the +> `$specialFog` console variable (which maps to `SceneGraph::useSpecial`): +> +> - `useSpecial = false` (default): Uses `buildFogTexture()` which **ignores per-volume colors** +> and only uses the global `fogColor` for all fog rendering. +> - `useSpecial = true`: Uses `buildFogTextureSpecial()` which **blends per-volume colors** +> based on camera height and distance. +> +> Since `$specialFog` defaults to `false` and is never enabled by Tribes 2 game scripts, +> the per-volume colors are loaded from mission files but have no effect on rendering. +> All fog (both haze and fog volumes) is rendered using the global `fogColor`. +> +> See [The `$specialFog` Console Variable](#the-specialfog-console-variable) for details. + +### Example from Tribes 2 Mission (BeggarsRun.mis) + +``` +new Sky(Sky) { + visibleDistance = "500"; + fogDistance = "225"; + fogColor = "0.257800 0.125000 0.097700 1.000000"; + fogVolume1 = "500 1 300"; // visDist=500, minHeight=1, maxHeight=300 + fogVolume2 = "1000 301 500"; // visDist=1000, minHeight=301, maxHeight=500 + fogVolume3 = "17000 501 1000"; // visDist=17000, minHeight=501, maxHeight=1000 + fogVolumeColor1 = "128.000000 128.000000 128.000000 0.000000"; + fogVolumeColor2 = "128.000000 128.000000 128.000000 0.000000"; + fogVolumeColor3 = "128.000000 128.000000 128.000000 0.000000"; +}; +``` + +Note that the `fogVolumeColor` values above use 0-255 range instead of the expected 0-1 range for `TypeColorF`. Many community maps have similar issues, sometimes with garbage alpha values from uninitialized memory. Since per-volume colors are unused by default (see [`$specialFog`](#the-specialfog-console-variable)), this has no visual effect. + +--- + +## Haze (Distance-Based Fog) + +Haze is a simple distance-based fog with a **quadratic** falloff curve. It creates a smooth transition from clear visibility to full fog. + +### Algorithm + +```cpp +// From sceneState.h:247-256 +inline F32 SceneState::getHaze(F32 dist) +{ + // No fog if distance is less than fogDistance + if (dist <= mFogDistance) + return 0; + + // Full fog beyond visibleDistance + if (dist > mVisibleDistance) + return 1.0; + + // Quadratic falloff between fogDistance and visibleDistance + F32 fogScale = 1.0 / (mVisibleDistance - mFogDistance); + F32 distFactor = (dist - mFogDistance) * fogScale - 1.0; + return 1.0 - distFactor * distFactor; +} +``` + +### Explanation + +1. If `dist <= fogDistance`: No haze (return 0) +2. If `dist > visibleDistance`: Full haze (return 1) +3. Otherwise: Apply quadratic curve + +The formula `1.0 - (distFactor)^2` where `distFactor = (dist - fogDistance) / (visibleDistance - fogDistance) - 1.0` creates an **inverted parabola** that: + +- Starts at 0 when dist = fogDistance +- Reaches 1 when dist = visibleDistance +- Has a smooth acceleration (slow at first, faster later) + +### Visualization + +``` +Haze +1.0 | ***** + | *** + | ** + | ** + | ** + | ** + | ** + | ** +0.0 |**** + +--------------------------> + 0 fogDist visibleDist Distance +``` + +### JavaScript Implementation + +```javascript +function getHaze(dist, fogDistance, visibleDistance) { + if (dist <= fogDistance) return 0; + if (dist > visibleDistance) return 1; + + const fogScale = 1.0 / (visibleDistance - fogDistance); + const distFactor = (dist - fogDistance) * fogScale - 1.0; + return 1.0 - distFactor * distFactor; +} +``` + +--- + +## Fog Volumes (Height-Based Fog) + +Fog volumes are horizontal fog layers that exist between specified height ranges. Each volume has its own visibility distance and color. + +### Data Structures + +```cpp +struct FogVolume { + float visibleDistance; // Visibility within this fog layer + float minHeight; // Bottom of fog layer (world Z) + float maxHeight; // Top of fog layer (world Z) + float percentage; // Fog intensity multiplier (default 1.0) + ColorF color; // Fog color (RGBA) +}; + +// Maximum of 3 fog volumes +const int MaxFogVolumes = 3; +``` + +### Fog Band Processing + +The engine pre-processes fog volumes into "fog bands" relative to the camera's height. This creates two lists: + +- **Positive fog bands**: For points above the camera +- **Negative fog bands**: For points below the camera + +Each band stores: + +```cpp +struct FogBand { + bool isFog; // true if this is a fog volume, false if clear air + float cap; // Height extent of this band + float factor; // Fog factor = (1 / (visibleDistance * visFactor)) * percentage + ColorF color; // Band color +}; +``` + +### Setup Algorithm + +The setup happens each frame in `SceneState::setupFog()`: + +```cpp +void SceneState::setupFog() +{ + // Calculate fog scale for haze + if (mVisibleDistance == mFogDistance) { + mFogScale = 1000.0f; // Arbitrary large constant + } else { + mFogScale = 1.0 / (mVisibleDistance - mFogDistance); + } + + // Build positive fog bands (above camera) + mPosFogBands.clear(); + float camZ = mCamPosition.z; + + // Find first fog volume above or containing camera + int i; + for (i = 0; i < mNumFogVolumes; i++) { + if (camZ < mFogVolumes[i].maxHeight) + break; + } + + if (i < mNumFogVolumes) { + float prevHeight = camZ; + for (; i < mNumFogVolumes; i++) { + // Add clear band if there's a gap before this fog volume + if (prevHeight < mFogVolumes[i].minHeight) { + FogBand fb; + fb.isFog = false; + fb.cap = mFogVolumes[i].minHeight - prevHeight; + fb.color = mFogVolumes[i].color; + prevHeight = mFogVolumes[i].minHeight; + mPosFogBands.push_back(fb); + } + + // Add fog band for this volume + FogBand fb; + fb.isFog = true; + fb.cap = mFogVolumes[i].maxHeight - prevHeight; + fb.factor = (1 / (mFogVolumes[i].visibleDistance * mVisFactor)) + * mFogVolumes[i].percentage; + fb.color = mFogVolumes[i].color; + prevHeight = mFogVolumes[i].maxHeight; + mPosFogBands.push_back(fb); + } + } + + // Similar logic for negative fog bands (below camera) + // ... (traverses volumes in reverse order) +} +``` + +### Ray-Marching Through Fog Bands + +When calculating fog for a point, the engine traces a ray from the camera to the point and accumulates fog through each band it passes: + +```cpp +F32 SceneState::getFog(float dist, float deltaZ) +{ + float haze = 0; + Vector *band; + + // Choose band list based on direction + if (deltaZ < 0) { + deltaZ = -deltaZ; + band = &mNegFogBands; + } else { + band = &mPosFogBands; + } + + float ht = deltaZ; // Remaining height to traverse + + for (int i = 0; i < band->size(); i++) { + FogBand &bnd = (*band)[i]; + + if (ht < bnd.cap) { + // Ray ends within this band + if (bnd.isFog) + haze += dist * bnd.factor; + break; + } + + // Ray passes through entire band + // Calculate distance traveled in this band using similar triangles + float subDist = dist * bnd.cap / ht; + if (bnd.isFog) + haze += subDist * bnd.factor; + dist -= subDist; + ht -= bnd.cap; + } + + return haze; +} +``` + +### Key Insight: Similar Triangles + +The fog calculation uses similar triangles to determine how much distance the ray travels through each height band: + +``` +Camera -------- dist --------> Point + | | + | | + ht (total deltaZ) | + | | + v v + +For a band of height 'cap': + subDist / dist = cap / ht + subDist = dist * cap / ht +``` + +--- + +## Combined Fog Calculation + +The main function `getHazeAndFog()` combines both haze and fog volumes: + +```cpp +F32 SceneState::getHazeAndFog(float dist, float deltaZ) +{ + float haze = 0; + + // Calculate distance-based haze + if (dist > mFogDistance) { + if (dist > mVisibleDistance) + return 1.0; + + float distFactor = (dist - mFogDistance) * mFogScale - 1.0; + haze = 1.0 - distFactor * distFactor; + } + + // Add height-based fog from fog volumes + Vector *band; + if (deltaZ < 0) { + deltaZ = -deltaZ; + band = &mNegFogBands; + } else { + band = &mPosFogBands; + } + + float ht = deltaZ; + for (int i = 0; i < band->size(); i++) { + FogBand &bnd = (*band)[i]; + + if (ht < bnd.cap) { + if (bnd.isFog) + haze += dist * bnd.factor; + break; + } + float subDist = dist * bnd.cap / ht; + if (bnd.isFog) + haze += subDist * bnd.factor; + dist -= subDist; + ht -= bnd.cap; + } + + // Clamp to [0, 1] + if (haze > 1) + return 1; + return haze; +} +``` + +### Critical Implementation Note: Parameter Separation + +**IMPORTANT**: Notice that haze uses `mFogDistance` and `mVisibleDistance` (global parameters), while fog bands use their own per-volume `visibleDistance` in the factor calculation. + +When implementing in Three.js or other engines: + +1. **Haze** must use global `fogDistance` and `visibleDistance` +2. **Fog volumes** use their own per-volume `visibleDistance` for factor calculation +3. These are ADDED together, not blended + +A common mistake is to adjust the haze near/far values based on which fog volume the camera is in. This is incorrect - the haze always uses global parameters regardless of camera height. + +--- + +## Fog Application by Object Type + +Different object types apply fog differently: + +### 1. Terrain + +Terrain uses a pre-computed **fog texture** (64x64 RGBA). Each vertex samples this texture to get its fog value. + +```cpp +// From terrRender.cc - allocating terrain points +ChunkCornerPoint *TerrainRender::allocPoint(Point2I pos) +{ + ChunkCornerPoint *ret = /* allocate */; + ret->x = pos.x * mSquareSize + mBlockPos.x; + ret->y = pos.y * mSquareSize + mBlockPos.y; + ret->z = fixedToFloat(mCurrentBlock->getHeight(pos.x, pos.y)); + ret->distance = (*ret - mCamPos).len(); + + // Get fog texture coordinates for this vertex + gClientSceneGraph->getFogCoordPair(ret->distance, ret->z, + ret->fogRed, ret->fogGreen); + return ret; +} +``` + +The fog texture coordinates are computed as: + +```cpp +inline void SceneGraph::getFogCoordPair(F32 dist, F32 z, F32 &x, F32 &y) +{ + x = (getVisibleDistanceMod() - dist) * mInvVisibleDistance; + y = (z - mHeightOffset) * mInvHeightRange; +} +``` + +### 2. Shapes (TSShapeInstance) + +Shapes use **textured fogging** - a single uniform fog value for the entire shape, computed at the shape's center. + +From the GarageGames forum: + +> "TS instances use textured fogging. Textured fogging calculates a single fog value based on the TS object's location, and uses that for the whole thing." + +The fog value is obtained via: + +```cpp +float fogValue = state->getHazeAndFog(distance, height_difference); +``` + +This value is then used to blend the shape's color with the fog color. + +### 3. Interiors + +Interiors use **vertex-based fogging** - fog is calculated per-vertex. + +From the GarageGames forum: + +> "Interiors use the vertex fog. Each vertex has a fog value placed into it during the render prep phase." + +--- + +## The Fog Texture + +The engine builds a 64x64 RGBA texture that encodes fog values based on distance and height. This is rebuilt each frame. + +### Texture Layout + +- **U-axis (horizontal)**: Distance from `visibleDistance` (left, u=0) to 0 (right, u=1) +- **V-axis (vertical)**: Height from terrain minimum (bottom, v=0) to terrain maximum (top, v=1) +- **Alpha channel**: Fog amount (0-255) +- **RGB channels**: Fog color + +### Building the Fog Texture + +```cpp +void SceneGraph::buildFogTexture(SceneState *pState) +{ + const Point3F &cp = pState->getCameraPosition(); + + // Create texture if needed + if (!bool(mFogTexture)) { + mFogTexture = TextureHandle(NULL, + new GBitmap(64, 64, false, GBitmap::RGBA), true); + } + + TerrainBlock *block = getCurrentTerrain(); + if (block) { + GridSquare *sq = block->findSquare(TerrainBlock::BlockShift, Point2I(0,0)); + F32 heightRange = fixedToFloat(sq->maxHeight - sq->minHeight); + mHeightOffset = fixedToFloat(sq->minHeight); + + mInvHeightRange = 1 / heightRange; + mInvVisibleDistance = 1 / getVisibleDistanceMod(); + + GBitmap *fogBitmap = mFogTexture.getBitmap(); + F32 heightStep = heightRange / F32(fogBitmap->getHeight()); + + // Distance starts at visibleDistance (inset by half texel) + F32 distStart = getVisibleDistanceMod() - + (getVisibleDistanceMod() / (fogBitmap->getWidth() * 2)); + ColorI fogColor(mFogColor); + + // Pre-compute haze values for each distance column + if (mHazeArrayDirty) { + F32 distStep = -getVisibleDistanceMod() / F32(fogBitmap->getWidth()); + F32 dist = distStart; + for (U32 i = 0; i < FogTextureDistSize; i++) { + mHazeArray[i] = pState->getHaze(dist); + F32 prevDist = dist; + dist += distStep; + mDistArray[i] = dist / prevDist; + } + mHazeArrayDirty = false; + } + + // Build texture row by row (each row = different height) + F32 ht = mHeightOffset + (heightStep / 2) - cp.z; // Delta-Z from camera + U32 fc = *((U32 *)&fogColor) & 0x00FFFFFF; // RGB only + + for (U32 j = 0; j < fogBitmap->getHeight(); j++) { + F32 dist = distStart; + U32 *ptr = (U32 *)fogBitmap->getAddress(0, j); + + // Get initial fog value for this height + F32 fogStart = pState->getFog(dist, ht); + + for (U32 i = 0; i < fogBitmap->getWidth(); i++) { + // Combine fog volume contribution with haze + U32 fog = (fogStart + mHazeArray[i]) * 255; + fogStart *= mDistArray[i]; // Scale fog for shorter distance + if (fog > 255) + fog = 255; + *ptr++ = fc | (fog << 24); // RGB | Alpha + } + ht += heightStep; + } + mFogTexture.refresh(); + } +} +``` + +--- + +## Three.js Implementation Guide + +### Approach 1: Shader-Based (Recommended) + +Implement fog calculation in a custom shader: + +```glsl +// Vertex shader +varying float vFogFactor; + +uniform vec3 cameraPosition; +uniform float fogDistance; +uniform float visibleDistance; +uniform int numFogVolumes; +uniform vec3 fogVolumes[3]; // (visibleDistance, minHeight, maxHeight) +uniform float fogPercentages[3]; + +void main() { + vec4 worldPos = modelMatrix * vec4(position, 1.0); + float dist = length(worldPos.xyz - cameraPosition); + float deltaZ = worldPos.z - cameraPosition.z; + + // Calculate haze (distance-based fog) + float haze = 0.0; + if (dist > fogDistance && dist <= visibleDistance) { + float fogScale = 1.0 / (visibleDistance - fogDistance); + float distFactor = (dist - fogDistance) * fogScale - 1.0; + haze = 1.0 - distFactor * distFactor; + } else if (dist > visibleDistance) { + haze = 1.0; + } + + // Calculate fog volume contribution + float volumeFog = calculateFogVolumes(dist, deltaZ, + cameraPosition.z, + numFogVolumes, + fogVolumes, + fogPercentages); + + vFogFactor = clamp(haze + volumeFog, 0.0, 1.0); + + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} + +// Fragment shader +varying float vFogFactor; +uniform vec3 fogColor; + +void main() { + vec3 color = /* your base color calculation */; + gl_FragColor = vec4(mix(color, fogColor, vFogFactor), 1.0); +} +``` + +### Approach 2: Three.js FogExp2 Approximation + +For a quick approximation, you could use Three.js's built-in fog, but note it won't match exactly: + +```javascript +// This is NOT an exact match but gives similar visual results +scene.fog = new THREE.Fog(fogColor, fogDistance, visibleDistance); +``` + +However, Three.js uses **linear** interpolation between near and far, while Tribes 2 uses **quadratic**. For accurate results, you need a custom shader. + +### JavaScript Helper Functions + +```javascript +// Haze calculation (distance-based fog) +function getHaze(dist, fogDistance, visibleDistance) { + if (dist <= fogDistance) return 0; + if (dist > visibleDistance) return 1; + + const fogScale = 1.0 / (visibleDistance - fogDistance); + const distFactor = (dist - fogDistance) * fogScale - 1.0; + return 1.0 - distFactor * distFactor; +} + +// Fog volume structure +class FogVolume { + constructor( + visibleDistance, + minHeight, + maxHeight, + percentage = 1.0, + color = null, + ) { + this.visibleDistance = visibleDistance; + this.minHeight = minHeight; + this.maxHeight = maxHeight; + this.percentage = percentage; + this.color = color; + } +} + +// Fog band structure (precomputed relative to camera) +class FogBand { + constructor(isFog, cap, factor, color) { + this.isFog = isFog; + this.cap = cap; // Height extent + this.factor = factor; // Fog strength + this.color = color; + } +} + +// Build fog bands for a given camera height +// Note: visibilityFactor defaults to 1.0 (full quality) matching Torque's smVisibleDistanceMod default +function setupFogBands(cameraZ, fogVolumes, visibilityFactor = 1.0) { + const posBands = []; + const negBands = []; + + // Sort volumes by minHeight + const sortedVolumes = [...fogVolumes].sort( + (a, b) => a.minHeight - b.minHeight, + ); + + // Build positive bands (above camera) + let startIdx = sortedVolumes.findIndex((v) => cameraZ < v.maxHeight); + if (startIdx >= 0) { + let prevHeight = cameraZ; + for (let i = startIdx; i < sortedVolumes.length; i++) { + const vol = sortedVolumes[i]; + + // Add clear band if gap exists + if (prevHeight < vol.minHeight) { + posBands.push( + new FogBand(false, vol.minHeight - prevHeight, 0, vol.color), + ); + prevHeight = vol.minHeight; + } + + // Add fog band + // factor = (1 / (volumeVisDist * visFactor)) * percentage + // where visFactor = smVisibleDistanceMod (default 1.0) + const factor = + (1 / (vol.visibleDistance * visibilityFactor)) * vol.percentage; + posBands.push( + new FogBand(true, vol.maxHeight - prevHeight, factor, vol.color), + ); + prevHeight = vol.maxHeight; + } + } + + // Build negative bands (below camera) - traverse in reverse + startIdx = sortedVolumes.findLastIndex((v) => cameraZ > v.minHeight); + if (startIdx >= 0) { + let prevHeight = cameraZ; + for (let i = startIdx; i >= 0; i--) { + const vol = sortedVolumes[i]; + + // Add clear band if gap exists + if (prevHeight > vol.maxHeight) { + negBands.push( + new FogBand(false, prevHeight - vol.maxHeight, 0, vol.color), + ); + prevHeight = vol.maxHeight; + } + + // Add fog band + const factor = + (1 / (vol.visibleDistance * visibilityFactor)) * vol.percentage; + negBands.push( + new FogBand(true, prevHeight - vol.minHeight, factor, vol.color), + ); + prevHeight = vol.minHeight; + } + } + + return { posBands, negBands }; +} + +// Calculate fog from volumes using fog bands +function getFogFromBands(dist, deltaZ, bands) { + let fog = 0; + const isNegative = deltaZ < 0; + const bandList = isNegative ? bands.negBands : bands.posBands; + deltaZ = Math.abs(deltaZ); + + let remainingHeight = deltaZ; + let remainingDist = dist; + + for (const band of bandList) { + if (remainingHeight < band.cap) { + // Ray ends within this band + if (band.isFog) { + fog += remainingDist * band.factor; + } + break; + } + + // Ray passes through entire band + const subDist = (remainingDist * band.cap) / remainingHeight; + if (band.isFog) { + fog += subDist * band.factor; + } + remainingDist -= subDist; + remainingHeight -= band.cap; + } + + return fog; +} + +// Complete fog calculation +function getHazeAndFog(dist, deltaZ, fogDistance, visibleDistance, fogBands) { + const haze = getHaze(dist, fogDistance, visibleDistance); + + if (haze >= 1.0) return 1.0; + + const volumeFog = getFogFromBands(dist, deltaZ, fogBands); + + return Math.min(1.0, haze + volumeFog); +} +``` + +### Usage Example + +```javascript +// Parse mission file parameters +const fogDistance = 225; +const visibleDistance = 500; +const fogColor = new THREE.Color(0.258, 0.125, 0.098); + +const fogVolumes = [ + new FogVolume(500, 1, 300), + new FogVolume(1000, 301, 500), + new FogVolume(17000, 501, 1000), +]; + +// In render loop +function animate() { + const cameraZ = camera.position.z; + const fogBands = setupFogBands(cameraZ, fogVolumes); + + // For each object or vertex + const objectPos = new THREE.Vector3(/* ... */); + const dist = camera.position.distanceTo(objectPos); + const deltaZ = objectPos.z - camera.position.z; + + const fogFactor = getHazeAndFog( + dist, + deltaZ, + fogDistance, + visibleDistance, + fogBands, + ); + + // Apply fog to object color + // objectColor.lerp(fogColor, fogFactor); +} +``` + +--- + +## Additional Notes + +### Sky Fog Bans (Horizon Fog Gradient) + +The Sky object renders "bans" (fog bands) directly onto the sky to create a smooth fog-to-sky gradient at the horizon. This is controlled by the `noRenderBans` property (default: false). + +#### How Sky Fog Bans Work + +When the camera is NOT inside a fog volume, the engine renders fog bands as geometry overlaid on the skybox: + +```cpp +// sky.cc - Key constants +#define HORIZON 0.0f // Base height of lower fog band +#define OFFSET_HEIGHT 60.0f // Height of fog band above horizon (world units) +``` + +The fog bands are positioned relative to the skybox geometry: + +```cpp +// sky.cc:1137-1149 - Skybox corner calculation +// mRadius = visibleDistance * 0.95 +// tpt = (1,1,1).normalize(mRadius) -> each component = mRadius / sqrt(3) +// mSkyBoxPt.x = mSkyBoxPt.z = mRadius / sqrt(3) +``` + +For a mission with `visibleDistance = 600`: +- `mRadius = 600 * 0.95 = 570` +- `mSkyBoxPt.x = 570 / sqrt(3) ≈ 329` (skybox corner coordinate) + +The fog band geometry spans from height 0 (`HORIZON`) to height 60 (`OFFSET_HEIGHT`) at the skybox distance. This creates a narrow fog gradient just above the terrain horizon. + +#### Fog Ban Alpha Values + +When NOT in a fog volume (`depthInFog <= 0`): +```cpp +banHeights[0] = HORIZON; // 0.0 - lower band at horizon +banHeights[1] = OFFSET_HEIGHT; // 60.0 - upper band +alphaBan[0] = 0.0; // Upper band edge is fully transparent +alphaBan[1] = 0.0; // Center top is fully transparent +``` + +The fog bands render as triangle strips with linear vertex alpha interpolation: +- Lower vertices (at horizon): full fog color (alpha = 1.0) +- Upper vertices (at OFFSET_HEIGHT): transparent (alpha = 0.0) + +This creates a gradient from solid fog color at the horizon to clear sky above. + +#### Three.js Implementation + +For a fullscreen sky shader, convert the height-based fog band to a direction-based calculation: + +```glsl +// Calculate the direction.y value where fog band ends +// horizonFogHeight = OFFSET_HEIGHT / sqrt(skyBoxPtX^2 + OFFSET_HEIGHT^2) +// For visibleDistance=600: horizonFogHeight ≈ 0.18 + +uniform float horizonFogHeight; + +float baseFogFactor; +if (direction.y <= 0.0) { + // At or below horizon: full fog + baseFogFactor = 1.0; +} else if (direction.y >= horizonFogHeight) { + // Above fog band: no fog (show sky) + baseFogFactor = 0.0; +} else { + // Within fog band: gradient + // Use (1-t)^2 for a gentler falloff at the top, matching Torque's appearance + float t = direction.y / horizonFogHeight; + baseFogFactor = (1.0 - t) * (1.0 - t); +} + +vec3 finalColor = mix(skyColor.rgb, fogColor, baseFogFactor); +``` + +The `(1-t)²` curve approximates the visual result of Torque's linear vertex interpolation when rendered through perspective projection on curved fog band geometry. + +#### Visible Distance Culling + +Objects at or beyond `visibleDistance` are not rendered in Tribes 2 (see `sceneGraph.cc` where the far plane is set to `getVisibleDistanceMod()`). For Three.js implementations, discard fragments at `dist >= fogFar` in the fog shader to prevent fully-fogged geometry from appearing as silhouettes against the sky gradient: + +```glsl +// In fog fragment shader +if (dist >= fogFar) { + discard; +} +``` + +This ensures a seamless transition from fogged terrain to the sky's fog gradient. + +### Storm Fog + +The engine supports dynamic fog changes via the `stormFog` scripting method, which fades fog layers in and out over time. The `percentage` field on fog volumes is modified during storms. + +### Visibility Distance Modifier (`smVisibleDistanceMod`) + +The engine has a global `smVisibleDistanceMod` (range 0.5 to 1.0, default 1.0) that acts as a quality setting for draw distance. It affects fog calculation in two ways: + +1. **Distance scaling**: Both `fogDistance` and `visibleDistance` are multiplied by `smVisibleDistanceMod`, reducing effective visibility on lower quality settings. + +2. **Fog volume factor**: The fog factor formula uses this value: + ```cpp + factor = (1 / (visibleDistance * mVisFactor)) * percentage; + ``` + where `mVisFactor = smVisibleDistanceMod`. + +**Important for Three.js implementation**: Since this is a quality preference (not a ratio of visibility distances), use `visFactor = 1.0` for full quality: + +```glsl +float factor = (1.0 / volVisDist) * percentage; +``` + +A common mistake is computing `visFactor = globalVisDist / volumeVisDist` - this is incorrect. The Torque code passes `smVisibleDistanceMod` directly to `SceneState`, not a computed ratio. + +### Object Culling + +Objects are culled if `getHazeAndFog()` returns 1.0 for their bounding box. The function `isBoxFogVisible()` is used for this check. + +--- + +## The `$specialFog` Console Variable + +The engine contains two separate implementations for building the fog texture, controlled by the static variable `SceneGraph::useSpecial` which is exposed as the `$specialFog` console variable. + +### Declaration and Default Value + +```cpp +// sceneGraph.h:128 +static bool useSpecial; + +// sceneGraph.cc:96 +bool SceneGraph::useSpecial = false; + +// gameConnection.cc:1631 +Con::addVariable("specialFog", TypeBool, &SceneGraph::useSpecial); +``` + +### The Two Code Paths + +```cpp +// sceneGraph.cc:166-169 +if(!useSpecial) + buildFogTexture( pBaseState ); +else + buildFogTextureSpecial( pBaseState ); +``` + +### `buildFogTexture()` - Default Mode (useSpecial = false) + +This is the standard fog texture builder. It computes fog values based on distance and height, but **uses only the global `mFogColor`** for the entire texture: + +```cpp +// sceneGraph.cc:198-265 +void SceneGraph::buildFogTexture(SceneState *pState) +{ + // ... + ColorI fogColor(mFogColor); // Only global fog color used + // ... + for (U32 j = 0; j < fogBitmap->getHeight(); j++) { + // ... + for (U32 i = 0; i < fogBitmap->getWidth(); i++) { + U32 fog = (fogStart + mHazeArray[i]) * 255; + // ... + *ptr++ = fc | (fog << 24); // fc = global fogColor RGB + } + } +} +``` + +Per-volume colors (`fogVolumeColor1/2/3`) are completely ignored in this path. + +### `buildFogTextureSpecial()` - Special Mode (useSpecial = true) + +This alternative implementation **blends per-volume fog colors** based on camera position: + +```cpp +// sceneGraph.cc:282-402 +void SceneGraph::buildFogTextureSpecial(SceneState *pState) +{ + // ... + // For single fog volume - blends volume color with global fog color + ColorI c(hazePct * ffogColor.red + bandPct * (array[0].red * 255), + hazePct * ffogColor.green + bandPct * (array[0].green * 255), + hazePct * ffogColor.blue + bandPct * (array[0].blue * 255), + (hazePct + bandPct) * 255); + + // For two fog volumes - blends both volume colors with global fog color + ColorI c(hazePct * ffogColor.red + bandPct0 * array[0].red + bandPct1 * array[1].red, + hazePct * ffogColor.green + bandPct0 * array[0].green + bandPct1 * array[1].green, + hazePct * ffogColor.blue + bandPct0 * array[0].blue + bandPct1 * array[1].blue, + (hazePct + bandPct0 + bandPct1) * 255); + // ... +} +``` + +The volume colors are extracted via `getFogs()` which pulls from the `FogBand` structures that were populated from `mFogVolumes[i].color` during `setupFog()`. + +### Why Per-Volume Colors Don't Work in Tribes 2 + +1. **Default is disabled**: `SceneGraph::useSpecial` initializes to `false` +2. **Scripts never enable it**: A search of `GameData-base` shows no scripts set `$specialFog = true` +3. **Result**: The special fog path is never taken, so per-volume colors have no effect + +### Enabling Per-Volume Colors + +To enable per-volume fog colors, you would need to run in the game console: + +``` +$specialFog = true; +``` + +This was likely a feature that was implemented but never shipped as the default, possibly due to performance concerns or visual issues. + +--- + +## References + +- `tribes2-engine/sceneGraph/sceneState.cc` - Core fog calculation functions +- `tribes2-engine/sceneGraph/sceneGraph.cc` - Fog texture building +- `tribes2-engine/terrain/sky.cc` - Sky object and fog volume configuration +- `tribes2-engine/terrain/terrRender.cc` - Terrain fog application +- GarageGames Forum Discussion on Fog Rendering +- The Game Programmer's Guide to Torque, Chapter 8.4.5 (Fog) diff --git a/scripts/screenshot.ts b/scripts/screenshot.ts new file mode 100644 index 00000000..3eaa24a1 --- /dev/null +++ b/scripts/screenshot.ts @@ -0,0 +1,114 @@ +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import puppeteer, { type KeyInput } from "puppeteer"; +import { parseArgs } from "node:util"; + +function sleep(ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +const { values, positionals } = parseArgs({ + options: { + camera: { + type: "string", + default: "1", + }, + debug: { + type: "boolean", + default: false, + }, + "no-fog": { + type: "boolean", + default: false, + }, + }, + allowPositionals: true, +}); + +const missionName = positionals[0]; +const cameraNumber = parseInt(values.camera, 10); +const debugMode = values.debug; +const fogEnabled = !values["no-fog"]; + +if (!missionName) { + console.error( + "Usage: npx tsx scripts/screenshot.ts [cameraNumber]", + ); + console.error("Example: npx tsx scripts/screenshot.ts TWL2_WoodyMyrk 1"); + process.exit(1); +} + +const cameraKey = String(cameraNumber) as KeyInput; +const outputType = "png"; +const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "t2-screenshot-")); +const outputPath = path.join( + tempDir, + `${missionName}.${cameraNumber}.${debugMode ? "debug." : ""}${outputType}`, +); + +const browser = await puppeteer.launch({ headless: true }); +const page = await browser.newPage(); +await page.setViewport({ width: 900, height: 600 }); + +const baseUrl = `http://localhost:3000/t2-mapper/?mission=${encodeURIComponent(missionName)}`; + +await page.evaluateOnNewDocument( + (debugMode, fogEnabled) => { + localStorage.setItem( + "settings", + JSON.stringify({ + fov: 80, + audioEnabled: false, + animationEnabled: false, + debugMode, + fogEnabled, + }), + ); + }, + debugMode, + fogEnabled, +); + +console.log(`Loading: ${baseUrl}`); +await page.goto(baseUrl, { waitUntil: "load" }); +await page.waitForNetworkIdle({ idleTime: 500 }); + +const mapViewer = await page.waitForSelector("canvas"); +if (!mapViewer) { + console.error("Could not find canvas element"); + process.exit(1); +} +await sleep(50); + +// Close the popover by pressing Escape +await page.keyboard.press("Escape"); +await sleep(50); + +// Hide controls from screenshots while keeping them selectable +await page.$eval("#controls", (el: HTMLElement) => { + el.style.visibility = "hidden"; +}); + +// Wait for mission to load +await page.waitForSelector("#loadingIndicator", { hidden: true }); +await sleep(500); + +// Select the camera +console.log(`Selecting camera: ${cameraNumber}`); +await mapViewer.press(cameraKey); +await page.waitForNetworkIdle({ idleTime: 250 }); +await sleep(100); + +// Take screenshot +await mapViewer.screenshot({ + path: outputPath, + type: outputType, +}); + +console.log(`Screenshot saved to: ${outputPath}`); + +await Promise.race([ + browser.close(), + sleep(3000).then(() => browser.process()?.kill("SIGKILL")), +]); diff --git a/src/components/CloudLayers.tsx b/src/components/CloudLayers.tsx index 28439bc8..f768deb7 100644 --- a/src/components/CloudLayers.tsx +++ b/src/components/CloudLayers.tsx @@ -11,7 +11,7 @@ import { Texture, RepeatWrapping, LinearFilter, - SRGBColorSpace, + NoColorSpace, Group, } from "three"; import { loadDetailMapList, textureToUrl } from "../loaders"; @@ -119,8 +119,11 @@ function createCloudGeometry( positions[idx * 3 + 2] = z; // UV coordinates for texture (will be offset for scrolling) - uvs[idx * 2] = col / (GRID_SIZE - 1); - uvs[idx * 2 + 1] = row / (GRID_SIZE - 1); + // Torque uses mTextureScale default of (1, 1), which with x/y going 0-4 + // gives UV range 0-4, tiling the texture 4 times across the dome. + // This creates the swirly detail effect visible in Tribes 2. + uvs[idx * 2] = col; // 0 to 4 (tiles 4x) + uvs[idx * 2 + 1] = row; // 0 to 4 (tiles 4x) } } @@ -245,13 +248,17 @@ function adjustCorners(positions: Float32Array): void { /** * Setup cloud texture with proper wrapping and filtering. + * Uses NoColorSpace to pass values through directly without conversion, + * matching Torque's gamma-space rendering pipeline. */ function setupCloudTexture(texture: Texture): Texture { texture.wrapS = RepeatWrapping; texture.wrapT = RepeatWrapping; texture.minFilter = LinearFilter; texture.magFilter = LinearFilter; - texture.colorSpace = SRGBColorSpace; + // NoColorSpace: values pass through directly without sRGB conversion. + // Torque didn't do color space conversion - textures went straight to display. + texture.colorSpace = NoColorSpace; texture.needsUpdate = true; return texture; } @@ -484,12 +491,16 @@ export function CloudLayers({ object }: CloudLayersProps) { }, [object]); // Wind direction from windVelocity + // Torque uses Z-up with windVelocity (x, y, z) where Y is forward. + // Our cloud geometry has UV U along world X, UV V along world Z. + // Rotate 90 degrees clockwise to match Torque's coordinate system. const windDirection = useMemo(() => { const windVelocity = getProperty(object, "windVelocity"); if (windVelocity) { const [x, y] = windVelocity.split(" ").map((s: string) => parseFloat(s)); if (x !== 0 || y !== 0) { - return new Vector2(x, y).normalize(); + // Rotate 90 degrees clockwise: (x, y) -> (y, -x) + return new Vector2(y, -x).normalize(); } } return new Vector2(1, 0); diff --git a/src/components/FogProvider.tsx b/src/components/FogProvider.tsx new file mode 100644 index 00000000..ca0acffb --- /dev/null +++ b/src/components/FogProvider.tsx @@ -0,0 +1,303 @@ +/** + * FogProvider - Manages Tribes 2 fog state and provides fog uniforms to materials. + * + * Tribes 2 has two fog systems: + * 1. Distance-based haze: Global fog from fogDistance to visibleDistance with quadratic falloff + * 2. Height-based volumetric fog: Up to 3 fog volumes with independent height ranges and colors + * + * The fog density depends on how much of the view ray passes through each fog volume, + * which varies based on camera height relative to volume boundaries. + */ +import { + createContext, + useContext, + useMemo, + useRef, + type ReactNode, +} from "react"; +import { useFrame } from "@react-three/fiber"; +import { Color } from "three"; +import type { TorqueObject } from "../torqueScript"; +import { getFloat, getProperty } from "../mission"; + +/** Maximum number of fog volumes supported (matches Torque) */ +export const MAX_FOG_VOLUMES = 3; +/** Floats per fog volume in shader uniform: [visDist, minH, maxH, percentage] */ +const FLOATS_PER_VOLUME = 4; + +/** + * A single fog volume with height boundaries and visibility settings. + * + * Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false). + * All fog uses the global fogColor regardless of fogVolumeColor values in mission files. + */ +export interface FogVolume { + /** Distance at which objects are fully obscured within this volume */ + visibleDistance: number; + /** Bottom height boundary of the fog volume */ + minHeight: number; + /** Top height boundary of the fog volume */ + maxHeight: number; + /** Fog density percentage (0-1), can be animated for storm effects */ + percentage: number; +} + +/** Complete fog state parsed from a Sky object */ +export interface FogState { + /** Distance at which fog starts (near plane) */ + fogDistance: number; + /** Distance at which fog is fully opaque (far plane) */ + visibleDistance: number; + /** Color for distance-based haze */ + fogColor: Color; + /** Height-based fog volumes (up to 3) */ + fogVolumes: FogVolume[]; + /** Highest point of any fog volume (used for optimization) */ + fogLine: number; + /** Whether fog is enabled */ + enabled: boolean; +} + +/** Fog uniforms to pass to shaders */ +export interface FogUniforms { + /** Distance fog near plane */ + fogNear: number; + /** Distance fog far plane */ + fogFar: number; + /** Distance fog color (linear color space) */ + fogColor: Color; + /** Fog volume data as flat array for shader: [visDist, minH, maxH, percentage] x 3 = 12 floats */ + fogVolumeData: Float32Array; + /** Current camera Y position */ + cameraHeight: number; + /** Whether volumetric fog is active */ + hasVolumetricFog: boolean; +} + +const FogContext = createContext(null); +const FogUniformsContext = + createContext | null>(null); + +/** + * Parse a Tribes 2 color string (space-separated RGB or RGBA values 0-1). + * + * Torque (2001) worked in gamma space - colors were specified as they should + * appear on screen. Three.js expects linear colors (it converts to sRGB on output). + * We convert sRGB->linear so the final output matches the intended appearance. + */ +function parseColor(colorString: string | undefined): Color { + if (!colorString) return new Color(0.5, 0.5, 0.5); + const parts = colorString.split(" ").map((s) => parseFloat(s)); + const [r, g, b] = parts; + // Convert from sRGB (how Torque specified colors) to linear (what Three.js expects) + return new Color().setRGB(r, g, b).convertSRGBToLinear(); +} + +/** + * Parse a fog volume property string. + * Format: "visibleDistance minHeight maxHeight" + * + * Note: fogVolumeColor is intentionally not parsed - per-volume colors are + * NOT used in Tribes 2 ($specialFog defaults to false). All fog uses fogColor. + */ +function parseFogVolume( + volumeStr: string | undefined, + percentage: number = 1.0, +): FogVolume | null { + if (!volumeStr) return null; + + const parts = volumeStr.split(" ").map((s) => parseFloat(s)); + if (parts.length < 3) return null; + + const [visibleDistance, minHeight, maxHeight] = parts; + + // Volume is invalid if visibleDistance is 0 or heights are equal + if (visibleDistance <= 0 || maxHeight <= minHeight) return null; + + return { + visibleDistance, + minHeight, + maxHeight, + percentage: Math.max(0, Math.min(1, percentage)), + }; +} + +/** + * Parse fog state from a Sky TorqueObject. + * @param object - The Sky TorqueObject containing fog properties + * @param highQuality - If true, use high_ fog distance variants when available + */ +export function parseFogState( + object: TorqueObject, + highQuality: boolean = true, +): FogState { + // Distance-based fog parameters + const fogDistanceBase = getFloat(object, "fogDistance") ?? 0; + const visibleDistanceBase = getFloat(object, "visibleDistance") ?? 1000; + const highFogDistance = getFloat(object, "high_fogDistance"); + const highVisibleDistance = getFloat(object, "high_visibleDistance"); + + // Use high_ variants if highQuality is enabled and they're available + const fogDistance = + highQuality && highFogDistance != null && highFogDistance > 0 + ? highFogDistance + : fogDistanceBase; + const visibleDistance = + highQuality && highVisibleDistance != null && highVisibleDistance > 0 + ? highVisibleDistance + : visibleDistanceBase; + + const fogColor = parseColor(getProperty(object, "fogColor")); + + // Parse fog volumes (up to 3) + // Note: fogVolumeColor is intentionally not parsed - see parseFogVolume comment + const fogVolumes: FogVolume[] = []; + + for (let i = 1; i <= MAX_FOG_VOLUMES; i++) { + const volume = parseFogVolume( + getProperty(object, `fogVolume${i}`), + 1.0, // Default percentage, could parse from storm fog state + ); + if (volume) { + fogVolumes.push(volume); + } + } + + // Calculate fog line (highest point of any fog volume) + const fogLine = fogVolumes.reduce( + (max, vol) => Math.max(max, vol.maxHeight), + 0, + ); + + // Fog is enabled if we have valid distance parameters + const enabled = visibleDistance > fogDistance; + + return { + fogDistance, + visibleDistance, + fogColor, + fogVolumes, + fogLine, + enabled, + }; +} + +/** + * Create initial fog uniforms structure. + */ +function createFogUniforms(): FogUniforms { + return { + fogNear: 0, + fogFar: 1000, + fogColor: new Color(0.5, 0.5, 0.5), + fogVolumeData: new Float32Array(MAX_FOG_VOLUMES * FLOATS_PER_VOLUME), + cameraHeight: 0, + hasVolumetricFog: false, + }; +} + +/** + * Update fog uniforms from fog state. + */ +function updateFogUniforms( + uniforms: FogUniforms, + state: FogState, + cameraY: number, +): void { + uniforms.fogNear = state.fogDistance; + uniforms.fogFar = state.visibleDistance; + uniforms.fogColor.copy(state.fogColor); + uniforms.cameraHeight = cameraY; + uniforms.hasVolumetricFog = state.fogVolumes.length > 0; + + // Pack fog volume data for shader: [visDist, minH, maxH, percentage] x 3 + for (let i = 0; i < MAX_FOG_VOLUMES; i++) { + const offset = i * FLOATS_PER_VOLUME; + const vol = state.fogVolumes[i]; + + if (vol) { + uniforms.fogVolumeData[offset + 0] = vol.visibleDistance; + uniforms.fogVolumeData[offset + 1] = vol.minHeight; + uniforms.fogVolumeData[offset + 2] = vol.maxHeight; + uniforms.fogVolumeData[offset + 3] = vol.percentage; + } else { + // Mark as inactive with visibleDistance = 0 + uniforms.fogVolumeData[offset + 0] = 0; + uniforms.fogVolumeData[offset + 1] = 0; + uniforms.fogVolumeData[offset + 2] = 0; + uniforms.fogVolumeData[offset + 3] = 0; + } + } +} + +interface FogProviderProps { + object: TorqueObject; + enabled?: boolean; + children: ReactNode; +} + +/** + * Provides fog state and uniforms to the scene. + * Updates fog uniforms each frame based on camera position. + * + * Note: Shader materials get fog uniforms from globalFogUniforms (updated by Sky). + * This provider is for React components that need fog state or the FogUniforms object. + */ +export function FogProvider({ + object, + enabled = true, + children, +}: FogProviderProps) { + const fogState = useMemo(() => { + const state = parseFogState(object); + state.enabled = state.enabled && enabled; + return state; + }, [object, enabled]); + + const uniformsRef = useRef(createFogUniforms()); + + // Update uniforms each frame with current camera position + useFrame(({ camera }) => { + if (fogState.enabled) { + updateFogUniforms(uniformsRef.current, fogState, camera.position.y); + } + }); + + // Initial update + useMemo(() => { + updateFogUniforms(uniformsRef.current, fogState, 0); + }, [fogState]); + + return ( + + + {children} + + + ); +} + +/** + * Hook to access the current fog state. + */ +export function useFogState(): FogState | null { + return useContext(FogContext); +} + +/** + * Hook to access fog uniforms ref (for shader updates). + */ +export function useFogUniforms(): React.MutableRefObject | null { + return useContext(FogUniformsContext); +} + +/** + * Get the fog color at a given height. + * Used for skybox and background color blending. + * + * Note: Per-volume colors are not used in Tribes 2, so this always + * returns the global fog color regardless of height. + */ +export function getFogColorAtHeight(state: FogState, _height: number): Color { + return state.fogColor; +} diff --git a/src/components/ForceFieldBare.tsx b/src/components/ForceFieldBare.tsx index b97acdde..e4794059 100644 --- a/src/components/ForceFieldBare.tsx +++ b/src/components/ForceFieldBare.tsx @@ -6,7 +6,7 @@ import { BoxGeometry, Color, DoubleSide, - LinearSRGBColorSpace, + NoColorSpace, RepeatWrapping, Texture, } from "three"; @@ -47,8 +47,9 @@ function parseColor(colorStr: string): [number, number, number] { function setupForceFieldTexture(texture: Texture) { texture.wrapS = texture.wrapT = RepeatWrapping; - // Linear color space - gamma correction is applied in the shader - texture.colorSpace = LinearSRGBColorSpace; + // NoColorSpace - values pass through directly to display without conversion, + // matching how WaterBlock handles textures in custom ShaderMaterial. + texture.colorSpace = NoColorSpace; texture.flipY = false; texture.needsUpdate = true; } @@ -155,21 +156,16 @@ function ForceFieldFallback({ }: ForceFieldGeometryProps) { const geometry = useCornerBoxGeometry(scale); - // Apply gamma correction to match the main shader's pow(color, 2.2) - const gammaColor = useMemo( - () => - new Color( - Math.pow(color[0], 2.2), - Math.pow(color[1], 2.2), - Math.pow(color[2], 2.2), - ), + // Use color directly - no gamma correction needed to match main shader + const fallbackColor = useMemo( + () => new Color(color[0], color[1], color[2]), [color], ); return ( { + injectCustomFog(shader, globalFogUniforms); + // Only inject lighting for Lambert materials (Basic materials are unlit) + if (mat instanceof MeshLambertMaterial) { + injectShapeLighting(shader); + } + }; +} + function createMaterialFromFlags( baseMaterial: MeshStandardMaterial, texture: Texture, @@ -64,6 +82,7 @@ function createMaterialFromFlags( blending: isAdditive ? AdditiveBlending : undefined, fog: true, }); + applyShapeShaderModifications(mat); return mat; } @@ -90,6 +109,8 @@ function createMaterialFromFlags( ...baseProps, side: 0, // FrontSide }); + applyShapeShaderModifications(backMat); + applyShapeShaderModifications(frontMat); return [backMat, frontMat]; } @@ -100,6 +121,7 @@ function createMaterialFromFlags( side: 2, // DoubleSide reflectivity: 0, }); + applyShapeShaderModifications(mat); return mat; } diff --git a/src/components/InteriorInstance.tsx b/src/components/InteriorInstance.tsx index 59904d75..4fa41b65 100644 --- a/src/components/InteriorInstance.tsx +++ b/src/components/InteriorInstance.tsx @@ -1,4 +1,4 @@ -import { memo, Suspense, useMemo } from "react"; +import { memo, Suspense, useMemo, useCallback } from "react"; import { ErrorBoundary } from "react-error-boundary"; import { Mesh, Material, MeshStandardMaterial, Texture } from "three"; import { useGLTF, useTexture } from "@react-three/drei"; @@ -8,8 +8,16 @@ import { getPosition, getProperty, getRotation, getScale } from "../mission"; import { setupColor } from "../textureUtils"; import { FloatingLabel } from "./FloatingLabel"; import { useDebug } from "./SettingsProvider"; +import { injectCustomFog } from "../fogShader"; +import { globalFogUniforms } from "../globalFogUniforms"; +import { injectInteriorLighting } from "../interiorMaterial"; -const LIGHTMAP_INTENSITY = 4; +/** + * Lightmap intensity multiplier. + * Lightmaps contain baked lighting from interior-specific lights only + * (not scene sun/ambient - that's applied in real-time). + */ +const LIGHTMAP_INTENSITY = 2.5; /** * Load a .gltf file that was converted from a .dif, used for "interior" models. @@ -36,19 +44,35 @@ function InteriorTexture({ const flagNames = new Set(material?.userData?.flag_names ?? []); const isSelfIlluminating = flagNames.has("SelfIlluminating"); - // Self-illuminating materials are fullbright (unlit) + // Inject volumetric fog and lighting multipliers into materials + const onBeforeCompile = useCallback((shader: any) => { + injectCustomFog(shader, globalFogUniforms); + injectInteriorLighting(shader); + }, []); + + // Self-illuminating materials are fullbright (unlit), no lightmap if (isSelfIlluminating) { - return ; + return ( + + ); } - // Use lightMap if available (baked lighting from DIF files) - // Three.js MeshLambertMaterial automatically uses uv2 for lightMap + // Use MeshLambertMaterial for diffuse-only lighting (matches Tribes 2's GL pipeline) + // Interiors respond to scene sun + ambient (from Sky object) in real-time + // Lightmaps contain baked lighting from interior-specific lights only + // DIF files are reusable across missions with different sun settings return ( ); } @@ -56,13 +80,22 @@ function InteriorTexture({ /** * Extract lightmap texture from a glTF material. * The io_dif Blender addon stores lightmaps in the emissive channel for transport. + * + * Note: Torque used lightmaps directly as linear data (no gamma correction in + * the engine). The glTF loader preserves the original PNG data. We explicitly + * set colorSpace to linear to match Torque's behavior. */ function getLightMap(material: Material | null): Texture | null { if (!material) return null; // glTF materials come through as MeshStandardMaterial const stdMat = material as MeshStandardMaterial; // Lightmap is stored in emissiveMap with 0 strength (just for glTF transport) - return stdMat.emissiveMap ?? null; + const lightMap = stdMat.emissiveMap; + if (lightMap) { + // Use linear color space to match Torque's direct multiply behavior + lightMap.colorSpace = "srgb-linear"; + } + return lightMap ?? null; } function InteriorMesh({ node }: { node: Mesh }) { @@ -70,7 +103,7 @@ function InteriorMesh({ node }: { node: Mesh }) { const lightMaps = useMemo(() => { if (!node.material) return []; if (Array.isArray(node.material)) { - return node.material.map(getLightMap); + return node.material.map((m) => getLightMap(m)); } return [getLightMap(node.material)]; }, [node.material]); diff --git a/src/components/SettingsProvider.tsx b/src/components/SettingsProvider.tsx index 53aa9563..1a136473 100644 --- a/src/components/SettingsProvider.tsx +++ b/src/components/SettingsProvider.tsx @@ -13,6 +13,8 @@ type StateSetter = ReturnType>[1]; type SettingsContext = { fogEnabled: boolean; setFogEnabled: StateSetter; + highQualityFog: boolean; + setHighQualityFog: StateSetter; fov: number; setFov: StateSetter; audioEnabled: boolean; @@ -37,6 +39,7 @@ const ControlsContext = createContext(null); type PersistedSettings = { fogEnabled?: boolean; + highQualityFog?: boolean; speedMultiplier?: number; fov?: number; audioEnabled?: boolean; @@ -58,6 +61,7 @@ export function useControls() { export function SettingsProvider({ children }: { children: ReactNode }) { const [fogEnabled, setFogEnabled] = useState(true); + const [highQualityFog, setHighQualityFog] = useState(false); const [speedMultiplier, setSpeedMultiplier] = useState(1); const [fov, setFov] = useState(90); const [audioEnabled, setAudioEnabled] = useState(false); @@ -68,6 +72,8 @@ export function SettingsProvider({ children }: { children: ReactNode }) { () => ({ fogEnabled, setFogEnabled, + highQualityFog, + setHighQualityFog, fov, setFov, audioEnabled, @@ -75,7 +81,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) { animationEnabled, setAnimationEnabled, }), - [fogEnabled, speedMultiplier, fov, audioEnabled, animationEnabled], + [fogEnabled, highQualityFog, fov, audioEnabled, animationEnabled], ); const debugContext: DebugContext = useMemo( @@ -108,6 +114,9 @@ export function SettingsProvider({ children }: { children: ReactNode }) { if (savedSettings.fogEnabled != null) { setFogEnabled(savedSettings.fogEnabled); } + if (savedSettings.highQualityFog != null) { + setHighQualityFog(savedSettings.highQualityFog); + } if (savedSettings.speedMultiplier != null) { setSpeedMultiplier(savedSettings.speedMultiplier); } @@ -129,6 +138,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) { saveTimerRef.current = setTimeout(() => { const settingsToSave: PersistedSettings = { fogEnabled, + highQualityFog, speedMultiplier, fov, audioEnabled, @@ -149,6 +159,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) { }; }, [ fogEnabled, + highQualityFog, speedMultiplier, fov, audioEnabled, diff --git a/src/components/Sky.tsx b/src/components/Sky.tsx index 4f3a1d92..97639e4b 100644 --- a/src/components/Sky.tsx +++ b/src/components/Sky.tsx @@ -1,49 +1,26 @@ import { Suspense, useMemo, useEffect, useRef } from "react"; import { useQuery } from "@tanstack/react-query"; +import { useThree, useFrame } from "@react-three/fiber"; import { useCubeTexture } from "@react-three/drei"; -import { Color, ShaderMaterial, BackSide, ShaderChunk } from "three"; +import { Color, Fog } from "three"; import type { TorqueObject } from "../torqueScript"; -import { getFloat, getInt, getProperty } from "../mission"; +import { getInt, getProperty } from "../mission"; import { useSettings } from "./SettingsProvider"; import { BASE_URL, loadDetailMapList, textureToUrl } from "../loaders"; import { CloudLayers } from "./CloudLayers"; +import { parseFogState, type FogState, type FogVolume } from "./FogProvider"; +import { installCustomFogShader } from "../fogShader"; +import { + globalFogUniforms, + updateGlobalFogUniforms, + packFogVolumeData, + resetGlobalFogUniforms, +} from "../globalFogUniforms"; const FALLBACK_TEXTURE_URL = `${BASE_URL}/black.png`; -/** - * Tribes 2 fog formula (from sceneState.cc getHaze): - * fogScale = 1.0 / (visibleDistance - fogDistance) - * distFactor = (dist - fogDistance) * fogScale - 1.0 - * haze = 1.0 - distFactor * distFactor - * - * This creates an "ease-in" quadratic curve where fog builds slowly at first, - * then accelerates toward visibleDistance. - * - * Set USE_QUADRATIC_FOG to true to use this formula, false to use Three.js linear fog. - */ -const USE_QUADRATIC_FOG = false; - -function installQuadraticFogShader() { - ShaderChunk.fog_fragment = ` -#ifdef USE_FOG - float fogFactor = 0.0; - if (vFogDepth > fogNear) { - if (vFogDepth >= fogFar) { - fogFactor = 1.0; - } else { - float fogScale = 1.0 / (fogFar - fogNear); - float distFactor = (vFogDepth - fogNear) * fogScale - 1.0; - fogFactor = 1.0 - distFactor * distFactor; - } - } - gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor); -#endif -`; -} - -if (USE_QUADRATIC_FOG) { - installQuadraticFogShader(); -} +// Track if fog shader has been installed (idempotent installation) +let fogShaderInstalled = false; /** * Parse a Tribes 2 color string (space-separated RGB or RGBA values 0-1). @@ -70,12 +47,225 @@ function useDetailMapList(name: string) { }); } +/** + * Inner component that renders the skybox once texture URLs are known. + * Separated so useCubeTexture only runs with valid URLs. + */ +// Torque sky constants (from sky.cc) +// OFFSET_HEIGHT = 60.0 - height of the horizon fog band in world units +const HORIZON_FOG_HEIGHT = 60.0; + +function SkyBoxTexture({ + skyBoxFiles, + fogColor, + fogState, +}: { + skyBoxFiles: string[]; + fogColor?: Color; + fogState?: FogState; +}) { + const { camera } = useThree(); + const skyBox = useCubeTexture(skyBoxFiles, { path: "" }); + + const enableFog = !!fogColor; + + const inverseProjectionMatrix = useMemo(() => { + return camera.projectionMatrixInverse; + }, [camera]); + + const fogVolumeData = useMemo( + () => + fogState ? packFogVolumeData(fogState.fogVolumes) : new Float32Array(12), + [fogState], + ); + + // Calculate the horizon fog cutoff based on visible distance + // In Torque's sky.cc: + // mRadius = visibleDistance * 0.95 + // tpt = (1,1,1).normalize(mRadius) -> each component = mRadius / sqrt(3) + // mSkyBoxPt.x = mSkyBoxPt.z = mRadius / sqrt(3) (corner of cube) + // + // The fog band is rendered as geometry from height 0 to OFFSET_HEIGHT (60) + // on a skybox where the horizontal distance to the edge is mSkyBoxPt.x + // + // For a ray direction, direction.y corresponds to the vertical component + // The fog should cover directions where: + // height / horizontal_dist = direction.y / sqrt(1 - direction.y^2) < 60 / skyBoxPt.x + // + // Simplifying: direction.y < OFFSET_HEIGHT / sqrt(skyBoxPt.x^2 + OFFSET_HEIGHT^2) + const horizonFogHeight = useMemo(() => { + if (!fogState) return 0.18; // Default fallback + const mRadius = fogState.visibleDistance * 0.95; + const skyBoxPtX = mRadius / Math.sqrt(3); // Corner coordinate + // For direction vector (horizontal, y), y / horizontal = height / skyBoxPtX + // At the fog boundary: y / sqrt(1-y^2) = 60 / skyBoxPtX + // Solving for y: y = 60 / sqrt(skyBoxPtX^2 + 60^2) + return HORIZON_FOG_HEIGHT / Math.sqrt(skyBoxPtX * skyBoxPtX + HORIZON_FOG_HEIGHT * HORIZON_FOG_HEIGHT); + }, [fogState]); + + return ( + + + + + + sRGB output conversion + // Use proper sRGB transfer function (not simplified gamma 2.2) to match Three.js + vec3 linearToSRGB(vec3 linear) { + vec3 low = linear * 12.92; + vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055; + return mix(low, high, step(vec3(0.0031308), linear)); + } + + void main() { + vec2 ndc = vUv * 2.0 - 1.0; + vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0); + viewPos.xyz /= viewPos.w; + vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz); + direction = vec3(direction.z, direction.y, -direction.x); + // Sample skybox - Three.js CubeTexture with SRGBColorSpace auto-converts to linear + vec4 skyColor = textureCube(skybox, direction); + vec3 finalColor; + + if (enableFog) { + vec3 effectiveFogColor = fogColor; + + // Calculate how much fog volume the ray passes through + // For skybox at "infinite" distance, the relevant height is how much + // of the volume is above/below camera depending on view direction + float volumeFogInfluence = 0.0; + + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + if (volVisDist <= 0.0) continue; + + // Check if camera is inside this volume + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + // Camera is inside the fog volume + // Looking horizontally or up at shallow angles means ray travels + // through more fog before exiting the volume + float heightAboveCamera = volMaxH - cameraHeight; + float heightBelowCamera = cameraHeight - volMinH; + float volumeHeight = volMaxH - volMinH; + + // For horizontal rays (direction.y ≈ 0), maximum fog influence + // For rays going up steeply, less fog (exits volume quickly) + // For rays going down, more fog (travels through volume below) + float rayInfluence; + if (direction.y >= 0.0) { + // Looking up: influence based on how steep we're looking + // Shallow angles = long path through fog = high influence + rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y); + } else { + // Looking down: always high fog (into the volume) + rayInfluence = 1.0; + } + + // Scale by percentage and volume depth factor + volumeFogInfluence += rayInfluence * volPct; + } + } + + // Base fog factor from view direction (for haze at horizon) + // In Torque, the fog "bans" (bands) are rendered as geometry from + // height 0 (HORIZON) to height 60 (OFFSET_HEIGHT) on the skybox. + // The skybox corner is at mSkyBoxPt.x = mRadius / sqrt(3). + // + // horizonFogHeight is the direction.y value where the fog band ends: + // horizonFogHeight = 60 / sqrt(skyBoxPt.x^2 + 60^2) + // + // For Firestorm (visDist=600): mRadius=570, skyBoxPt.x=329, horizonFogHeight≈0.18 + // + // Torque renders the fog bands as geometry with linear vertex alpha + // interpolation. We use a squared curve (t^2) to create a gentler + // falloff at the top of the gradient, matching Tribes 2's appearance. + float baseFogFactor; + if (direction.y <= 0.0) { + // Looking at or below horizon: full fog + baseFogFactor = 1.0; + } else if (direction.y >= horizonFogHeight) { + // Above fog band: no fog + baseFogFactor = 0.0; + } else { + // Within fog band: squared curve for gentler falloff at top + float t = direction.y / horizonFogHeight; + baseFogFactor = (1.0 - t) * (1.0 - t); + } + + // Combine base fog with volume fog influence + // When inside a volume, increase fog intensity + float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5); + + finalColor = mix(skyColor.rgb, effectiveFogColor, finalFogFactor); + } else { + finalColor = skyColor.rgb; + } + // Convert linear result to sRGB for display + gl_FragColor = vec4(linearToSRGB(finalColor), 1.0); + } + `} + depthWrite={false} + depthTest={false} + /> + + ); +} + export function SkyBox({ materialList, fogColor, + fogState, }: { materialList: string; fogColor?: Color; + fogState?: FogState; }) { const { data: detailMapList } = useDetailMapList(materialList); @@ -90,89 +280,121 @@ export function SkyBox({ textureToUrl(detailMapList[0]), // +z textureToUrl(detailMapList[2]), // -z ] - : [ - FALLBACK_TEXTURE_URL, - FALLBACK_TEXTURE_URL, - FALLBACK_TEXTURE_URL, - FALLBACK_TEXTURE_URL, - FALLBACK_TEXTURE_URL, - FALLBACK_TEXTURE_URL, - ], + : null, [detailMapList], ); - const skyBox = useCubeTexture(skyBoxFiles, { path: "" }); - - const materialRef = useRef(null!); - - const shaderMaterial = useMemo(() => { - // Always use a shader to apply the X-axis mirror transformation. - // Optionally blend fog toward the horizon. - return new ShaderMaterial({ - uniforms: { - skybox: { value: skyBox }, - fogColor: { value: fogColor ?? new Color(0, 0, 0) }, - enableFog: { value: !!fogColor }, - }, - vertexShader: ` - varying vec3 vDirection; - - void main() { - vDirection = position; - vec4 pos = projectionMatrix * mat4(mat3(modelViewMatrix)) * vec4(position, 1.0); - gl_Position = pos.xyww; - } - `, - fragmentShader: ` - uniform samplerCube skybox; - uniform vec3 fogColor; - uniform bool enableFog; - - varying vec3 vDirection; - - void main() { - vec3 direction = normalize(vDirection); - // Swap X and Z, negate X to mirror across X axis - direction = vec3(direction.z, direction.y, -direction.x); - vec4 skyColor = textureCube(skybox, direction); - - if (enableFog) { - // Fog increases toward and below horizon - // direction.y: -1 = straight down, 0 = horizon, 1 = straight up - // Use smoothstep for gradual transition (matches Three.js linear fog feel) - float fogFactor = 1.0 - smoothstep(-0.1, 0.5, direction.y); - vec3 finalColor = mix(skyColor.rgb, fogColor, fogFactor); - gl_FragColor = vec4(finalColor, 1.0); - } else { - gl_FragColor = skyColor; - } - } - `, - side: BackSide, - depthWrite: false, - }); - }, [skyBox, fogColor]); - - // Update uniforms when props change (ensures reactivity) - useEffect(() => { - if (materialRef.current) { - materialRef.current.uniforms.skybox.value = skyBox; - materialRef.current.uniforms.fogColor.value = - fogColor ?? new Color(0, 0, 0); - materialRef.current.uniforms.enableFog.value = !!fogColor; - } - }, [skyBox, fogColor]); + // Don't render until we have real texture URLs + if (!skyBoxFiles) { + return null; + } return ( - - - - + ); } +/** + * Get fog near/far parameters for the distance-based haze. + * + * IMPORTANT: In Torque, the distance-based haze ALWAYS uses the global + * fogDistance and visibleDistance parameters. Per-volume fog contributions + * are calculated separately in the volumetric fog shader and ADDED to haze. + * + * The shader's haze formula reads fogNear/fogFar from scene.fog, so these + * must be the global parameters, NOT per-volume adjusted values. + * + * @returns [near, far] distances for haze (always global values) + */ +function calculateFogParameters( + fogState: FogState, + _cameraHeight: number, +): [number, number] { + const { fogDistance, visibleDistance } = fogState; + // Always return global fog parameters for the haze calculation. + // Volumetric fog from fog volumes is computed separately in the shader + // and added to the haze value. + return [fogDistance, visibleDistance]; +} + +/** + * Dynamic fog component that manages Torque-style fog rendering. + * + * This component: + * - Sets up Three.js Fog with global fogDistance/visibleDistance for haze + * - Updates cameraHeight uniform each frame for volumetric fog shaders + * - Manages global fog uniforms lifecycle (reset on mount, cleanup on unmount) + * + * The custom fog shader (fogFragmentShader) handles: + * 1. Haze: Distance-based quadratic fog using global parameters + * 2. Volume fog: Height-based fog using per-volume parameters + * Both are combined additively, matching Torque's getHazeAndFog function. + */ +function DynamicFog({ fogState }: { fogState: FogState }) { + const { scene, camera } = useThree(); + const fogRef = useRef(null); + + // Pack fog volume data once (it doesn't change during runtime) + const fogVolumeData = useMemo( + () => packFogVolumeData(fogState.fogVolumes), + [fogState.fogVolumes], + ); + + // Install custom fog shader (idempotent - only runs once globally) + useEffect(() => { + if (!fogShaderInstalled) { + installCustomFogShader(); + fogShaderInstalled = true; + } + }, []); + + // Create fog object on mount + useEffect(() => { + // Reset global fog uniforms to ensure clean state for new mission + resetGlobalFogUniforms(); + + const [near, far] = calculateFogParameters(fogState, camera.position.y); + const fog = new Fog(fogState.fogColor, near, far); + scene.fog = fog; + fogRef.current = fog; + + // Initial update of global fog uniforms + updateGlobalFogUniforms(camera.position.y, fogVolumeData); + + return () => { + scene.fog = null; + fogRef.current = null; + // Reset fog uniforms on unmount so next mission starts clean + resetGlobalFogUniforms(); + }; + }, [scene, camera, fogState, fogVolumeData]); + + // Update fog parameters each frame based on camera height + useFrame(() => { + const fog = fogRef.current; + if (!fog) return; + + const cameraHeight = camera.position.y; + + // Update Three.js basic fog + const [near, far] = calculateFogParameters(fogState, cameraHeight); + fog.near = near; + fog.far = far; + fog.color.copy(fogState.fogColor); + + // Update global fog uniforms for volumetric fog shaders + updateGlobalFogUniforms(cameraHeight, fogVolumeData); + }); + + return null; +} + export function Sky({ object }: { object: TorqueObject }) { - const { fogEnabled } = useSettings(); + const { fogEnabled, highQualityFog } = useSettings(); // Skybox textures const materialList = getProperty(object, "materialList"); @@ -184,50 +406,13 @@ export function Sky({ object }: { object: TorqueObject }) { const useSkyTextures = getInt(object, "useSkyTextures") ?? 1; - // Fog parameters - Tribes 2 uses fogDistance (near) and visibleDistance (far) - // high_* variants are used for high quality settings (-1 or 0 means use normal) - const fogDistanceBase = getFloat(object, "fogDistance"); - const visibleDistanceBase = getFloat(object, "visibleDistance"); - const highFogDistance = getFloat(object, "high_fogDistance"); - const highVisibleDistance = getFloat(object, "high_visibleDistance"); - - // Parse fog volumes - format: "visibleDistance minHeight maxHeight" - // These define height-based fog bands with different densities - const fogVolume1 = useMemo(() => { - const value = getProperty(object, "fogVolume1"); - if (value) { - const [visibleDistance, minHeight, maxHeight] = value - .split(" ") - .map((s: string) => parseFloat(s)); - // Only valid if visibleDistance > 0 and has a height range - if (visibleDistance > 0 && maxHeight > minHeight) { - return { visibleDistance, minHeight, maxHeight }; - } - } - return null; - }, [object]); - - // Use high quality values if available and valid (> 0) - const baseFogNear = - highFogDistance != null && highFogDistance > 0 - ? highFogDistance - : fogDistanceBase; - const baseFogFar = - highVisibleDistance != null && highVisibleDistance > 0 - ? highVisibleDistance - : visibleDistanceBase; - - // If fogVolume1 is defined, use denser fog - // Torque's fog volumes ADD density on top of base fog - objects inside - // a fog volume get significantly more haze. We approximate this by - // using a fraction of the volume's visibleDistance. - const fogNear = fogVolume1 - ? Math.min(baseFogNear ?? Infinity, fogVolume1.visibleDistance * 0.25) - : baseFogNear; - const fogFar = fogVolume1 - ? Math.min(baseFogFar ?? Infinity, fogVolume1.visibleDistance * 0.9) - : baseFogFar; + // Parse full fog state from Sky object using FogProvider's parser + const fogState = useMemo( + () => parseFogState(object, highQualityFog), + [object, highQualityFog], + ); + // Get sRGB fog color for background const fogColor = useMemo( () => parseColorString(getProperty(object, "fogColor")), [object], @@ -235,34 +420,52 @@ export function Sky({ object }: { object: TorqueObject }) { const skyColor = skySolidColor || fogColor; - const backgroundColor = skyColor ? ( - - ) : null; + // Only enable fog if we have valid distance parameters + const hasFogParams = fogState.enabled && fogEnabled; - // Only enable fog if we have valid near/far distances - const hasFogParams = fogNear != null && fogFar != null && fogFar > fogNear; + // Use the linear fog color from fogState - Three.js will handle display conversion + const effectiveFogColor = fogState.fogColor; + + // Set scene background color directly using useThree + // This ensures the gap between fogged terrain and skybox blends correctly + const { scene, gl } = useThree(); + useEffect(() => { + if (hasFogParams) { + // Use effective fog color for background (matches terrain fog) + const bgColor = effectiveFogColor.clone(); + scene.background = bgColor; + // Also set the renderer clear color as a fallback + gl.setClearColor(bgColor); + } else if (skyColor) { + const bgColor = skyColor[0].clone(); + scene.background = bgColor; + gl.setClearColor(bgColor); + } else { + scene.background = null; + } + return () => { + scene.background = null; + }; + }, [scene, gl, hasFogParams, effectiveFogColor, skyColor]); return ( <> {materialList && useSkyTextures ? ( - + + {/* Key forces remount when mission changes to clear texture caches */} - ) : ( - // If there's no material list or skybox textures are disabled, - // render solid background - backgroundColor - )} + ) : null} {/* Cloud layers render independently of skybox textures */} - {fogEnabled && hasFogParams && fogColor ? ( - - ) : null} + {hasFogParams ? : null} ); } diff --git a/src/components/Sun.tsx b/src/components/Sun.tsx index b78f1c03..f055ce8f 100644 --- a/src/components/Sun.tsx +++ b/src/components/Sun.tsx @@ -43,8 +43,9 @@ export function Sun({ object }: { object: TorqueObject }) { return new Color(r, g, b); }, [object]); - // Lighting intensities - terrain and shapes need good directional + ambient balance - const directionalIntensity = 1.8; + // Base lighting intensities - neutral baseline, each object type applies its own multipliers + // See lightingConfig.ts for per-object-type adjustments + const directionalIntensity = 1.0; const ambientIntensity = 1.0; // Shadow camera covers the entire terrain (Tribes 2 terrains are typically 2048+ units) @@ -58,15 +59,16 @@ export function Sun({ object }: { object: TorqueObject }) { color={color} intensity={directionalIntensity} castShadow - shadow-mapSize-width={4096} - shadow-mapSize-height={4096} + shadow-mapSize-width={8192} + shadow-mapSize-height={8192} shadow-camera-left={-shadowCameraSize} shadow-camera-right={shadowCameraSize} shadow-camera-top={shadowCameraSize} shadow-camera-bottom={-shadowCameraSize} shadow-camera-near={100} shadow-camera-far={12000} - shadow-bias={-0.001} + shadow-bias={-0.0003} + shadow-normalBias={0.5} /> {/* Ambient fill light - prevents pure black shadows */} diff --git a/src/components/TerrainBlock.tsx b/src/components/TerrainBlock.tsx index f66bc869..26ac7af7 100644 --- a/src/components/TerrainBlock.tsx +++ b/src/components/TerrainBlock.tsx @@ -4,6 +4,7 @@ import { useQuery } from "@tanstack/react-query"; import { DataTexture, FloatType, + LinearFilter, NearestFilter, NoColorSpace, ClampToEdgeWrapping, @@ -11,6 +12,7 @@ import { RedFormat, RepeatWrapping, UnsignedByteType, + Vector3, } from "three"; import type { TorqueObject } from "../torqueScript"; import { getFloat, getInt, getPosition, getProperty } from "../mission"; @@ -23,6 +25,238 @@ import { useSceneObject } from "./useSceneObject"; const DEFAULT_SQUARE_SIZE = 8; const DEFAULT_VISIBLE_DISTANCE = 600; const TERRAIN_SIZE = 256; +const LIGHTMAP_SIZE = 512; // Match Tribes 2's 512x512 lightmap +const HEIGHT_SCALE = 2048; // Matches displacementScale for terrain + +/** + * Displace terrain vertices on CPU and compute smooth normals from heightmap gradients. + * + * Height sampling uses NEAREST filtering to match the GPU DataTexture default: + * texel = floor(uv * textureWidth), clamped to valid range. + * + * Normals use bilinear interpolation for smooth gradients, preventing banding + * that would occur with face normals from computeVertexNormals(). + */ +function displaceTerrainAndComputeNormals( + geometry: PlaneGeometry, + heightMap: Uint16Array, + squareSize: number, +): void { + const posAttr = geometry.attributes.position; + const uvAttr = geometry.attributes.uv; + const normalAttr = geometry.attributes.normal; + const positions = posAttr.array as Float32Array; + const uvs = uvAttr.array as Float32Array; + const normals = normalAttr.array as Float32Array; + const vertexCount = posAttr.count; + + // Helper to get height at heightmap coordinates with clamping (integer coords) + const getHeightInt = (col: number, row: number): number => { + col = Math.max(0, Math.min(TERRAIN_SIZE - 1, col)); + row = Math.max(0, Math.min(TERRAIN_SIZE - 1, row)); + return (heightMap[row * TERRAIN_SIZE + col] / 65535) * HEIGHT_SCALE; + }; + + // Helper to get bilinearly interpolated height (matches GPU texture sampling) + const getHeight = (col: number, row: number): number => { + col = Math.max(0, Math.min(TERRAIN_SIZE - 1, col)); + row = Math.max(0, Math.min(TERRAIN_SIZE - 1, row)); + + const col0 = Math.floor(col); + const row0 = Math.floor(row); + const col1 = Math.min(col0 + 1, TERRAIN_SIZE - 1); + const row1 = Math.min(row0 + 1, TERRAIN_SIZE - 1); + + const fx = col - col0; + const fy = row - row0; + + const h00 = (heightMap[row0 * TERRAIN_SIZE + col0] / 65535) * HEIGHT_SCALE; + const h10 = (heightMap[row0 * TERRAIN_SIZE + col1] / 65535) * HEIGHT_SCALE; + const h01 = (heightMap[row1 * TERRAIN_SIZE + col0] / 65535) * HEIGHT_SCALE; + const h11 = (heightMap[row1 * TERRAIN_SIZE + col1] / 65535) * HEIGHT_SCALE; + + // Bilinear interpolation + const h0 = h00 * (1 - fx) + h10 * fx; + const h1 = h01 * (1 - fx) + h11 * fx; + return h0 * (1 - fy) + h1 * fy; + }; + + // Process each vertex + for (let i = 0; i < vertexCount; i++) { + const u = uvs[i * 2]; + const v = uvs[i * 2 + 1]; + + // Map UV to heightmap coordinates - must match Torque's terrain sampling. + // Torque formula: floor(worldPos / squareSize) & BlockMask + // UV 0→1 maps to world 0→2048, squareSize=8, so: floor(UV * 256) & 255 + // This wraps at edges for seamless terrain tiling. + const col = Math.floor(u * TERRAIN_SIZE) & (TERRAIN_SIZE - 1); + const row = Math.floor(v * TERRAIN_SIZE) & (TERRAIN_SIZE - 1); + + // Use direct integer sampling to match GPU nearest-neighbor filtering + const height = getHeightInt(col, row); + positions[i * 3 + 1] = height; + + // Compute normal using central differences on heightmap with smooth interpolation. + // Use fractional coordinates for gradient sampling to get smooth normals. + const colF = u * (TERRAIN_SIZE - 1); + const rowF = v * (TERRAIN_SIZE - 1); + const hL = getHeight(colF - 1, rowF); // left + const hR = getHeight(colF + 1, rowF); // right + const hD = getHeight(colF, rowF + 1); // down (increasing row) + const hU = getHeight(colF, rowF - 1); // up (decreasing row) + + // Gradients in heightmap space (col increases = +U, row increases = +V) + const dCol = (hR - hL) / 2; // height change per column + const dRow = (hD - hU) / 2; // height change per row + + // Now map heightmap gradients to world-space normal + // After rotateX(-PI/2) and rotateY(-PI/2): + // - U direction (col) maps to world +Z + // - V direction (row) maps to world +X + // + // For heightfield normal: n = normalize(-dh/dx, 1, -dh/dz) in world space + // But we need the normal to face outward (toward the viewer), so use positive signs + let nx = dRow; + let ny = squareSize; + let nz = dCol; + + // Normalize + const len = Math.sqrt(nx * nx + ny * ny + nz * nz); + if (len > 0) { + nx /= len; + ny /= len; + nz /= len; + } else { + nx = 0; + ny = 1; + nz = 0; + } + + normals[i * 3] = nx; + normals[i * 3 + 1] = ny; + normals[i * 3 + 2] = nz; + } + + posAttr.needsUpdate = true; + normalAttr.needsUpdate = true; +} + +/** + * Generate a terrain lightmap texture with smooth normals. + * + * The key insight: banding occurs because vertex normals are computed from + * discrete heightmap samples, creating discontinuities at grid boundaries. + * + * Solution: Compute normals from BILINEARLY INTERPOLATED heights at each + * lightmap pixel. This produces smooth gradients because the interpolated + * height surface is C0 continuous (no discontinuities). + * + * @param heightMap - Uint16 heightmap data (256x256) + * @param sunDirection - Normalized sun direction vector (points FROM sun TO scene) + * @param squareSize - World units per heightmap cell + * @returns DataTexture with lighting intensity values + */ +function generateTerrainLightmap( + heightMap: Uint16Array, + sunDirection: Vector3, + squareSize: number, +): DataTexture { + // Helper to get bilinearly interpolated height at any fractional position + // Supports negative and out-of-range coordinates via wrapping + const getInterpolatedHeight = (col: number, row: number): number => { + // Wrap to valid range using modulo (handles negative values correctly) + const wrappedCol = ((col % TERRAIN_SIZE) + TERRAIN_SIZE) % TERRAIN_SIZE; + const wrappedRow = ((row % TERRAIN_SIZE) + TERRAIN_SIZE) % TERRAIN_SIZE; + + const col0 = Math.floor(wrappedCol); + const row0 = Math.floor(wrappedRow); + const col1 = (col0 + 1) & (TERRAIN_SIZE - 1); // Wrap at edge + const row1 = (row0 + 1) & (TERRAIN_SIZE - 1); + + const fx = wrappedCol - col0; + const fy = wrappedRow - row0; + + const h00 = heightMap[row0 * TERRAIN_SIZE + col0] / 65535; + const h10 = heightMap[row0 * TERRAIN_SIZE + col1] / 65535; + const h01 = heightMap[row1 * TERRAIN_SIZE + col0] / 65535; + const h11 = heightMap[row1 * TERRAIN_SIZE + col1] / 65535; + + // Bilinear interpolation + const h0 = h00 * (1 - fx) + h10 * fx; + const h1 = h01 * (1 - fx) + h11 * fx; + return (h0 * (1 - fy) + h1 * fy) * HEIGHT_SCALE; + }; + + // Light direction (negate sun direction since it points FROM sun) + const lightDir = new Vector3( + -sunDirection.x, + -sunDirection.y, + -sunDirection.z, + ).normalize(); + + const lightmapData = new Uint8Array(LIGHTMAP_SIZE * LIGHTMAP_SIZE); + + // Epsilon for gradient sampling (in heightmap units) + // Use 0.5 to sample across a reasonable distance for smooth gradients + const eps = 0.5; + + // Generate lightmap by computing normal from interpolated heights at each pixel + for (let lRow = 0; lRow < LIGHTMAP_SIZE; lRow++) { + for (let lCol = 0; lCol < LIGHTMAP_SIZE; lCol++) { + // Generate texel for terrain position matching Torque's relight(): + // Torque starts at halfStep (0.25) within each square, not at corner. + // With 2 lightmap pixels per terrain square: pos = lCol/2 + 0.25 + const col = lCol / 2 + 0.25; + const row = lRow / 2 + 0.25; + + // Compute gradient using central differences on interpolated heights + const hL = getInterpolatedHeight(col - eps, row); + const hR = getInterpolatedHeight(col + eps, row); + const hU = getInterpolatedHeight(col, row - eps); + const hD = getInterpolatedHeight(col, row + eps); + + // Gradient in heightmap units + const dCol = (hR - hL) / (2 * eps); + const dRow = (hD - hU) / (2 * eps); + + // Convert to world-space normal - must match displaceTerrainAndComputeNormals + // After geometry rotations: U (col) → +Z, V (row) → +X + const nx = -dRow; + const ny = squareSize; + const nz = -dCol; + + const len = Math.sqrt(nx * nx + ny * ny + nz * nz); + + // Compute NdotL + const NdotL = Math.max( + 0, + (nx / len) * lightDir.x + + (ny / len) * lightDir.y + + (nz / len) * lightDir.z, + ); + + lightmapData[lRow * LIGHTMAP_SIZE + lCol] = Math.floor(NdotL * 255); + } + } + + const texture = new DataTexture( + lightmapData, + LIGHTMAP_SIZE, + LIGHTMAP_SIZE, + RedFormat, + UnsignedByteType, + ); + texture.colorSpace = NoColorSpace; + texture.generateMipmaps = true; + texture.wrapS = ClampToEdgeWrapping; + texture.wrapT = ClampToEdgeWrapping; + texture.magFilter = LinearFilter; + texture.minFilter = LinearFilter; + texture.needsUpdate = true; + + return texture; +} /** * Load a .ter file, used for terrain heightmap and texture info. @@ -112,16 +346,45 @@ export const TerrainBlock = memo(function TerrainBlock({ return value ? value.split(" ").map((s: string) => parseInt(s, 10)) : []; }, [object]); - // Shared geometry for all tiles + const { data: terrain } = useTerrain(terrainFile); + + // Shared geometry for all tiles - with smooth normals computed from heightmap const sharedGeometry = useMemo(() => { + if (!terrain) return null; + const size = squareSize * 256; const geometry = new PlaneGeometry(size, size, 256, 256); geometry.rotateX(-Math.PI / 2); geometry.rotateY(-Math.PI / 2); - return geometry; - }, [squareSize]); - const { data: terrain } = useTerrain(terrainFile); + // Displace vertices on CPU and compute smooth normals + displaceTerrainAndComputeNormals(geometry, terrain.heightMap, squareSize); + + return geometry; + }, [squareSize, terrain]); + + // Get sun direction for lightmap generation + const sun = useSceneObject("Sun"); + const sunDirection = useMemo(() => { + if (!sun) return new Vector3(0.57735, -0.57735, 0.57735); // Default diagonal + const directionStr = + getProperty(sun, "direction") ?? "0.57735 0.57735 -0.57735"; + const [tx, ty, tz] = directionStr + .split(" ") + .map((s: string) => parseFloat(s)); + // Convert Torque (X, Y, Z) to Three.js: swap Y/Z + const x = tx; + const y = tz; + const z = ty; + const len = Math.sqrt(x * x + y * y + z * z); + return new Vector3(x / len, y / len, z / len); + }, [sun]); + + // Generate terrain lightmap for smooth per-pixel lighting + const terrainLightmap = useMemo(() => { + if (!terrain) return null; + return generateTerrainLightmap(terrain.heightMap, sunDirection, squareSize); + }, [terrain, sunDirection, squareSize]); // Shared displacement map from heightmap - created once for all tiles const sharedDisplacementMap = useMemo(() => { @@ -218,7 +481,12 @@ export const TerrainBlock = memo(function TerrainBlock({ setTileAssignments(newAssignments); }); - if (!terrain || !sharedDisplacementMap || !sharedAlphaTextures) { + if ( + !terrain || + !sharedGeometry || + !sharedDisplacementMap || + !sharedAlphaTextures + ) { return null; } @@ -236,6 +504,7 @@ export const TerrainBlock = memo(function TerrainBlock({ visibilityMask={primaryVisibilityMask} alphaTextures={sharedAlphaTextures} detailTextureName={detailTexture} + lightmap={terrainLightmap} /> {/* Pooled tiles - stable keys, always mounted */} {poolIndices.map((poolIndex) => { @@ -253,6 +522,7 @@ export const TerrainBlock = memo(function TerrainBlock({ visibilityMask={pooledVisibilityMask} alphaTextures={sharedAlphaTextures} detailTextureName={detailTexture} + lightmap={terrainLightmap} visible={assignment !== null} /> ); diff --git a/src/components/TerrainTile.tsx b/src/components/TerrainTile.tsx index 21535e5b..63190671 100644 --- a/src/components/TerrainTile.tsx +++ b/src/components/TerrainTile.tsx @@ -15,6 +15,8 @@ import { import { setupColor } from "../textureUtils"; import { updateTerrainTextureShader } from "../terrainMaterial"; import { useDebug } from "./SettingsProvider"; +import { injectCustomFog } from "../fogShader"; +import { globalFogUniforms } from "../globalFogUniforms"; const DEFAULT_SQUARE_SIZE = 8; @@ -39,6 +41,7 @@ interface TerrainTileProps { visibilityMask: DataTexture; alphaTextures: DataTexture[]; detailTextureName?: string; + lightmap?: DataTexture; visible?: boolean; } @@ -48,12 +51,14 @@ function BlendedTerrainTextures({ textureNames, alphaTextures, detailTextureName, + lightmap, }: { displacementMap: DataTexture; visibilityMask: DataTexture; textureNames: string[]; alphaTextures: DataTexture[]; detailTextureName?: string; + lightmap?: DataTexture; }) { const { debugMode } = useDebug(); @@ -86,7 +91,11 @@ function BlendedTerrainTextures({ tiling: TILING, debugMode, detailTexture: detailTextureUrl ? detailTexture : null, + lightmap, }); + + // Inject volumetric fog using global uniforms + injectCustomFog(shader, globalFogUniforms); }, [ baseTextures, @@ -95,22 +104,25 @@ function BlendedTerrainTextures({ debugMode, detailTexture, detailTextureUrl, + lightmap, ], ); // Key must include factors that change shader code structure (not just uniforms) // - debugMode: affects fragment shader branching // - detailTextureUrl: affects vertex shader (adds varying) and fragment shader - const materialKey = `${debugMode ? "debug" : "normal"}-${detailTextureUrl ? "detail" : "nodetail"}`; + // - lightmap: affects shader structure (uses lightmap for NdotL instead of vertex normals) + const materialKey = `${debugMode ? "debug" : "normal"}-${detailTextureUrl ? "detail" : "nodetail"}-${lightmap ? "lightmap" : "nolightmap"}`; + // Displacement is done on CPU, so no displacementMap needed + // We keep 'map' to provide UV coordinates for shader (vMapUv) + // Use MeshLambertMaterial for compatibility with shadow maps return ( ); @@ -122,12 +134,14 @@ function TerrainMaterial({ textureNames, alphaTextures, detailTextureName, + lightmap, }: { displacementMap: DataTexture; visibilityMask: DataTexture; textureNames: string[]; alphaTextures: DataTexture[]; detailTextureName?: string; + lightmap?: DataTexture; }) { return ( ); @@ -162,6 +177,7 @@ export const TerrainTile = memo(function TerrainTile({ visibilityMask, alphaTextures, detailTextureName, + lightmap, visible = true, }: TerrainTileProps) { const position = useMemo(() => { @@ -189,6 +205,7 @@ export const TerrainTile = memo(function TerrainTile({ textureNames={textureNames} alphaTextures={alphaTextures} detailTextureName={detailTextureName} + lightmap={lightmap} /> ); diff --git a/src/components/WaterBlock.tsx b/src/components/WaterBlock.tsx index d3f4f75b..24989140 100644 --- a/src/components/WaterBlock.tsx +++ b/src/components/WaterBlock.tsx @@ -1,7 +1,7 @@ import { memo, Suspense, useEffect, useMemo, useRef } from "react"; import { useTexture } from "@react-three/drei"; import { useFrame } from "@react-three/fiber"; -import { DoubleSide, PlaneGeometry, RepeatWrapping } from "three"; +import { DoubleSide, NoColorSpace, PlaneGeometry, RepeatWrapping } from "three"; import { textureToUrl } from "../loaders"; import type { TorqueObject } from "../torqueScript"; import { getPosition, getProperty, getRotation, getScale } from "../mission"; @@ -67,6 +67,10 @@ export function WaterSurfaceMaterial({ const texArray = Array.isArray(textures) ? textures : [textures]; texArray.forEach((tex) => { setupColor(tex); + // Use NoColorSpace for water textures - our custom ShaderMaterial + // outputs values that are already in the correct space for display. + // Using SRGBColorSpace would cause double-conversion. + tex.colorSpace = NoColorSpace; tex.wrapS = RepeatWrapping; tex.wrapT = RepeatWrapping; }); diff --git a/src/fogShader.ts b/src/fogShader.ts new file mode 100644 index 00000000..a2eccbd7 --- /dev/null +++ b/src/fogShader.ts @@ -0,0 +1,322 @@ +/** + * Custom fog shader code for Tribes 2-style fog rendering. + * + * Based on the V12/Torque engine fog system used in Tribes 2 (circa 2001). + * See Tribes2_Fog_System.md for complete documentation. + * + * Implements: + * - Quadratic distance-based haze (Torque's getHaze formula) + * - Height-based fog volumes with ray-marching accumulation + * + * Key insight from Torque source: Fog volumes ADD fog based on distance + * traveled through each volume, they don't replace the global fog parameters. + */ + +import { ShaderChunk } from "three"; + +/** + * Fog uniform declarations for fragment shaders. + * Add this to the top of fragment shaders that need fog. + */ +export const fogUniformsDeclaration = ` +#ifdef USE_FOG + uniform vec3 fogColor; + uniform float fogNear; + uniform float fogFar; + + // Volumetric fog: 3 volumes, 4 floats each + // [visDist, minHeight, maxHeight, percentage] + // Note: Per-volume colors not used ($specialFog = false), all fog uses fogColor + uniform float fogVolumeData[12]; + uniform float cameraHeight; + uniform bool hasVolumetricFog; +#endif +`; + +/** + * Custom fog fragment shader that implements Torque's fog system. + * Replaces Three.js default fog_fragment chunk. + * + * Torque fog algorithm (from sceneState.cc getHazeAndFog): + * + * 1. HAZE (distance-based): + * - No fog if dist <= fogDistance + * - Full fog if dist > visibleDistance + * - Otherwise: quadratic curve using formula: + * distFactor = (dist - fogDistance) * fogScale - 1.0 + * haze = 1.0 - distFactor * distFactor + * where fogScale = 1.0 / (visibleDistance - fogDistance) + * + * 2. FOG VOLUMES (height-based): + * - Each volume has a fog factor = (1 / visibleDistance) * percentage + * - Ray-march from camera to fragment, accumulating fog through each volume + * - Use similar triangles: subDist = dist * (heightInVolume / totalDeltaZ) + * - Fog contribution = subDist * factor + * - Sum all volume contributions + * + * 3. Final fog = clamp(haze + volumeFog, 0, 1) + */ +export const fogFragmentShader = ` +#ifdef USE_FOG + float dist = vFogDepth; + + // Discard fragments at or beyond visible distance - matches Torque's behavior + // where objects beyond visibleDistance are not rendered at all. + // This prevents fully-fogged geometry from showing as silhouettes against + // the sky's fog-to-sky gradient. + if (dist >= fogFar) { + discard; + } + + // Step 1: Calculate distance-based haze (quadratic falloff) + // Since we discard at fogFar, haze never reaches 1.0 here + float haze = 0.0; + if (dist > fogNear) { + float fogScale = 1.0 / (fogFar - fogNear); + float distFactor = (dist - fogNear) * fogScale - 1.0; + haze = 1.0 - distFactor * distFactor; + } + + // Step 2: Calculate fog volume contributions + // Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false) + // All fog uses the global fogColor - see Tribes2_Fog_System.md for details + float volumeFog = 0.0; + + #ifdef USE_VOLUMETRIC_FOG + { + #ifdef USE_FOG_WORLD_POSITION + float fragmentHeight = vFogWorldPosition.y; + #else + float fragmentHeight = cameraHeight; + #endif + + float deltaY = fragmentHeight - cameraHeight; + float absDeltaY = abs(deltaY); + + // Determine if we're going up (positive) or down (negative) + if (absDeltaY > 0.01) { + // Non-horizontal ray: ray-march through fog volumes + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + // Skip inactive volumes (visibleDistance = 0) + if (volVisDist <= 0.0) continue; + + // Calculate fog factor for this volume + // From Torque: factor = (1 / (volumeVisDist * visFactor)) * percentage + // where visFactor is smVisibleDistanceMod (a user quality pref, default 1.0) + // Since we don't have quality settings, we use visFactor = 1.0 + float factor = (1.0 / volVisDist) * volPct; + + // Find ray intersection with this volume's height range + float rayMinY = min(cameraHeight, fragmentHeight); + float rayMaxY = max(cameraHeight, fragmentHeight); + + // Check if ray intersects volume height range + if (rayMinY < volMaxH && rayMaxY > volMinH) { + float intersectMin = max(rayMinY, volMinH); + float intersectMax = min(rayMaxY, volMaxH); + float intersectHeight = intersectMax - intersectMin; + + // Calculate distance traveled through this volume using similar triangles: + // subDist / dist = intersectHeight / absDeltaY + float subDist = dist * (intersectHeight / absDeltaY); + + // Accumulate fog: fog += subDist * factor + volumeFog += subDist * factor; + } + } + } else { + // Near-horizontal ray: if camera is inside a volume, apply full fog for that volume + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + if (volVisDist <= 0.0) continue; + + // If camera is inside this volume, apply fog for full distance + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + float factor = (1.0 / volVisDist) * volPct; + volumeFog += dist * factor; + } + } + } + } + #endif + + // Step 3: Combine haze and volume fog + // Torque's clamping: if (bandPct + hazePct > 1) hazePct = 1 - bandPct + // This gives fog volumes priority over haze + float volPct = min(volumeFog, 1.0); + float hazePct = haze; + if (volPct + hazePct > 1.0) { + hazePct = 1.0 - volPct; + } + float fogFactor = hazePct + volPct; + + // Apply fog using global fogColor (per-volume colors not used in Tribes 2) + gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor); +#endif +`; + +/** + * Vertex shader code to pass world position for fog calculation. + */ +export const fogVertexShader = ` +#ifdef USE_FOG + #define USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; +#endif +`; + +export const fogVertexShaderWorldPos = ` +#ifdef USE_FOG + vFogWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz; +#endif +`; + +/** + * Install custom fog shaders globally. + * Call this once at app startup to replace Three.js default fog. + */ +export function installCustomFogShader(): void { + // Note: This modifies global shader chunks, affecting all materials + // For more control, use onBeforeCompile on individual materials + + ShaderChunk.fog_pars_fragment = ` +#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif + + // Custom volumetric fog uniforms (only defined when USE_VOLUMETRIC_FOG is set) + // Format: [visDist, minH, maxH, percentage] x 3 volumes = 12 floats + #ifdef USE_VOLUMETRIC_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + #endif + + #ifdef USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif +#endif +`; + + ShaderChunk.fog_fragment = fogFragmentShader; + + // Add world position output to vertex shader + ShaderChunk.fog_pars_vertex = ` +#ifdef USE_FOG + varying float vFogDepth; + #ifdef USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif +#endif +`; + + ShaderChunk.fog_vertex = ` +#ifdef USE_FOG + // Use Euclidean distance from camera, not view-space z-depth + // This ensures fog doesn't change when rotating the camera + vFogDepth = length(mvPosition.xyz); + #ifdef USE_FOG_WORLD_POSITION + vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; + #endif +#endif +`; +} + +/** + * Shared fog shader uniform objects interface. + * These objects are passed directly to shaders so uniform values can be updated per-frame. + */ +export interface FogShaderUniformObjects { + fogVolumeData: { value: Float32Array }; + cameraHeight: { value: number }; +} + +/** + * Add fog uniforms to a shader via onBeforeCompile. + * Use this for materials that need custom fog without modifying global chunks. + * + * @param shader - The shader object from onBeforeCompile + * @param fogUniforms - Shared uniform objects (pass the objects, not values) + */ +export function addFogUniformsToShader( + shader: { uniforms: Record }, + fogUniforms: FogShaderUniformObjects, +): void { + // Pass the uniform objects directly so they stay linked to FogProvider updates + shader.uniforms.fogVolumeData = fogUniforms.fogVolumeData; + shader.uniforms.cameraHeight = fogUniforms.cameraHeight; +} + +/** + * Inject custom fog code into a material's shader. + * Call this in material's onBeforeCompile callback. + * This enables full volumetric fog support for the material. + * + * @param shader - The shader object from onBeforeCompile + * @param fogUniforms - Shared uniform objects from globalFogUniforms + */ +export function injectCustomFog( + shader: { + uniforms: Record; + vertexShader: string; + fragmentShader: string; + }, + fogUniforms: FogShaderUniformObjects, +): void { + // Add uniforms - pass objects directly so they stay linked + addFogUniformsToShader(shader, fogUniforms); + + // Add world position varying to vertex shader + shader.vertexShader = shader.vertexShader.replace( + "#include ", + `#include +#ifdef USE_FOG + #define USE_FOG_WORLD_POSITION + #define USE_VOLUMETRIC_FOG + varying vec3 vFogWorldPosition; +#endif`, + ); + + shader.vertexShader = shader.vertexShader.replace( + "#include ", + `#include +#ifdef USE_FOG + vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; +#endif`, + ); + + // Add volumetric fog uniforms to fragment shader + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + `#include +#ifdef USE_FOG + #define USE_VOLUMETRIC_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + #define USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; +#endif`, + ); + + // Replace fog fragment with custom implementation + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + fogFragmentShader, + ); +} diff --git a/src/forceFieldMaterial.ts b/src/forceFieldMaterial.ts index 6d0f7827..33e35826 100644 --- a/src/forceFieldMaterial.ts +++ b/src/forceFieldMaterial.ts @@ -22,9 +22,10 @@ import { Vector2, } from "three"; -// Opacity multiplier to compensate for DoubleSide rendering both front and back faces. -// In Tribes 2, back faces were often occluded by surrounding geometry (door frames, walls). -export const OPACITY_FACTOR = 0.5; +// Opacity multiplier - set to 1.0 to match Tribes 2's baseTranslucency directly. +// Previously 0.5 to compensate for DoubleSide, but this made force fields too dim. +// Tribes 2 used the full baseTranslucency value even though back faces could render. +export const OPACITY_FACTOR = 1.0; // Vertex shader const vertexShader = ` @@ -78,13 +79,10 @@ void main() { } // Tribes 2 GL_MODULATE: output = texture * vertexColor + // No gamma correction - textures use NoColorSpace and values pass through + // directly to display, matching how WaterBlock handles sRGB textures. vec3 modulatedColor = texColor.rgb * tintColor; - // Gamma correction: T2 textures were authored for CRT displays (~2.2 gamma). - // Converting to linear space makes them appear as they did on those displays. - // This significantly darkens the colors to match the original look. - modulatedColor = pow(modulatedColor, vec3(2.2)); - float adjustedOpacity = opacity * opacityFactor; gl_FragColor = vec4(modulatedColor, adjustedOpacity); @@ -92,12 +90,19 @@ void main() { // Custom fog for additive blending: fade out rather than blend to fog color. // Standard fog (mix toward fogColor) doesn't work with additive blending // because we'd still be adding fogColor to the framebuffer. + // Uses Torque's quadratic haze formula for consistency. #ifdef USE_FOG - #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp(-fogDensity * fogDensity * vFogDepth * vFogDepth); - #else - float fogFactor = smoothstep(fogNear, fogFar, vFogDepth); - #endif + float dist = vFogDepth; + float fogFactor = 0.0; + if (dist > fogNear) { + if (dist >= fogFar) { + fogFactor = 1.0; + } else { + float fogScale = 1.0 / (fogFar - fogNear); + float distFactor = (dist - fogNear) * fogScale - 1.0; + fogFactor = 1.0 - distFactor * distFactor; + } + } gl_FragColor.a *= 1.0 - fogFactor; #endif } diff --git a/src/globalFogUniforms.ts b/src/globalFogUniforms.ts new file mode 100644 index 00000000..ff9d664c --- /dev/null +++ b/src/globalFogUniforms.ts @@ -0,0 +1,79 @@ +/** + * Global fog shader uniforms that can be shared across all materials. + * + * This module provides a singleton set of fog uniforms that: + * 1. Sky component updates each frame with camera height and fog volume data + * 2. Materials reference directly via import (avoiding React context issues) + * + * The uniform objects themselves are stable - only their .value properties change. + * This allows Three.js materials to reference them once and get automatic updates. + */ + +const MAX_FOG_VOLUMES = 3; +/** Floats per fog volume: [visDist, minH, maxH, percentage] */ +const FLOATS_PER_VOLUME = 4; + +/** + * Shared fog shader uniform objects. + * Materials should import and use these directly in onBeforeCompile. + */ +export const globalFogUniforms = { + fogVolumeData: { + value: new Float32Array(MAX_FOG_VOLUMES * FLOATS_PER_VOLUME), + }, + cameraHeight: { value: 0 }, +}; + +/** + * Update the global fog uniforms with new values. + * Called by Sky component each frame. + */ +export function updateGlobalFogUniforms( + cameraHeight: number, + fogVolumeData: Float32Array, +): void { + globalFogUniforms.cameraHeight.value = cameraHeight; + globalFogUniforms.fogVolumeData.value.set(fogVolumeData); +} + +/** + * Reset global fog uniforms to default values. + * Called when Sky unmounts to clean up fog state for next mission. + */ +export function resetGlobalFogUniforms(): void { + globalFogUniforms.cameraHeight.value = 0; + globalFogUniforms.fogVolumeData.value.fill(0); +} + +/** + * Pack fog volume data into a flat array for shaders. + * Format: [visDist, minH, maxH, percentage] x 3 = 12 floats + * + * Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false). + * All fog uses the global fogColor, so we don't pack color data. + */ +export function packFogVolumeData( + fogVolumes: Array<{ + visibleDistance: number; + minHeight: number; + maxHeight: number; + percentage: number; + }>, +): Float32Array { + const data = new Float32Array(MAX_FOG_VOLUMES * FLOATS_PER_VOLUME); + + for (let i = 0; i < MAX_FOG_VOLUMES; i++) { + const offset = i * FLOATS_PER_VOLUME; + const vol = fogVolumes[i]; + + if (vol) { + data[offset + 0] = vol.visibleDistance; + data[offset + 1] = vol.minHeight; + data[offset + 2] = vol.maxHeight; + data[offset + 3] = vol.percentage; + } + // Inactive volumes default to 0 (Float32Array is zero-initialized) + } + + return data; +} diff --git a/src/interiorMaterial.ts b/src/interiorMaterial.ts new file mode 100644 index 00000000..3e7be53f --- /dev/null +++ b/src/interiorMaterial.ts @@ -0,0 +1,37 @@ +/** + * Interior material shader modifications. + * Injects per-object-type lighting multipliers into MeshLambertMaterial. + */ + +import { INTERIOR_LIGHTING } from "./lightingConfig"; + +/** + * Inject lighting multipliers into a MeshLambertMaterial shader. + * Call this from onBeforeCompile after other shader modifications (e.g., fog). + */ +export function injectInteriorLighting(shader: any): void { + // Add lighting multiplier uniforms + shader.uniforms.interiorDirectionalFactor = { + value: INTERIOR_LIGHTING.directional, + }; + shader.uniforms.interiorAmbientFactor = { value: INTERIOR_LIGHTING.ambient }; + + // Declare uniforms in fragment shader + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + `#include +uniform float interiorDirectionalFactor; +uniform float interiorAmbientFactor; +`, + ); + + // Scale directional light contribution + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + `#include + // Apply interior-specific lighting multipliers + reflectedLight.directDiffuse *= interiorDirectionalFactor; + reflectedLight.indirectDiffuse *= interiorAmbientFactor; +`, + ); +} diff --git a/src/lightingConfig.ts b/src/lightingConfig.ts new file mode 100644 index 00000000..d5379aad --- /dev/null +++ b/src/lightingConfig.ts @@ -0,0 +1,33 @@ +/** + * Per-object-type lighting intensity multipliers. + * + * These allow fine-tuning of directional and ambient light contributions + * for each object type to match Tribes 2's original appearance. + * + * The Torque engine uses distinctly different lighting systems for each object type: + * - Terrain: Pre-baked lightmaps with directional sun dot-product calculation + * - Interiors: Vertex colors or lightmaps with animated light states + * - DTS Shapes: OpenGL hardware lighting with per-material flags + * + * Values are multipliers applied to the global Sun intensity (which is set to 1.0/1.0): + * - directional: Multiplier for directional (sun) light contribution + * - ambient: Multiplier for ambient light contribution (affects shadow darkness) + */ + +export const TERRAIN_LIGHTING = { + directional: 4, + ambient: 1.5, +}; + +export const INTERIOR_LIGHTING = { + directional: 3, + ambient: 1, +}; + +export const SHAPE_LIGHTING = { + directional: 1, + ambient: 1.5, +}; + +// Note: Water does not use lighting - Tribes 2's Phase 2 (lightmap) is disabled. +// Water textures are rendered directly without scene lighting. diff --git a/src/shapeMaterial.ts b/src/shapeMaterial.ts index a3460603..02f10891 100644 --- a/src/shapeMaterial.ts +++ b/src/shapeMaterial.ts @@ -1,3 +1,7 @@ +/** + * Shape material utilities and shader modifications. + */ + import { MeshStandardMaterial, Texture, @@ -6,6 +10,38 @@ import { LinearMipmapLinearFilter, SRGBColorSpace, } from "three"; +import { SHAPE_LIGHTING } from "./lightingConfig"; + +/** + * Inject lighting multipliers into a MeshLambertMaterial or MeshBasicMaterial shader. + * Call this from onBeforeCompile after other shader modifications (e.g., fog). + */ +export function injectShapeLighting(shader: any): void { + // Add lighting multiplier uniforms + shader.uniforms.shapeDirectionalFactor = { + value: SHAPE_LIGHTING.directional, + }; + shader.uniforms.shapeAmbientFactor = { value: SHAPE_LIGHTING.ambient }; + + // Declare uniforms in fragment shader + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + `#include +uniform float shapeDirectionalFactor; +uniform float shapeAmbientFactor; +`, + ); + + // Scale directional and ambient light contributions + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + `#include + // Apply shape-specific lighting multipliers + reflectedLight.directDiffuse *= shapeDirectionalFactor; + reflectedLight.indirectDiffuse *= shapeAmbientFactor; +`, + ); +} // Shared shader modification function to avoid duplication const alphaAsRoughnessShaderModifier = (shader: any) => { diff --git a/src/terrainMaterial.ts b/src/terrainMaterial.ts index 8410010e..34523709 100644 --- a/src/terrainMaterial.ts +++ b/src/terrainMaterial.ts @@ -3,6 +3,15 @@ * Handles multi-layer texture blending for Tribes 2 terrain rendering. */ +import { TERRAIN_LIGHTING } from "./lightingConfig"; + +// Terrain and texture dimensions (must match TerrainBlock.tsx constants) +const TERRAIN_SIZE = 256; // Terrain grid size in squares +const LIGHTMAP_SIZE = 512; // Lightmap texture size (2 pixels per terrain square) + +// Texture brightness scale to prevent clipping and preserve shadow visibility +const TEXTURE_BRIGHTNESS_SCALE = 0.7; + // Detail texture tiling factor. // Torque uses world-space generation: U = worldX * (62.0 / textureWidth) // For 256px texture across 2048 world units, this gives ~496 repeats mathematically. @@ -24,6 +33,7 @@ export function updateTerrainTextureShader({ tiling, debugMode = false, detailTexture = null, + lightmap = null, }: { shader: any; baseTextures: any[]; @@ -32,9 +42,16 @@ export function updateTerrainTextureShader({ tiling: Record; debugMode?: boolean; detailTexture?: any; + lightmap?: any; }) { const layerCount = baseTextures.length; + // Add terrain lighting multiplier uniforms + shader.uniforms.terrainDirectionalFactor = { + value: TERRAIN_LIGHTING.directional, + }; + shader.uniforms.terrainAmbientFactor = { value: TERRAIN_LIGHTING.ambient }; + baseTextures.forEach((tex, i) => { shader.uniforms[`albedo${i}`] = { value: tex }; }); @@ -60,6 +77,11 @@ export function updateTerrainTextureShader({ // Add debug mode uniform shader.uniforms.debugMode = { value: debugMode ? 1.0 : 0.0 }; + // Add lightmap uniform for smooth per-pixel terrain lighting + if (lightmap) { + shader.uniforms.terrainLightmap = { value: lightmap }; + } + // Add detail texture uniforms if (detailTexture) { shader.uniforms.detailTexture = { value: detailTexture }; @@ -82,6 +104,8 @@ vTerrainWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;`, // Declare our uniforms at the top of the fragment shader shader.fragmentShader = ` +uniform float terrainDirectionalFactor; +uniform float terrainAmbientFactor; uniform sampler2D albedo0; uniform sampler2D albedo1; uniform sampler2D albedo2; @@ -101,6 +125,7 @@ uniform float tiling4; uniform float tiling5; uniform float debugMode; ${visibilityMask ? "uniform sampler2D visibilityMask;" : ""} +${lightmap ? "uniform sampler2D terrainLightmap;" : ""} ${ detailTexture ? `uniform sampler2D detailTexture; @@ -169,11 +194,14 @@ float getWireframe(vec2 uv, float gridSize, float lineWidth) { } // Sample linear masks (use R channel) - float a1 = texture2D(mask1, baseUv).r; - ${layerCount > 1 ? `float a2 = texture2D(mask2, baseUv).r;` : ""} - ${layerCount > 2 ? `float a3 = texture2D(mask3, baseUv).r;` : ""} - ${layerCount > 3 ? `float a4 = texture2D(mask4, baseUv).r;` : ""} - ${layerCount > 4 ? `float a5 = texture2D(mask5, baseUv).r;` : ""} + // Add +0.5 texel offset: Torque samples alpha at grid corners (integer indices), + // but GPU linear filtering samples at texel centers. This offset aligns them. + vec2 alphaUv = baseUv + vec2(0.5 / ${TERRAIN_SIZE}.0); + float a1 = texture2D(mask1, alphaUv).r; + ${layerCount > 1 ? `float a2 = texture2D(mask2, alphaUv).r;` : ""} + ${layerCount > 2 ? `float a3 = texture2D(mask3, alphaUv).r;` : ""} + ${layerCount > 3 ? `float a4 = texture2D(mask4, alphaUv).r;` : ""} + ${layerCount > 4 ? `float a5 = texture2D(mask5, alphaUv).r;` : ""} // Bottom-up compositing: each mask tells how much the higher layer replaces lower ${layerCount > 1 ? `vec3 blended = mix(c0, c1, clamp(a1, 0.0, 1.0));` : ""} @@ -203,25 +231,83 @@ float getWireframe(vec2 uv, float gridSize, float lineWidth) { : "" } - // Debug mode wireframe handling + // Apply texture color or debug mode solid gray if (debugMode > 0.5) { - // 256 grid cells across the terrain (matches terrain resolution) - float wireframe = getWireframe(baseUv, 256.0, 1.0); - vec3 wireColor = vec3(0.0, 0.8, 0.4); // Green wireframe - - if (gl_FrontFacing) { - // Front face: show textures with barely visible wireframe overlay - diffuseColor.rgb = mix(textureColor, wireColor, wireframe * 0.05); - } else { - // Back face: show only wireframe, discard non-wireframe pixels - if (wireframe < 0.1) { - discard; - } - diffuseColor.rgb = mix(vec3(0.0), wireColor, 0.25); - } + // Solid gray to visualize lighting only (without texture influence) + diffuseColor.rgb = vec3(0.5); } else { - diffuseColor.rgb = textureColor; + // Scale texture to prevent clipping, preserving shadow visibility + diffuseColor.rgb = textureColor * ${TEXTURE_BRIGHTNESS_SCALE}; } +`, + ); + + // When lightmap is available, replace vertex normal-based lighting with smooth lightmap + // This eliminates banding by using pre-computed per-pixel NdotL values + if (lightmap) { + // Override the RE_Direct_Lambert function to use our lightmap NdotL + // instead of computing dotNL from vertex normals + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + `#include + +// Override RE_Direct to use terrain lightmap for smooth NdotL +#undef RE_Direct +void RE_Direct_TerrainLightmap( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + + // Sample pre-computed terrain lightmap (smooth NdotL values) + // Add +0.5 texel offset to align GPU texel-center sampling with Torque's corner sampling + vec2 lightmapUv = vMapUv + vec2(0.5 / ${LIGHTMAP_SIZE}.0); + float lightmapNdotL = texture2D(terrainLightmap, lightmapUv).r; + + // Use lightmap NdotL instead of dot(geometryNormal, directLight.direction) + // directLight.color already has shadow factor applied from getShadow() + // Apply terrain-specific directional intensity multiplier + vec3 directIrradiance = lightmapNdotL * directLight.color * terrainDirectionalFactor; + + // Debug mode: visualize raw lightmap values (no textures) + if (debugMode > 0.5) { + reflectedLight.directDiffuse = directIrradiance; + } else { + reflectedLight.directDiffuse += directIrradiance * BRDF_Lambert( material.diffuseColor ); + } +} +#define RE_Direct RE_Direct_TerrainLightmap + +`, + ); + + // Override lights_fragment_begin to fix hemisphere light irradiance calculation + // The default uses geometryNormal which causes banding + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + `#include +// Fix: Recalculate irradiance without using vertex normals (causes banding) +// Use flat upward normal for hemisphere/light probe calculations +#if defined( RE_IndirectDiffuse ) +{ + vec3 flatNormal = vec3(0.0, 1.0, 0.0); + irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, flatNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[i], flatNormal ); + } + #endif +} +#endif +`, + ); + } + + // Scale ambient/indirect lighting to darken shadows on terrain + shader.fragmentShader = shader.fragmentShader.replace( + "#include ", + `#include + // Scale indirect (ambient) light to increase shadow contrast on terrain + reflectedLight.indirectDiffuse *= terrainAmbientFactor; `, ); } diff --git a/src/waterMaterial.ts b/src/waterMaterial.ts index bc24ce41..20d3d066 100644 --- a/src/waterMaterial.ts +++ b/src/waterMaterial.ts @@ -1,4 +1,6 @@ import { ShaderMaterial, Texture, DoubleSide, Color } from "three"; +import { globalFogUniforms } from "./globalFogUniforms"; +import { fogFragmentShader } from "./fogShader"; /** * Tribes 2 WaterBlock shader material @@ -21,6 +23,11 @@ import { ShaderMaterial, Texture, DoubleSide, Color } from "three"; const vertexShader = /* glsl */ ` #include + #ifdef USE_FOG + #define USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif + uniform float uTime; uniform float uWaveMagnitude; @@ -46,6 +53,12 @@ const vertexShader = /* glsl */ ` vec3 displaced = position; displaced.y += getWaveHeight(worldPos.xyz); + // Calculate final world position after displacement for fog + #ifdef USE_FOG + vec4 displacedWorldPos = modelMatrix * vec4(displaced, 1.0); + vFogWorldPosition = displacedWorldPos.xyz; + #endif + // Calculate view vector for environment mapping vViewVector = cameraPosition - worldPos.xyz; vDistance = length(vViewVector); @@ -53,19 +66,36 @@ const vertexShader = /* glsl */ ` vec4 mvPosition = viewMatrix * modelMatrix * vec4(displaced, 1.0); gl_Position = projectionMatrix * mvPosition; - #include + // Set fog depth (distance from camera) - normally done by fog_vertex include + // but we can't use that include because it references 'transformed' which we don't have + #ifdef USE_FOG + vFogDepth = length(mvPosition.xyz); + #endif } `; const fragmentShader = /* glsl */ ` #include + // Enable volumetric fog (must be defined before fog uniforms) + #ifdef USE_FOG + #define USE_VOLUMETRIC_FOG + #define USE_FOG_WORLD_POSITION + #endif + uniform float uTime; uniform float uOpacity; uniform float uEnvMapIntensity; uniform sampler2D uBaseTexture; uniform sampler2D uEnvMapTexture; + // Volumetric fog uniforms + #ifdef USE_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + varying vec3 vFogWorldPosition; + #endif + varying vec3 vWorldPosition; varying vec3 vViewVector; varying float vDistance; @@ -95,8 +125,6 @@ const fragmentShader = /* glsl */ ` void main() { // Calculate base texture UVs using world position (1/48 tiling) - // Note: In Three.js Y-up coordinates, the water surface is on the XZ plane - // Torque uses Z-up where the surface is XY, so we use xz here vec2 baseUV = vWorldPosition.xz * TEXTURE_SCALE; // Phase (time in radians for drift cycle) @@ -110,21 +138,14 @@ const fragmentShader = /* glsl */ ` vec2 uv1a = rotateUV(baseUV, radians(30.0)); // === Phase 1b: Second base texture pass (rotated 60 degrees total, with drift) === - // OpenGL matrix order: glRotatef(60) then glTranslatef(drift) means - // the transform is R60 * T, so when applied to UV: R60 * (UV + drift) - // Translation is applied first, then rotation. vec2 uv1b = rotateUV(baseUV + vec2(baseDriftX, baseDriftY), radians(60.0)); // Calculate cross-fade swing value - // From engine: A1 = cos((X/Q1 + time/Q2) * 6.0), A2 = sin((Y/Q1 + time/Q2) * 6.28) - // Using xz for Three.js Y-up coordinate system float A1 = cos(((vWorldPosition.x / Q1) + (uTime / Q2)) * 6.0); float A2 = sin(((vWorldPosition.z / Q1) + (uTime / Q2)) * TWO_PI); float swing = (A1 + A2) * 0.15 + 0.5; // Cross-fade alpha calculation from engine - // alpha1a = ((1-swing) * opacity) / (1 - (swing * opacity)) - // alpha1b = swing * opacity float alpha1a = ((1.0 - swing) * uOpacity) / max(1.0 - (swing * uOpacity), 0.001); float alpha1b = swing * uOpacity; @@ -132,53 +153,38 @@ const fragmentShader = /* glsl */ ` vec4 texColor1a = texture2D(uBaseTexture, uv1a); vec4 texColor1b = texture2D(uBaseTexture, uv1b); - // Simulate multi-pass alpha accumulation (screen blend formula) - // Pass 1a: framebuffer = tex1a * alpha1a + bg * (1 - alpha1a) - // Pass 1b: framebuffer = tex1b * alpha1b + prev * (1 - alpha1b) - // Combined alpha = 1 - (1 - alpha1a) * (1 - alpha1b) + // Combined alpha and color float combinedAlpha = 1.0 - (1.0 - alpha1a) * (1.0 - alpha1b); - - // Combined color (premultiplied then divided by combined alpha) - // color = tex1b * alpha1b + tex1a * alpha1a * (1 - alpha1b) vec3 baseColor = (texColor1a.rgb * alpha1a * (1.0 - alpha1b) + texColor1b.rgb * alpha1b) / max(combinedAlpha, 0.001); // === Phase 3: Environment map / specular === - // Reflection UV calculation from engine (fluidQuadTree.cc lines 910-962) - // Engine uses eye-to-point vector (point - eye), unnormalized. - // vViewVector is camera - worldPos (point-to-eye), so we negate it. - // Torque Z-up maps XY to UV; Three.js Y-up maps XZ to UV. vec3 reflectVec = -vViewVector; - reflectVec.y = abs(reflectVec.y); // Y is vertical in Three.js (was Z in Torque) + reflectVec.y = abs(reflectVec.y); if (reflectVec.y < 0.001) reflectVec.y = 0.001; vec2 envUV; if (vDistance < 0.001) { envUV = vec2(0.0); } else { - // Standard UV reflection mapping with adjustment to reduce edge emphasis float value = (vDistance - reflectVec.y) / (vDistance * vDistance); envUV.x = reflectVec.x * value; - envUV.y = reflectVec.z * value; // Z maps to V in Three.js Y-up + envUV.y = reflectVec.z * value; } - // Convert from [-1,1] to [0,1] envUV = envUV * 0.5 + 0.5; - - // Add time-based wobble to environment map envUV.x += A1 * Q3; envUV.y += A2 * Q3; vec4 envColor = texture2D(uEnvMapTexture, envUV); - - // Blend environment map additively (GL_SRC_ALPHA, GL_ONE in original engine) - // Engine uses GL_MODULATE with color (1,1,1,envMapIntensity), so texture alpha - // is multiplied with intensity before additive blend. vec3 finalColor = baseColor + envColor.rgb * envColor.a * uEnvMapIntensity; + // Note: Tribes 2 water does NOT use lighting - Phase 2 (lightmap) is disabled + // in the original engine. Water colors come directly from textures. + gl_FragColor = vec4(finalColor, combinedAlpha); - // Apply scene fog (integrated with Three.js fog system) - #include + // Apply volumetric fog using shared Torque-style fog shader + ${fogFragmentShader} } `; @@ -201,6 +207,9 @@ export function createWaterMaterial(options?: { fogColor: { value: new Color() }, fogNear: { value: 1 }, fogFar: { value: 2000 }, + // Volumetric fog uniforms (shared with global fog system) + fogVolumeData: globalFogUniforms.fogVolumeData, + cameraHeight: globalFogUniforms.cameraHeight, }, vertexShader, fragmentShader,