• 01 - Games
  • 02 - Creative Instruments & Explorers
  • 03 - Language, Signals & Text
  • 04 - Developer & Web Utilities
  • 05 - Generators & Data
  • 06 - Colour Theory
  • 07 - Music 26
  • 08 - 3D, Shaders & Visuals
ARCHIVE

ASTEROID FIELD - INTERACTIVE GAME SOURCE CODE

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Asteroid Field</title>
  <meta name="description" content="A 3D arcade space shooter: break the belt, survive the core.">
  <meta name="theme-color" content="#030308">
  <style>@font-face{font-family:Chakra Petch;font-style:normal;font-display:swap;font-weight:500;src:url(data:font/woff2;base64,d09GMgABAAAAACbkAA4AAAAAYAwAACaLAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGngbu2QchHgGYACFJBEICt4wxggLg3oAATYCJAOHcAQgBYQmB4Z/G/ZQRQdi2DgA7YG/EEYi8jgQFxdGUb0ZL/v/lNwYwyqA1wdXkooJJg7xBDHehsOBuoX0gE8YQ0Hc1fSXEt/gA9mY+78D4WX9D4ZckmtaEDfJTSKqKkdo7JNcHv6b+7xvkmy2BJKRJMiyq+qpqrDACoVEB/iFKtIcT9v6ebvLwtIi5ikuYGCCgIqIgXUKaF95FibeWadg9EW1XkRy0fmjQvjn/4B5333vp4EEESRJYANqg6TOCWwMA53ZdP/ncc4enegxYOLMmFiR0glwtxrSFmjTpIVK0p9iZTAoopuzg86cYncwZ1oGkwZmlkylnHlvbEwUnugH3dv9dzNGoQhaVxUhSYK5hCyLUW/b/v0HX/0w5+cb2S68kRfwcA20fA0U7g14pHGi3fizs00RDvf7VVIRi4FI/qXRyOJD/Qr2bciQlSsrV56tfOHKIVeG6FD1kbFCcEr2eP+u/M8BAEu3STEllmkJBIxG2+a+e3j+X/ff2rfncNbk4Xf96kOV8SBaNHPB6ykarIQ+5OXL4RDEM8Hs4sE1I6sHqmkRLxoxr0SbxqSpZgH/5Mrp7OO6fhXCIuMEyncalb51VZmVqA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jYf1pWyvPqane+1GXGrZJI1aV3qbwHGLu9NPbHd5GJV6H2j7Irbpfmdp7y6nKMWFOhNd9GSXu/4x8Doliy6Zp58ml0vYSaobSAXtY0tkAAA==) format("woff")}@font-face{font-family:Chakra Petch;font-style:normal;font-display:swap;font-weight:600;src:url(data:font/woff2;base64,d09GMgABAAAAACbwAA4AAAAAX+wAACaZAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGngbu0AchHgGYACFJBEICt4oxh8Lg3oAATYCJAOHcAQgBYQyB4Z/G/VQRUaGjQNAAr7+NRJhSjWjiGpSItn/p+QOEbMK9hsikia4UqlhI2EMVWzsU9uyFUiSW6svhG3id81LxUGnzs8cIh7ExPEaHA7hGHRI4JIjNPZJLs8H+/V67rzdvwEEFS6SY2Kjolu2gI5A2Kjy/Dw/tz/31SIZo+aYb9Hk6DGiRpWJSOToNLJAsZsyCv3Z/CjsIkoWteruubcn7CuBwaAMIcEZpERYnCNBsT/Pb/PPsNYug7kolliBlIBg0sPBqysY8B48ec6FtYnLYJEFi3ab2993Vb/S+BVqc6PC5gik/u+wKco/xY3ebhNbBFGUpnYAfD/9+w90qPrIWCE4JXu8f5cv77R6+sCFJ7iUy2hPdT3YE9oLDtKXbXbNZLwxF0Vx/zvWHo3SucQjJEIj4ZVH5F3oNNEkPkzPVrCzIStDhuzCR1ZWzj7ykZUhULXLLLDAAoAEA0lh5357eP5/rdL23T/vTFX4h7iWO4DC5O+qOBIGZeKLunve/KkA91aIarmWsYOoIhT7nNMhAh2FjoXPiVERwkQG/v+b/s/+ZENXly4s8hmBRKL8y8y8DJPzQ+kh0FWt7rV8SikeI1moVhQaxV/Tb3ZDbYpz4E5+KzBi8zZtd7O/1lxPriZX8+86tSkGxTkkkkEltFocg8Od0ggj8WNvLt9QoQfRwNs6ieQonVD2+F93e/0u+sbXWEUepUgRCUFCToJIEG+cNlVnWtyxEbIIkOAQcxzEBjNm8+oa70mALQCzIGPYMKBgIFgM6sdDMELcxXubaIrNUmrL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GSXu/4x8Doliy6Zp58ml0vYSaobSAXtY0tkAAA==) format("woff")}@font-face{font-family:Chakra Petch;font-style:normal;font-display:swap;font-weight:700;src:url(data:font/woff2;base64,d09GMgABAAAAACasAA4AAAAAX/AAACZVAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGngbu1QchHgGYACFJBEICt4gxh8Lg3oAATYCJAOHcAQgBYQsB4Z/GwNRMwPBxgGgAF8+m42oYeMgPBpcHxWlVDPP/usEbgy5PZiaXCUpIVhNG42b9ioti3wXQ8ErLcq5+F3fU8c/jU/XJ5GF5gxsG/mTnLwE9fv1fs/c3ewLECuWACCZFACrVBSxS8XBJ6E+OwI6P/Bu6/3PZ+vGmSJ+B2pOHDNFxY1irlwDcaBCgOLOlAhtWVvtyuaVLdsW1Nm2zuatbljeNk/RxroVFP3Bb2/vXtTMB/0ESRIm0gSCgWaW9vj/j3v4rXPf/zNNUlCQaMBpElAUfcyaiUPMbad//4Hf95tftxpYuQVjfv4jq9+QZOXXItVdJLwJz8moq+j0EUY1Cpg93r+XY3pzM75uN6GALKHc+QpZPdLAGWHpB1SKSa8Xk0EqYmIySHf35gcxhV2ppi1O+NMQyvh3SlTkV6aKzrBzl9oQS7sHFvFwwDNrxKfCZxN8B4LhE61AOlGUw0vOsYyJr4h3DKHLRa9RU7koGpfm+e+XzpJ/aO2hMDbebVHJVQxqJw4UsjQhsZZBle73TZtNKM8P1WKRMQKJRPnLn83uTeaWWhSqdZ3CUqs7hTPIk2gUPHwtnX6h6Tp+cXEgJMph5CX9313GL2X8DqpUiY9QGIHwragYjTGxWquarHKl7RsyXLwACSyNeXx2ffVd6tkjriIXKMuinFWlMIK/A9xtWeUB+grYBJEhhBBEikIKkUKkEOfYXcbmu3kUleZQ7l+SAIYAtIKYRYMCCQXCo5DX1hBmKYSXJIgUuRD5qiBq1ENItEG064C685wdcdc9iEkeMesQzJl/8oteb9gI0EKaPQjTPvhZEPBWpmgA59/VZTXAgAHKv0IRUaoHR2DIvw1USKj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TD1Gs057zimieMaFBntX+P/NLjJCjaHfjtbgy7qrHDsehbihfTM1osLU5IitvGXtgpA9K0Dztjbd/p6sb9BK1HFhebuIkTlRplnxRu1fXq1Fxvo6neZjV6pQItW1RrAAAAeNpswQPMEAoYAMD7/mzbxrNtZNu2bS3bTdm2bduet+wa4szuJADvN/nax7whEiRIpLBjjmhqlWZWm6SIopor5q7iWjjquBNKKOkTnzrplNPO+MznvohEvvSVlr521jmtXDDZGmt946Fvfed7P/jRRZe0dtlPfvaLX933m3+10U57bXXUwVz/+V8npdxTWmddddNFGWWVU94V3fXUSw8VIrGKKkUSlVXRW1V99NNfX/MMsE41j1RXQ02j1VLbQIMNMUgdddVT3wPbNbDXPrPMlklmWWSVTXY55JRL7kgaySJ5pIiUkSpSR5pIG+kifWSw04vIGJm89CoyR5bIGtlkkE4eea2Q2AIFzXfASGkkldEfUkmtocZ+96f0kd16G/ztoEM22mSzLZZZbrc9kkgZOQyzS7LIabgZkUtajz2xVX4F5DNVEwv9JXnkjjwKSWGUEcYaY5yhkTfyaeRO5I8CUTAKReEoEkWjWBSPElEyPjHebVdN8I/rbvmgmyx+oT4+LD6ApufigEEgCgJo3FMLbrdoH7gE2B+8fHQipzezvi6V24pFvChpqwRF5HUBilCCMlSgBvVBnr8ZUITYpylwWi8oEpT3xDwvCsIyPJVh7iEXRz+qP/lUeLXHUKZzrw/Ir55VTuNh/WlbK8+pqd77UZcatkkjVpXepvAcYu7009sd3kYlXofaPsitul+Z2nvLqcoxYU6E130ZJe7/jHwOiWLLpmnnyaXS9hJqhtIBe1jS2QAA) format("woff")}:root{--accent: #ffaa44;--ink: #eef2ff;--ink-dim: rgba(220, 228, 255, .55);--glass: rgba(6, 8, 18, .62);--font: "Chakra Petch", system-ui, sans-serif}*{margin:0;padding:0;box-sizing:border-box}body{overflow:hidden;background:#030308;font-family:var(--font);color:var(--ink);-webkit-font-smoothing:antialiased}#game{position:absolute;inset:0;display:block;width:100vw;height:100vh}.hud{position:absolute;top:18px;z-index:10;pointer-events:none;text-shadow:0 2px 12px rgba(0,0,0,.85)}.hud-left{left:24px}.hud-right{right:24px;text-align:right}.hud-label{font-size:11px;font-weight:600;letter-spacing:.32em;color:var(--ink-dim)}.hud-label span{color:var(--accent)}.hud-score{font-size:40px;font-weight:700;line-height:1.05;letter-spacing:.04em;font-variant-numeric:tabular-nums;text-shadow:0 0 18px rgba(140,190,255,.45),0 2px 12px rgba(0,0,0,.85)}.hud-lives{display:flex;gap:6px;margin-top:8px;height:16px}.hud-lives svg{width:16px;height:16px;filter:drop-shadow(0 0 4px rgba(90,180,255,.7))}.hud-sector{font-size:20px;font-weight:600;letter-spacing:.18em;color:var(--accent);text-shadow:0 0 16px color-mix(in srgb,var(--accent) 60%,transparent),0 2px 12px rgba(0,0,0,.85);transition:color .6s ease}.controls{position:absolute;left:50%;bottom:74px;transform:translate(-50%);z-index:10;display:flex;gap:22px;padding:9px 18px;font-size:12px;letter-spacing:.08em;color:var(--ink-dim);background:var(--glass);border:1px solid rgba(255,255,255,.08);border-radius:999px;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);white-space:nowrap;transition:opacity .8s ease,transform .8s ease;pointer-events:none}.controls b{color:var(--ink);font-weight:600}.controls.hidden{opacity:0;transform:translate(-50%,10px)}.popups{position:absolute;inset:0;z-index:9;pointer-events:none;overflow:hidden}.pop{position:absolute;font-size:15px;font-weight:700;letter-spacing:.05em;transform:translate(-50%,-50%);text-shadow:0 0 10px currentColor,0 1px 3px rgba(0,0,0,.9);animation:pop .9s cubic-bezier(.2,.8,.3,1) forwards}.pop.big{font-size:19px}@keyframes pop{0%{opacity:0;transform:translate(-50%,-30%) scale(.6)}15%{opacity:1;transform:translate(-50%,-70%) scale(1.15)}to{opacity:0;transform:translate(-50%,-190%) scale(1)}}.panel{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:10;min-width:340px;padding:30px 56px 32px;text-align:center;background:var(--glass);border:1px solid color-mix(in srgb,var(--accent) 45%,transparent);border-radius:6px;box-shadow:0 0 60px color-mix(in srgb,var(--accent) 18%,transparent),0 24px 60px #0009;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);display:none}.panel.visible{display:block;animation:panelIn .45s cubic-bezier(.2,.9,.3,1.2)}.panel:before,.panel:after{content:"";position:absolute;width:14px;height:14px;border:2px solid var(--accent)}.panel:before{top:-2px;left:-2px;border-right:0;border-bottom:0}.panel:after{bottom:-2px;right:-2px;border-left:0;border-top:0}.panel-kicker{font-size:12px;font-weight:600;letter-spacing:.4em;color:var(--accent)}.panel-title{margin-top:8px;font-size:44px;font-weight:700;letter-spacing:.08em;text-shadow:0 0 28px color-mix(in srgb,var(--accent) 70%,transparent)}.panel-sub{margin-top:12px;font-size:15px;letter-spacing:.06em;color:var(--ink-dim)}.panel-sub b{color:var(--ink)}.panel-danger{--accent: #ff5a5a}@keyframes panelIn{0%{opacity:0;transform:translate(-50%,-50%) scale(.92)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}.debug{position:absolute;top:90px;right:12px;z-index:20;font:12px/1.5 ui-monospace,Menlo,monospace;color:#9fffc8;background:#0009;padding:8px 10px;border-radius:8px;white-space:pre;pointer-events:none}@media(max-width:640px){.controls{display:none}.hud-score{font-size:30px}.panel{min-width:0;width:calc(100% - 32px);padding:24px 20px}.panel-title{font-size:32px}}.panel-menu{min-width:460px;padding-bottom:22px}.panel-menu .panel-title{font-size:36px}.menu{list-style:none;margin:18px 0 10px;text-align:left}.menu-item{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:7px 12px;border-radius:3px;font-size:15px;letter-spacing:.04em;color:var(--ink-dim);cursor:pointer;border-left:2px solid transparent}.menu-item.selected{color:var(--ink);background:color-mix(in srgb,var(--accent) 14%,transparent);border-left-color:var(--accent)}.menu-item.type-action .menu-label{font-weight:600}.menu-value{display:flex;align-items:center;gap:8px}.menu-arrow{background:none;border:0;color:inherit;font:inherit;font-size:11px;padding:2px 4px;cursor:pointer;opacity:.6}.menu-item.selected .menu-arrow{opacity:1;color:var(--accent)}.menu-choice{min-width:150px;text-align:center;font-weight:600}.menu-bars{display:flex;gap:3px}.menu-bars i{width:8px;height:12px;background:#ffffff1f;border-radius:1px}.menu-bars i.on{background:var(--accent);box-shadow:0 0 6px color-mix(in srgb,var(--accent) 60%,transparent)}.menu-key{padding:2px 8px;border:1px solid rgba(255,255,255,.2);border-radius:3px;font-size:13px;font-weight:600;color:var(--ink)}.menu-key.waiting{border-color:var(--accent);color:var(--accent);animation:blink 1s steps(2) infinite}.panel-hint{font-size:11px;letter-spacing:.12em;color:var(--ink-dim)}@keyframes blink{50%{opacity:.4}}.touch,.touch-only{display:none}body.touch-on .touch{display:block}body.touch-on .touch-only{display:inline}body.touch-on .controls,body.touch-on .panel-hint{display:none}.touch{position:absolute;inset:0;z-index:11;pointer-events:none;user-select:none;-webkit-user-select:none}.touch-stick{position:absolute;left:0;bottom:0;width:50%;height:60%;pointer-events:auto;touch-action:none}.touch-stick-base,.touch-stick-knob{position:absolute;left:0;top:0;border-radius:50%;opacity:0;transition:opacity .15s}.touch-stick-base{width:120px;height:120px;margin:-60px 0 0 -60px;border:2px solid rgba(255,255,255,.25)}.touch-stick-knob{width:52px;height:52px;margin:-26px 0 0 -26px;background:color-mix(in srgb,var(--accent) 45%,transparent)}.touch.stick-active .touch-stick-base,.touch.stick-active .touch-stick-knob{opacity:1}.touch-btn{position:absolute;pointer-events:auto;touch-action:none;border-radius:50%;border:2px solid rgba(255,255,255,.25);background:#0a0e1e73;color:var(--ink);font:600 12px var(--font);letter-spacing:.12em}.touch-btn.down{background:color-mix(in srgb,var(--accent) 40%,transparent);border-color:var(--accent)}.touch-fire{right:28px;bottom:34px;width:92px;height:92px}.touch-thrust{right:136px;bottom:26px;width:70px;height:70px;font-size:10px}.touch-shield{right:26px;bottom:140px;width:64px;height:64px;font-size:9px}.touch-jump{right:116px;bottom:112px;width:58px;height:58px;font-size:9px}.touch-pause{position:absolute;top:16px;left:50%;transform:translate(-50%);pointer-events:auto;width:40px;height:40px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#0a0e1e73;color:var(--ink);font:700 13px var(--font)}@media(max-width:640px){.panel-menu{min-width:0}.menu-item{font-size:13px;padding:6px 8px}.menu-choice{min-width:0}}.hud-combo{display:flex;align-items:baseline;gap:8px;margin-top:2px;height:22px;opacity:0;transition:opacity .2s}.hud-combo.on{opacity:1}.hud-combo #comboMult{font-size:20px;font-weight:700;color:var(--accent);text-shadow:0 0 12px color-mix(in srgb,var(--accent) 70%,transparent)}.hud-combo #comboCount{font-size:11px;letter-spacing:.2em;color:var(--ink-dim)}.hud-combo i{width:60px;height:3px;background:#ffffff1f;align-self:center}.hud-combo i b{display:block;height:100%;background:var(--accent)}.hud-combo.bump #comboMult{animation:bump .35s ease-out}@keyframes bump{0%{transform:scale(1.6)}to{transform:scale(1)}}.hud-wave{margin-top:4px;font-size:12px;font-weight:600;letter-spacing:.3em;color:var(--ink-dim)}.hud-wave.boss{color:#ff6b6b;animation:blink .8s steps(2) infinite}.boss-bar{position:absolute;top:20px;left:50%;transform:translate(-50%);z-index:10;width:min(420px,50vw);text-align:center;display:none;pointer-events:none}.boss-bar.visible{display:block}.boss-name{font-size:12px;font-weight:700;letter-spacing:.4em;color:#ff8a7a;text-shadow:0 0 10px rgba(255,80,60,.7)}.boss-track{margin-top:6px;height:6px;background:#ffffff1a;border:1px solid rgba(255,120,100,.35)}.boss-track i{display:block;height:100%;background:linear-gradient(90deg,#ff3b3b,#ffae3b);transition:width .15s}.boss-bar.shielded .boss-track i{background:linear-gradient(90deg,#ff6b8a,#ffd0dc);animation:blink .4s steps(2) infinite}.status{position:absolute;left:50%;bottom:20px;transform:translate(-50%);z-index:10;display:flex;align-items:center;gap:18px;pointer-events:none}.meter{display:flex;align-items:center;gap:8px;font-size:10px;font-weight:600;letter-spacing:.25em;color:var(--ink-dim)}.meter .track{width:110px;height:6px;background:#ffffff1a;border-radius:1px;overflow:hidden}.meter .track i{display:block;height:100%;width:0}.meter-heat .track i{background:linear-gradient(90deg,#ffb347,#ff4b2b)}.meter-heat.hot span{color:#ff6b4b}.meter-heat.locked .track i{animation:blink .25s steps(2) infinite}.meter-shield .track i{background:#5ad8ff;box-shadow:0 0 8px #5ad8ff}.meter-shield.active span{color:#5ad8ff}.meter-jump .track{width:50px}.meter-jump .track i{background:#b9a6ff}.meter-jump.ready span{color:#d9ccff}.buffs{display:flex;gap:6px}.buff{padding:2px 7px;border:1px solid currentColor;border-radius:2px;font-size:10px;font-weight:700;letter-spacing:.15em}.toast{position:absolute;top:22%;left:50%;transform:translate(-50%);z-index:10;pointer-events:none;font-size:26px;font-weight:700;letter-spacing:.25em;opacity:0;white-space:nowrap;text-shadow:0 0 20px currentColor,0 2px 10px rgba(0,0,0,.9)}.toast.show{animation:toast 1.6s ease-out forwards}@keyframes toast{0%{opacity:0;transform:translate(-50%,10px) scale(.9)}12%{opacity:1;transform:translate(-50%) scale(1)}75%{opacity:1}to{opacity:0;transform:translate(-50%,-14px)}}.panel-upgrade{min-width:min(760px,94vw)}.cards{display:flex;gap:14px;margin:22px 0 14px}.card{flex:1;text-align:left;padding:16px 16px 18px;border:1px solid rgba(255,255,255,.14);border-radius:4px;background:#ffffff08;cursor:pointer;transition:transform .15s,border-color .15s,background .15s}.card.selected{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent);transform:translateY(-3px)}.card-key{font-size:11px;font-weight:700;color:var(--accent);letter-spacing:.2em}.card-name{margin-top:6px;font-size:18px;font-weight:700;letter-spacing:.04em}.card-desc{margin-top:6px;font-size:13px;line-height:1.4;color:var(--ink-dim)}.card-level{margin-top:10px;display:flex;gap:4px}.card-level i{width:14px;height:4px;background:#ffffff26}.card-level i.on{background:var(--accent)}.card-level i.next{background:color-mix(in srgb,var(--accent) 50%,transparent)}.run-stats{margin:14px auto 0;display:grid;grid-template-columns:auto auto;gap:4px 22px;width:max-content;font-size:14px;font-weight:500;letter-spacing:.06em;color:var(--ink-dim);text-align:left}.run-stats b{color:var(--ink);text-align:right;font-variant-numeric:tabular-nums}.run-stats .best{grid-column:1 / -1;text-align:center;margin-top:6px;color:var(--accent);font-weight:700;letter-spacing:.3em}body.touch-on .status{bottom:186px}@media(max-width:640px){.cards{flex-direction:column}.status{gap:10px}.meter .track{width:60px}.boss-bar{top:70px;width:70vw}}.title-screen{position:absolute;inset:0;z-index:15;display:none;align-items:center;justify-content:center;background:radial-gradient(ellipse at center,#03030a40,#03030ac7 75%)}.title-screen.visible{display:flex}@media(max-height:640px){.title-logo{font-size:40px}.title-body{margin-top:16px;max-height:calc(100vh - 170px)}}body.screen-title .hud,body.screen-title .status,body.screen-title .controls,body.screen-title .boss-bar,body.screen-title .popups,body.screen-title .toast,body.screen-title .touch,body.screen-title .coach{display:none!important}.title-inner{width:min(560px,calc(100vw - 32px));text-align:center}.title-logo{font-size:clamp(40px,9vw,76px);font-weight:700;letter-spacing:.14em;line-height:1;color:var(--ink);text-shadow:0 0 30px color-mix(in srgb,var(--accent) 70%,transparent),0 4px 30px rgba(0,0,0,.9);animation:titleIn 1.2s cubic-bezier(.2,.8,.2,1)}.title-tagline{margin-top:10px;font-size:13px;letter-spacing:.4em;color:var(--accent);text-transform:uppercase}.title-body{max-height:calc(100vh - 230px);overflow-y:auto;overscroll-behavior:contain;margin:30px auto 14px;padding:10px;background:var(--glass);border:1px solid color-mix(in srgb,var(--accent) 35%,transparent);border-radius:6px;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);text-align:left}.title-menu{margin:0}.title-item{padding:11px 14px}.title-item .menu-label{display:flex;flex-direction:column;gap:2px;font-size:17px}.title-item.mode .menu-label{font-weight:600}.title-item small{font-size:11px;letter-spacing:.08em;color:var(--ink-dim);font-weight:400}.title-best{font-size:11px;font-weight:700;letter-spacing:.18em;color:var(--accent)}.title-view{padding:8px 10px}.title-view[hidden],.title-menu[hidden]{display:none}.title-back,.panel-btn{margin-top:12px;padding:8px 16px;font:600 13px var(--font);letter-spacing:.1em;color:var(--ink);background:#ffffff0d;border:1px solid rgba(255,255,255,.2);border-radius:3px;cursor:pointer}.title-back:hover,.panel-btn:hover{border-color:var(--accent)}kbd{display:inline-block;padding:1px 6px;border:1px solid rgba(255,255,255,.3);border-bottom-width:2px;border-radius:3px;font:600 11px var(--font);color:var(--ink)}.score-tabs{display:flex;gap:6px;margin-bottom:12px}.score-tab{flex:1;padding:7px;font:600 12px var(--font);letter-spacing:.1em;color:var(--ink-dim);background:none;border:1px solid rgba(255,255,255,.12);border-radius:3px;cursor:pointer}.score-tab.on{color:var(--ink);border-color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,transparent)}.score-list{list-style:none}.score-list li{display:grid;grid-template-columns:28px 1fr auto auto;gap:12px;padding:5px 4px;font-size:14px;color:var(--ink-dim);border-bottom:1px solid rgba(255,255,255,.05)}.score-list b{color:var(--ink);font-variant-numeric:tabular-nums}.score-list .rank{color:var(--accent);font-weight:700}.score-list .date{font-size:11px}.score-empty{padding:20px 4px;color:var(--ink-dim)}.howto-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.howto-grid h3{font-size:11px;letter-spacing:.3em;color:var(--accent);margin:4px 0 8px}.howto-keys,.howto-legend{list-style:none;font-size:13px;color:var(--ink-dim)}.howto-keys li{display:flex;align-items:center;gap:6px;padding:3px 0}.howto-keys span{margin-left:auto}.howto-legend li{display:grid;grid-template-columns:10px 64px 1fr;gap:8px;align-items:center;padding:3px 0}.howto-legend.pickups li{grid-template-columns:10px 1fr}.howto-legend i{width:10px;height:10px;border-radius:50%}.howto-legend b{color:var(--ink);font-weight:600}.howto-note{margin-top:10px;font-size:12px;line-height:1.5;color:var(--ink-dim)}.howto-note b{color:var(--ink)}.howto-actions{display:flex;gap:10px;justify-content:flex-end}@keyframes titleIn{0%{opacity:0;letter-spacing:.5em;filter:blur(8px)}to{opacity:1;letter-spacing:.14em;filter:none}}.panel-sector{min-width:min(520px,94vw)}.threats{list-style:none;margin:18px auto 0;width:max-content;max-width:100%;text-align:left;font-size:13px;font-weight:400;letter-spacing:.02em}.threats li{display:grid;grid-template-columns:10px 76px 1fr;gap:10px;align-items:center;padding:3px 0;color:var(--ink-dim)}.threats i{width:10px;height:10px;border-radius:50%}.threats b{color:var(--ink);font-weight:600}.sector-boss{margin-top:14px;font-size:12px;font-weight:500;letter-spacing:.2em;color:var(--ink-dim);text-transform:uppercase}.sector-boss b{color:#ff8a7a}.panel-actions{display:flex;gap:10px;justify-content:center;margin-top:18px}.panel-btn kbd{margin-right:6px}.run-stats .upgrades{max-width:240px;font-size:12px;text-align:right}.coach{position:absolute;left:50%;bottom:120px;transform:translate(-50%);z-index:12;display:none;align-items:center;gap:14px;padding:12px 20px;background:var(--glass);border:1px solid color-mix(in srgb,var(--accent) 55%,transparent);border-radius:6px;font-size:17px;font-weight:600;letter-spacing:.04em;pointer-events:none;white-space:nowrap}.coach.visible{display:flex;animation:panelIn .35s ease-out}.coach .step{font-size:11px;letter-spacing:.3em;color:var(--accent)}.coach .skip{font-size:11px;font-weight:500;color:var(--ink-dim)}.coach.done{border-color:#6dff8a}.coach.done .step{color:#6dff8a}body.touch-on .coach{bottom:250px}@media(max-width:640px){.howto-grid{grid-template-columns:1fr}.coach{font-size:14px;white-space:normal;width:calc(100% - 32px)}}

#chrome {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.chrome-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(238, 242, 255, 0.35);
  border-radius: 4px;
  background: rgba(6, 8, 18, 0.85);
  backdrop-filter: blur(8px);
  color: #eef2ff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chrome-btn:hover {
  border-color: var(--accent, #ffaa44);
  background: rgba(20, 26, 48, 0.95);
  color: #ffffff;
}
.chrome-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}
.chrome-btn-icon {
  padding: 5px 10px;
  font-size: 15px;
  line-height: 1;
}
.boss-bar {
  top: 60px !important;
}
</style>
</head>
<body>

  <div id="chrome">
    <a class="chrome-btn" href="/games" target="_top" data-back-to-games title="Back to Games" aria-label="Back to Games">← BACK</a>
    <a class="chrome-btn" href="https://github.com/alaric-visi/asteroid-field" target="_blank" rel="noopener noreferrer" data-github-link title="View on GitHub" aria-label="View on GitHub">
      <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.28-.01-1.02-.02-2-3.2.7-3.88-1.54-3.88-1.54-.52-1.33-1.28-1.68-1.28-1.68-1.05-.71.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.73-1.54-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.29 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.8 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.8 1.19 1.83 1.19 3.09 0 4.42-2.7 5.39-5.26 5.67.41.36.78 1.06.78 2.14 0 1.55-.01 2.79-.01 3.17 0 .31.21.68.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"/></svg>
      <span>GITHUB</span>
    </a>
    <button type="button" class="chrome-btn chrome-btn-icon" data-fullscreen-toggle title="Toggle fullscreen" aria-label="Toggle fullscreen">⛶</button>
  </div>

<canvas id="game" aria-label="Asteroid Field game view"></canvas>

  <div id="popups" class="popups" aria-hidden="true"></div>

  <div class="hud hud-left">
    <div class="hud-label">SCORE</div>
    <div class="hud-score" id="score">0</div>
    <div class="hud-combo" id="combo"><span id="comboMult">×1</span><span id="comboCount"></span><i><b id="comboBar"></b></i></div>
    <div class="hud-lives" id="lives" aria-label="Ships remaining"></div>
  </div>

  <div class="hud hud-right">
    <div class="hud-label">SECTOR <span id="level">1</span></div>
    <div class="hud-sector" id="sectorName">ROCKY BELT</div>
    <div class="hud-wave" id="wave">WAVE 1 / 3</div>
  </div>

  <div class="boss-bar" id="bossBar">
    <div class="boss-name" id="bossName">HIVE CORE</div>
    <div class="boss-track"><i id="bossFill"></i></div>
  </div>

  <div class="status" id="status">
    <div class="meter meter-heat" id="heatMeter"><span>HEAT</span><div class="track"><i id="heatFill"></i></div></div>
    <div class="meter meter-shield" id="shieldMeter"><span>SHIELD</span><div class="track"><i id="shieldFill"></i></div></div>
    <div class="meter meter-jump" id="jumpMeter"><span>JUMP</span><div class="track"><i id="jumpFill"></i></div></div>
    <div class="buffs" id="buffs"></div>
  </div>

  <div class="toast" id="toast" aria-live="polite"></div>

  <div class="controls" id="controls">
    <span><b>← →</b> / <b>A D</b> turn</span>
    <span><b>↑</b> / <b>W</b> thrust</span>
    <span><b>SPACE</b> fire</span>
    <span><b>P</b> / <b>ESC</b> pause</span>
  </div>

  <div id="gameOver" class="panel panel-danger">
    <div class="panel-kicker">RUN COMPLETE</div>
    <div class="panel-title" id="gameOverText">GAME OVER</div>
    <div class="run-stats" id="runStats"></div>
    <div class="panel-actions">
      <button class="panel-btn" data-action="retry"><kbd>R</kbd> Retry</button>
      <button class="panel-btn" data-action="title"><kbd>Esc</kbd> Title</button>
    </div>
  </div>

  <div id="levelUp" class="panel panel-sector">
    <div class="panel-kicker" id="levelUpKicker">SECTOR 1</div>
    <div class="panel-title" id="levelUpText"></div>
    <div class="panel-sub" id="levelUpSubtitle"></div>
    <ul class="threats" id="levelUpThreats"></ul>
    <div class="sector-boss" id="levelUpBoss"></div>
  </div>

  <div id="upgrade" class="panel panel-upgrade">
    <div class="panel-kicker">SECTOR CLEARED</div>
    <div class="panel-title">CHOOSE AN UPGRADE</div>
    <div class="cards" id="cards"></div>
    <div class="panel-hint">1 · 2 · 3, or ← → then Enter</div>
  </div>

  <div id="paused" class="panel panel-menu">
    <div class="panel-kicker">HOLDING POSITION</div>
    <div class="panel-title">PAUSED</div>
    <ul class="menu" id="menu" role="menu"></ul>
    <div class="panel-hint">↑ ↓ select · ← → change · Enter choose · Esc resume</div>
  </div>

  <div id="coach" class="coach" aria-live="polite"></div>

  <div id="title" class="title-screen">
    <div class="title-inner">
      <div class="title-logo" id="titleLogo"></div>
      <div class="title-tagline" id="titleTagline"></div>
      <div class="title-body">
        <ul class="menu title-menu" id="titleMenu" role="menu"></ul>
        <div class="title-view" id="titleScores" hidden></div>
        <div class="title-view" id="titleHowto" hidden></div>
        <div class="title-view title-settings" id="titleSettings" hidden>
          <div class="panel-kicker">SETTINGS</div>
          <ul class="menu" id="titleSettingsMenu" role="menu"></ul>
        </div>
      </div>
      <div class="panel-hint" id="titleHint"></div>
    </div>
  </div>
  <script>(()=>{function Gu({hz:n=60,maxFrameSeconds:e=.25,step:t}){let i=1/n,s=0;return{dt:i,advance(r){s+=Math.min(Math.max(r,0),e);let a=0;for(;s>=i-1e-9;)t(i),s-=i,a++;return{ticks:a,alpha:Math.min(Math.max(s/i,0),1)}}}}function Vu(n,e,{timeScale:t=()=>1}={}){let i=performance.now();function s(r){let a=(r-i)/1e3;i=r;let{alpha:o}=n.advance(a*t());e({alpha:o,frameSeconds:Math.min(a,.25),now:r/1e3}),requestAnimationFrame(s)}requestAnimationFrame(s)}var pt={lives:3,radius:12,maxTurnRate:6.2,turnAccel:42,turnDecel:70,turnRate:6.2,thrust:760,maxSpeed:560,dragPerLegacyFrame:.99,assistDragPerLegacyFrame:.965,tapFireInterval:.1,autoFireInterval:.16,recoil:14,invulnerableSeconds:2,muzzleOffset:18,exhaustOffset:18,trailOffset:16},Ln={speed:600,lifeSeconds:80/60,radius:3,trailLength:8},Qt={restitution:.9,spawnSafeRadius:150,minSplitSize:15,childPositionJitter:20,childVelocityKeep:.8,childVelocityJitter:180,spinJitter:1.2,collisionSpinKick:1.8,bounceFxMinSpeed:72},Wu=3,ar={bigAsteroidMinSize:30,bigAsteroid:.06,shipHit:.14},zi={max:28,decayPerLegacyFrame:.88,fire:1.5,shipHit:16},bn={maxHeat:100,heatPerShot:8,coolRate:32,recoverBelow:35,spreadAngle:.14,extraShotHeat:.3},gi={chargeSeconds:.3,reappearSeconds:.25,cooldown:4,misjumpChance:.12,candidates:14},$t={max:100,drain:40,regen:12,regenDelay:1,minToActivate:12,ramMaxSize:15,ramCost:8,bounceCost:12,shotCost:8},Hi={window:2.5,killsPerStep:5,maxMultiplier:8},vi={life:10,radius:12,buffSeconds:10,smallAsteroidDropChance:.05,saucerDropChance:{big:.4,small:.6}},Pt={shotSpeed:280,shotLife:2.2,shotRadius:4,saucer:{big:{radius:22,hp:2,speed:110,fireEvery:1.4,points:200},small:{radius:13,hp:1,speed:150,fireEvery:1.1,points:1e3}},boss:{radius:86,turretRadius:13,turretHp:5,turretPoints:250,pointsPerSector:3e3,maxBrood:14}},Co={dragPerLegacyFrame:.94,thrustMul:.45},Xu=1.4,Yu=2.4;function Xn(n,e){return n**(e*60)}function an(n,e,t){n.x<0?n.x+=e:n.x>e&&(n.x-=e),n.y<0?n.y+=t:n.y>t&&(n.y-=t)}function Ze(n,e){return e?n>e/2?n-e:n<-e/2?n+e:n:n}function zt(n,e,t,i,s){let r=Ze(n.x-e.x,s?.width),a=Ze(n.y-e.y,s?.height),o=t+i;return r*r+a*a<o*o}function wt(n,e,t,i){let s=e-n;return Math.abs(s)>i/2?e:n+s*t}var or=[{name:"rocky",title:"ROCKY BELT",accent:"#ffaa44",nebulaA:[58,28,10],nebulaB:[90,40,15],lightDir:[-.55,.65,.5],backdrop:{kind:0,x:1.25,y:-.6,radius:.78,colorA:[.42,.2,.08],colorB:[.75,.48,.24]}},{name:"icy",title:"ICE FIELD",accent:"#44e0ff",nebulaA:[8,30,46],nebulaB:[10,60,78],lightDir:[.6,.55,.55],backdrop:{kind:1,x:-1.25,y:.5,radius:.42,colorA:[.22,.42,.62],colorB:[.7,.88,1]}},{name:"plasma",title:"PLASMA NEBULA",accent:"#ff55e0",nebulaA:[40,8,46],nebulaB:[70,10,60],lightDir:[.65,.6,.45],backdrop:{kind:2,x:1.35,y:.62,radius:.16,colorA:[1.4,.45,1.15],colorB:[.7,.15,.6]}}];function qu(n){return or[n-1]??or[0]}var on={spread:{weight:3,label:"SPREAD",color:"#ffae3b",timed:!0},rapid:{weight:3,label:"RAPID",color:"#ffe14d",timed:!0},pierce:{weight:2,label:"PIERCE",color:"#c77dff",timed:!0},shield:{weight:3,label:"SHIELD",color:"#5ad8ff",timed:!1},life:{weight:.6,label:"+1 SHIP",color:"#6dff8a",timed:!1}};var Ro=[{id:"twinShot",name:"Twin Shot",desc:"Adds a pair of angled barrels",max:2,apply:n=>{n.spread+=1}},{id:"coolant",name:"Coolant Loop",desc:"Shots make 25% less heat",max:3,apply:n=>{n.heatMul*=.75}},{id:"heatsink",name:"Heat Sink",desc:"Cannon cools 40% faster",max:3,apply:n=>{n.coolMul*=1.4}},{id:"capacitor",name:"Shield Capacitor",desc:"+40 maximum shield energy",max:3,apply:n=>{n.shieldMax+=40}},{id:"regen",name:"Field Regenerator",desc:"Shield recharges 50% faster",max:3,apply:n=>{n.shieldRegenMul*=1.5}},{id:"piercing",name:"Piercing Rounds",desc:"Shots pass through one more target",max:2,apply:n=>{n.pierce+=1}},{id:"jumpDrive",name:"Jump Drive",desc:"Hyperspace recharges 40% faster and never misjumps",max:1,apply:n=>{n.jumpCooldownMul*=.6,n.safeJump=!0}},{id:"thrusters",name:"Afterburners",desc:"+20% thrust and top speed",max:2,apply:n=>{n.thrustMul*=1.2}},{id:"magnet",name:"Tractor Beam",desc:"Draws pickups in from further away",max:2,apply:n=>{n.magnet+=140}},{id:"rail",name:"Rail Accelerator",desc:"+25% missile speed and range",max:2,apply:n=>{n.missileSpeedMul*=1.25}},{id:"hull",name:"Spare Hull",desc:"+1 ship",max:3,apply:(n,e)=>{e.lives+=1}}],fs=Object.fromEntries(Ro.map(n=>[n.id,n]));function lr(n=1){let e=n>>>0,t=()=>{e=e+1831565813>>>0;let i=e;return i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61),((i^i>>>14)>>>0)/4294967296};return{seed:n>>>0,next:t,range:(i,s)=>i+(s-i)*t(),signed:(i=1)=>(t()-.5)*i,chance:i=>t()<i,angle:()=>t()*Math.PI*2}}function Qu(){return{spread:0,heatMul:1,coolMul:1,shieldMax:$t.max,shieldRegenMul:1,pierce:0,jumpCooldownMul:1,safeJump:!1,thrustMul:1,magnet:0,missileSpeedMul:1}}function Do(){return{x:0,y:0,prevX:0,prevY:0,angle:-Math.PI/2,prevAngle:-Math.PI/2,vx:0,vy:0,angVel:0,radius:pt.radius,boosting:!1,invulnerable:0,alive:!0,fireCooldown:0,fireQueued:!1,heat:0,overheated:!1,energy:$t.max,shieldActive:!1,shieldRegenDelay:0,jump:null,jumpCooldown:0,frosted:!1,buffs:{}}}function ds(n,e,t){Object.assign(n,Do(),{x:e.width/2,y:e.height/2,prevX:e.width/2,prevY:e.height/2,invulnerable:pt.invulnerableSeconds,energy:t?.shieldMax??$t.max})}function Zu(n,e,t,i){let s=n.length;if(s<2)return;let r=0;for(let v of n)r=Math.max(r,e(v));let a=Math.max(2*r,1),o=Math.max(1,Math.floor(t.width/a)),l=Math.max(1,Math.floor(t.height/a)),c=t.width/o,u=t.height/l,h=new Map,d=new Int32Array(s),p=new Int32Array(s);for(let v=0;v<s;v++){let g=(Math.floor(n[v].x/c)%o+o)%o,f=(Math.floor(n[v].y/u)%l+l)%l;d[v]=g,p[v]=f;let x=f*o+g,A=h.get(x);A||h.set(x,A=[]),A.push(v)}let m=new Set;for(let v=0;v<s;v++){m.clear();for(let g=-1;g<=1;g++)for(let f=-1;f<=1;f++){let x=(p[v]+g+l)%l*o+(d[v]+f+o)%o;if(m.has(x))continue;m.add(x);let A=h.get(x);if(A)for(let y of A)y>v&&i(v,y)}}}function Ku(n,e,t){n.x+=n.vx*e,n.y+=n.vy*e,an(n,t.width,t.height)}function Ju(n,e,t,i){let{restitution:s,collisionSpinKick:r}=Qt,a=(o,l)=>{{let c=n[o],u=n[l],h=Ze(u.x-c.x,t?.width),d=Ze(u.y-c.y,t?.height),p=Math.sqrt(h*h+d*d),m=c.size+u.size;if(p>=m)return;if(p===0){let C=e.angle();h=Math.cos(C),d=Math.sin(C),p=.01}let v=h/p,g=d/p,f=m-p,x=c.size*c.size,A=u.size*u.size,y=x+A;c.x-=v*f*(A/y),c.y-=g*f*(A/y),u.x+=v*f*(x/y),u.y+=g*f*(x/y),t&&(an(c,t.width,t.height),an(u,t.width,t.height));let b=(u.vx-c.vx)*v+(u.vy-c.vy)*g;if(b>=0)return;let T=-(1+s)*b/(1/x+1/A);c.vx-=T*v/x,c.vy-=T*g/x,u.vx+=T*v/A,u.vy+=T*g/A,c.spin.x+=e.signed(r),c.spin.y+=e.signed(r),u.spin.x+=e.signed(r),u.spin.y+=e.signed(r),i?.({x:c.x+v*c.size,y:c.y+g*c.size,speed:Math.abs(b)})}};if(t)Zu(n,o=>o.size,t,a);else for(let o=0;o<n.length;o++)for(let l=o+1;l<n.length;l++)a(o,l)}function Gr(n,e,t){let i=a=>(a+n*12)%12,s=e*Math.min(t,1-t),r=a=>t-s*Math.max(-1,Math.min(i(a)-3,Math.min(9-i(a),1)));return[Math.round(r(0)*255),Math.round(r(8)*255),Math.round(r(4)*255)]}function Yn(n){let e=parseInt(n.slice(1),16);return[e>>16&255,e>>8&255,e&255]}var kp=[Yn("#ff6600"),Yn("#ffcc33")];function ju(){return{particles:[],shockwaves:[],engineTrail:[],shake:0,particleCap:1/0}}function ln(n,e,t,i,s,r=12){for(let a=0;a<r;a++){if(n.particles.length>=n.particleCap)return;let o=Math.PI*2*a/r+e.next()*.4,l=(1.5+e.next()*4)*60,c=(34+e.next()*20)/60;n.particles.push({x:t,y:i,vx:Math.cos(o)*l,vy:Math.sin(o)*l,life:c,maxLife:54/60,rgb:s,size:2.5+e.next()*3.5,kind:e.chance(.35)?"debris":"spark",rot:e.angle(),rotSpeed:e.signed(.3)*60})}}function $u(n,e,t,i,s){if(n.particles.length>=n.particleCap)return;let r=22/60;n.particles.push({x:t+e.signed(6),y:i+e.signed(6),vx:(-Math.cos(s)*3+e.signed(2))*60,vy:(-Math.sin(s)*3+e.signed(2))*60,life:r,maxLife:r,rgb:kp[e.chance(.5)?0:1],size:2+e.next()*2.5,kind:"spark",rot:0,rotSpeed:0})}function pn(n,e,t,i,s=1){n.shockwaves.push({x:e,y:t,r:4,alpha:.9,rgb:i,growth:480*s})}function cn(n,e){n.shake=Math.min(zi.max,n.shake+e)}function eh(n,e,t){n.engineTrail.push({x:e,y:t,life:16/60})}function cr(n,e){let t=Xn(.98,e);n.particles=n.particles.filter(r=>(r.x+=r.vx*e,r.y+=r.vy*e,r.vx*=t,r.vy*=t,r.rot+=r.rotSpeed*e,r.life-=e,r.life>0));let i=Xn(.94,e),s=Xn(.9,e);n.shockwaves=n.shockwaves.filter(r=>(r.r+=r.growth*e,r.growth*=i,r.alpha*=s,r.alpha>.02)),n.engineTrail=n.engineTrail.filter(r=>(r.life-=e)>0),n.shake>0&&(n.shake*=Xn(zi.decayPerLegacyFrame,e),n.shake<.05&&(n.shake=0))}function th(){return{count:0,timer:0,multiplier:1,best:0}}function ps(n,e){let t=n.combo;n.tally.kills++,t.count++,t.timer=Hi.window;let i=t.multiplier;t.multiplier=Math.min(Hi.maxMultiplier,1+Math.floor(t.count/Hi.killsPerStep)),t.multiplier>i&&n.events.push({type:"comboUp",multiplier:t.multiplier}),t.best=Math.max(t.best,t.count);let s=e*t.multiplier;return n.score+=s,s}function nh(n){let e=n.combo;e.count>=Hi.killsPerStep&&n.events.push({type:"comboBroken",count:e.count}),e.count=0,e.timer=0,e.multiplier=1}function ih(n,e){let t=n.combo;t.count!==0&&(t.timer-=e,t.timer<=0&&(t.count=0,t.multiplier=1))}function sh(n,e,t,i=1,s=0){return{x:n,y:e,prevX:n,prevY:e,vx:Math.cos(t)*Ln.speed*i,vy:Math.sin(t)*Ln.speed*i,life:Ln.lifeSeconds,trail:[],pierce:s,hitIds:null,dead:!1}}function zp(n,e,t){return n<e?Math.min(n+t,e):Math.max(n-t,e)}function Hp(n,e,t){let{world:i}=n,s=1/0,r=(a,o)=>{let l=Math.hypot(Ze(a.x-e,i.width),Ze(a.y-t,i.height))-o;l<s&&(s=l)};for(let a of n.asteroids)a.dead||r(a,a.size);for(let a of n.enemies)r(a,a.radius);for(let a of n.enemyShots)r(a,0);return n.boss&&r(n.boss,n.boss.radius),s}function Gp(n){let{rng:e,world:t,stats:i}=n,s=()=>({x:e.range(40,t.width-40),y:e.range(40,t.height-40)});if(!i.safeJump&&e.chance(gi.misjumpChance))return{...s(),misjump:!0};let a=null;for(let o=0;o<gi.candidates;o++){let l=s();l.clear=Hp(n,l.x,l.y),(!a||l.clear>a.clear)&&(a=l)}return{x:a.x,y:a.y,misjump:!1}}function Vp(n,e,t){let{ship:i,stats:s}=n;if(i.jumpCooldown=Math.max(0,i.jumpCooldown-t),i.jump){if(i.jump.t-=t,i.jump.phase==="out"&&i.jump.t<=0){let r=Gp(n);i.x=i.prevX=r.x,i.y=i.prevY=r.y,i.jump={phase:"in",t:gi.reappearSeconds},n.events.push({type:"hyperspaceIn",x:r.x,y:r.y,misjump:r.misjump})}else i.jump.phase==="in"&&i.jump.t<=0&&(i.jump=null,i.invulnerable=Math.max(i.invulnerable,.3));return i.jump!==null}return e.hyperspace&&i.jumpCooldown<=0?(i.jump={phase:"out",t:gi.chargeSeconds},i.jumpCooldown=gi.cooldown*s.jumpCooldownMul,i.vx*=.2,i.vy*=.2,i.boosting=!1,i.shieldActive&&(i.shieldActive=!1,n.events.push({type:"shieldOff"})),n.events.push({type:"hyperspaceOut",x:i.x,y:i.y}),!0):!1}function Wp(n,e,t){let{ship:i,stats:s}=n,r=i.energy>(i.shieldActive?0:$t.minToActivate),a=e&&r;a!==i.shieldActive&&n.events.push({type:a?"shieldOn":"shieldOff"}),i.shieldActive=a,a?(i.energy-=$t.drain*t,i.shieldRegenDelay=$t.regenDelay,i.energy<=0&&(i.energy=0,i.shieldActive=!1,n.events.push({type:"shieldOff",depleted:!0}))):(i.shieldRegenDelay-=t,i.shieldRegenDelay<=0&&(i.energy=Math.min(s.shieldMax,i.energy+$t.regen*s.shieldRegenMul*t)))}function Xp(n,e){let{ship:t,stats:i,fx:s}=n,r=Math.cos(t.angle),a=Math.sin(t.angle),o=t.x+r*pt.muzzleOffset,l=t.y+a*pt.muzzleOffset,c=i.spread+(t.buffs.spread>0?1:0),u=i.pierce+(t.buffs.pierce>0?2:0),h=[0];for(let p=1;p<=c;p++)h.push(p*bn.spreadAngle,-p*bn.spreadAngle);for(let p of h)n.missiles.push(sh(o,l,t.angle+p,i.missileSpeedMul,u));n.tally.shots+=h.length;let d=t.buffs.rapid>0;t.fireCooldown=e*(d?.6:1),t.fireQueued=!1,t.vx-=r*pt.recoil,t.vy-=a*pt.recoil,cn(s,zi.fire),n.events.push({type:"shoot",x:o,y:l,angle:t.angle,barrels:h.length}),d||(t.heat+=bn.heatPerShot*i.heatMul*(1+bn.extraShotHeat*c),t.heat>=bn.maxHeat&&(t.heat=bn.maxHeat,t.overheated=!0,n.events.push({type:"overheated"})))}function Yp(n,{held:e,pressed:t},i){let{ship:s,stats:r,options:a}=n;s.heat=Math.max(0,s.heat-bn.coolRate*r.coolMul*i),s.overheated&&s.heat<=bn.recoverBelow&&(s.overheated=!1,n.events.push({type:"cooled"})),s.fireCooldown=Math.max(0,s.fireCooldown-i),t.fire&&(s.fireQueued=!0);let o=a.autoFire&&e.fire;if((s.fireQueued||o)&&s.fireCooldown<=0){if(s.overheated){t.fire&&n.events.push({type:"dryFire"}),s.fireQueued=!1;return}Xp(n,s.fireQueued?pt.tapFireInterval:pt.autoFireInterval)}}function rh(n,e,t){let{ship:i,fx:s,fxRng:r,options:a,stats:o,world:l}=n;if(!i.alive)return;let{held:c,pressed:u,turn:h}=e;for(let A of Object.keys(i.buffs))i.buffs[A]-=t,i.buffs[A]<=0&&(delete i.buffs[A],n.events.push({type:"buffExpired",kind:A}));if(i.invulnerable=Math.max(0,i.invulnerable-t),Vp(n,u,t))return;Wp(n,c.shield,t);let d=h??(c.right?1:0)-(c.left?1:0),p=Math.max(-1,Math.min(1,d))*pt.maxTurnRate,m=Math.sign(p)===Math.sign(i.angVel)&&Math.abs(p)>Math.abs(i.angVel);i.angVel=zp(i.angVel,p,(m||i.angVel===0?pt.turnAccel:pt.turnDecel)*t),i.angle+=i.angVel*t,i.boosting=c.thrust;let v=Math.cos(i.angle),g=Math.sin(i.angle);if(i.boosting){let A=pt.thrust*o.thrustMul*(i.frosted?Co.thrustMul:1);i.vx+=v*A*t,i.vy+=g*A*t;let y=pt.maxSpeed*Math.sqrt(o.thrustMul),b=Math.hypot(i.vx,i.vy);b>y&&(i.vx*=y/b,i.vy*=y/b),r.chance(.5)&&$u(s,r,i.x-v*pt.exhaustOffset,i.y-g*pt.exhaustOffset,i.angle),eh(s,i.x-v*pt.trailOffset,i.y-g*pt.trailOffset)}Yp(n,e,t),i.x+=i.vx*t,i.y+=i.vy*t;let f=a.assist&&!i.boosting?pt.assistDragPerLegacyFrame:pt.dragPerLegacyFrame;i.frosted&&(f=Math.min(f,Co.dragPerLegacyFrame));let x=Xn(f,t);i.vx*=x,i.vy*=x,an(i,l.width,l.height)}var en={rock:{label:"Rock",blurb:"Splits in two",points:[20,50,100],hp:[1,1,1],children:2,color:{hue:[16,36],sat:.55,light:.5}},ice:{label:"Ice",blurb:"Shatters fast; leaves slowing frost",points:[40,100,200],hp:[1,1,1],children:3,childSpeed:1.6,frost:{radiusMul:2.2,seconds:3.5},color:{hue:[180,240],sat:.7,light:.5}},plasma:{label:"Plasma",blurb:"Detonates \u2014 chain them",points:[80,200,400],hp:[1,1,1],children:2,blast:{radiusMul:2.6,delay:.12},color:{hue:[300,340],sat:.8,light:.6}},metal:{label:"Metal",blurb:"Armoured; glancing shots ricochet",points:[60,150,300],hp:[3,2,1],children:2,deflectBelow:.35,color:{hue:[205,225],sat:.15,light:.55}},magnetic:{label:"Magnetic",blurb:"Pulls you and other rocks in",points:[150,300,450],hp:[3,3,2],children:0,pull:{radius:280,strength:170},color:{hue:[212,228],sat:.6,light:.38}},crystal:{label:"Crystal",blurb:"Always drops a pickup",points:[250,250,250],hp:[1,1,1],children:0,jitter:90,drop:!0,color:{hue:[95,140],sat:.8,light:.6}},comet:{label:"Comet",blurb:"Fast, and its tail is lethal",points:[400,400,400],hp:[1,1,1],children:0,comet:!0,color:{hue:[185,200],sat:.5,light:.8}}},Io=14;function Vr(n){return n>30?0:n>15?1:2}function xi(n,{x:e,y:t,size:i,vx:s,vy:r,type:a,hue:o,sat:l,light:c,fromSplit:u=!1}){let h=n.rng,d=en[a];o===void 0&&(o=h.range(d.color.hue[0],d.color.hue[1])/360,l=d.color.sat,c=d.color.light);let p=d.hp[Vr(i)];return{id:n.nextId++,x:e,y:t,prevX:e,prevY:t,vx:s,vy:r,size:i,type:a,hue:o,sat:l,light:c,rgb:Gr(o,l,c),hp:p,maxHp:p,spin:{x:h.signed(Qt.spinJitter),y:h.signed(Qt.spinJitter),z:h.signed(Qt.spinJitter)},pulsePhase:h.angle(),fromSplit:u,dead:!1,age:0,jitterTimer:h.range(.5,1.5),entered:!1}}function qp(n){let e=Object.entries(on),t=n.next()*e.reduce((i,[,s])=>i+s.weight,0);for(let[i,s]of e)if(t-=s.weight,t<=0)return i;return e[0][0]}function ms(n,e,t,i=qp(n.rng)){let{rng:s}=n;n.pickups.push({id:n.nextId++,kind:i,x:e,y:t,prevX:e,prevY:t,vx:s.signed(80),vy:s.signed(80),life:vi.life,dead:!1}),n.events.push({type:"pickupSpawned",kind:i,x:e,y:t})}function Qp(n,e){let{ship:t,stats:i}=n;on[e.kind].timed?t.buffs[e.kind]=vi.buffSeconds:e.kind==="shield"?t.energy=i.shieldMax:e.kind==="life"&&(n.lives=Math.min(n.lives+1,9)),n.events.push({type:"pickupCollected",kind:e.kind,x:e.x,y:e.y})}function ah(n,e){let{ship:t,world:i,stats:s}=n,r=Xn(.985,e),a=t.alive&&!t.jump;for(let o of n.pickups){if(o.life-=e,o.life<=0){o.dead=!0;continue}if(a&&s.magnet>0){let l=Ze(t.x-o.x,i.width),c=Ze(t.y-o.y,i.height),u=Math.hypot(l,c);u<s.magnet&&u>1&&(o.vx+=l/u*900*e,o.vy+=c/u*900*e)}o.vx*=r,o.vy*=r,o.x+=o.vx*e,o.y+=o.vy*e,an(o,i.width,i.height),a&&zt(t,o,t.radius+4,vi.radius,i)&&(o.dead=!0,Qp(n,o))}}var Zp=[255,255,255];function oh(n,e,t,i,s=200){let{rng:r,world:a,ship:o}=n,l=0,c=0;for(let h=0;h<40&&(l=r.next()*a.width,c=r.next()*a.height,!(Math.hypot(Ze(l-o.x,a.width),Ze(c-o.y,a.height))>=s));h++);let u=xi(n,{x:l,y:c,size:t,vx:r.signed(i),vy:r.signed(i),type:e});return n.asteroids.push(u),u}function lh(n){let{rng:e,world:t}=n,i=Math.floor(e.next()*4),s=Io*3,r=[{x:-s,y:e.next()*t.height},{x:t.width+s,y:e.next()*t.height},{x:e.next()*t.width,y:-s},{x:e.next()*t.width,y:t.height+s}][i],a=e.range(.25,.75)*t.width,o=e.range(.25,.75)*t.height,l=Math.hypot(a-r.x,o-r.y),c=e.range(320,420),u=xi(n,{x:r.x,y:r.y,size:Io,vx:(a-r.x)/l*c,vy:(o-r.y)/l*c,type:"comet"});n.asteroids.push(u),n.events.push({type:"cometIncoming",x:r.x,y:r.y})}function Kp(n,e,t,i){let{world:s,ship:r}=n,a=(o,l)=>{let c=Ze(e.x-o.x,s.width),u=Ze(e.y-o.y,s.height),h=Math.hypot(c,u);if(h>=t.radius||h<1)return;let d=l*(1-h/t.radius)*i;o.vx+=c/h*d,o.vy+=u/h*d};r.alive&&!r.jump&&a(r,t.strength);for(let o of n.asteroids)o!==e&&!o.dead&&o.type!=="magnetic"&&o.type!=="comet"&&a(o,t.strength*.6)}function Po(n,e){let{world:t,rng:i}=n;for(let r of n.asteroids){if(r.dead)continue;r.age+=e;let a=en[r.type];if(a.pull&&Kp(n,r,a.pull,e),a.jitter&&(r.jitterTimer-=e,r.jitterTimer<=0)){r.vx+=i.signed(a.jitter*2),r.vy+=i.signed(a.jitter*2);let o=Math.hypot(r.vx,r.vy);o>140&&(r.vx*=140/o,r.vy*=140/o),r.jitterTimer=i.range(.6,1.4)}r.x+=r.vx*e,r.y+=r.vy*e,a.comet?r.x>0&&r.x<t.width&&r.y>0&&r.y<t.height?r.entered=!0:r.entered&&(r.dead=!0):an(r,t.width,t.height)}let s=n.asteroids.filter(r=>!r.dead&&r.type!=="comet");Ju(s,n.rng,t,r=>{if(r.speed<=Qt.bounceFxMinSpeed)return;let a=r.speed/60;ln(n.fx,n.fxRng,r.x,r.y,Zp,Math.min(6,Math.floor(a))),cn(n.fx,Math.min(3,a*.4)),n.events.push({type:"bounce",intensity:a,x:r.x,y:r.y})})}function gs(n,e,t=1,{byPlayer:i=!0}={}){return e.dead?!1:(e.hp-=t,e.hp>0?(n.events.push({type:"asteroidHit",id:e.id,x:e.x,y:e.y,asteroidType:e.type,hp:e.hp}),!1):(Uo(n,e,{byPlayer:i}),!0))}function Uo(n,e,{byPlayer:t=!0}={}){if(e.dead)return;e.dead=!0;let{rng:i,fx:s,fxRng:r}=n,a=en[e.type],o=t?ps(n,a.points[Vr(e.size)]):0;if(a.children>0&&e.size>Qt.minSplitSize){let l=Qt.childVelocityJitter*(a.childSpeed??1);for(let c=0;c<a.children;c++){let u=xi(n,{x:e.x+i.signed(Qt.childPositionJitter),y:e.y+i.signed(Qt.childPositionJitter),size:e.size/2,vx:0,vy:0,type:e.type,hue:e.hue,sat:e.sat,light:e.light,fromSplit:!0});u.vx=e.vx*Qt.childVelocityKeep+i.signed(l),u.vy=e.vy*Qt.childVelocityKeep+i.signed(l),n.newAsteroids.push(u)}}a.frost&&n.frostFields.push({x:e.x,y:e.y,r:e.size*a.frost.radiusMul,life:a.frost.seconds,maxLife:a.frost.seconds}),a.blast&&n.blasts.push({x:e.x,y:e.y,r:e.size*a.blast.radiusMul,delay:a.blast.delay,rgb:e.rgb}),(a.drop||t&&e.size<=15&&i.chance(vi.smallAsteroidDropChance))&&ms(n,e.x,e.y),ln(s,r,e.x,e.y,e.rgb,16),pn(s,e.x,e.y,e.rgb),cn(s,Math.min(6,e.size/8)),t&&e.size>=ar.bigAsteroidMinSize&&(n.hitStop=Math.max(n.hitStop,ar.bigAsteroid)),n.events.push({type:"asteroidDestroyed",id:e.id,x:e.x,y:e.y,vx:e.vx,vy:e.vy,size:e.size,asteroidType:e.type,hue:e.hue,sat:e.sat,light:e.light,points:o})}function ch(n,e,t,i){let s=en[t.type];if(!s.deflectBelow||!e.vx&&!e.vy)return!1;let{world:r}=n,a=Ze(e.x-t.x,r.width),o=Ze(e.y-t.y,r.height),l=Math.hypot(a,o)||1,c=a/l,u=o/l,h=Math.hypot(e.vx,e.vy)||1;if(-(e.vx*c+e.vy*u)/h>=s.deflectBelow)return!1;let p=e.vx*c+e.vy*u;return e.vx-=2*p*c,e.vy-=2*p*u,e.x=t.x+c*(t.size+i+1),e.y=t.y+u*(t.size+i+1),e.trail.length=0,n.events.push({type:"deflect",x:e.x,y:e.y}),!0}function uh(n,e=[]){e.length=0;let t=Math.hypot(n.vx,n.vy)||1;for(let i of[22,46,70])e.push({x:n.x-n.vx/t*i,y:n.y-n.vy/t*i});return e}var qn=[{size:40,speed:120,waves:3,budget:[10,13,16],weights:{rock:1,crystal:.12},saucers:{big:.6,small:0},comets:0,boss:{type:"rock",hp:30,turrets:3,name:"HIVE CORE"},intro:{subtitle:"Clear the belt. Break the Hive."}},{size:35,speed:165,waves:3,budget:[13,16,19],weights:{ice:1,rock:.4,metal:.35,crystal:.12},saucers:{big:.5,small:.4},comets:.5,boss:{type:"ice",hp:42,turrets:4,name:"GLACIER HEART"},intro:{subtitle:"Shards scatter fast \u2014 and leave frost behind"}},{size:32,speed:190,waves:4,budget:[15,18,21,24],weights:{plasma:1,metal:.4,magnetic:.35,ice:.3,crystal:.12},saucers:{big:.3,small:.7},comets:.6,boss:{type:"plasma",hp:56,turrets:5,name:"NOVA SEED"},intro:{subtitle:"Volatile cores detonate \u2014 chain them"}}],Bo={rock:2,ice:3,plasma:4,metal:4,magnetic:5,crystal:3};var hh={big:Yn("#7dffb0"),small:Yn("#ff6b8a")},mn=n=>qn[(n.level-1)%qn.length],yi=n=>Math.floor((n.level-1)/qn.length);function fh(n,e,t,i,s=1){let r=Pt.shotSpeed*s;n.enemyShots.push({x:e,y:t,prevX:e,prevY:t,vx:Math.cos(i)*r,vy:Math.sin(i)*r,life:Pt.shotLife,dead:!1}),n.events.push({type:"enemyShot",x:e,y:t})}function dh(n,e,t){let{ship:i,world:s}=n;return Math.atan2(Ze(i.y-t,s.height),Ze(i.x-e,s.width))}function Lo(n,e){let{rng:t,world:i}=n,s=Pt.saucer[e],r=t.chance(.5),a=r?-s.radius:i.width+s.radius;n.enemies.push({id:n.nextId++,kind:e,x:a,y:t.range(.15,.85)*i.height,prevX:a,prevY:0,vx:(r?1:-1)*s.speed*(1+.1*yi(n)),vy:0,radius:s.radius,hp:s.hp,fireTimer:s.fireEvery,turnTimer:t.range(.6,1.6),entered:!1,dead:!1}),n.events.push({type:"enemySpawned",kind:e})}function Wr(n,e,t=1){e.dead||(e.hp-=t,e.hp<=0?Xr(n,e,{byPlayer:!0}):n.events.push({type:"enemyHit",x:e.x,y:e.y}))}function Xr(n,e,{byPlayer:t}){if(e.dead)return;e.dead=!0;let{fx:i,fxRng:s,rng:r}=n,a=t?ps(n,Pt.saucer[e.kind].points):0;t&&r.chance(vi.saucerDropChance[e.kind])&&ms(n,e.x,e.y),ln(i,s,e.x,e.y,hh[e.kind],22),pn(i,e.x,e.y,hh[e.kind],1.3),cn(i,6),n.events.push({type:"enemyDestroyed",kind:e.kind,x:e.x,y:e.y,points:a})}function Jp(n,e){let{rng:t,world:i,ship:s}=n,r=yi(n);for(let a of n.enemies)if(!a.dead){if(a.turnTimer-=e,a.turnTimer<=0&&(a.vy=[-.6,0,.6][Math.floor(t.next()*3)]*Math.abs(a.vx),a.turnTimer=t.range(.8,1.8)),a.x+=a.vx*e,a.y+=a.vy*e,a.y<0?a.y+=i.height:a.y>i.height&&(a.y-=i.height),a.x>0&&a.x<i.width)a.entered=!0;else if(a.entered){a.dead=!0;continue}if(a.fireTimer-=e,a.fireTimer<=0&&s.alive&&a.entered){let o=Pt.saucer[a.kind],l=a.kind==="small"?dh(n,a.x,a.y)+t.signed(.5/(1+r)):t.angle();fh(n,a.x,a.y,l),a.fireTimer=o.fireEvery*t.range(.8,1.2)}for(let o of n.asteroids)if(!o.dead&&o.type!=="comet"&&zt(a,o,a.radius,o.size,i)){Xr(n,a,{byPlayer:!1}),gs(n,o,1,{byPlayer:!1});break}}}function jp(n,e){let{world:t}=n;for(let i of n.enemyShots){if(i.life-=e,i.life<=0){i.dead=!0;continue}i.x+=i.vx*e,i.y+=i.vy*e,an(i,t.width,t.height);for(let s of n.asteroids)if(!s.dead&&zt(i,s,Pt.shotRadius,s.size,t)){i.dead=!0;break}}}function Yr(n,e){let t=n.angle+e.offset;return{x:n.x+Math.cos(t)*n.radius*.92,y:n.y+Math.sin(t)*n.radius*.92}}function ph(n){let{rng:e,world:t,ship:i}=n,s=mn(n).boss,r=yi(n),a=[[.25,.25],[.75,.25],[.25,.75],[.75,.75]].map(([u,h])=>({x:u*t.width,y:h*t.height}));a.sort((u,h)=>Math.hypot(h.x-i.x,h.y-i.y)-Math.hypot(u.x-i.x,u.y-i.y));let o=en[s.type].color,l=(o.hue[0]+o.hue[1])/720,c=Math.round(s.hp*(1+.5*r));n.boss={id:n.nextId++,type:s.type,x:a[0].x,y:a[0].y,prevX:a[0].x,prevY:a[0].y,vx:e.signed(70),vy:e.signed(70),radius:Pt.boss.radius,hp:c,maxHp:c,angle:0,prevAngle:0,spin:.35,turrets:Array.from({length:s.turrets},(u,h)=>({offset:h/s.turrets*Math.PI*2,hp:Pt.boss.turretHp,alive:!0,cooldown:1.5+h*.45})),phase:1,shieldTimer:0,broodTimer:5,hue:l,sat:o.sat,light:o.light,rgb:Gr(l,o.sat,o.light)},n.events.push({type:"bossSpawned",bossType:s.type})}function $p(n,e){let t=n.boss;if(!t)return;let{rng:i,world:s,ship:r}=n;t.x+=t.vx*e,t.y+=t.vy*e,an(t,s.width,s.height),t.angle+=t.spin*e*(t.phase===2?1.7:1),t.shieldTimer=Math.max(0,t.shieldTimer-e);for(let a of t.turrets)if(a.alive&&(a.cooldown-=e,a.cooldown<=0&&r.alive&&!r.jump)){let o=Yr(t,a);fh(n,o.x,o.y,dh(n,o.x,o.y)+i.signed(.25),.9),a.cooldown=(t.phase===2?1.2:1.9)+i.next()*.8}if(t.broodTimer-=e,t.broodTimer<=0&&(t.broodTimer=t.phase===2?5:7.5,n.asteroids.length<Pt.boss.maxBrood)){let a=mn(n).size/2;for(let o=0;o<2;o++){let l=i.angle(),c=t.radius+a+4;n.newAsteroids.push(xi(n,{x:t.x+Math.cos(l)*c,y:t.y+Math.sin(l)*c,size:a,vx:Math.cos(l)*120+t.vx,vy:Math.sin(l)*120+t.vy,type:t.type,fromSplit:!0}))}n.events.push({type:"bossBrood",x:t.x,y:t.y})}for(let a of n.asteroids){if(a.dead||a.type==="comet")continue;let o=Ze(a.x-t.x,s.width),l=Ze(a.y-t.y,s.height),c=Math.hypot(o,l)||1,u=t.radius+a.size;if(c>=u)continue;let h=o/c,d=l/c;a.x+=h*(u-c),a.y+=d*(u-c);let p=(a.vx-t.vx)*h+(a.vy-t.vy)*d;p<0&&(a.vx-=1.8*p*h,a.vy-=1.8*p*d)}}function em(n){let e=n.boss,{fx:t,fxRng:i}=n,s=ps(n,Pt.boss.pointsPerSector*n.level);for(let r=0;r<5;r++){let a=r/5*Math.PI*2;ln(t,i,e.x+Math.cos(a)*e.radius*.6,e.y+Math.sin(a)*e.radius*.6,e.rgb,24)}pn(t,e.x,e.y,e.rgb,2.6),pn(t,e.x,e.y,[255,255,255],1.6),cn(t,26),n.hitStop=Math.max(n.hitStop,.35),ms(n,e.x-20,e.y),ms(n,e.x+20,e.y),n.events.push({type:"bossDestroyed",x:e.x,y:e.y,radius:e.radius,bossType:e.type,hue:e.hue,sat:e.sat,light:e.light,points:s}),n.boss=null,n.director.bossDefeated=!0}function No(n,e){let t=n.boss;if(t){if(t.shieldTimer>0){n.events.push({type:"bossShieldHit",x:t.x,y:t.y});return}t.hp-=e,n.events.push({type:"bossHit",x:t.x,y:t.y,hp:t.hp}),t.phase===1&&t.hp<=t.maxHp/2&&(t.phase=2,t.shieldTimer=3,t.broodTimer=0,n.events.push({type:"bossPhase",phase:2,x:t.x,y:t.y})),t.hp<=0&&em(n)}}function mh(n,e,t){let i=n.boss;if(!i)return!1;let{world:s,fx:r,fxRng:a}=n;for(let o of i.turrets){if(!o.alive)continue;let l=Yr(i,o);if(zt(e,l,t,Pt.boss.turretRadius,s)){if(e.dead=!0,o.hp--,o.hp<=0){o.alive=!1;let c=ps(n,Pt.boss.turretPoints);ln(r,a,l.x,l.y,[255,170,80],18),pn(r,l.x,l.y,[255,170,80]),cn(r,5),n.events.push({type:"turretDestroyed",x:l.x,y:l.y,points:c})}else n.events.push({type:"bossHit",x:l.x,y:l.y,hp:i.hp});return!0}}return zt(e,i,t,i.radius,s)?(e.dead=!0,No(n,1),!0):!1}function gh(n,e){Jp(n,e),$p(n,e),jp(n,e)}var tm=Yn("#00ccff"),nm=Yn("#66d9ff");function im(n){return n.alive&&!n.jump&&n.invulnerable<=0&&!n.shieldActive}function Ai(n){let{ship:e,fx:t,fxRng:i}=n;return!im(e)||n.options.training?!1:(n.lives--,ln(t,i,e.x,e.y,tm,26),pn(t,e.x,e.y,nm),cn(t,zi.shipHit),n.hitStop=Math.max(n.hitStop,ar.shipHit),nh(n),n.events.push({type:"shipDestroyed",x:e.x,y:e.y}),n.lives<=0?(e.alive=!1,e.boosting=!1,e.shieldActive=!1,n.mode="over",n.won=!1,n.events.push({type:"gameOver",score:n.score})):(ds(e,n.world,n.stats),t.engineTrail=[]),!0)}var sm=[255,240,255];function rm(n,e){let{fx:t,fxRng:i,world:s,ship:r}=n;pn(t,e.x,e.y,e.rgb,1.9),pn(t,e.x,e.y,sm,1.2),ln(t,i,e.x,e.y,e.rgb,26),cn(t,9),n.events.push({type:"blast",x:e.x,y:e.y,r:e.r});for(let a of n.asteroids)!a.dead&&zt(a,e,a.size,e.r,s)&&gs(n,a,1,{byPlayer:!0});for(let a of n.enemies)!a.dead&&zt(a,e,a.radius,e.r,s)&&Wr(n,a,2);n.boss&&zt(n.boss,e,n.boss.radius,e.r,s)&&No(n,2),r.alive&&zt(r,e,r.radius,e.r*.75,s)&&Ai(n)}function vh(n,e){let{ship:t,world:i}=n;n.frostFields=n.frostFields.filter(r=>(r.life-=e)>0),t.frosted=n.frostFields.some(r=>Math.hypot(Ze(t.x-r.x,i.width),Ze(t.y-r.y,i.height))<r.r);let s=[];n.blasts=n.blasts.filter(r=>(r.delay-=e,r.delay>0?!0:(s.push(r),!1)));for(let r of s)rm(n,r)}function xh(n,e){n.pierce>0?(n.pierce--,(n.hitIds??=new Set).add(e)):n.dead=!0}function Ah(n){let{world:e}=n,t=Ln.radius;for(let i of n.missiles)if(!i.dead){if(mh(n,i,t)){n.tally.hits++;continue}for(let s of n.enemies)if(!(s.dead||i.hitIds?.has(s.id))&&zt(i,s,t,s.radius,e)){Wr(n,s,1),n.tally.hits++,xh(i,s.id);break}if(!i.dead){for(let s of n.asteroids)if(!(s.dead||i.hitIds?.has(s.id))&&zt(i,s,t,s.size,e)){if(ch(n,i,s,t))break;gs(n,s,1),n.tally.hits++,xh(i,s.id);break}}}}function yh(n,e){let{ship:t,world:i}=n;if(e.type==="comet"||e.size<=$t.ramMaxSize){Uo(n,e,{byPlayer:!0}),t.energy=Math.max(0,t.energy-$t.ramCost),n.events.push({type:"shieldRam",x:e.x,y:e.y});return}let s=Ze(t.x-e.x,i.width),r=Ze(t.y-e.y,i.height),a=Math.hypot(s,r)||1,o=s/a,l=r/a;t.x=e.x+o*(e.size+t.radius+1),t.y=e.y+l*(e.size+t.radius+1);let c=(t.vx-e.vx)*o+(t.vy-e.vy)*l;c<0&&(t.vx-=1.6*c*o,t.vy-=1.6*c*l,e.vx+=.3*c*o,e.vy+=.3*c*l),t.vx+=o*60,t.vy+=l*60,t.energy=Math.max(0,t.energy-$t.bounceCost),n.events.push({type:"shieldHit",x:t.x-o*t.radius,y:t.y-l*t.radius})}var am=[];function Mh(n){let{ship:e,world:t}=n;if(!e.alive||e.jump)return;let i=(s,r)=>zt(e,s,e.radius,r,t);for(let s of n.asteroids)if(!(s.dead||!i(s,s.size))){if(e.shieldActive)yh(n,s);else if(Ai(n))return}for(let s of n.asteroids)if(!(s.dead||s.type!=="comet"||e.shieldActive)){for(let r of uh(s,am))if(i(r,9)&&Ai(n))return}for(let s of n.enemies){if(s.dead||!i(s,s.radius))continue;let r=e.shieldActive||e.invulnerable>0;if(Xr(n,s,{byPlayer:r}),!r&&Ai(n))return}if(n.boss&&i(n.boss,n.boss.radius)){if(e.shieldActive)yh(n,{...n.boss,size:n.boss.radius,type:"boss"});else if(Ai(n))return}for(let s of n.enemyShots)if(!(s.dead||!i(s,Pt.shotRadius))){if(s.dead=!0,e.shieldActive)e.energy=Math.max(0,e.energy-$t.shotCost),n.events.push({type:"shieldHit",x:s.x,y:s.y});else if(Ai(n))return}}function om(n,e){let t=Object.entries(e),i=n.next()*t.reduce((s,[,r])=>s+r,0);for(let[s,r]of t)if(i-=r,i<=0)return s;return t[t.length-1][0]}function Fo(n){let{rng:e}=n;n.wave=0,n.director={waveBreak:0,bossDefeated:!1,saucerTimer:e.range(10,18),cometTimer:e.range(12,20)},Sh(n)}function Sh(n){let{rng:e}=n,t=mn(n),i=yi(n);if(n.wave++,n.wave>t.waves){ph(n),n.events.push({type:"waveStarted",wave:n.wave,waves:t.waves,boss:!0});return}let s=t.budget[n.wave-1]*(1+.35*i),r=t.speed*(1+.1*i),a=0;for(;s>=2;){let o=Object.fromEntries(Object.entries(t.weights).filter(([u])=>Bo[u]<=s&&(u!=="crystal"||a<1)));if(Object.keys(o).length===0)break;let l=om(e,o);s-=Bo[l],l==="crystal"&&a++;let c=l==="magnetic"||l==="crystal"?t.size*.75:t.size;oh(n,l,c,r)}n.events.push({type:"waveStarted",wave:n.wave,waves:t.waves,boss:!1})}function lm(n){let{rng:e}=n,t=Ro.filter(s=>(n.upgrades[s.id]??0)<s.max).map(s=>s.id),i=[];for(;i.length<3&&t.length;)i.push(t.splice(Math.floor(e.next()*t.length),1)[0]);n.upgradeChoices=i,n.mode="upgrade",n.events.push({type:"upgradeOffered",choices:i})}function cm(n){if(n.events.push({type:"sectorCleared",level:n.level}),n.runMode==="campaign"&&n.level>=qn.length){n.ship.boosting=!1,n.mode="over",n.won=!0,n.events.push({type:"won",score:n.score});return}lm(n)}function _h(n,e){let t=n.upgradeChoices?.[e];t&&(fs[t].apply(n.stats,n),n.upgrades[t]=(n.upgrades[t]??0)+1,n.upgradeChoices=null,n.events.push({type:"upgradeChosen",id:t}),n.level++,ds(n.ship,n.world,n.stats),n.fx.engineTrail=[],n.missiles=[],n.enemyShots=[],n.enemies=[],n.pickups=[],n.frostFields=[],n.blasts=[],n.asteroids=[],Fo(n),n.mode="transition",n.transitionTimer=Wu,n.events.push({type:"levelUp",level:n.level,intro:mn(n).intro}))}function bh(n,e){if(n.mode!=="playing")return;let{rng:t}=n,i=mn(n),s=n.director,r=yi(n);if(!n.boss&&!s.bossDefeated&&(s.saucerTimer-=e,s.saucerTimer<=0&&(s.saucerTimer=t.range(14,22)/(1+.2*r),n.enemies.length===0&&(t.chance(i.saucers.small)?Lo(n,"small"):t.chance(i.saucers.big)&&Lo(n,"big"))),s.cometTimer-=e,s.cometTimer<=0&&(s.cometTimer=t.range(15,25),t.chance(i.comets)&&lh(n))),!(!n.boss&&n.asteroids.every(l=>l.dead||l.type==="comet"))){s.waveBreak=0;return}if(s.waveBreak<=0){s.waveBreak=Xu,n.events.push({type:"waveCleared",wave:n.wave});return}s.waveBreak-=e,!(s.waveBreak>0)&&(s.bossDefeated?cm(n):Sh(n))}var fb=Object.freeze({held:Object.freeze({left:!1,right:!1,thrust:!1,fire:!1,shield:!1}),pressed:Object.freeze({fire:!1,pause:!1,restart:!1,hyperspace:!1}),turn:void 0,choice:void 0}),Eh=Object.freeze({autoFire:!0,assist:!1,training:!1}),Th=["campaign","endless","daily"];function Ch({width:n,height:e,seed:t=1,options:i=Eh,runMode:s="campaign"}){let r={options:{...Eh,...i},runMode:Th.includes(s)?s:"campaign",world:{width:n,height:e},seed:t>>>0,rng:lr(t),fxRng:lr((t^2654435769)>>>0),nextId:1,events:[],time:0};return Qr(r),r}function qr(n,{seed:e=n.seed,runMode:t=n.runMode,intro:i=!1}={}){n.seed=e>>>0,n.rng=lr(n.seed),n.fxRng=lr((n.seed^2654435769)>>>0),n.runMode=Th.includes(t)?t:"campaign",n.events.length=0,Qr(n,{intro:i})}function Qr(n,{intro:e=!1}={}){Object.assign(n,{mode:"playing",paused:!1,won:!1,lives:pt.lives,score:0,level:1,wave:0,transitionTimer:0,hitStop:0,runTime:0,ship:Do(),stats:Qu(),upgrades:{},upgradeChoices:null,combo:th(),tally:{shots:0,hits:0,kills:0},missiles:[],asteroids:[],newAsteroids:[],enemies:[],enemyShots:[],boss:null,pickups:[],frostFields:[],blasts:[],director:null,fx:ju()}),ds(n.ship,n.world,n.stats),Fo(n),n.events.push({type:"runStarted",runMode:n.runMode}),e&&(n.mode="transition",n.transitionTimer=Yu,n.events.push({type:"levelUp",level:1,intro:mn(n).intro}))}function Rh(n,e,t){let{world:i}=n;if(e<=0||t<=0||e===i.width&&t===i.height)return;let s=i.width<=0||i.height<=0,r=e/i.width,a=t/i.height;if(i.width=e,i.height=t,s){Qr(n);return}let o=[n.ship,...n.asteroids,...n.missiles,...n.enemies,...n.enemyShots,...n.pickups];n.boss&&o.push(n.boss);for(let l of o)l.x*=r,l.y*=a,l.prevX=l.x,l.prevY=l.y;for(let l of[...n.frostFields,...n.blasts])l.x*=r,l.y*=a;for(let l of n.missiles)l.trail.length=0;n.fx.engineTrail.length=0}function Zr(n,e){n.mode==="over"||n.paused===e||(n.paused=e,n.events.push({type:e?"paused":"resumed"}))}function Oo(n,e,t){let{pressed:i}=e;if(n.mode==="over"){if(i.restart){Qr(n);return}}else i.pause&&Zr(n,!n.paused);if(!n.paused){if(n.time+=t,um(n),n.hitStop>0){n.hitStop-=t;return}if(n.mode==="upgrade"){cr(n.fx,t),e.choice!==void 0&&_h(n,e.choice);return}if(n.mode==="transition"){cr(n.fx,t),n.transitionTimer-=t,n.transitionTimer<=0&&(n.mode="playing",n.events.push({type:"transitionEnded"}));return}if(n.mode==="over"){Po(n,t),cr(n.fx,t),wh(n);return}n.runTime+=t,rh(n,e,t),hm(n,t),Po(n,t),gh(n,t),ah(n,t),vh(n,t),cr(n.fx,t),Ah(n),Mh(n),ih(n,t),wh(n),bh(n,t)}}function um(n){let{ship:e}=n;e.prevX=e.x,e.prevY=e.y,e.prevAngle=e.angle;for(let t of[n.asteroids,n.missiles,n.enemies,n.enemyShots,n.pickups])for(let i of t)i.prevX=i.x,i.prevY=i.y;n.boss&&(n.boss.prevX=n.boss.x,n.boss.prevY=n.boss.y,n.boss.prevAngle=n.boss.angle)}function hm(n,e){for(let t of n.missiles)t.trail.push({x:t.x,y:t.y}),t.trail.length>Ln.trailLength&&t.trail.shift(),Ku(t,e,n.world),t.life-=e,t.life<=0&&(t.dead=!0)}function wh(n){let e=t=>!t.dead;n.asteroids=n.asteroids.filter(e).concat(n.newAsteroids),n.newAsteroids=[],n.missiles=n.missiles.filter(e),n.enemies=n.enemies.filter(e),n.enemyShots=n.enemyShots.filter(e),n.pickups=n.pickups.filter(e)}var Ih="asteroids3d.settings.v1",Kr=Object.freeze({left:["ArrowLeft","KeyA"],right:["ArrowRight","KeyD"],thrust:["ArrowUp","KeyW"],fire:["Space"],hyperspace:["ShiftLeft","KeyS","ArrowDown"],shield:["KeyE","KeyQ"],pause:["KeyP","Escape"],restart:["KeyR"]}),ko=Object.freeze({masterVolume:.8,musicVolume:.6,sfxVolume:.9,shake:"full",flashes:"full",palette:"standard",gameSpeed:1,fireMode:"hold",assist:!1,quality:"auto",tutorialDone:!1,bindings:Kr}),Ph={shake:["full","reduced","off"],flashes:["full","reduced"],palette:["standard","colorblind"],gameSpeed:[1,.75],fireMode:["hold","tap"],assist:[!1,!0],quality:["auto","low","medium","high","ultra"],tutorialDone:[!1,!0]};function Dh(n,e=ko){let t={...e,bindings:{...Kr}};if(!n||typeof n!="object")return t;for(let i of["masterVolume","musicVolume","sfxVolume"]){let s=Number(n[i]);Number.isFinite(s)&&(t[i]=Math.min(1,Math.max(0,Math.round(s*10)/10)))}for(let[i,s]of Object.entries(Ph))s.includes(n[i])&&(t[i]=n[i]);if(n.bindings&&typeof n.bindings=="object")for(let i of Object.keys(Kr)){let s=n.bindings[i];Array.isArray(s)&&s.length&&s.every(r=>typeof r=="string")&&(t.bindings[i]=[...s])}return t}function Uh(n=fm(),{reducedMotion:e=!1}={}){let t=e?{...ko,shake:"off",flashes:"reduced"}:ko,i=Dh(dm(n),t),s=new Set;function r(a){i=Dh(a,t),pm(n,i),s.forEach(o=>o(i))}return{get:()=>i,set:(a,o)=>r({...i,[a]:o}),cycle(a,o=1){let l=Ph[a],c=l.indexOf(i[a]);r({...i,[a]:l[(c+o+l.length)%l.length]})},nudge(a,o){r({...i,[a]:i[a]+o*.1})},bind(a,o){let l={};for(let[c,u]of Object.entries(i.bindings)){let h=u.filter(d=>d!==o);l[c]=c===a?[o,...h.filter(d=>d!==u[0])]:h.length?h:u}r({...i,bindings:l})},resetBindings:()=>r({...i,bindings:{...Kr}}),subscribe(a){return s.add(a),a(i),()=>s.delete(a)}}}function zo(n){return{shakeScale:n.shake==="full"?1:n.shake==="reduced"?.35:0,flashScale:n.flashes==="full"?1:.3,palette:n.palette}}function fm(){try{return window.localStorage}catch{return null}}function dm(n){try{return JSON.parse(n?.getItem(Ih)??"null")}catch{return null}}function pm(n,e){try{n?.setItem(Ih,JSON.stringify(e))}catch{}}var Bh="asteroids3d.highscores.v1";function mm(){try{return window.localStorage}catch{return null}}function Lh(n=mm()){let e={};try{e=JSON.parse(n?.getItem(Bh)??"{}")||{}}catch{e={}}let t=()=>{try{n?.setItem(Bh,JSON.stringify(e))}catch{}};return{list:i=>[...e[i]??[]],best:i=>e[i]?.[0]?.score??0,record(i,s){let r=[...e[i]??[],{...s,date:new Date().toISOString().slice(0,10)}];r.sort((o,l)=>l.score-o.score),e[i]=r.slice(0,10),t();let a=e[i].findIndex(o=>o.score===s.score&&o.sector===s.sector)+1;return a>0?a:null}}}function Nh(n=new Date){let e=n.toISOString().slice(0,10),t=2166136261;for(let i=0;i<e.length;i++)t=Math.imul(t^e.charCodeAt(i),16777619);return t>>>0}var ur=["left","right","thrust","fire","shield"],Fh=["fire","pause","restart","hyperspace"];function Oh(n=window,{onFirstInput:e}={}){let t=Object.fromEntries(ur.map(a=>[a,!1])),i=Object.fromEntries(Fh.map(a=>[a,!1])),s=Object.fromEntries(ur.map(a=>[a,!1])),r=new Map;return n.addEventListener("keydown",a=>{e?.();let o=r.get(a.code);o&&(a.preventDefault(),o in t&&(t[o]=s[o]=!0),!a.repeat&&o in i&&(i[o]=!0))}),n.addEventListener("keyup",a=>{let o=r.get(a.code);o in t&&(t[o]=!1)}),n.addEventListener("blur",()=>ur.forEach(a=>t[a]=!1)),{setBindings(a){r=new Map;for(let[o,l]of Object.entries(a))for(let c of l)r.set(c,o);ur.forEach(o=>t[o]=!1)},snapshot(){let a={held:{},pressed:{...i}};for(let o of ur)a.held[o]=t[o]||s[o],s[o]=!1;return Fh.forEach(o=>i[o]=!1),a}}}var St={A:0,B:1,X:2,Y:3,LB:4,RB:5,LT:6,RT:7,START:9,UP:12,DOWN:13,LEFT:14,RIGHT:15};function kh(){let n=null,e={},t=0,i=0,s={left:!1,right:!1,thrust:!1,fire:!1,shield:!1},r={fire:!1,pause:!1,restart:!1,hyperspace:!1},a={up:!1,down:!1,left:!1,right:!1,confirm:!1,back:!1},o;function l(){if(n=[...navigator.getGamepads?.()??[]].find(b=>b&&b.connected)??null,!n){Object.keys(s).forEach(b=>s[b]=!1),o=void 0;return}let u=b=>!!n.buttons[b]?.pressed,h=b=>n.buttons[b]?.value??0,d=b=>u(b)&&!e[b],p=n.axes[0]??0,m=n.axes[1]??0,v=Math.abs(p)<.2?0:Math.sign(p)*((Math.abs(p)-.2)/(1-.2)),g=(u(St.RIGHT)?1:0)-(u(St.LEFT)?1:0);o=g!==0?g:v!==0?v:void 0,s.thrust=h(St.RT)>.25||u(St.B)||u(St.UP),s.fire=u(St.A)||u(St.RB)||u(St.X),s.shield=h(St.LT)>.3,d(St.LB)&&(r.hyperspace=!0),(d(St.A)||d(St.RB)||d(St.X))&&(r.fire=!0),d(St.START)&&(r.pause=!0),(d(St.A)||d(St.Y))&&(r.restart=!0);let f=m<-.6&&t>=-.6,x=m>.6&&t<=.6,A=p<-.6&&i>=-.6,y=p>.6&&i<=.6;(d(St.UP)||f)&&(a.up=!0),(d(St.DOWN)||x)&&(a.down=!0),(d(St.LEFT)||A)&&(a.left=!0),(d(St.RIGHT)||y)&&(a.right=!0),d(St.A)&&(a.confirm=!0),d(St.B)&&(a.back=!0),i=p,t=m,e=Object.fromEntries(n.buttons.map((b,T)=>[T,b.pressed]))}return{poll:l,get connected(){return n!==null},snapshot(){let c={held:{...s},pressed:{...r},turn:o};return Object.keys(r).forEach(u=>r[u]=!1),c},takeMenu(){let c={...a};return Object.keys(a).forEach(u=>a[u]=!1),c},rumble(c,u,h){n?.vibrationActuator?.playEffect?.("dual-rumble",{duration:h,strongMagnitude:c,weakMagnitude:u})?.catch?.(()=>{})}}}function zh({onFirstTouch:n}={}){let e=document.createElement("div");e.className="touch",e.innerHTML=`
    <div class="touch-stick"><div class="touch-stick-base"></div><div class="touch-stick-knob"></div></div>
    <button class="touch-btn touch-thrust" aria-label="Thrust">THRUST</button>
    <button class="touch-btn touch-fire" aria-label="Fire">FIRE</button>
    <button class="touch-btn touch-shield" aria-label="Shield">SHIELD</button>
    <button class="touch-btn touch-jump" aria-label="Hyperspace">JUMP</button>
    <button class="touch-pause" aria-label="Pause">II</button>
  `,document.body.appendChild(e);let t=e.querySelector(".touch-stick"),i=e.querySelector(".touch-stick-base"),s=e.querySelector(".touch-stick-knob"),r={thrust:!1,fire:!1,shield:!1},a={fire:!1,pause:!1,restart:!1,hyperspace:!1},o=null,l=null,c={x:0,y:0};function u(){document.body.classList.contains("touch-on")||(document.body.classList.add("touch-on"),n?.())}window.matchMedia?.("(pointer: coarse)").matches&&u(),window.addEventListener("touchstart",u,{passive:!0});function h(m,v,g=0,f=0){i.style.transform=`translate(${m}px, ${v}px)`,s.style.transform=`translate(${m+g}px, ${v+f}px)`}t.addEventListener("pointerdown",m=>{m.preventDefault(),l=m.pointerId,t.setPointerCapture(m.pointerId);let v=t.getBoundingClientRect();c={x:m.clientX-v.left,y:m.clientY-v.top},e.classList.add("stick-active"),h(c.x,c.y)}),t.addEventListener("pointermove",m=>{if(m.pointerId!==l)return;let v=t.getBoundingClientRect(),g=m.clientX-v.left-c.x,f=m.clientY-v.top-c.y,x=Math.hypot(g,f);x>60&&(g*=60/x,f*=60/x);let A=Math.min(1,x/60);o=A>.25?{x:g,y:f,mag:A}:null,h(c.x,c.y,g,f)});let d=m=>{m.pointerId===l&&(l=null,o=null,e.classList.remove("stick-active"))};t.addEventListener("pointerup",d),t.addEventListener("pointercancel",d);function p(m,v,g){let f=e.querySelector(m);f.addEventListener("pointerdown",A=>{A.preventDefault(),f.setPointerCapture(A.pointerId),r[v]=!0,f.classList.add("down"),g?.()});let x=()=>{r[v]=!1,f.classList.remove("down")};f.addEventListener("pointerup",x),f.addEventListener("pointercancel",x)}return p(".touch-fire","fire",()=>{a.fire=!0,a.restart=!0}),p(".touch-thrust","thrust"),p(".touch-shield","shield"),p(".touch-jump","jump",()=>{a.hyperspace=!0}),e.querySelector(".touch-pause").addEventListener("pointerdown",m=>{m.preventDefault(),a.pause=!0}),{snapshot(){let m={held:{thrust:r.thrust||(o?.mag??0)>=.92,fire:r.fire,shield:r.shield},pressed:{...a},aim:o};return Object.keys(a).forEach(v=>a[v]=!1),m}}}var gm=n=>Math.atan2(Math.sin(n),Math.cos(n));function Hh({keyboard:n,gamepad:e,touch:t,getShipAngle:i}){let s={fire:!1,pause:!1,restart:!1,hyperspace:!1},r;return{press(a){s[a]=!0},choose(a){r=a},snapshot(){let a=n.snapshot(),o=e.snapshot(),l=t.snapshot(),c={left:a.held.left||o.held.left,right:a.held.right||o.held.right,thrust:a.held.thrust||o.held.thrust||l.held.thrust,fire:a.held.fire||o.held.fire||l.held.fire,shield:a.held.shield||o.held.shield||l.held.shield},u={};for(let p of["fire","pause","restart","hyperspace"])u[p]=a.pressed[p]||o.pressed[p]||l.pressed[p]||s[p];Object.keys(s).forEach(p=>s[p]=!1);let h;if(c.left||c.right)h=void 0;else if(o.turn!==void 0)h=o.turn;else if(l.aim){let p=gm(Math.atan2(l.aim.y,l.aim.x)-i());h=Math.max(-1,Math.min(1,p*2.5))}let d=r;return r=void 0,{held:c,pressed:u,turn:h,choice:d}}}}var Gh=n=>Math.atan2(Math.sin(n),Math.cos(n));function Vh(n=Math.random){let e=0,t=0;return function(s){let{ship:r,world:a}=s,o={left:!1,right:!1,thrust:!1,fire:!1,shield:!1},l={fire:!1,pause:!1,restart:!1,hyperspace:!1},c=s.mode==="upgrade"?Math.floor(n()*(s.upgradeChoices?.length||1)):void 0;if(!r.alive||r.jump)return{held:o,pressed:l,turn:void 0,choice:c};let u=null,h=1/0,d=null,p=1/0,m=(f,x)=>{let A=Ze(f.x-r.x,a.width),y=Ze(f.y-r.y,a.height),b=Math.hypot(A,y)-x;b<h&&(h=b,u=f),b<p&&(p=b,d={o:f,dx:A,dy:y,d:b})};for(let f of s.asteroids)f.dead||m(f,f.size);for(let f of s.enemies)m(f,f.radius);s.boss&&m(s.boss,s.boss.radius);let v=0;if(d){let f=Math.hypot(d.dx,d.dy)/Ln.speed,x=Math.atan2(d.dy+d.o.vy*f,d.dx+d.o.vx*f),A=Gh(x-r.angle);v=Math.max(-1,Math.min(1,A*3)),o.fire=Math.abs(A)<.22&&p<520&&!r.overheated}e-=1/60,e<=0&&(e=1.5+n()*2,t=n()*Math.PI*2);let g=Math.hypot(r.vx,r.vy);return h>220&&g<140&&Math.abs(Gh(t-r.angle))<.6&&(o.thrust=!0),h<40&&(r.energy>25?o.shield=!0:r.jumpCooldown<=0&&(l.hyperspace=!0)),{held:o,pressed:l,turn:v,choice:c}}}function Wh(){let n=null,e={},t=null,i=null,s={x:0,y:0,width:1,height:1},r={master:.8,music:.6,sfx:.9},a=[];function o(){if(!n)return;let u=n.currentTime;t.gain.setTargetAtTime(r.master,u,.05),e.music.gain.setTargetAtTime(r.music*.55,u,.05),e.sfx.gain.setTargetAtTime(r.sfx,u,.05),e.ui.gain.setTargetAtTime(r.sfx*.8,u,.05)}function l(){if(!n){let u=window.AudioContext||window.webkitAudioContext;if(!u)return;n=new u;let h=n.createDynamicsCompressor();h.threshold.value=-18,h.knee.value=12,h.ratio.value=4,h.attack.value=.003,h.release.value=.25;let d=n.createDynamicsCompressor();d.threshold.value=-2,d.knee.value=0,d.ratio.value=20,d.attack.value=.001,d.release.value=.1,t=n.createGain(),t.connect(h).connect(d).connect(n.destination);for(let m of["sfx","ui","music"])e[m]=n.createGain(),e[m].connect(t);i=n.createBuffer(1,n.sampleRate*2,n.sampleRate);let p=i.getChannelData(0);for(let m=0;m<p.length;m++)p[m]=Math.random()*2-1;o(),a.forEach(m=>m())}n.state==="suspended"&&n.resume()}function c(u,h){if(u===void 0)return e.sfx;let d=n.createStereoPanner();d.pan.value=Math.max(-1,Math.min(1,u/s.width*2-1))*.75;let p=Math.hypot(u-s.x,h-s.y)/Math.hypot(s.width,s.height),m=n.createBiquadFilter();return m.type="lowpass",m.frequency.value=1200+16e3*(1-Math.min(1,p*1.6))**2,d.connect(m).connect(e.sfx),d}return{get ctx(){return n},get noise(){return i},buses:e,unlock:l,onUnlock:u=>a.push(u),spatial:c,setListener(u,h,d,p){Object.assign(s,{x:u,y:h,width:d,height:p})},setVolumes({masterVolume:u,musicVolume:h,sfxVolume:d}){Object.assign(r,{master:u,music:h,sfx:d}),o()}}}var Mi=(n=.06)=>1+(Math.random()-.5)*n;function Xh(n){let e=null;function t({freqStart:s,freqEnd:r=s,duration:a=.15,type:o="sine",volume:l=.3,delay:c=0,out:u,detune:h=1}){let d=n.ctx;if(!d)return;let p=d.currentTime+c,m=d.createOscillator(),v=d.createGain();m.type=o,m.frequency.setValueAtTime(Math.max(s*h,1),p),r!==s&&m.frequency.exponentialRampToValueAtTime(Math.max(r*h,1),p+a),v.gain.setValueAtTime(1e-4,p),v.gain.linearRampToValueAtTime(l,p+.004),v.gain.exponentialRampToValueAtTime(.001,p+a),m.connect(v).connect(u??n.buses.sfx),m.start(p),m.stop(p+a+.03)}function i({duration:s=.3,volume:r=.4,filterFreqStart:a=2e3,filterFreqEnd:o=200,delay:l=0,out:c}){let u=n.ctx;if(!u)return;let h=u.currentTime+l,d=u.createBufferSource();d.buffer=n.noise,d.playbackRate.value=Mi(.2);let p=u.createBiquadFilter();p.type="lowpass",p.frequency.setValueAtTime(a,h),p.frequency.exponentialRampToValueAtTime(Math.max(o,40),h+s);let m=u.createGain();m.gain.setValueAtTime(r,h),m.gain.exponentialRampToValueAtTime(.001,h+s),d.connect(p).connect(m).connect(c??n.buses.sfx),d.start(h,Math.random()*1.5),d.stop(h+s+.03)}return{shoot({x:s,y:r}={}){if(!n.ctx)return;let a=n.spatial(s,r);t({freqStart:900,freqEnd:240,duration:.11,type:"sawtooth",volume:.12,out:a,detune:Mi(.1)}),t({freqStart:1800,freqEnd:600,duration:.05,type:"square",volume:.03,out:a,detune:Mi(.1)})},asteroidBreak({size:s,x:r,y:a}){if(!n.ctx)return;let o=n.spatial(r,a),l=s>25,c=Mi(.12);i({duration:l?.45:.22,volume:l?.38:.22,filterFreqStart:(l?1800:2600)*c,filterFreqEnd:150,out:o}),t({freqStart:l?160:280,freqEnd:l?50:100,duration:l?.4:.18,volume:.24,out:o,detune:c})},shipExplosion({x:s,y:r}={}){if(!n.ctx)return;let a=n.spatial(s,r);i({duration:.8,volume:.55,filterFreqStart:2500,filterFreqEnd:80,out:a}),t({freqStart:140,freqEnd:35,duration:.8,volume:.4,out:a})},bounce({intensity:s,x:r,y:a}){n.ctx&&t({freqStart:480+Math.random()*200,freqEnd:180,duration:.05,type:"triangle",volume:Math.min(.2,.05+s*.03),out:n.spatial(r,a)})},levelUp:()=>[440,554,659,880].forEach((s,r)=>t({freqStart:s,duration:.18,type:"square",volume:.14,delay:r*.09,out:n.buses.ui})),win:()=>[523,659,784,1046,784,1046].forEach((s,r)=>t({freqStart:s,duration:.22,type:"square",volume:.16,delay:r*.1,out:n.buses.ui})),gameOver:()=>t({freqStart:220,freqEnd:70,duration:.9,type:"sawtooth",volume:.2,out:n.buses.ui}),hyperspace(s){let r=n.buses.sfx;t({freqStart:s?300:1600,freqEnd:s?1800:260,duration:.3,type:"sine",volume:.18,out:r}),i({duration:.25,volume:.12,filterFreqStart:s?600:5e3,filterFreqEnd:s?6e3:400,out:r})},shieldOn:()=>t({freqStart:220,freqEnd:440,duration:.18,type:"triangle",volume:.1}),shieldOff:()=>t({freqStart:440,freqEnd:180,duration:.15,type:"triangle",volume:.08}),shieldHit({x:s,y:r}={}){n.ctx&&t({freqStart:1400,freqEnd:500,duration:.12,type:"square",volume:.07,out:n.spatial(s,r),detune:Mi(.15)})},overheated:()=>[880,660,880,660].forEach((s,r)=>t({freqStart:s,duration:.08,type:"square",volume:.07,delay:r*.09,out:n.buses.ui})),dryFire:()=>t({freqStart:180,freqEnd:120,duration:.05,type:"square",volume:.08}),pickup:()=>[660,880,1320].forEach((s,r)=>t({freqStart:s,duration:.12,type:"triangle",volume:.12,delay:r*.05,out:n.buses.ui})),deflect({x:s,y:r}={}){n.ctx&&t({freqStart:2400,freqEnd:3200,duration:.09,type:"sine",volume:.1,out:n.spatial(s,r),detune:Mi(.2)})},clank({x:s,y:r}={}){if(!n.ctx)return;let a=n.spatial(s,r);t({freqStart:420,freqEnd:300,duration:.12,type:"square",volume:.1,out:a,detune:Mi(.15)}),i({duration:.08,volume:.12,filterFreqStart:4e3,filterFreqEnd:1500,out:a})},blast({x:s,y:r}={}){if(!n.ctx)return;let a=n.spatial(s,r);i({duration:.7,volume:.5,filterFreqStart:3e3,filterFreqEnd:60,out:a}),t({freqStart:110,freqEnd:30,duration:.7,volume:.4,out:a})},enemyShot({x:s,y:r}={}){n.ctx&&t({freqStart:520,freqEnd:200,duration:.12,type:"square",volume:.06,out:n.spatial(s,r),detune:Mi(.1)})},bossRoar(){t({freqStart:70,freqEnd:45,duration:1.4,type:"sawtooth",volume:.25}),t({freqStart:105,freqEnd:60,duration:1.4,type:"sawtooth",volume:.15})},comboUp:s=>t({freqStart:500+s*90,duration:.1,type:"triangle",volume:.09,out:n.buses.ui}),waveChime:()=>[523,784].forEach((s,r)=>t({freqStart:s,duration:.2,type:"triangle",volume:.1,delay:r*.12,out:n.buses.ui})),uiMove:()=>t({freqStart:1200,freqEnd:1e3,duration:.04,type:"triangle",volume:.06,out:n.buses.ui}),uiSelect:()=>t({freqStart:700,freqEnd:1400,duration:.08,type:"triangle",volume:.08,out:n.buses.ui}),setThrust(s){let r=n.ctx;if(r){if(s&&!e){let a=r.createBufferSource();a.buffer=n.noise,a.loop=!0;let o=r.createBiquadFilter();o.type="bandpass",o.frequency.value=180,o.Q.value=.7,e=r.createGain(),e.gain.value=0,a.connect(o).connect(e).connect(n.buses.sfx),a.start()}if(e){let a=e.gain;a.cancelScheduledValues(r.currentTime),a.setValueAtTime(a.value,r.currentTime),a.linearRampToValueAtTime(s?.1:0,r.currentTime+.08)}}}}}var Jr=.13392857142857142,vm=.12,xm=25,Ho=n=>440*2**((n-69)/12),Yh=[[[57,[0,3,7]],[53,[0,4,7]],[48,[0,4,7]],[55,[0,4,7]]],[[50,[0,3,7]],[46,[0,4,7]],[53,[0,4,7]],[48,[0,4,7]]],[[52,[0,3,7]],[53,[0,4,7]],[52,[0,3,7]],[50,[0,3,7]]]],ym=[1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0],Am=[0,1,2,3,2,1,0,1,2,3,2,1,0,2,1,3],Go=(n,e,t)=>{let i=Math.max(0,Math.min(1,(t-n)/(e-n)));return i*i*(3-2*i)};function qh(n){let e=null,t=null,i=0,s=0,r=0,a=0,o=0;function l(){let p=n.ctx,m=p.createBiquadFilter();m.type="lowpass",m.frequency.value=18e3,m.connect(n.buses.music);let v=()=>{let g=p.createGain();return g.gain.value=0,g.connect(m),g};e={pad:v(),bass:v(),arp:v(),drums:v(),filter:m}}function c(p,m,v,g,f,x,{attack:A=.005,filterFrom:y,filterTo:b}={}){let T=n.ctx,C=T.createOscillator();C.type=p,C.frequency.value=m;let D=T.createGain();D.gain.setValueAtTime(1e-4,v),D.gain.linearRampToValueAtTime(f,v+A),D.gain.exponentialRampToValueAtTime(1e-4,v+g);let S=C;if(y){let M=T.createBiquadFilter();M.type="lowpass",M.frequency.setValueAtTime(y,v),M.frequency.exponentialRampToValueAtTime(b,v+g),S=C.connect(M)}return S.connect(D).connect(x),C.start(v),C.stop(v+g+.05),C}function u(p,m,v,g,f,x){let A=n.ctx,y=A.createBufferSource();y.buffer=n.noise;let b=A.createBiquadFilter();b.type=g,b.frequency.value=f;let T=A.createGain();T.gain.setValueAtTime(v,p),T.gain.exponentialRampToValueAtTime(1e-4,p+m),y.connect(b).connect(T).connect(x),y.start(p,Math.random()),y.stop(p+m+.02)}function h(p,m){let v=Math.floor(p/16),g=p%16;g===0&&(a=o);let[f,x]=Yh[a][v%4],A=[...x.map(y=>f+y),f+12];if(g===0)for(let y of[f-12,...A.slice(0,3)])for(let b of[-.004,.004])c("sawtooth",Ho(y)*(1+b),m,Jr*16+.6,.035,e.pad,{attack:.4,filterFrom:1400,filterTo:600});if(ym[g]&&r>.08&&c("sawtooth",Ho(f-12),m,Jr*1.8,.2,e.bass,{filterFrom:900,filterTo:160}),r>.32){let y=A[Am[g]%A.length]+12;c("triangle",Ho(y),m,Jr*1.6,.075,e.arp)}r>.5&&g%2===1&&u(m,.04,g%4===3?.1:.05,"highpass",7e3,e.drums),r>.6&&(g===0||g===8||r>.85&&(g===6||g===14))&&(c("sine",140,m,.28,.55,e.drums,{filterFrom:2e3,filterTo:200}),c("sine",55,m+.01,.25,.35,e.drums)),r>.78&&(g===4||g===12)&&(u(m,.16,.22,"bandpass",1800,e.drums),c("triangle",190,m,.1,.12,e.drums))}function d(){let p=n.ctx;for(;s<p.currentTime+vm;)h(i,s),s+=Jr,i++;let m=p.currentTime;e.pad.gain.setTargetAtTime(.8,m,.5),e.bass.gain.setTargetAtTime(Go(.08,.3,r),m,.6),e.arp.gain.setTargetAtTime(Go(.32,.55,r),m,.6),e.drums.gain.setTargetAtTime(Go(.5,.75,r),m,.4)}return{start(){n.ctx&&(e||l(),!t&&(i=0,s=n.ctx.currentTime+.1,e.filter.frequency.setTargetAtTime(18e3,n.ctx.currentTime,.1),t=setInterval(d,xm)))},stop(p=1.5){if(!t)return;clearInterval(t),t=null;let m=n.ctx.currentTime;for(let v of["pad","bass","arp","drums"])e[v].gain.setTargetAtTime(0,m,p/4)},setIntensity(p){r=Math.max(0,Math.min(1,p))},setSector(p){o=Math.max(0,Math.min(Yh.length-1,p))},setMuffled(p){e&&e.filter.frequency.setTargetAtTime(p?650:18e3,n.ctx.currentTime,.15)},get playing(){return t!==null}}}var Mm=0,Qh=1,Sm=2;var ad=1,_m=2,$n=3,On=0,Ct=1,Lt=2,_t=0,Ci=1,kn=2,Zh=3,Kh=4,bm=5,Zi=100,Em=101,wm=102,Tm=103,Cm=104,Rm=200,Dm=201,Im=202,Pm=203,Sl=204,_l=205,Um=206,Bm=207,Lm=208,Nm=209,Fm=210,Om=211,km=212,zm=213,Hm=214,bl=0,El=1,wl=2,Os=3,Tl=4,Cl=5,Rl=6,Dl=7,od=0,Gm=1,Vm=2,Ri=0,Wm=1,Xm=2,Ym=3,qm=4,Qm=5,Zm=6,Km=7;var ld=300,ks=301,zs=302,Il=303,Pl=304,co=306,Ul=1e3,ji=1001,Bl=1002,Wt=1003,Jm=1004;var jr=1005;var Vt=1006,Vo=1007;var ti=1008;var bt=1009,cd=1010,ud=1011,wr=1012,Qc=1013,si=1014,Fn=1015,li=1016,Zc=1017,Kc=1018,Di=1020,hd=35902,fd=1021,dd=1022,Rn=1023,pd=1024,md=1025,Ls=1026,Ii=1027,Jc=1028,jc=1029,gd=1030,$c=1031;var eu=1033,wa=33776,Ta=33777,Ca=33778,Ra=33779,Ll=35840,Nl=35841,Fl=35842,Ol=35843,kl=36196,zl=37492,Hl=37496,Gl=37808,Vl=37809,Wl=37810,Xl=37811,Yl=37812,ql=37813,Ql=37814,Zl=37815,Kl=37816,Jl=37817,jl=37818,$l=37819,ec=37820,tc=37821,Da=36492,nc=36494,ic=36495,vd=36283,sc=36284,rc=36285,ac=36286;var Ia=2300,oc=2301,Wo=2302,Jh=2400,jh=2401,$h=2402;var ci=3200,jm=3201;var xd=0,$m=1,vn="",$e="srgb",Hn="srgb-linear",uo="linear",ht="srgb";var vs=7680;var ef=519,eg=512,tg=513,ng=514,yd=515,ig=516,sg=517,rg=518,ag=519,tf=35044,Xs=35048;var nf="300 es",ni=2e3,Pa=2001,nn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let s=this._listeners[e];if(s!==void 0){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let s=i.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,e);e.target=null}}},Ht=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],sf=1234567,Ar=Math.PI/180,Tr=180/Math.PI;function is(){let n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ht[n&255]+Ht[n>>8&255]+Ht[n>>16&255]+Ht[n>>24&255]+"-"+Ht[e&255]+Ht[e>>8&255]+"-"+Ht[e>>16&15|64]+Ht[e>>24&255]+"-"+Ht[t&63|128]+Ht[t>>8&255]+"-"+Ht[t>>16&255]+Ht[t>>24&255]+Ht[i&255]+Ht[i>>8&255]+Ht[i>>16&255]+Ht[i>>24&255]).toLowerCase()}function Tt(n,e,t){return Math.max(e,Math.min(t,n))}function tu(n,e){return(n%e+e)%e}function og(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function lg(n,e,t){return n!==e?(t-n)/(e-n):0}function Mr(n,e,t){return(1-t)*n+t*e}function cg(n,e,t,i){return Mr(n,e,1-Math.exp(-t*i))}function ug(n,e=1){return e-Math.abs(tu(n,e*2)-e)}function hg(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function fg(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function dg(n,e){return n+Math.floor(Math.random()*(e-n+1))}function pg(n,e){return n+Math.random()*(e-n)}function mg(n){return n*(.5-Math.random())}function gg(n){n!==void 0&&(sf=n);let e=sf+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function vg(n){return n*Ar}function xg(n){return n*Tr}function yg(n){return(n&n-1)===0&&n!==0}function Ag(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Mg(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Sg(n,e,t,i,s){let r=Math.cos,a=Math.sin,o=r(t/2),l=a(t/2),c=r((e+i)/2),u=a((e+i)/2),h=r((e-i)/2),d=a((e-i)/2),p=r((i-e)/2),m=a((i-e)/2);switch(s){case"XYX":n.set(o*u,l*h,l*d,o*c);break;case"YZY":n.set(l*d,o*u,l*h,o*c);break;case"ZXZ":n.set(l*h,l*d,o*u,o*c);break;case"XZX":n.set(o*u,l*m,l*p,o*c);break;case"YXY":n.set(l*p,o*u,l*m,o*c);break;case"ZYZ":n.set(l*m,l*p,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function Ps(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Zt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Ad={DEG2RAD:Ar,RAD2DEG:Tr,generateUUID:is,clamp:Tt,euclideanModulo:tu,mapLinear:og,inverseLerp:lg,lerp:Mr,damp:cg,pingpong:ug,smoothstep:hg,smootherstep:fg,randInt:dg,randFloat:pg,randFloatSpread:mg,seededRandom:gg,degToRad:vg,radToDeg:xg,isPowerOfTwo:yg,ceilPowerOfTwo:Ag,floorPowerOfTwo:Mg,setQuaternionFromProperEuler:Sg,normalize:Zt,denormalize:Ps},K=class n{constructor(e=0,t=0){n.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}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,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*s+e.x,this.y=r*s+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ge=class n{constructor(e,t,i,s,r,a,o,l,c){n.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,a,o,l,c)}set(e,t,i,s,r,a,o,l,c){let u=this.elements;return u[0]=e,u[1]=s,u[2]=o,u[3]=t,u[4]=r,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.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 i=e.elements,s=t.elements,r=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],p=i[5],m=i[8],v=s[0],g=s[3],f=s[6],x=s[1],A=s[4],y=s[7],b=s[2],T=s[5],C=s[8];return r[0]=a*v+o*x+l*b,r[3]=a*g+o*A+l*T,r[6]=a*f+o*y+l*C,r[1]=c*v+u*x+h*b,r[4]=c*g+u*A+h*T,r[7]=c*f+u*y+h*C,r[2]=d*v+p*x+m*b,r[5]=d*g+p*A+m*T,r[8]=d*f+p*y+m*C,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],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*r*u+i*o*l+s*r*c-s*a*l}invert(){let e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,d=o*l-u*r,p=c*r-a*l,m=t*h+i*d+s*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let v=1/m;return e[0]=h*v,e[1]=(s*c-u*i)*v,e[2]=(o*i-s*a)*v,e[3]=d*v,e[4]=(u*t-s*l)*v,e[5]=(s*r-o*t)*v,e[6]=p*v,e[7]=(i*l-c*t)*v,e[8]=(a*t-i*r)*v,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,i,s,r,a,o){let l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-s*c,s*l,-s*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Xo.makeScale(e,t)),this}rotate(e){return this.premultiply(Xo.makeRotation(-e)),this}translate(e,t){return this.premultiply(Xo.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),i=Math.sin(e);return this.set(t,-i,0,i,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,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Xo=new Ge;function Md(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Ua(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function _g(){let n=Ua("canvas");return n.style.display="block",n}var rf={};function xr(n){n in rf||(rf[n]=!0,console.warn(n))}function bg(n,e,t){return new Promise(function(i,s){function r(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:s();break;case n.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:i()}}setTimeout(r,t)})}function Eg(n){let e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function wg(n){let e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}var nt={enabled:!0,workingColorSpace:Hn,spaces:{},convert:function(n,e,t){return this.enabled===!1||e===t||!e||!t||(this.spaces[e].transfer===ht&&(n.r=ii(n.r),n.g=ii(n.g),n.b=ii(n.b)),this.spaces[e].primaries!==this.spaces[t].primaries&&(n.applyMatrix3(this.spaces[e].toXYZ),n.applyMatrix3(this.spaces[t].fromXYZ)),this.spaces[t].transfer===ht&&(n.r=Ns(n.r),n.g=Ns(n.g),n.b=Ns(n.b))),n},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)},getPrimaries:function(n){return this.spaces[n].primaries},getTransfer:function(n){return n===vn?uo:this.spaces[n].transfer},getLuminanceCoefficients:function(n,e=this.workingColorSpace){return n.fromArray(this.spaces[e].luminanceCoefficients)},define:function(n){Object.assign(this.spaces,n)},_getMatrix:function(n,e,t){return n.copy(this.spaces[e].toXYZ).multiply(this.spaces[t].fromXYZ)},_getDrawingBufferColorSpace:function(n){return this.spaces[n].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(n=this.workingColorSpace){return this.spaces[n].workingColorSpaceConfig.unpackColorSpace}};function ii(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ns(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var af=[.64,.33,.3,.6,.15,.06],of=[.2126,.7152,.0722],lf=[.3127,.329],cf=new Ge().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),uf=new Ge().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);nt.define({[Hn]:{primaries:af,whitePoint:lf,transfer:uo,toXYZ:cf,fromXYZ:uf,luminanceCoefficients:of,workingColorSpaceConfig:{unpackColorSpace:$e},outputColorSpaceConfig:{drawingBufferColorSpace:$e}},[$e]:{primaries:af,whitePoint:lf,transfer:ht,toXYZ:cf,fromXYZ:uf,luminanceCoefficients:of,outputColorSpaceConfig:{drawingBufferColorSpace:$e}}});var xs,lc=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{xs===void 0&&(xs=Ua("canvas")),xs.width=e.width,xs.height=e.height;let i=xs.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=xs}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Ua("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let a=0;a<r.length;a++)r[a]=ii(r[a]/255)*255;return i.putImageData(s,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(ii(t[i]/255)*255):t[i]=ii(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Tg=0,Ba=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Tg++}),this.uuid=is(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let a=0,o=s.length;a<o;a++)s[a].isDataTexture?r.push(Yo(s[a].image)):r.push(Yo(s[a]))}else r=Yo(s);i.url=r}return t||(e.images[this.uuid]=i),i}};function Yo(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?lc.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Cg=0,Ft=class n extends nn{constructor(e=n.DEFAULT_IMAGE,t=n.DEFAULT_MAPPING,i=ji,s=ji,r=Vt,a=ti,o=Rn,l=bt,c=n.DEFAULT_ANISOTROPY,u=vn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Cg++}),this.uuid=is(),this.name="",this.source=new Ba(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new K(0,0),this.repeat=new K(1,1),this.center=new K(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ge,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ld)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ul:e.x=e.x-Math.floor(e.x);break;case ji:e.x=e.x<0?0:1;break;case Bl:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ul:e.y=e.y-Math.floor(e.y);break;case ji:e.y=e.y<0?0:1;break;case Bl:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Ft.DEFAULT_IMAGE=null;Ft.DEFAULT_MAPPING=ld;Ft.DEFAULT_ANISOTROPY=1;var Ke=class n{constructor(e=0,t=0,i=0,s=1){n.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}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,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,s=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*s+a[12]*r,this.y=a[1]*t+a[5]*i+a[9]*s+a[13]*r,this.z=a[2]*t+a[6]*i+a[10]*s+a[14]*r,this.w=a[3]*t+a[7]*i+a[11]*s+a[15]*r,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,i,s,r,l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],m=l[9],v=l[2],g=l[6],f=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-v)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+v)<.1&&Math.abs(m+g)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let A=(c+1)/2,y=(p+1)/2,b=(f+1)/2,T=(u+d)/4,C=(h+v)/4,D=(m+g)/4;return A>y&&A>b?A<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(A),s=T/i,r=C/i):y>b?y<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(y),i=T/s,r=D/s):b<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(b),i=C/r,s=D/r),this.set(i,s,r,t),this}let x=Math.sqrt((g-m)*(g-m)+(h-v)*(h-v)+(d-u)*(d-u));return Math.abs(x)<.001&&(x=1),this.x=(g-m)/x,this.y=(h-v)/x,this.z=(d-u)/x,this.w=Math.acos((c+p+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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},cc=class extends nn{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ke(0,0,e,t),this.scissorTest=!1,this.viewport=new Ke(0,0,e,t);let s={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Vt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);let r=new Ft(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);r.flipY=!1,r.generateMipmaps=i.generateMipmaps,r.internalFormat=i.internalFormat,this.textures=[];let a=i.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=i;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 i=0,s=e.textures.length;i<s;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new Ba(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},at=class extends cc{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},La=class extends Ft{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=Wt,this.minFilter=Wt,this.wrapR=ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var uc=class extends Ft{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=Wt,this.minFilter=Wt,this.wrapR=ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var zn=class{constructor(e=0,t=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,a,o){let l=i[s+0],c=i[s+1],u=i[s+2],h=i[s+3],d=r[a+0],p=r[a+1],m=r[a+2],v=r[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=d,e[t+1]=p,e[t+2]=m,e[t+3]=v;return}if(h!==v||l!==d||c!==p||u!==m){let g=1-o,f=l*d+c*p+u*m+h*v,x=f>=0?1:-1,A=1-f*f;if(A>Number.EPSILON){let b=Math.sqrt(A),T=Math.atan2(b,f*x);g=Math.sin(g*T)/b,o=Math.sin(o*T)/b}let y=o*x;if(l=l*g+d*y,c=c*g+p*y,u=u*g+m*y,h=h*g+v*y,g===1-o){let b=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=b,c*=b,u*=b,h*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,s,r,a){let o=i[s],l=i[s+1],c=i[s+2],u=i[s+3],h=r[a],d=r[a+1],p=r[a+2],m=r[a+3];return e[t]=o*m+u*h+l*p-c*d,e[t+1]=l*m+u*d+c*h-o*p,e[t+2]=c*m+u*p+o*d-l*h,e[t+3]=u*m-o*h-l*d-c*p,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,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,s=e._y,r=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(s/2),h=o(r/2),d=l(i/2),p=l(s/2),m=l(r/2);switch(a){case"XYZ":this._x=d*u*h+c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h-d*p*m;break;case"YXZ":this._x=d*u*h+c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h+d*p*m;break;case"ZXY":this._x=d*u*h-c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h-d*p*m;break;case"ZYX":this._x=d*u*h-c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h+d*p*m;break;case"YZX":this._x=d*u*h+c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h-d*p*m;break;case"XZY":this._x=d*u*h-c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h+d*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],s=t[4],r=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=i+o+h;if(d>0){let p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(r-c)*p,this._z=(a-s)*p}else if(i>o&&i>h){let p=2*Math.sqrt(1+i-o-h);this._w=(u-l)/p,this._x=.25*p,this._y=(s+a)/p,this._z=(r+c)/p}else if(o>h){let p=2*Math.sqrt(1+o-i-h);this._w=(r-c)/p,this._x=(s+a)/p,this._y=.25*p,this._z=(l+u)/p}else{let p=2*Math.sqrt(1+h-i-o);this._w=(a-s)/p,this._x=(r+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Tt(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,s=e._y,r=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+s*c-r*l,this._y=s*u+a*l+r*o-i*c,this._z=r*u+a*c+i*l-s*o,this._w=a*u-i*o-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,s=this._y,r=this._z,a=this._w,o=a*e._w+i*e._x+s*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=s,this._z=r,this;let l=1-o*o;if(l<=Number.EPSILON){let p=1-t;return this._w=p*a+t*this._w,this._x=p*i+t*this._x,this._y=p*s+t*this._y,this._z=p*r+t*this._z,this.normalize(),this}let c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=i*h+this._x*d,this._y=s*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},P=class n{constructor(e=0,t=0,i=0){n.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(hf.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(hf.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,s=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,s=this.z,r=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*s-o*i),u=2*(o*t-r*s),h=2*(r*i-a*t);return this.x=t+l*c+a*h-o*u,this.y=i+l*u+o*c-r*h,this.z=s+l*h+r*u-a*c,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,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,s=e.y,r=e.z,a=t.x,o=t.y,l=t.z;return this.x=s*l-r*o,this.y=r*a-i*l,this.z=i*o-s*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return qo.copy(this).projectOnVector(e),this.sub(qo)}reflect(e){return this.sub(qo.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}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,i){let s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,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(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},qo=new P,hf=new zn,ri=class{constructor(e=new P(1/0,1/0,1/0),t=new P(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(wn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(wn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=wn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let r=i.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,wn):wn.fromBufferAttribute(r,a),wn.applyMatrix4(e.matrixWorld),this.expandByPoint(wn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),$r.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),$r.copy(i.boundingBox)),$r.applyMatrix4(e.matrixWorld),this.union($r)}let s=e.children;for(let r=0,a=s.length;r<a;r++)this.expandByObject(s[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,wn),wn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(hr),ea.subVectors(this.max,hr),ys.subVectors(e.a,hr),As.subVectors(e.b,hr),Ms.subVectors(e.c,hr),Si.subVectors(As,ys),_i.subVectors(Ms,As),Gi.subVectors(ys,Ms);let t=[0,-Si.z,Si.y,0,-_i.z,_i.y,0,-Gi.z,Gi.y,Si.z,0,-Si.x,_i.z,0,-_i.x,Gi.z,0,-Gi.x,-Si.y,Si.x,0,-_i.y,_i.x,0,-Gi.y,Gi.x,0];return!Qo(t,ys,As,Ms,ea)||(t=[1,0,0,0,1,0,0,0,1],!Qo(t,ys,As,Ms,ea))?!1:(ta.crossVectors(Si,_i),t=[ta.x,ta.y,ta.z],Qo(t,ys,As,Ms,ea))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,wn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(wn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Qn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Qn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Qn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Qn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Qn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Qn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Qn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Qn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Qn),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)}},Qn=[new P,new P,new P,new P,new P,new P,new P,new P],wn=new P,$r=new ri,ys=new P,As=new P,Ms=new P,Si=new P,_i=new P,Gi=new P,hr=new P,ea=new P,ta=new P,Vi=new P;function Qo(n,e,t,i,s){for(let r=0,a=n.length-3;r<=a;r+=3){Vi.fromArray(n,r);let o=s.x*Math.abs(Vi.x)+s.y*Math.abs(Vi.y)+s.z*Math.abs(Vi.z),l=e.dot(Vi),c=t.dot(Vi),u=i.dot(Vi);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}var Rg=new ri,fr=new P,Zo=new P,Pi=class{constructor(e=new P,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):Rg.setFromPoints(e).getCenter(i);let s=0;for(let r=0,a=e.length;r<a;r++)s=Math.max(s,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;fr.subVectors(e,this.center);let t=fr.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(fr,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Zo.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(fr.copy(e.center).add(Zo)),this.expandByPoint(fr.copy(e.center).sub(Zo))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},Zn=new P,Ko=new P,na=new P,bi=new P,Jo=new P,ia=new P,jo=new P,Na=class{constructor(e=new P,t=new P(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Zn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Zn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zn.copy(this.origin).addScaledVector(this.direction,t),Zn.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Ko.copy(e).add(t).multiplyScalar(.5),na.copy(t).sub(e).normalize(),bi.copy(this.origin).sub(Ko);let r=e.distanceTo(t)*.5,a=-this.direction.dot(na),o=bi.dot(this.direction),l=-bi.dot(na),c=bi.lengthSq(),u=Math.abs(1-a*a),h,d,p,m;if(u>0)if(h=a*l-o,d=a*o-l,m=r*u,h>=0)if(d>=-m)if(d<=m){let v=1/u;h*=v,d*=v,p=h*(h+a*d+2*o)+d*(a*h+d+2*l)+c}else d=r,h=Math.max(0,-(a*d+o)),p=-h*h+d*(d+2*l)+c;else d=-r,h=Math.max(0,-(a*d+o)),p=-h*h+d*(d+2*l)+c;else d<=-m?(h=Math.max(0,-(-a*r+o)),d=h>0?-r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c):d<=m?(h=0,d=Math.min(Math.max(-r,-l),r),p=d*(d+2*l)+c):(h=Math.max(0,-(a*r+o)),d=h>0?r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c);else d=a>0?-r:r,h=Math.max(0,-(a*d+o)),p=-h*h+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),s&&s.copy(Ko).addScaledVector(na,d),p}intersectSphere(e,t){Zn.subVectors(e.center,this.origin);let i=Zn.dot(this.direction),s=Zn.dot(Zn)-i*i,r=e.radius*e.radius;if(s>r)return null;let a=Math.sqrt(r-s),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,a,o,l,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,s=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,s=(e.min.x-d.x)*c),u>=0?(r=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),i>a||r>s||((r>i||isNaN(i))&&(i=r),(a<s||isNaN(s))&&(s=a),h>=0?(o=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),i>l||o>s)||((o>i||i!==i)&&(i=o),(l<s||s!==s)&&(s=l),s<0)?null:this.at(i>=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Zn)!==null}intersectTriangle(e,t,i,s,r){Jo.subVectors(t,e),ia.subVectors(i,e),jo.crossVectors(Jo,ia);let a=this.direction.dot(jo),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;bi.subVectors(this.origin,e);let l=o*this.direction.dot(ia.crossVectors(bi,ia));if(l<0)return null;let c=o*this.direction.dot(Jo.cross(bi));if(c<0||l+c>a)return null;let u=-o*bi.dot(jo);return u<0?null:this.at(u/a,r)}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)}},ct=class n{constructor(e,t,i,s,r,a,o,l,c,u,h,d,p,m,v,g){n.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,a,o,l,c,u,h,d,p,m,v,g)}set(e,t,i,s,r,a,o,l,c,u,h,d,p,m,v,g){let f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=s,f[1]=r,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=u,f[10]=h,f[14]=d,f[3]=p,f[7]=m,f[11]=v,f[15]=g,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 n().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,s=1/Ss.setFromMatrixColumn(e,0).length(),r=1/Ss.setFromMatrixColumn(e,1).length(),a=1/Ss.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,s=e.y,r=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){let d=a*u,p=a*h,m=o*u,v=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+m*c,t[5]=d-v*c,t[9]=-o*l,t[2]=v-d*c,t[6]=m+p*c,t[10]=a*l}else if(e.order==="YXZ"){let d=l*u,p=l*h,m=c*u,v=c*h;t[0]=d+v*o,t[4]=m*o-p,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=p*o-m,t[6]=v+d*o,t[10]=a*l}else if(e.order==="ZXY"){let d=l*u,p=l*h,m=c*u,v=c*h;t[0]=d-v*o,t[4]=-a*h,t[8]=m+p*o,t[1]=p+m*o,t[5]=a*u,t[9]=v-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){let d=a*u,p=a*h,m=o*u,v=o*h;t[0]=l*u,t[4]=m*c-p,t[8]=d*c+v,t[1]=l*h,t[5]=v*c+d,t[9]=p*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){let d=a*l,p=a*c,m=o*l,v=o*c;t[0]=l*u,t[4]=v-d*h,t[8]=m*h+p,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=p*h+m,t[10]=d-v*h}else if(e.order==="XZY"){let d=a*l,p=a*c,m=o*l,v=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+v,t[5]=a*u,t[9]=p*h-m,t[2]=m*h-p,t[6]=o*u,t[10]=v*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Dg,e,Ig)}lookAt(e,t,i){let s=this.elements;return un.subVectors(e,t),un.lengthSq()===0&&(un.z=1),un.normalize(),Ei.crossVectors(i,un),Ei.lengthSq()===0&&(Math.abs(i.z)===1?un.x+=1e-4:un.z+=1e-4,un.normalize(),Ei.crossVectors(i,un)),Ei.normalize(),sa.crossVectors(un,Ei),s[0]=Ei.x,s[4]=sa.x,s[8]=un.x,s[1]=Ei.y,s[5]=sa.y,s[9]=un.y,s[2]=Ei.z,s[6]=sa.z,s[10]=un.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,s=t.elements,r=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],p=i[13],m=i[2],v=i[6],g=i[10],f=i[14],x=i[3],A=i[7],y=i[11],b=i[15],T=s[0],C=s[4],D=s[8],S=s[12],M=s[1],w=s[5],B=s[9],U=s[13],k=s[2],H=s[6],O=s[10],Y=s[14],G=s[3],ee=s[7],ce=s[11],re=s[15];return r[0]=a*T+o*M+l*k+c*G,r[4]=a*C+o*w+l*H+c*ee,r[8]=a*D+o*B+l*O+c*ce,r[12]=a*S+o*U+l*Y+c*re,r[1]=u*T+h*M+d*k+p*G,r[5]=u*C+h*w+d*H+p*ee,r[9]=u*D+h*B+d*O+p*ce,r[13]=u*S+h*U+d*Y+p*re,r[2]=m*T+v*M+g*k+f*G,r[6]=m*C+v*w+g*H+f*ee,r[10]=m*D+v*B+g*O+f*ce,r[14]=m*S+v*U+g*Y+f*re,r[3]=x*T+A*M+y*k+b*G,r[7]=x*C+A*w+y*H+b*ee,r[11]=x*D+A*B+y*O+b*ce,r[15]=x*S+A*U+y*Y+b*re,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],i=e[4],s=e[8],r=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],p=e[14],m=e[3],v=e[7],g=e[11],f=e[15];return m*(+r*l*h-s*c*h-r*o*d+i*c*d+s*o*p-i*l*p)+v*(+t*l*p-t*c*d+r*a*d-s*a*p+s*c*u-r*l*u)+g*(+t*c*h-t*o*p-r*a*h+i*a*p+r*o*u-i*c*u)+f*(-s*o*u-t*l*h+t*o*d+s*a*h-i*a*d+i*l*u)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],m=e[12],v=e[13],g=e[14],f=e[15],x=h*g*c-v*d*c+v*l*p-o*g*p-h*l*f+o*d*f,A=m*d*c-u*g*c-m*l*p+a*g*p+u*l*f-a*d*f,y=u*v*c-m*h*c+m*o*p-a*v*p-u*o*f+a*h*f,b=m*h*l-u*v*l-m*o*d+a*v*d+u*o*g-a*h*g,T=t*x+i*A+s*y+r*b;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let C=1/T;return e[0]=x*C,e[1]=(v*d*r-h*g*r-v*s*p+i*g*p+h*s*f-i*d*f)*C,e[2]=(o*g*r-v*l*r+v*s*c-i*g*c-o*s*f+i*l*f)*C,e[3]=(h*l*r-o*d*r-h*s*c+i*d*c+o*s*p-i*l*p)*C,e[4]=A*C,e[5]=(u*g*r-m*d*r+m*s*p-t*g*p-u*s*f+t*d*f)*C,e[6]=(m*l*r-a*g*r-m*s*c+t*g*c+a*s*f-t*l*f)*C,e[7]=(a*d*r-u*l*r+u*s*c-t*d*c-a*s*p+t*l*p)*C,e[8]=y*C,e[9]=(m*h*r-u*v*r-m*i*p+t*v*p+u*i*f-t*h*f)*C,e[10]=(a*v*r-m*o*r+m*i*c-t*v*c-a*i*f+t*o*f)*C,e[11]=(u*o*r-a*h*r-u*i*c+t*h*c+a*i*p-t*o*p)*C,e[12]=b*C,e[13]=(u*v*s-m*h*s+m*i*d-t*v*d-u*i*g+t*h*g)*C,e[14]=(m*o*s-a*v*s-m*i*l+t*v*l+a*i*g-t*o*g)*C,e[15]=(a*h*s-u*o*s+u*i*l-t*h*l-a*i*d+t*o*d)*C,this}scale(e){let t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),s=Math.sin(t),r=1-i,a=e.x,o=e.y,l=e.z,c=r*a,u=r*o;return this.set(c*a+i,c*o-s*l,c*l+s*o,0,c*o+s*l,u*o+i,u*l-s*a,0,c*l-s*o,u*l+s*a,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,a){return this.set(1,i,r,0,e,1,a,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){let s=this.elements,r=t._x,a=t._y,o=t._z,l=t._w,c=r+r,u=a+a,h=o+o,d=r*c,p=r*u,m=r*h,v=a*u,g=a*h,f=o*h,x=l*c,A=l*u,y=l*h,b=i.x,T=i.y,C=i.z;return s[0]=(1-(v+f))*b,s[1]=(p+y)*b,s[2]=(m-A)*b,s[3]=0,s[4]=(p-y)*T,s[5]=(1-(d+f))*T,s[6]=(g+x)*T,s[7]=0,s[8]=(m+A)*C,s[9]=(g-x)*C,s[10]=(1-(d+v))*C,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){let s=this.elements,r=Ss.set(s[0],s[1],s[2]).length(),a=Ss.set(s[4],s[5],s[6]).length(),o=Ss.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Tn.copy(this);let c=1/r,u=1/a,h=1/o;return Tn.elements[0]*=c,Tn.elements[1]*=c,Tn.elements[2]*=c,Tn.elements[4]*=u,Tn.elements[5]*=u,Tn.elements[6]*=u,Tn.elements[8]*=h,Tn.elements[9]*=h,Tn.elements[10]*=h,t.setFromRotationMatrix(Tn),i.x=r,i.y=a,i.z=o,this}makePerspective(e,t,i,s,r,a,o=ni){let l=this.elements,c=2*r/(t-e),u=2*r/(i-s),h=(t+e)/(t-e),d=(i+s)/(i-s),p,m;if(o===ni)p=-(a+r)/(a-r),m=-2*a*r/(a-r);else if(o===Pa)p=-a/(a-r),m=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,a,o=ni){let l=this.elements,c=1/(t-e),u=1/(i-s),h=1/(a-r),d=(t+e)*c,p=(i+s)*u,m,v;if(o===ni)m=(a+r)*h,v=-2*h;else if(o===Pa)m=r*h,v=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=v,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},Ss=new P,Tn=new ct,Dg=new P(0,0,0),Ig=new P(1,1,1),Ei=new P,sa=new P,un=new P,ff=new ct,df=new zn,Xt=class n{constructor(e=0,t=0,i=0,s=n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}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,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let s=e.elements,r=s[0],a=s[4],o=s[8],l=s[1],c=s[5],u=s[9],h=s[2],d=s[6],p=s[10];switch(t){case"XYZ":this._y=Math.asin(Tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Tt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Tt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Tt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Tt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return ff.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ff,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return df.setFromEuler(this),this.setFromQuaternion(df,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Xt.DEFAULT_ORDER="XYZ";var Fa=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},Pg=0,pf=new P,_s=new zn,Kn=new ct,ra=new P,dr=new P,Ug=new P,Bg=new zn,mf=new P(1,0,0),gf=new P(0,1,0),vf=new P(0,0,1),xf={type:"added"},Lg={type:"removed"},bs={type:"childadded",child:null},$o={type:"childremoved",child:null},Ot=class n extends nn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Pg++}),this.uuid=is(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let e=new P,t=new Xt,i=new zn,s=new P(1,1,1);function r(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(r),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new ct},normalMatrix:{value:new Ge}}),this.matrix=new ct,this.matrixWorld=new ct,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Fa,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return _s.setFromAxisAngle(e,t),this.quaternion.multiply(_s),this}rotateOnWorldAxis(e,t){return _s.setFromAxisAngle(e,t),this.quaternion.premultiply(_s),this}rotateX(e){return this.rotateOnAxis(mf,e)}rotateY(e){return this.rotateOnAxis(gf,e)}rotateZ(e){return this.rotateOnAxis(vf,e)}translateOnAxis(e,t){return pf.copy(e).applyQuaternion(this.quaternion),this.position.add(pf.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(mf,e)}translateY(e){return this.translateOnAxis(gf,e)}translateZ(e){return this.translateOnAxis(vf,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Kn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?ra.copy(e):ra.set(e,t,i);let s=this.parent;this.updateWorldMatrix(!0,!1),dr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Kn.lookAt(dr,ra,this.up):Kn.lookAt(ra,dr,this.up),this.quaternion.setFromRotationMatrix(Kn),s&&(Kn.extractRotation(s.matrixWorld),_s.setFromRotationMatrix(Kn),this.quaternion.premultiply(_s.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(xf),bs.child=e,this.dispatchEvent(bs),bs.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Lg),$o.child=e,this.dispatchEvent($o),$o.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Kn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Kn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Kn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(xf),bs.child=e,this.dispatchEvent(bs),bs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,s=this.children.length;i<s;i++){let a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let s=this.children;for(let r=0,a=s.length;r<a;r++)s[r].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dr,e,Ug),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dr,Bg,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){let s=this.children;for(let r=0,a=s.length;r<a;r++)s[r].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function r(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let h=l[c];r(e.shapes,h)}else r(e.shapes,l)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(r(e.materials,this.material[l]));s.material=o}else s.material=r(e.materials,this.material);if(this.children.length>0){s.children=[];for(let o=0;o<this.children.length;o++)s.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let o=0;o<this.animations.length;o++){let l=this.animations[o];s.animations.push(r(e.animations,l))}}if(t){let o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),h=a(e.shapes),d=a(e.skeletons),p=a(e.animations),m=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=s,i;function a(o){let l=[];for(let c in o){let u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){let s=e.children[i];this.add(s.clone())}return this}};Ot.DEFAULT_UP=new P(0,1,0);Ot.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Cn=new P,Jn=new P,el=new P,jn=new P,Es=new P,ws=new P,yf=new P,tl=new P,nl=new P,il=new P,sl=new Ke,rl=new Ke,al=new Ke,Ki=class n{constructor(e=new P,t=new P,i=new P){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,s){s.subVectors(i,t),Cn.subVectors(e,t),s.cross(Cn);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){Cn.subVectors(s,t),Jn.subVectors(i,t),el.subVectors(e,t);let a=Cn.dot(Cn),o=Cn.dot(Jn),l=Cn.dot(el),c=Jn.dot(Jn),u=Jn.dot(el),h=a*c-o*o;if(h===0)return r.set(0,0,0),null;let d=1/h,p=(c*l-o*u)*d,m=(a*u-o*l)*d;return r.set(1-p-m,m,p)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,jn)===null?!1:jn.x>=0&&jn.y>=0&&jn.x+jn.y<=1}static getInterpolation(e,t,i,s,r,a,o,l){return this.getBarycoord(e,t,i,s,jn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,jn.x),l.addScaledVector(a,jn.y),l.addScaledVector(o,jn.z),l)}static getInterpolatedAttribute(e,t,i,s,r,a){return sl.setScalar(0),rl.setScalar(0),al.setScalar(0),sl.fromBufferAttribute(e,t),rl.fromBufferAttribute(e,i),al.fromBufferAttribute(e,s),a.setScalar(0),a.addScaledVector(sl,r.x),a.addScaledVector(rl,r.y),a.addScaledVector(al,r.z),a}static isFrontFacing(e,t,i,s){return Cn.subVectors(i,t),Jn.subVectors(e,t),Cn.cross(Jn).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),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 Cn.subVectors(this.c,this.b),Jn.subVectors(this.a,this.b),Cn.cross(Jn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return n.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return n.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,s,r){return n.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return n.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return n.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,s=this.b,r=this.c,a,o;Es.subVectors(s,i),ws.subVectors(r,i),tl.subVectors(e,i);let l=Es.dot(tl),c=ws.dot(tl);if(l<=0&&c<=0)return t.copy(i);nl.subVectors(e,s);let u=Es.dot(nl),h=ws.dot(nl);if(u>=0&&h<=u)return t.copy(s);let d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(Es,a);il.subVectors(e,r);let p=Es.dot(il),m=ws.dot(il);if(m>=0&&p<=m)return t.copy(r);let v=p*c-l*m;if(v<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(ws,o);let g=u*m-p*h;if(g<=0&&h-u>=0&&p-m>=0)return yf.subVectors(r,s),o=(h-u)/(h-u+(p-m)),t.copy(s).addScaledVector(yf,o);let f=1/(g+v+d);return a=v*f,o=d*f,t.copy(i).addScaledVector(Es,a).addScaledVector(ws,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Sd={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},wi={h:0,s:0,l:0},aa={h:0,s:0,l:0};function ol(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}var Pe=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=$e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,nt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=nt.workingColorSpace){return this.r=e,this.g=t,this.b=i,nt.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=nt.workingColorSpace){if(e=tu(e,1),t=Tt(t,0,1),i=Tt(i,0,1),t===0)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,a=2*i-r;this.r=ol(a,r,e+1/3),this.g=ol(a,r,e),this.b=ol(a,r,e-1/3)}return nt.toWorkingColorSpace(this,s),this}setStyle(e,t=$e){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=s[1],o=s[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=s[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=$e){let i=Sd[e.toLowerCase()];return i!==void 0?this.setHex(i,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=ii(e.r),this.g=ii(e.g),this.b=ii(e.b),this}copyLinearToSRGB(e){return this.r=Ns(e.r),this.g=Ns(e.g),this.b=Ns(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=$e){return nt.fromWorkingColorSpace(Gt.copy(this),e),Math.round(Tt(Gt.r*255,0,255))*65536+Math.round(Tt(Gt.g*255,0,255))*256+Math.round(Tt(Gt.b*255,0,255))}getHexString(e=$e){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=nt.workingColorSpace){nt.fromWorkingColorSpace(Gt.copy(this),t);let i=Gt.r,s=Gt.g,r=Gt.b,a=Math.max(i,s,r),o=Math.min(i,s,r),l,c,u=(o+a)/2;if(o===a)l=0,c=0;else{let h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case i:l=(s-r)/h+(s<r?6:0);break;case s:l=(r-i)/h+2;break;case r:l=(i-s)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=nt.workingColorSpace){return nt.fromWorkingColorSpace(Gt.copy(this),t),e.r=Gt.r,e.g=Gt.g,e.b=Gt.b,e}getStyle(e=$e){nt.fromWorkingColorSpace(Gt.copy(this),e);let t=Gt.r,i=Gt.g,s=Gt.b;return e!==$e?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(e,t,i){return this.getHSL(wi),this.setHSL(wi.h+e,wi.s+t,wi.l+i)}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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(wi),e.getHSL(aa);let i=Mr(wi.h,aa.h,t),s=Mr(wi.s,aa.s,t),r=Mr(wi.l,aa.l,t);return this.setHSL(i,s,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,s=this.b,r=e.elements;return this.r=r[0]*t+r[3]*i+r[6]*s,this.g=r[1]*t+r[4]*i+r[7]*s,this.b=r[2]*t+r[5]*i+r[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Gt=new Pe;Pe.NAMES=Sd;var Ng=0,xn=class extends nn{static get type(){return"Material"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ng++}),this.uuid=is(),this.name="",this.blending=Ci,this.side=On,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Sl,this.blendDst=_l,this.blendEquation=Zi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Pe(0,0,0),this.blendAlpha=0,this.depthFunc=Os,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ef,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vs,this.stencilZFail=vs,this.stencilZPass=vs,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ci&&(i.blending=this.blending),this.side!==On&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Sl&&(i.blendSrc=this.blendSrc),this.blendDst!==_l&&(i.blendDst=this.blendDst),this.blendEquation!==Zi&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Os&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ef&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vs&&(i.stencilFail=this.stencilFail),this.stencilZFail!==vs&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==vs&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){let a=[];for(let o in r){let l=r[o];delete l.metadata,a.push(l)}return a}if(t){let r=s(e.textures),a=s(e.images);r.length>0&&(i.textures=r),a.length>0&&(i.images=a)}return i}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,i=null;if(t!==null){let s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,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){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}},Oa=class extends xn{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xt,this.combine=od,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};var Et=new P,oa=new K,mt=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=tf,this.updateRanges=[],this.gpuType=Fn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[e+s]=t.array[i+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)oa.fromBufferAttribute(this,t),oa.applyMatrix3(e),this.setXY(t,oa.x,oa.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Et.fromBufferAttribute(this,t),Et.applyMatrix3(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Et.fromBufferAttribute(this,t),Et.applyMatrix4(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Et.fromBufferAttribute(this,t),Et.applyNormalMatrix(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Et.fromBufferAttribute(this,t),Et.transformDirection(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Ps(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Zt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ps(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ps(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zt(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=Ps(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zt(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=Ps(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),i=Zt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,s){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),i=Zt(i,this.array),s=Zt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=s,this}setXYZW(e,t,i,s,r){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),i=Zt(i,this.array),s=Zt(s,this.array),r=Zt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=s,this.array[e+3]=r,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!==tf&&(e.usage=this.usage),e}};var ka=class extends mt{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var za=class extends mt{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var xt=class extends mt{constructor(e,t,i){super(new Float32Array(e),t,i)}},Fg=0,gn=new ct,ll=new Ot,Ts=new P,hn=new ri,pr=new ri,Ut=new P,Nt=class n extends nn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Fg++}),this.uuid=is(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Md(e)?za:ka)(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 this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let r=new Ge().getNormalMatrix(e);i.applyNormalMatrix(r),i.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return gn.makeRotationFromQuaternion(e),this.applyMatrix4(gn),this}rotateX(e){return gn.makeRotationX(e),this.applyMatrix4(gn),this}rotateY(e){return gn.makeRotationY(e),this.applyMatrix4(gn),this}rotateZ(e){return gn.makeRotationZ(e),this.applyMatrix4(gn),this}translate(e,t,i){return gn.makeTranslation(e,t,i),this.applyMatrix4(gn),this}scale(e,t,i){return gn.makeScale(e,t,i),this.applyMatrix4(gn),this}lookAt(e){return ll.lookAt(e),ll.updateMatrix(),this.applyMatrix4(ll.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ts).negate(),this.translate(Ts.x,Ts.y,Ts.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let i=[];for(let s=0,r=e.length;s<r;s++){let a=e[s];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new xt(i,3))}else{for(let i=0,s=t.count;i<s;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.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(){this.boundingBox===null&&(this.boundingBox=new ri);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 P(-1/0,-1/0,-1/0),new P(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,s=t.length;i<s;i++){let r=t[i];hn.setFromBufferAttribute(r),this.morphTargetsRelative?(Ut.addVectors(this.boundingBox.min,hn.min),this.boundingBox.expandByPoint(Ut),Ut.addVectors(this.boundingBox.max,hn.max),this.boundingBox.expandByPoint(Ut)):(this.boundingBox.expandByPoint(hn.min),this.boundingBox.expandByPoint(hn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Pi);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new P,1/0);return}if(e){let i=this.boundingSphere.center;if(hn.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){let o=t[r];pr.setFromBufferAttribute(o),this.morphTargetsRelative?(Ut.addVectors(hn.min,pr.min),hn.expandByPoint(Ut),Ut.addVectors(hn.max,pr.max),hn.expandByPoint(Ut)):(hn.expandByPoint(pr.min),hn.expandByPoint(pr.max))}hn.getCenter(i);let s=0;for(let r=0,a=e.count;r<a;r++)Ut.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(Ut));if(t)for(let r=0,a=t.length;r<a;r++){let o=t[r],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)Ut.fromBufferAttribute(o,c),l&&(Ts.fromBufferAttribute(e,c),Ut.add(Ts)),s=Math.max(s,i.distanceToSquared(Ut))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,s=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new mt(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),o=[],l=[];for(let D=0;D<i.count;D++)o[D]=new P,l[D]=new P;let c=new P,u=new P,h=new P,d=new K,p=new K,m=new K,v=new P,g=new P;function f(D,S,M){c.fromBufferAttribute(i,D),u.fromBufferAttribute(i,S),h.fromBufferAttribute(i,M),d.fromBufferAttribute(r,D),p.fromBufferAttribute(r,S),m.fromBufferAttribute(r,M),u.sub(c),h.sub(c),p.sub(d),m.sub(d);let w=1/(p.x*m.y-m.x*p.y);isFinite(w)&&(v.copy(u).multiplyScalar(m.y).addScaledVector(h,-p.y).multiplyScalar(w),g.copy(h).multiplyScalar(p.x).addScaledVector(u,-m.x).multiplyScalar(w),o[D].add(v),o[S].add(v),o[M].add(v),l[D].add(g),l[S].add(g),l[M].add(g))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let D=0,S=x.length;D<S;++D){let M=x[D],w=M.start,B=M.count;for(let U=w,k=w+B;U<k;U+=3)f(e.getX(U+0),e.getX(U+1),e.getX(U+2))}let A=new P,y=new P,b=new P,T=new P;function C(D){b.fromBufferAttribute(s,D),T.copy(b);let S=o[D];A.copy(S),A.sub(b.multiplyScalar(b.dot(S))).normalize(),y.crossVectors(T,S);let w=y.dot(l[D])<0?-1:1;a.setXYZW(D,A.x,A.y,A.z,w)}for(let D=0,S=x.length;D<S;++D){let M=x[D],w=M.start,B=M.count;for(let U=w,k=w+B;U<k;U+=3)C(e.getX(U+0)),C(e.getX(U+1)),C(e.getX(U+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new mt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);let s=new P,r=new P,a=new P,o=new P,l=new P,c=new P,u=new P,h=new P;if(e)for(let d=0,p=e.count;d<p;d+=3){let m=e.getX(d+0),v=e.getX(d+1),g=e.getX(d+2);s.fromBufferAttribute(t,m),r.fromBufferAttribute(t,v),a.fromBufferAttribute(t,g),u.subVectors(a,r),h.subVectors(s,r),u.cross(h),o.fromBufferAttribute(i,m),l.fromBufferAttribute(i,v),c.fromBufferAttribute(i,g),o.add(u),l.add(u),c.add(u),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(v,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,p=t.count;d<p;d+=3)s.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),u.subVectors(a,r),h.subVectors(s,r),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Ut.fromBufferAttribute(e,t),Ut.normalize(),e.setXYZ(t,Ut.x,Ut.y,Ut.z)}toNonIndexed(){function e(o,l){let c=o.array,u=o.itemSize,h=o.normalized,d=new c.constructor(l.length*u),p=0,m=0;for(let v=0,g=l.length;v<g;v++){o.isInterleavedBufferAttribute?p=l[v]*o.data.stride+o.offset:p=l[v]*u;for(let f=0;f<u;f++)d[m++]=c[p++]}return new mt(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new n,i=this.index.array,s=this.attributes;for(let o in s){let l=s[o],c=e(l,i);t.setAttribute(o,c)}let r=this.morphAttributes;for(let o in r){let l=[],c=r[o];for(let u=0,h=c.length;u<h;u++){let d=c[u],p=e(d,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,l=a.length;o<l;o++){let c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let l in i){let c=i[l];e.data.attributes[l]=c.toJSON(e.data)}let s={},r=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){let p=c[h];u.push(p.toJSON(e.data))}u.length>0&&(s[l]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let s=e.attributes;for(let c in s){let u=s[c];this.setAttribute(c,u.clone(t))}let r=e.morphAttributes;for(let c in r){let u=[],h=r[c];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let c=0,u=a.length;c<u;c++){let h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},Af=new ct,Wi=new Na,la=new Pi,Mf=new P,ca=new P,ua=new P,ha=new P,cl=new P,fa=new P,Sf=new P,da=new P,et=class extends Ot{constructor(e=new Nt,t=new Oa){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){let o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){let i=this.geometry,s=i.attributes.position,r=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(s,e);let o=this.morphTargetInfluences;if(r&&o){fa.set(0,0,0);for(let l=0,c=r.length;l<c;l++){let u=o[l],h=r[l];u!==0&&(cl.fromBufferAttribute(h,e),a?fa.addScaledVector(cl,u):fa.addScaledVector(cl.sub(t),u))}t.add(fa)}return t}raycast(e,t){let i=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),la.copy(i.boundingSphere),la.applyMatrix4(r),Wi.copy(e.ray).recast(e.near),!(la.containsPoint(Wi.origin)===!1&&(Wi.intersectSphere(la,Mf)===null||Wi.origin.distanceToSquared(Mf)>(e.far-e.near)**2))&&(Af.copy(r).invert(),Wi.copy(e.ray).applyMatrix4(Af),!(i.boundingBox!==null&&Wi.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Wi)))}_computeIntersections(e,t,i){let s,r=this.geometry,a=this.material,o=r.index,l=r.attributes.position,c=r.attributes.uv,u=r.attributes.uv1,h=r.attributes.normal,d=r.groups,p=r.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,v=d.length;m<v;m++){let g=d[m],f=a[g.materialIndex],x=Math.max(g.start,p.start),A=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let y=x,b=A;y<b;y+=3){let T=o.getX(y),C=o.getX(y+1),D=o.getX(y+2);s=pa(this,f,e,i,c,u,h,T,C,D),s&&(s.faceIndex=Math.floor(y/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{let m=Math.max(0,p.start),v=Math.min(o.count,p.start+p.count);for(let g=m,f=v;g<f;g+=3){let x=o.getX(g),A=o.getX(g+1),y=o.getX(g+2);s=pa(this,a,e,i,c,u,h,x,A,y),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,v=d.length;m<v;m++){let g=d[m],f=a[g.materialIndex],x=Math.max(g.start,p.start),A=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let y=x,b=A;y<b;y+=3){let T=y,C=y+1,D=y+2;s=pa(this,f,e,i,c,u,h,T,C,D),s&&(s.faceIndex=Math.floor(y/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{let m=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let g=m,f=v;g<f;g+=3){let x=g,A=g+1,y=g+2;s=pa(this,a,e,i,c,u,h,x,A,y),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}}};function Og(n,e,t,i,s,r,a,o){let l;if(e.side===Ct?l=i.intersectTriangle(a,r,s,!0,o):l=i.intersectTriangle(s,r,a,e.side===On,o),l===null)return null;da.copy(o),da.applyMatrix4(n.matrixWorld);let c=t.ray.origin.distanceTo(da);return c<t.near||c>t.far?null:{distance:c,point:da.clone(),object:n}}function pa(n,e,t,i,s,r,a,o,l,c){n.getVertexPosition(o,ca),n.getVertexPosition(l,ua),n.getVertexPosition(c,ha);let u=Og(n,e,t,i,ca,ua,ha,Sf);if(u){let h=new P;Ki.getBarycoord(Sf,ca,ua,ha,h),s&&(u.uv=Ki.getInterpolatedAttribute(s,o,l,c,h,new K)),r&&(u.uv1=Ki.getInterpolatedAttribute(r,o,l,c,h,new K)),a&&(u.normal=Ki.getInterpolatedAttribute(a,o,l,c,h,new P),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));let d={a:o,b:l,c,normal:new P,materialIndex:0};Ki.getNormal(ca,ua,ha,d.normal),u.face=d,u.barycoord=h}return u}var $i=class n extends Nt{constructor(e=1,t=1,i=1,s=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:a};let o=this;s=Math.floor(s),r=Math.floor(r),a=Math.floor(a);let l=[],c=[],u=[],h=[],d=0,p=0;m("z","y","x",-1,-1,i,t,e,a,r,0),m("z","y","x",1,-1,i,t,-e,a,r,1),m("x","z","y",1,1,e,i,t,s,a,2),m("x","z","y",1,-1,e,i,-t,s,a,3),m("x","y","z",1,-1,e,t,i,s,r,4),m("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new xt(c,3)),this.setAttribute("normal",new xt(u,3)),this.setAttribute("uv",new xt(h,2));function m(v,g,f,x,A,y,b,T,C,D,S){let M=y/C,w=b/D,B=y/2,U=b/2,k=T/2,H=C+1,O=D+1,Y=0,G=0,ee=new P;for(let ce=0;ce<O;ce++){let re=ce*w-U;for(let Me=0;Me<H;Me++){let Le=Me*M-B;ee[v]=Le*x,ee[g]=re*A,ee[f]=k,c.push(ee.x,ee.y,ee.z),ee[v]=0,ee[g]=0,ee[f]=T>0?1:-1,u.push(ee.x,ee.y,ee.z),h.push(Me/C),h.push(1-ce/D),Y+=1}}for(let ce=0;ce<D;ce++)for(let re=0;re<C;re++){let Me=d+re+H*ce,Le=d+re+H*(ce+1),q=d+(re+1)+H*(ce+1),te=d+(re+1)+H*ce;l.push(Me,Le,te),l.push(Le,q,te),G+=6}o.addGroup(p,G,S),p+=G,d+=Y}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function Hs(n){let e={};for(let t in n){e[t]={};for(let i in n[t]){let s=n[t][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=s.clone():Array.isArray(s)?e[t][i]=s.slice():e[t][i]=s}}return e}function Kt(n){let e={};for(let t=0;t<n.length;t++){let i=Hs(n[t]);for(let s in i)e[s]=i[s]}return e}function kg(n){let e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function _d(n){let e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:nt.workingColorSpace}var zg={clone:Hs,merge:Kt},Hg=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Gg=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`,Je=class extends xn{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Hg,this.fragmentShader=Gg,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Hs(e.uniforms),this.uniformsGroups=kg(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let s in this.uniforms){let a=this.uniforms[s].value;a&&a.isTexture?t.uniforms[s]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[s]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[s]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[s]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[s]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[s]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[s]={type:"m4",value:a.toArray()}:t.uniforms[s]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},Ui=class extends Ot{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ct,this.projectionMatrix=new ct,this.projectionMatrixInverse=new ct,this.coordinateSystem=ni}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)}},Ti=new P,_f=new K,bf=new K,Bt=class extends Ui{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Tr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Ar*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Tr*2*Math.atan(Math.tan(Ar*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Ti.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ti.x,Ti.y).multiplyScalar(-e/Ti.z),Ti.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Ti.x,Ti.y).multiplyScalar(-e/Ti.z)}getViewSize(e,t){return this.getViewBounds(e,_f,bf),t.subVectors(bf,_f)}setViewOffset(e,t,i,s,r,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Ar*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s,a=this.view;if(this.view!==null&&this.view.enabled){let l=a.fullWidth,c=a.fullHeight;r+=a.offsetX*s/l,t-=a.offsetY*i/c,s*=a.width/l,i*=a.height/c}let o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far,this.coordinateSystem),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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},Cs=-90,Rs=1,hc=class extends Ot{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new Bt(Cs,Rs,e,t);s.layers=this.layers,this.add(s);let r=new Bt(Cs,Rs,e,t);r.layers=this.layers,this.add(r);let a=new Bt(Cs,Rs,e,t);a.layers=this.layers,this.add(a);let o=new Bt(Cs,Rs,e,t);o.layers=this.layers,this.add(o);let l=new Bt(Cs,Rs,e,t);l.layers=this.layers,this.add(l);let c=new Bt(Cs,Rs,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,s,r,a,o,l]=t;for(let c of t)this.remove(c);if(e===ni)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Pa)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,o,l,c,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;let v=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(t,r),e.setRenderTarget(i,1,s),e.render(t,a),e.setRenderTarget(i,2,s),e.render(t,o),e.setRenderTarget(i,3,s),e.render(t,l),e.setRenderTarget(i,4,s),e.render(t,c),i.texture.generateMipmaps=v,e.setRenderTarget(i,5,s),e.render(t,u),e.setRenderTarget(h,d,p),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}},Ha=class extends Ft{constructor(e,t,i,s,r,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:ks,super(e,t,i,s,r,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},fc=class extends at{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new Ha(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Vt}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 i={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},s=new $i(5,5,5),r=new Je({name:"CubemapFromEquirect",uniforms:Hs(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ct,blending:_t});r.uniforms.tEquirect.value=t;let a=new et(s,r),o=t.minFilter;return t.minFilter===ti&&(t.minFilter=Vt),new hc(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,s){let r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,s);e.setRenderTarget(r)}},ul=new P,Vg=new P,Wg=new Ge,ei=class{constructor(e=new P(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let s=ul.subVectors(i,t).cross(Vg.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(ul),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||Wg.getNormalMatrix(e),s=this.coplanarPoint(ul).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),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)}},Xi=new Pi,ma=new P,Cr=class{constructor(e=new ei,t=new ei,i=new ei,s=new ei,r=new ei,a=new ei){this.planes=[e,t,i,s,r,a]}set(e,t,i,s,r,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(s),o[4].copy(r),o[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=ni){let i=this.planes,s=e.elements,r=s[0],a=s[1],o=s[2],l=s[3],c=s[4],u=s[5],h=s[6],d=s[7],p=s[8],m=s[9],v=s[10],g=s[11],f=s[12],x=s[13],A=s[14],y=s[15];if(i[0].setComponents(l-r,d-c,g-p,y-f).normalize(),i[1].setComponents(l+r,d+c,g+p,y+f).normalize(),i[2].setComponents(l+a,d+u,g+m,y+x).normalize(),i[3].setComponents(l-a,d-u,g-m,y-x).normalize(),i[4].setComponents(l-o,d-h,g-v,y-A).normalize(),t===ni)i[5].setComponents(l+o,d+h,g+v,y+A).normalize();else if(t===Pa)i[5].setComponents(o,h,v,A).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Xi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Xi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Xi)}intersectsSprite(e){return Xi.center.set(0,0,0),Xi.radius=.7071067811865476,Xi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xi)}intersectsSphere(e){let t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let s=t[i];if(ma.x=s.normal.x>0?e.max.x:e.min.x,ma.y=s.normal.y>0?e.max.y:e.min.y,ma.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(ma)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function bd(){let n=null,e=!1,t=null,i=null;function s(r,a){t(r,a),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function Xg(n){let e=new WeakMap;function t(o,l){let c=o.array,u=o.usage,h=c.byteLength,d=n.createBuffer();n.bindBuffer(l,d),n.bufferData(l,c,u),o.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function i(o,l,c){let u=l.array,h=l.updateRanges;if(n.bindBuffer(c,o),h.length===0)n.bufferSubData(c,0,u);else{h.sort((p,m)=>p.start-m.start);let d=0;for(let p=1;p<h.length;p++){let m=h[d],v=h[p];v.start<=m.start+m.count+1?m.count=Math.max(m.count,v.start+v.count-m.start):(++d,h[d]=v)}h.length=d+1;for(let p=0,m=h.length;p<m;p++){let v=h[p];n.bufferSubData(c,v.start*u.BYTES_PER_ELEMENT,u,v.start,v.count)}l.clearUpdateRanges()}l.onUploadCallback()}function s(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);let l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){let u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:s,remove:r,update:a}}var Gs=class n extends Nt{constructor(e=1,t=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:s};let r=e/2,a=t/2,o=Math.floor(i),l=Math.floor(s),c=o+1,u=l+1,h=e/o,d=t/l,p=[],m=[],v=[],g=[];for(let f=0;f<u;f++){let x=f*d-a;for(let A=0;A<c;A++){let y=A*h-r;m.push(y,-x,0),v.push(0,0,1),g.push(A/o),g.push(1-f/l)}}for(let f=0;f<l;f++)for(let x=0;x<o;x++){let A=x+c*f,y=x+c*(f+1),b=x+1+c*(f+1),T=x+1+c*f;p.push(A,y,T),p.push(y,b,T)}this.setIndex(p),this.setAttribute("position",new xt(m,3)),this.setAttribute("normal",new xt(v,3)),this.setAttribute("uv",new xt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}},Yg=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,qg=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,Qg=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,Zg=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Kg=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,Jg=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,jg=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,$g=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,e0=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,t0=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,n0=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,i0=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,s0=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,r0=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		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 ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,a0=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,o0=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,l0=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,c0=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,u0=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,h0=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,f0=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,d0=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,p0=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,m0=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,g0=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,v0=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,x0=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,y0=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,A0=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,M0=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,S0="gl_FragColor = linearToOutputTexel( gl_FragColor );",_0=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( 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 );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,b0=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,E0=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,w0=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,T0=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,C0=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,R0=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,D0=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,I0=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,P0=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,U0=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,B0=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,L0=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,N0=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void 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 ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,F0=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,O0=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,k0=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,z0=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void 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 ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,H0=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,G0=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void 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 ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void 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 ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,V0=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,W0=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	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 ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void 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 ) {
#else
void 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 ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	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 ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void 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 ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,X0=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,Y0=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,q0=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,Q0=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,Z0=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,K0=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,J0=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,j0=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,$0=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,ev=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,tv=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,nv=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,iv=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,sv=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,rv=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,av=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,ov=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,lv=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,cv=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,uv=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,hv=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,fv=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,dv=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,pv=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,mv=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,gv=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,vv=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,xv=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,yv=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Av=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * depth - far );
}`,Mv=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,Sv=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,_v=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,bv=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,Ev=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,wv=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,Tv=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			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 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,Cv=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,Rv=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,Dv=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,Iv=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,Pv=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,Uv=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,Bv=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,Lv=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,Nv=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,Fv=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,Ov=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,kv=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,zv=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
		
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
		
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		
		#else
		
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,Hv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Gv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Vv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,Wv=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`,Xv=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,Yv=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		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 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,qv=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Qv=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Zv=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Kv=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Jv=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,jv=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,$v=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,ex=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,tx=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,nx=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,ix=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,sx=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,rx=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,ax=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,ox=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,lx=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,cx=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,ux=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,hx=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,fx=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,dx=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,px=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,mx=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,gx=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,vx=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,xx=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,yx=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,Ax=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,Mx=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Sx=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,_x=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,bx=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,We={alphahash_fragment:Yg,alphahash_pars_fragment:qg,alphamap_fragment:Qg,alphamap_pars_fragment:Zg,alphatest_fragment:Kg,alphatest_pars_fragment:Jg,aomap_fragment:jg,aomap_pars_fragment:$g,batching_pars_vertex:e0,batching_vertex:t0,begin_vertex:n0,beginnormal_vertex:i0,bsdfs:s0,iridescence_fragment:r0,bumpmap_pars_fragment:a0,clipping_planes_fragment:o0,clipping_planes_pars_fragment:l0,clipping_planes_pars_vertex:c0,clipping_planes_vertex:u0,color_fragment:h0,color_pars_fragment:f0,color_pars_vertex:d0,color_vertex:p0,common:m0,cube_uv_reflection_fragment:g0,defaultnormal_vertex:v0,displacementmap_pars_vertex:x0,displacementmap_vertex:y0,emissivemap_fragment:A0,emissivemap_pars_fragment:M0,colorspace_fragment:S0,colorspace_pars_fragment:_0,envmap_fragment:b0,envmap_common_pars_fragment:E0,envmap_pars_fragment:w0,envmap_pars_vertex:T0,envmap_physical_pars_fragment:O0,envmap_vertex:C0,fog_vertex:R0,fog_pars_vertex:D0,fog_fragment:I0,fog_pars_fragment:P0,gradientmap_pars_fragment:U0,lightmap_pars_fragment:B0,lights_lambert_fragment:L0,lights_lambert_pars_fragment:N0,lights_pars_begin:F0,lights_toon_fragment:k0,lights_toon_pars_fragment:z0,lights_phong_fragment:H0,lights_phong_pars_fragment:G0,lights_physical_fragment:V0,lights_physical_pars_fragment:W0,lights_fragment_begin:X0,lights_fragment_maps:Y0,lights_fragment_end:q0,logdepthbuf_fragment:Q0,logdepthbuf_pars_fragment:Z0,logdepthbuf_pars_vertex:K0,logdepthbuf_vertex:J0,map_fragment:j0,map_pars_fragment:$0,map_particle_fragment:ev,map_particle_pars_fragment:tv,metalnessmap_fragment:nv,metalnessmap_pars_fragment:iv,morphinstance_vertex:sv,morphcolor_vertex:rv,morphnormal_vertex:av,morphtarget_pars_vertex:ov,morphtarget_vertex:lv,normal_fragment_begin:cv,normal_fragment_maps:uv,normal_pars_fragment:hv,normal_pars_vertex:fv,normal_vertex:dv,normalmap_pars_fragment:pv,clearcoat_normal_fragment_begin:mv,clearcoat_normal_fragment_maps:gv,clearcoat_pars_fragment:vv,iridescence_pars_fragment:xv,opaque_fragment:yv,packing:Av,premultiplied_alpha_fragment:Mv,project_vertex:Sv,dithering_fragment:_v,dithering_pars_fragment:bv,roughnessmap_fragment:Ev,roughnessmap_pars_fragment:wv,shadowmap_pars_fragment:Tv,shadowmap_pars_vertex:Cv,shadowmap_vertex:Rv,shadowmask_pars_fragment:Dv,skinbase_vertex:Iv,skinning_pars_vertex:Pv,skinning_vertex:Uv,skinnormal_vertex:Bv,specularmap_fragment:Lv,specularmap_pars_fragment:Nv,tonemapping_fragment:Fv,tonemapping_pars_fragment:Ov,transmission_fragment:kv,transmission_pars_fragment:zv,uv_pars_fragment:Hv,uv_pars_vertex:Gv,uv_vertex:Vv,worldpos_vertex:Wv,background_vert:Xv,background_frag:Yv,backgroundCube_vert:qv,backgroundCube_frag:Qv,cube_vert:Zv,cube_frag:Kv,depth_vert:Jv,depth_frag:jv,distanceRGBA_vert:$v,distanceRGBA_frag:ex,equirect_vert:tx,equirect_frag:nx,linedashed_vert:ix,linedashed_frag:sx,meshbasic_vert:rx,meshbasic_frag:ax,meshlambert_vert:ox,meshlambert_frag:lx,meshmatcap_vert:cx,meshmatcap_frag:ux,meshnormal_vert:hx,meshnormal_frag:fx,meshphong_vert:dx,meshphong_frag:px,meshphysical_vert:mx,meshphysical_frag:gx,meshtoon_vert:vx,meshtoon_frag:xx,points_vert:yx,points_frag:Ax,shadow_vert:Mx,shadow_frag:Sx,sprite_vert:_x,sprite_frag:bx},ue={common:{diffuse:{value:new Pe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ge}},envmap:{envMap:{value:null},envMapRotation:{value:new Ge},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ge}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ge}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ge},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ge},normalScale:{value:new K(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ge},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ge}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ge}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ge}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Pe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0},uvTransform:{value:new Ge}},sprite:{diffuse:{value:new Pe(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}}},Nn={basic:{uniforms:Kt([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.fog]),vertexShader:We.meshbasic_vert,fragmentShader:We.meshbasic_frag},lambert:{uniforms:Kt([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,ue.lights,{emissive:{value:new Pe(0)}}]),vertexShader:We.meshlambert_vert,fragmentShader:We.meshlambert_frag},phong:{uniforms:Kt([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,ue.lights,{emissive:{value:new Pe(0)},specular:{value:new Pe(1118481)},shininess:{value:30}}]),vertexShader:We.meshphong_vert,fragmentShader:We.meshphong_frag},standard:{uniforms:Kt([ue.common,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.roughnessmap,ue.metalnessmap,ue.fog,ue.lights,{emissive:{value:new Pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:We.meshphysical_vert,fragmentShader:We.meshphysical_frag},toon:{uniforms:Kt([ue.common,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.gradientmap,ue.fog,ue.lights,{emissive:{value:new Pe(0)}}]),vertexShader:We.meshtoon_vert,fragmentShader:We.meshtoon_frag},matcap:{uniforms:Kt([ue.common,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,{matcap:{value:null}}]),vertexShader:We.meshmatcap_vert,fragmentShader:We.meshmatcap_frag},points:{uniforms:Kt([ue.points,ue.fog]),vertexShader:We.points_vert,fragmentShader:We.points_frag},dashed:{uniforms:Kt([ue.common,ue.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:We.linedashed_vert,fragmentShader:We.linedashed_frag},depth:{uniforms:Kt([ue.common,ue.displacementmap]),vertexShader:We.depth_vert,fragmentShader:We.depth_frag},normal:{uniforms:Kt([ue.common,ue.bumpmap,ue.normalmap,ue.displacementmap,{opacity:{value:1}}]),vertexShader:We.meshnormal_vert,fragmentShader:We.meshnormal_frag},sprite:{uniforms:Kt([ue.sprite,ue.fog]),vertexShader:We.sprite_vert,fragmentShader:We.sprite_frag},background:{uniforms:{uvTransform:{value:new Ge},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:We.background_vert,fragmentShader:We.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ge}},vertexShader:We.backgroundCube_vert,fragmentShader:We.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:We.cube_vert,fragmentShader:We.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:We.equirect_vert,fragmentShader:We.equirect_frag},distanceRGBA:{uniforms:Kt([ue.common,ue.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:We.distanceRGBA_vert,fragmentShader:We.distanceRGBA_frag},shadow:{uniforms:Kt([ue.lights,ue.fog,{color:{value:new Pe(0)},opacity:{value:1}}]),vertexShader:We.shadow_vert,fragmentShader:We.shadow_frag}};Nn.physical={uniforms:Kt([Nn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ge},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ge},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ge},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ge},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ge},sheen:{value:0},sheenColor:{value:new Pe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ge},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ge},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ge},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ge},attenuationDistance:{value:0},attenuationColor:{value:new Pe(0)},specularColor:{value:new Pe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ge},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ge},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ge}}]),vertexShader:We.meshphysical_vert,fragmentShader:We.meshphysical_frag};var ga={r:0,b:0,g:0},Yi=new Xt,Ex=new ct;function wx(n,e,t,i,s,r,a){let o=new Pe(0),l=r===!0?0:1,c,u,h=null,d=0,p=null;function m(x){let A=x.isScene===!0?x.background:null;return A&&A.isTexture&&(A=(x.backgroundBlurriness>0?t:e).get(A)),A}function v(x){let A=!1,y=m(x);y===null?f(o,l):y&&y.isColor&&(f(y,1),A=!0);let b=n.xr.getEnvironmentBlendMode();b==="additive"?i.buffers.color.setClear(0,0,0,1,a):b==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(n.autoClear||A)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(x,A){let y=m(A);y&&(y.isCubeTexture||y.mapping===co)?(u===void 0&&(u=new et(new $i(1,1,1),new Je({name:"BackgroundCubeMaterial",uniforms:Hs(Nn.backgroundCube.uniforms),vertexShader:Nn.backgroundCube.vertexShader,fragmentShader:Nn.backgroundCube.fragmentShader,side:Ct,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,T,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),Yi.copy(A.backgroundRotation),Yi.x*=-1,Yi.y*=-1,Yi.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Yi.y*=-1,Yi.z*=-1),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Ex.makeRotationFromEuler(Yi)),u.material.toneMapped=nt.getTransfer(y.colorSpace)!==ht,(h!==y||d!==y.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,h=y,d=y.version,p=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new et(new Gs(2,2),new Je({name:"BackgroundMaterial",uniforms:Hs(Nn.background.uniforms),vertexShader:Nn.background.vertexShader,fragmentShader:Nn.background.fragmentShader,side:On,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.toneMapped=nt.getTransfer(y.colorSpace)!==ht,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||d!==y.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,h=y,d=y.version,p=n.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function f(x,A){x.getRGB(ga,_d(n)),i.buffers.color.setClear(ga.r,ga.g,ga.b,A,a)}return{getClearColor:function(){return o},setClearColor:function(x,A=1){o.set(x),l=A,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,f(o,l)},render:v,addToRenderList:g}}function Tx(n,e){let t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},s=d(null),r=s,a=!1;function o(M,w,B,U,k){let H=!1,O=h(U,B,w);r!==O&&(r=O,c(r.object)),H=p(M,U,B,k),H&&m(M,U,B,k),k!==null&&e.update(k,n.ELEMENT_ARRAY_BUFFER),(H||a)&&(a=!1,y(M,w,B,U),k!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(k).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function u(M){return n.deleteVertexArray(M)}function h(M,w,B){let U=B.wireframe===!0,k=i[M.id];k===void 0&&(k={},i[M.id]=k);let H=k[w.id];H===void 0&&(H={},k[w.id]=H);let O=H[U];return O===void 0&&(O=d(l()),H[U]=O),O}function d(M){let w=[],B=[],U=[];for(let k=0;k<t;k++)w[k]=0,B[k]=0,U[k]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:w,enabledAttributes:B,attributeDivisors:U,object:M,attributes:{},index:null}}function p(M,w,B,U){let k=r.attributes,H=w.attributes,O=0,Y=B.getAttributes();for(let G in Y)if(Y[G].location>=0){let ce=k[G],re=H[G];if(re===void 0&&(G==="instanceMatrix"&&M.instanceMatrix&&(re=M.instanceMatrix),G==="instanceColor"&&M.instanceColor&&(re=M.instanceColor)),ce===void 0||ce.attribute!==re||re&&ce.data!==re.data)return!0;O++}return r.attributesNum!==O||r.index!==U}function m(M,w,B,U){let k={},H=w.attributes,O=0,Y=B.getAttributes();for(let G in Y)if(Y[G].location>=0){let ce=H[G];ce===void 0&&(G==="instanceMatrix"&&M.instanceMatrix&&(ce=M.instanceMatrix),G==="instanceColor"&&M.instanceColor&&(ce=M.instanceColor));let re={};re.attribute=ce,ce&&ce.data&&(re.data=ce.data),k[G]=re,O++}r.attributes=k,r.attributesNum=O,r.index=U}function v(){let M=r.newAttributes;for(let w=0,B=M.length;w<B;w++)M[w]=0}function g(M){f(M,0)}function f(M,w){let B=r.newAttributes,U=r.enabledAttributes,k=r.attributeDivisors;B[M]=1,U[M]===0&&(n.enableVertexAttribArray(M),U[M]=1),k[M]!==w&&(n.vertexAttribDivisor(M,w),k[M]=w)}function x(){let M=r.newAttributes,w=r.enabledAttributes;for(let B=0,U=w.length;B<U;B++)w[B]!==M[B]&&(n.disableVertexAttribArray(B),w[B]=0)}function A(M,w,B,U,k,H,O){O===!0?n.vertexAttribIPointer(M,w,B,k,H):n.vertexAttribPointer(M,w,B,U,k,H)}function y(M,w,B,U){v();let k=U.attributes,H=B.getAttributes(),O=w.defaultAttributeValues;for(let Y in H){let G=H[Y];if(G.location>=0){let ee=k[Y];if(ee===void 0&&(Y==="instanceMatrix"&&M.instanceMatrix&&(ee=M.instanceMatrix),Y==="instanceColor"&&M.instanceColor&&(ee=M.instanceColor)),ee!==void 0){let ce=ee.normalized,re=ee.itemSize,Me=e.get(ee);if(Me===void 0)continue;let Le=Me.buffer,q=Me.type,te=Me.bytesPerElement,ve=q===n.INT||q===n.UNSIGNED_INT||ee.gpuType===Qc;if(ee.isInterleavedBufferAttribute){let oe=ee.data,Ie=oe.stride,Oe=ee.offset;if(oe.isInstancedInterleavedBuffer){for(let Ne=0;Ne<G.locationSize;Ne++)f(G.location+Ne,oe.meshPerAttribute);M.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Ne=0;Ne<G.locationSize;Ne++)g(G.location+Ne);n.bindBuffer(n.ARRAY_BUFFER,Le);for(let Ne=0;Ne<G.locationSize;Ne++)A(G.location+Ne,re/G.locationSize,q,ce,Ie*te,(Oe+re/G.locationSize*Ne)*te,ve)}else{if(ee.isInstancedBufferAttribute){for(let oe=0;oe<G.locationSize;oe++)f(G.location+oe,ee.meshPerAttribute);M.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let oe=0;oe<G.locationSize;oe++)g(G.location+oe);n.bindBuffer(n.ARRAY_BUFFER,Le);for(let oe=0;oe<G.locationSize;oe++)A(G.location+oe,re/G.locationSize,q,ce,re*te,re/G.locationSize*oe*te,ve)}}else if(O!==void 0){let ce=O[Y];if(ce!==void 0)switch(ce.length){case 2:n.vertexAttrib2fv(G.location,ce);break;case 3:n.vertexAttrib3fv(G.location,ce);break;case 4:n.vertexAttrib4fv(G.location,ce);break;default:n.vertexAttrib1fv(G.location,ce)}}}}x()}function b(){D();for(let M in i){let w=i[M];for(let B in w){let U=w[B];for(let k in U)u(U[k].object),delete U[k];delete w[B]}delete i[M]}}function T(M){if(i[M.id]===void 0)return;let w=i[M.id];for(let B in w){let U=w[B];for(let k in U)u(U[k].object),delete U[k];delete w[B]}delete i[M.id]}function C(M){for(let w in i){let B=i[w];if(B[M.id]===void 0)continue;let U=B[M.id];for(let k in U)u(U[k].object),delete U[k];delete B[M.id]}}function D(){S(),a=!0,r!==s&&(r=s,c(r.object))}function S(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:o,reset:D,resetDefaultState:S,dispose:b,releaseStatesOfGeometry:T,releaseStatesOfProgram:C,initAttributes:v,enableAttribute:g,disableUnusedAttributes:x}}function Cx(n,e,t){let i;function s(c){i=c}function r(c,u){n.drawArrays(i,c,u),t.update(u,i,1)}function a(c,u,h){h!==0&&(n.drawArraysInstanced(i,c,u,h),t.update(u,i,h))}function o(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,u,0,h);let p=0;for(let m=0;m<h;m++)p+=u[m];t.update(p,i,1)}function l(c,u,h,d){if(h===0)return;let p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<c.length;m++)a(c[m],u[m],d[m]);else{p.multiDrawArraysInstancedWEBGL(i,c,0,u,0,d,0,h);let m=0;for(let v=0;v<h;v++)m+=u[v]*d[v];t.update(m,i,1)}}this.setMode=s,this.render=r,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Rx(n,e,t,i){let s;function r(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){let C=e.get("EXT_texture_filter_anisotropic");s=n.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(C){return!(C!==Rn&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){let D=C===li&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==bt&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==Fn&&!D)}function l(C){if(C==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let h=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),f=n.getParameter(n.MAX_VERTEX_ATTRIBS),x=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),A=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),b=m>0,T=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reverseDepthBuffer:d,maxTextures:p,maxVertexTextures:m,maxTextureSize:v,maxCubemapSize:g,maxAttributes:f,maxVertexUniforms:x,maxVaryings:A,maxFragmentUniforms:y,vertexTextures:b,maxSamples:T}}function Dx(n){let e=this,t=null,i=0,s=!1,r=!1,a=new ei,o=new Ge,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){let p=h.length!==0||d||i!==0||s;return s=d,i=h.length,p},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,p){let m=h.clippingPlanes,v=h.clipIntersection,g=h.clipShadows,f=n.get(h);if(!s||m===null||m.length===0||r&&!g)r?u(null):c();else{let x=r?0:i,A=x*4,y=f.clippingState||null;l.value=y,y=u(m,d,A,p);for(let b=0;b!==A;++b)y[b]=t[b];f.clippingState=y,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,p,m){let v=h!==null?h.length:0,g=null;if(v!==0){if(g=l.value,m!==!0||g===null){let f=p+v*4,x=d.matrixWorldInverse;o.getNormalMatrix(x),(g===null||g.length<f)&&(g=new Float32Array(f));for(let A=0,y=p;A!==v;++A,y+=4)a.copy(h[A]).applyMatrix4(x,o),a.normal.toArray(g,y),g[y+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,g}}function Ix(n){let e=new WeakMap;function t(a,o){return o===Il?a.mapping=ks:o===Pl&&(a.mapping=zs),a}function i(a){if(a&&a.isTexture){let o=a.mapping;if(o===Il||o===Pl)if(e.has(a)){let l=e.get(a).texture;return t(l,a.mapping)}else{let l=a.image;if(l&&l.height>0){let c=new fc(l.height);return c.fromEquirectangularTexture(n,a),e.set(a,c),a.addEventListener("dispose",s),t(c.texture,a.mapping)}else return null}}return a}function s(a){let o=a.target;o.removeEventListener("dispose",s);let l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}var Ga=class extends Ui{constructor(e=-1,t=1,i=1,s=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,s,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=i-e,a=i+e,o=s+t,l=s-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,a=r+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,l,this.near,this.far,this.coordinateSystem),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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Us=4,Ef=[.125,.215,.35,.446,.526,.582],Ji=20,hl=new Ga,wf=new Pe,fl=null,dl=0,pl=0,ml=!1,Qi=(1+Math.sqrt(5))/2,Ds=1/Qi,Tf=[new P(-Qi,Ds,0),new P(Qi,Ds,0),new P(-Ds,0,Qi),new P(Ds,0,Qi),new P(0,Qi,-Ds),new P(0,Qi,Ds),new P(-1,1,-1),new P(1,1,-1),new P(-1,1,1),new P(1,1,1)],Va=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100){fl=this._renderer.getRenderTarget(),dl=this._renderer.getActiveCubeFace(),pl=this._renderer.getActiveMipmapLevel(),ml=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Df(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Rf(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(fl,dl,pl),this._renderer.xr.enabled=ml,e.scissorTest=!1,va(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ks||e.mapping===zs?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),fl=this._renderer.getRenderTarget(),dl=this._renderer.getActiveCubeFace(),pl=this._renderer.getActiveMipmapLevel(),ml=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Vt,minFilter:Vt,generateMipmaps:!1,type:li,format:Rn,colorSpace:Hn,depthBuffer:!1},s=Cf(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Cf(e,t,i);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Px(r)),this._blurMaterial=Ux(r,e,t)}return s}_compileMaterial(e){let t=new et(this._lodPlanes[0],e);this._renderer.compile(t,hl)}_sceneToCubeUV(e,t,i,s){let o=new Bt(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.toneMapping;u.getClearColor(wf),u.toneMapping=Ri,u.autoClear=!1;let p=new Oa({name:"PMREM.Background",side:Ct,depthWrite:!1,depthTest:!1}),m=new et(new $i,p),v=!1,g=e.background;g?g.isColor&&(p.color.copy(g),e.background=null,v=!0):(p.color.copy(wf),v=!0);for(let f=0;f<6;f++){let x=f%3;x===0?(o.up.set(0,l[f],0),o.lookAt(c[f],0,0)):x===1?(o.up.set(0,0,l[f]),o.lookAt(0,c[f],0)):(o.up.set(0,l[f],0),o.lookAt(0,0,c[f]));let A=this._cubeSize;va(s,x*A,f>2?A:0,A,A),u.setRenderTarget(s),v&&u.render(m,o),u.render(e,o)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){let i=this._renderer,s=e.mapping===ks||e.mapping===zs;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Df()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Rf());let r=s?this._cubemapMaterial:this._equirectMaterial,a=new et(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=e;let l=this._cubeSize;va(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,hl)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let s=this._lodPlanes.length;for(let r=1;r<s;r++){let a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=Tf[(s-r-1)%Tf.length];this._blur(e,r-1,r,a,o)}t.autoClear=i}_blur(e,t,i,s,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,s,"latitudinal",r),this._halfBlur(a,e,i,i,s,"longitudinal",r)}_halfBlur(e,t,i,s,r,a,o){let l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let u=3,h=new et(this._lodPlanes[s],c),d=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(r)?Math.PI/(2*p):2*Math.PI/(2*Ji-1),v=r/m,g=isFinite(r)?1+Math.floor(u*v):Ji;g>Ji&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Ji}`);let f=[],x=0;for(let C=0;C<Ji;++C){let D=C/v,S=Math.exp(-D*D/2);f.push(S),C===0?x+=S:C<g&&(x+=2*S)}for(let C=0;C<f.length;C++)f[C]=f[C]/x;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=f,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);let{_lodMax:A}=this;d.dTheta.value=m,d.mipInt.value=A-i;let y=this._sizeLods[s],b=3*y*(s>A-Us?s-A+Us:0),T=4*(this._cubeSize-y);va(t,b,T,3*y,2*y),l.setRenderTarget(t),l.render(h,hl)}};function Px(n){let e=[],t=[],i=[],s=n,r=n-Us+1+Ef.length;for(let a=0;a<r;a++){let o=Math.pow(2,s);t.push(o);let l=1/o;a>n-Us?l=Ef[a-n+Us-1]:a===0&&(l=0),i.push(l);let c=1/(o-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,m=6,v=3,g=2,f=1,x=new Float32Array(v*m*p),A=new Float32Array(g*m*p),y=new Float32Array(f*m*p);for(let T=0;T<p;T++){let C=T%3*2/3-1,D=T>2?0:-1,S=[C,D,0,C+2/3,D,0,C+2/3,D+1,0,C,D,0,C+2/3,D+1,0,C,D+1,0];x.set(S,v*m*T),A.set(d,g*m*T);let M=[T,T,T,T,T,T];y.set(M,f*m*T)}let b=new Nt;b.setAttribute("position",new mt(x,v)),b.setAttribute("uv",new mt(A,g)),b.setAttribute("faceIndex",new mt(y,f)),e.push(b),s>Us&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function Cf(n,e,t){let i=new at(n,e,t);return i.texture.mapping=co,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function va(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function Ux(n,e,t){let i=new Float32Array(Ji),s=new P(0,1,0);return new Je({name:"SphericalGaussianBlur",defines:{n:Ji,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:nu(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:_t,depthTest:!1,depthWrite:!1})}function Rf(){return new Je({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:nu(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:_t,depthTest:!1,depthWrite:!1})}function Df(){return new Je({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:nu(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:_t,depthTest:!1,depthWrite:!1})}function nu(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}function Bx(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){let l=o.mapping,c=l===Il||l===Pl,u=l===ks||l===zs;if(c||u){let h=e.get(o),d=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new Va(n)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{let p=o.image;return c&&p&&p.height>0||u&&p&&s(p)?(t===null&&(t=new Va(n)),h=c?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",r),h.texture):null}}}return o}function s(o){let l=0,c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function r(o){let l=o.target;l.removeEventListener("dispose",r);let c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:a}}function Lx(n){let e={};function t(i){if(e[i]!==void 0)return e[i];let s;switch(i){case"WEBGL_depth_texture":s=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=n.getExtension(i)}return e[i]=s,s}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){let s=t(i);return s===null&&xr("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function Nx(n,e,t,i){let s={},r=new WeakMap;function a(h){let d=h.target;d.index!==null&&e.remove(d.index);for(let m in d.attributes)e.remove(d.attributes[m]);for(let m in d.morphAttributes){let v=d.morphAttributes[m];for(let g=0,f=v.length;g<f;g++)e.remove(v[g])}d.removeEventListener("dispose",a),delete s[d.id];let p=r.get(d);p&&(e.remove(p),r.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(h,d){return s[d.id]===!0||(d.addEventListener("dispose",a),s[d.id]=!0,t.memory.geometries++),d}function l(h){let d=h.attributes;for(let m in d)e.update(d[m],n.ARRAY_BUFFER);let p=h.morphAttributes;for(let m in p){let v=p[m];for(let g=0,f=v.length;g<f;g++)e.update(v[g],n.ARRAY_BUFFER)}}function c(h){let d=[],p=h.index,m=h.attributes.position,v=0;if(p!==null){let x=p.array;v=p.version;for(let A=0,y=x.length;A<y;A+=3){let b=x[A+0],T=x[A+1],C=x[A+2];d.push(b,T,T,C,C,b)}}else if(m!==void 0){let x=m.array;v=m.version;for(let A=0,y=x.length/3-1;A<y;A+=3){let b=A+0,T=A+1,C=A+2;d.push(b,T,T,C,C,b)}}else return;let g=new(Md(d)?za:ka)(d,1);g.version=v;let f=r.get(h);f&&e.remove(f),r.set(h,g)}function u(h){let d=r.get(h);if(d){let p=h.index;p!==null&&d.version<p.version&&c(h)}else c(h);return r.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function Fx(n,e,t){let i;function s(d){i=d}let r,a;function o(d){r=d.type,a=d.bytesPerElement}function l(d,p){n.drawElements(i,p,r,d*a),t.update(p,i,1)}function c(d,p,m){m!==0&&(n.drawElementsInstanced(i,p,r,d*a,m),t.update(p,i,m))}function u(d,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,r,d,0,m);let g=0;for(let f=0;f<m;f++)g+=p[f];t.update(g,i,1)}function h(d,p,m,v){if(m===0)return;let g=e.get("WEBGL_multi_draw");if(g===null)for(let f=0;f<d.length;f++)c(d[f]/a,p[f],v[f]);else{g.multiDrawElementsInstancedWEBGL(i,p,0,r,d,0,v,0,m);let f=0;for(let x=0;x<m;x++)f+=p[x]*v[x];t.update(f,i,1)}}this.setMode=s,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function Ox(n){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(r,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(r/3);break;case n.LINES:t.lines+=o*(r/2);break;case n.LINE_STRIP:t.lines+=o*(r-1);break;case n.LINE_LOOP:t.lines+=o*r;break;case n.POINTS:t.points+=o*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:i}}function kx(n,e,t){let i=new WeakMap,s=new Ke;function r(a,o,l){let c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0,d=i.get(o);if(d===void 0||d.count!==h){let S=function(){C.dispose(),i.delete(o),o.removeEventListener("dispose",S)};d!==void 0&&d.texture.dispose();let p=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],x=o.morphAttributes.color||[],A=0;p===!0&&(A=1),m===!0&&(A=2),v===!0&&(A=3);let y=o.attributes.position.count*A,b=1;y>e.maxTextureSize&&(b=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);let T=new Float32Array(y*b*4*h),C=new La(T,y,b,h);C.type=Fn,C.needsUpdate=!0;let D=A*4;for(let M=0;M<h;M++){let w=g[M],B=f[M],U=x[M],k=y*b*4*M;for(let H=0;H<w.count;H++){let O=H*D;p===!0&&(s.fromBufferAttribute(w,H),T[k+O+0]=s.x,T[k+O+1]=s.y,T[k+O+2]=s.z,T[k+O+3]=0),m===!0&&(s.fromBufferAttribute(B,H),T[k+O+4]=s.x,T[k+O+5]=s.y,T[k+O+6]=s.z,T[k+O+7]=0),v===!0&&(s.fromBufferAttribute(U,H),T[k+O+8]=s.x,T[k+O+9]=s.y,T[k+O+10]=s.z,T[k+O+11]=U.itemSize===4?s.w:1)}}d={count:h,texture:C,size:new K(y,b)},i.set(o,d),o.addEventListener("dispose",S)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let p=0;for(let v=0;v<c.length;v++)p+=c[v];let m=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",d.size)}return{update:r}}function zx(n,e,t,i){let s=new WeakMap;function r(l){let c=i.render.frame,u=l.geometry,h=e.get(l,u);if(s.get(h)!==c&&(e.update(h),s.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),s.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),s.set(l,c))),l.isSkinnedMesh){let d=l.skeleton;s.get(d)!==c&&(d.update(),s.set(d,c))}return h}function a(){s=new WeakMap}function o(l){let c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:r,dispose:a}}var Vs=class extends Ft{constructor(e,t,i,s,r,a,o,l,c,u=Ls){if(u!==Ls&&u!==Ii)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===Ls&&(i=si),i===void 0&&u===Ii&&(i=Di),super(null,s,r,a,o,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Wt,this.minFilter=l!==void 0?l:Wt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Ed=new Ft,If=new Vs(1,1),wd=new La,Td=new uc,Cd=new Ha,Pf=[],Uf=[],Bf=new Float32Array(16),Lf=new Float32Array(9),Nf=new Float32Array(4);function Ys(n,e,t){let i=n[0];if(i<=0||i>0)return n;let s=e*t,r=Pf[s];if(r===void 0&&(r=new Float32Array(s),Pf[s]=r),e!==0){i.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(r,o)}return r}function Rt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Dt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function ho(n,e){let t=Uf[e];t===void 0&&(t=new Int32Array(e),Uf[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function Hx(n,e){let t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function Gx(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;n.uniform2fv(this.addr,e),Dt(t,e)}}function Vx(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Rt(t,e))return;n.uniform3fv(this.addr,e),Dt(t,e)}}function Wx(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Rt(t,e))return;n.uniform4fv(this.addr,e),Dt(t,e)}}function Xx(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(Rt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Dt(t,e)}else{if(Rt(t,i))return;Nf.set(i),n.uniformMatrix2fv(this.addr,!1,Nf),Dt(t,i)}}function Yx(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(Rt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Dt(t,e)}else{if(Rt(t,i))return;Lf.set(i),n.uniformMatrix3fv(this.addr,!1,Lf),Dt(t,i)}}function qx(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(Rt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Dt(t,e)}else{if(Rt(t,i))return;Bf.set(i),n.uniformMatrix4fv(this.addr,!1,Bf),Dt(t,i)}}function Qx(n,e){let t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function Zx(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;n.uniform2iv(this.addr,e),Dt(t,e)}}function Kx(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Rt(t,e))return;n.uniform3iv(this.addr,e),Dt(t,e)}}function Jx(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Rt(t,e))return;n.uniform4iv(this.addr,e),Dt(t,e)}}function jx(n,e){let t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function $x(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;n.uniform2uiv(this.addr,e),Dt(t,e)}}function ey(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Rt(t,e))return;n.uniform3uiv(this.addr,e),Dt(t,e)}}function ty(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Rt(t,e))return;n.uniform4uiv(this.addr,e),Dt(t,e)}}function ny(n,e,t){let i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s);let r;this.type===n.SAMPLER_2D_SHADOW?(If.compareFunction=yd,r=If):r=Ed,t.setTexture2D(e||r,s)}function iy(n,e,t){let i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.setTexture3D(e||Td,s)}function sy(n,e,t){let i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.setTextureCube(e||Cd,s)}function ry(n,e,t){let i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.setTexture2DArray(e||wd,s)}function ay(n){switch(n){case 5126:return Hx;case 35664:return Gx;case 35665:return Vx;case 35666:return Wx;case 35674:return Xx;case 35675:return Yx;case 35676:return qx;case 5124:case 35670:return Qx;case 35667:case 35671:return Zx;case 35668:case 35672:return Kx;case 35669:case 35673:return Jx;case 5125:return jx;case 36294:return $x;case 36295:return ey;case 36296:return ty;case 35678:case 36198:case 36298:case 36306:case 35682:return ny;case 35679:case 36299:case 36307:return iy;case 35680:case 36300:case 36308:case 36293:return sy;case 36289:case 36303:case 36311:case 36292:return ry}}function oy(n,e){n.uniform1fv(this.addr,e)}function ly(n,e){let t=Ys(e,this.size,2);n.uniform2fv(this.addr,t)}function cy(n,e){let t=Ys(e,this.size,3);n.uniform3fv(this.addr,t)}function uy(n,e){let t=Ys(e,this.size,4);n.uniform4fv(this.addr,t)}function hy(n,e){let t=Ys(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function fy(n,e){let t=Ys(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function dy(n,e){let t=Ys(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function py(n,e){n.uniform1iv(this.addr,e)}function my(n,e){n.uniform2iv(this.addr,e)}function gy(n,e){n.uniform3iv(this.addr,e)}function vy(n,e){n.uniform4iv(this.addr,e)}function xy(n,e){n.uniform1uiv(this.addr,e)}function yy(n,e){n.uniform2uiv(this.addr,e)}function Ay(n,e){n.uniform3uiv(this.addr,e)}function My(n,e){n.uniform4uiv(this.addr,e)}function Sy(n,e,t){let i=this.cache,s=e.length,r=ho(t,s);Rt(i,r)||(n.uniform1iv(this.addr,r),Dt(i,r));for(let a=0;a!==s;++a)t.setTexture2D(e[a]||Ed,r[a])}function _y(n,e,t){let i=this.cache,s=e.length,r=ho(t,s);Rt(i,r)||(n.uniform1iv(this.addr,r),Dt(i,r));for(let a=0;a!==s;++a)t.setTexture3D(e[a]||Td,r[a])}function by(n,e,t){let i=this.cache,s=e.length,r=ho(t,s);Rt(i,r)||(n.uniform1iv(this.addr,r),Dt(i,r));for(let a=0;a!==s;++a)t.setTextureCube(e[a]||Cd,r[a])}function Ey(n,e,t){let i=this.cache,s=e.length,r=ho(t,s);Rt(i,r)||(n.uniform1iv(this.addr,r),Dt(i,r));for(let a=0;a!==s;++a)t.setTexture2DArray(e[a]||wd,r[a])}function wy(n){switch(n){case 5126:return oy;case 35664:return ly;case 35665:return cy;case 35666:return uy;case 35674:return hy;case 35675:return fy;case 35676:return dy;case 5124:case 35670:return py;case 35667:case 35671:return my;case 35668:case 35672:return gy;case 35669:case 35673:return vy;case 5125:return xy;case 36294:return yy;case 36295:return Ay;case 36296:return My;case 35678:case 36198:case 36298:case 36306:case 35682:return Sy;case 35679:case 36299:case 36307:return _y;case 35680:case 36300:case 36308:case 36293:return by;case 36289:case 36303:case 36311:case 36292:return Ey}}var dc=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=ay(t.type)}},pc=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=wy(t.type)}},mc=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let s=this.seq;for(let r=0,a=s.length;r!==a;++r){let o=s[r];o.setValue(e,t[o.id],i)}}},gl=/(\w+)(\])?(\[|\.)?/g;function Ff(n,e){n.seq.push(e),n.map[e.id]=e}function Ty(n,e,t){let i=n.name,s=i.length;for(gl.lastIndex=0;;){let r=gl.exec(i),a=gl.lastIndex,o=r[1],l=r[2]==="]",c=r[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===s){Ff(t,c===void 0?new dc(o,n,e):new pc(o,n,e));break}else{let h=t.map[o];h===void 0&&(h=new mc(o),Ff(t,h)),t=h}}}var Fs=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<i;++s){let r=e.getActiveUniform(t,s),a=e.getUniformLocation(t,r.name);Ty(r,a,this)}}setValue(e,t,i,s){let r=this.map[t];r!==void 0&&r.setValue(e,i,s)}setOptional(e,t,i){let s=t[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,t,i,s){for(let r=0,a=t.length;r!==a;++r){let o=t[r],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,s)}}static seqWithValue(e,t){let i=[];for(let s=0,r=e.length;s!==r;++s){let a=e[s];a.id in t&&i.push(a)}return i}};function Of(n,e,t){let i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}var Cy=37297,Ry=0;function Dy(n,e){let t=n.split(`
`),i=[],s=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=s;a<r;a++){let o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(`
`)}var kf=new Ge;function Iy(n){nt._getMatrix(kf,nt.workingColorSpace,n);let e=`mat3( ${kf.elements.map(t=>t.toFixed(4))} )`;switch(nt.getTransfer(n)){case uo:return[e,"LinearTransferOETF"];case ht:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function zf(n,e,t){let i=n.getShaderParameter(e,n.COMPILE_STATUS),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";let r=/ERROR: 0:(\d+)/.exec(s);if(r){let a=parseInt(r[1]);return t.toUpperCase()+`

`+s+`

`+Dy(n.getShaderSource(e),a)}else return s}function Py(n,e){let t=Iy(e);return[`vec4 ${n}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}function Uy(n,e){let t;switch(e){case Wm:t="Linear";break;case Xm:t="Reinhard";break;case Ym:t="Cineon";break;case qm:t="ACESFilmic";break;case Zm:t="AgX";break;case Km:t="Neutral";break;case Qm:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var xa=new P;function By(){nt.getLuminanceCoefficients(xa);let n=xa.x.toFixed(4),e=xa.y.toFixed(4),t=xa.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${n}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
`)}function Ly(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(yr).join(`
`)}function Ny(n){let e=[];for(let t in n){let i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function Fy(n,e){let t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let r=n.getActiveAttrib(e,s),a=r.name,o=1;r.type===n.FLOAT_MAT2&&(o=2),r.type===n.FLOAT_MAT3&&(o=3),r.type===n.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function yr(n){return n!==""}function Hf(n,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Gf(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Oy=/^[ \t]*#include +<([\w\d./]+)>/gm;function gc(n){return n.replace(Oy,zy)}var ky=new Map;function zy(n,e){let t=We[e];if(t===void 0){let i=ky.get(e);if(i!==void 0)t=We[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return gc(t)}var Hy=/#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 Vf(n){return n.replace(Hy,Gy)}function Gy(n,e,t,i){let s="";for(let r=parseInt(e);r<parseInt(t);r++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function Wf(n){let e=`precision ${n.precision} float;
	precision ${n.precision} int;
	precision ${n.precision} sampler2D;
	precision ${n.precision} samplerCube;
	precision ${n.precision} sampler3D;
	precision ${n.precision} sampler2DArray;
	precision ${n.precision} sampler2DShadow;
	precision ${n.precision} samplerCubeShadow;
	precision ${n.precision} sampler2DArrayShadow;
	precision ${n.precision} isampler2D;
	precision ${n.precision} isampler3D;
	precision ${n.precision} isamplerCube;
	precision ${n.precision} isampler2DArray;
	precision ${n.precision} usampler2D;
	precision ${n.precision} usampler3D;
	precision ${n.precision} usamplerCube;
	precision ${n.precision} usampler2DArray;
	`;return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function Vy(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===ad?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===_m?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===$n&&(e="SHADOWMAP_TYPE_VSM"),e}function Wy(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case ks:case zs:e="ENVMAP_TYPE_CUBE";break;case co:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Xy(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case zs:e="ENVMAP_MODE_REFRACTION";break}return e}function Yy(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case od:e="ENVMAP_BLENDING_MULTIPLY";break;case Gm:e="ENVMAP_BLENDING_MIX";break;case Vm:e="ENVMAP_BLENDING_ADD";break}return e}function qy(n){let e=n.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function Qy(n,e,t,i){let s=n.getContext(),r=t.defines,a=t.vertexShader,o=t.fragmentShader,l=Vy(t),c=Wy(t),u=Xy(t),h=Yy(t),d=qy(t),p=Ly(t),m=Ny(r),v=s.createProgram(),g,f,x=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(yr).join(`
`),g.length>0&&(g+=`
`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(yr).join(`
`),f.length>0&&(f+=`
`)):(g=[Wf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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",`
`].filter(yr).join(`
`),f=[Wf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ri?"#define TONE_MAPPING":"",t.toneMapping!==Ri?We.tonemapping_pars_fragment:"",t.toneMapping!==Ri?Uy("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",We.colorspace_pars_fragment,Py("linearToOutputTexel",t.outputColorSpace),By(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(yr).join(`
`)),a=gc(a),a=Hf(a,t),a=Gf(a,t),o=gc(o),o=Hf(o,t),o=Gf(o,t),a=Vf(a),o=Vf(o),t.isRawShaderMaterial!==!0&&(x=`#version 300 es
`,g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+g,f=["#define varying in",t.glslVersion===nf?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===nf?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+f);let A=x+g+a,y=x+f+o,b=Of(s,s.VERTEX_SHADER,A),T=Of(s,s.FRAGMENT_SHADER,y);s.attachShader(v,b),s.attachShader(v,T),t.index0AttributeName!==void 0?s.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(v,0,"position"),s.linkProgram(v);function C(w){if(n.debug.checkShaderErrors){let B=s.getProgramInfoLog(v).trim(),U=s.getShaderInfoLog(b).trim(),k=s.getShaderInfoLog(T).trim(),H=!0,O=!0;if(s.getProgramParameter(v,s.LINK_STATUS)===!1)if(H=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(s,v,b,T);else{let Y=zf(s,b,"vertex"),G=zf(s,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(v,s.VALIDATE_STATUS)+`

Material Name: `+w.name+`
Material Type: `+w.type+`

Program Info Log: `+B+`
`+Y+`
`+G)}else B!==""?console.warn("THREE.WebGLProgram: Program Info Log:",B):(U===""||k==="")&&(O=!1);O&&(w.diagnostics={runnable:H,programLog:B,vertexShader:{log:U,prefix:g},fragmentShader:{log:k,prefix:f}})}s.deleteShader(b),s.deleteShader(T),D=new Fs(s,v),S=Fy(s,v)}let D;this.getUniforms=function(){return D===void 0&&C(this),D};let S;this.getAttributes=function(){return S===void 0&&C(this),S};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=s.getProgramParameter(v,Cy)),M},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Ry++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=b,this.fragmentShader=T,this}var Zy=0,vc=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(s)===!1&&(a.add(s),s.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new xc(e),t.set(e,i)),i}},xc=class{constructor(e){this.id=Zy++,this.code=e,this.usedTimes=0}};function Ky(n,e,t,i,s,r,a){let o=new Fa,l=new vc,c=new Set,u=[],h=s.logarithmicDepthBuffer,d=s.vertexTextures,p=s.precision,m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(S){return c.add(S),S===0?"uv":`uv${S}`}function g(S,M,w,B,U){let k=B.fog,H=U.geometry,O=S.isMeshStandardMaterial?B.environment:null,Y=(S.isMeshStandardMaterial?t:e).get(S.envMap||O),G=Y&&Y.mapping===co?Y.image.height:null,ee=m[S.type];S.precision!==null&&(p=s.getMaxPrecision(S.precision),p!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",p,"instead."));let ce=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,re=ce!==void 0?ce.length:0,Me=0;H.morphAttributes.position!==void 0&&(Me=1),H.morphAttributes.normal!==void 0&&(Me=2),H.morphAttributes.color!==void 0&&(Me=3);let Le,q,te,ve;if(ee){let ut=Nn[ee];Le=ut.vertexShader,q=ut.fragmentShader}else Le=S.vertexShader,q=S.fragmentShader,l.update(S),te=l.getVertexShaderID(S),ve=l.getFragmentShaderID(S);let oe=n.getRenderTarget(),Ie=n.state.buffers.depth.getReversed(),Oe=U.isInstancedMesh===!0,Ne=U.isBatchedMesh===!0,tt=!!S.map,j=!!S.matcap,se=!!Y,I=!!S.aoMap,Ce=!!S.lightMap,ne=!!S.bumpMap,Ae=!!S.normalMap,le=!!S.displacementMap,Ue=!!S.emissiveMap,xe=!!S.metalnessMap,R=!!S.roughnessMap,_=S.anisotropy>0,z=S.clearcoat>0,Q=S.dispersion>0,$=S.iridescence>0,Z=S.sheen>0,be=S.transmission>0,he=_&&!!S.anisotropyMap,ye=z&&!!S.clearcoatMap,Qe=z&&!!S.clearcoatNormalMap,ie=z&&!!S.clearcoatRoughnessMap,Se=$&&!!S.iridescenceMap,Be=$&&!!S.iridescenceThicknessMap,Fe=Z&&!!S.sheenColorMap,_e=Z&&!!S.sheenRoughnessMap,je=!!S.specularMap,Ve=!!S.specularColorMap,ft=!!S.specularIntensityMap,L=be&&!!S.transmissionMap,fe=be&&!!S.thicknessMap,X=!!S.gradientMap,J=!!S.alphaMap,me=S.alphaTest>0,de=!!S.alphaHash,ze=!!S.extensions,Mt=Ri;S.toneMapped&&(oe===null||oe.isXRRenderTarget===!0)&&(Mt=n.toneMapping);let kt={shaderID:ee,shaderType:S.type,shaderName:S.name,vertexShader:Le,fragmentShader:q,defines:S.defines,customVertexShaderID:te,customFragmentShaderID:ve,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:p,batching:Ne,batchingColor:Ne&&U._colorsTexture!==null,instancing:Oe,instancingColor:Oe&&U.instanceColor!==null,instancingMorph:Oe&&U.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:oe===null?n.outputColorSpace:oe.isXRRenderTarget===!0?oe.texture.colorSpace:Hn,alphaToCoverage:!!S.alphaToCoverage,map:tt,matcap:j,envMap:se,envMapMode:se&&Y.mapping,envMapCubeUVHeight:G,aoMap:I,lightMap:Ce,bumpMap:ne,normalMap:Ae,displacementMap:d&&le,emissiveMap:Ue,normalMapObjectSpace:Ae&&S.normalMapType===$m,normalMapTangentSpace:Ae&&S.normalMapType===xd,metalnessMap:xe,roughnessMap:R,anisotropy:_,anisotropyMap:he,clearcoat:z,clearcoatMap:ye,clearcoatNormalMap:Qe,clearcoatRoughnessMap:ie,dispersion:Q,iridescence:$,iridescenceMap:Se,iridescenceThicknessMap:Be,sheen:Z,sheenColorMap:Fe,sheenRoughnessMap:_e,specularMap:je,specularColorMap:Ve,specularIntensityMap:ft,transmission:be,transmissionMap:L,thicknessMap:fe,gradientMap:X,opaque:S.transparent===!1&&S.blending===Ci&&S.alphaToCoverage===!1,alphaMap:J,alphaTest:me,alphaHash:de,combine:S.combine,mapUv:tt&&v(S.map.channel),aoMapUv:I&&v(S.aoMap.channel),lightMapUv:Ce&&v(S.lightMap.channel),bumpMapUv:ne&&v(S.bumpMap.channel),normalMapUv:Ae&&v(S.normalMap.channel),displacementMapUv:le&&v(S.displacementMap.channel),emissiveMapUv:Ue&&v(S.emissiveMap.channel),metalnessMapUv:xe&&v(S.metalnessMap.channel),roughnessMapUv:R&&v(S.roughnessMap.channel),anisotropyMapUv:he&&v(S.anisotropyMap.channel),clearcoatMapUv:ye&&v(S.clearcoatMap.channel),clearcoatNormalMapUv:Qe&&v(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ie&&v(S.clearcoatRoughnessMap.channel),iridescenceMapUv:Se&&v(S.iridescenceMap.channel),iridescenceThicknessMapUv:Be&&v(S.iridescenceThicknessMap.channel),sheenColorMapUv:Fe&&v(S.sheenColorMap.channel),sheenRoughnessMapUv:_e&&v(S.sheenRoughnessMap.channel),specularMapUv:je&&v(S.specularMap.channel),specularColorMapUv:Ve&&v(S.specularColorMap.channel),specularIntensityMapUv:ft&&v(S.specularIntensityMap.channel),transmissionMapUv:L&&v(S.transmissionMap.channel),thicknessMapUv:fe&&v(S.thicknessMap.channel),alphaMapUv:J&&v(S.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(Ae||_),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!H.attributes.uv&&(tt||J),fog:!!k,useFog:S.fog===!0,fogExp2:!!k&&k.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:Ie,skinning:U.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:re,morphTextureStride:Me,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:n.shadowMap.enabled&&w.length>0,shadowMapType:n.shadowMap.type,toneMapping:Mt,decodeVideoTexture:tt&&S.map.isVideoTexture===!0&&nt.getTransfer(S.map.colorSpace)===ht,decodeVideoTextureEmissive:Ue&&S.emissiveMap.isVideoTexture===!0&&nt.getTransfer(S.emissiveMap.colorSpace)===ht,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Lt,flipSided:S.side===Ct,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:ze&&S.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ze&&S.extensions.multiDraw===!0||Ne)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return kt.vertexUv1s=c.has(1),kt.vertexUv2s=c.has(2),kt.vertexUv3s=c.has(3),c.clear(),kt}function f(S){let M=[];if(S.shaderID?M.push(S.shaderID):(M.push(S.customVertexShaderID),M.push(S.customFragmentShaderID)),S.defines!==void 0)for(let w in S.defines)M.push(w),M.push(S.defines[w]);return S.isRawShaderMaterial===!1&&(x(M,S),A(M,S),M.push(n.outputColorSpace)),M.push(S.customProgramCacheKey),M.join()}function x(S,M){S.push(M.precision),S.push(M.outputColorSpace),S.push(M.envMapMode),S.push(M.envMapCubeUVHeight),S.push(M.mapUv),S.push(M.alphaMapUv),S.push(M.lightMapUv),S.push(M.aoMapUv),S.push(M.bumpMapUv),S.push(M.normalMapUv),S.push(M.displacementMapUv),S.push(M.emissiveMapUv),S.push(M.metalnessMapUv),S.push(M.roughnessMapUv),S.push(M.anisotropyMapUv),S.push(M.clearcoatMapUv),S.push(M.clearcoatNormalMapUv),S.push(M.clearcoatRoughnessMapUv),S.push(M.iridescenceMapUv),S.push(M.iridescenceThicknessMapUv),S.push(M.sheenColorMapUv),S.push(M.sheenRoughnessMapUv),S.push(M.specularMapUv),S.push(M.specularColorMapUv),S.push(M.specularIntensityMapUv),S.push(M.transmissionMapUv),S.push(M.thicknessMapUv),S.push(M.combine),S.push(M.fogExp2),S.push(M.sizeAttenuation),S.push(M.morphTargetsCount),S.push(M.morphAttributeCount),S.push(M.numDirLights),S.push(M.numPointLights),S.push(M.numSpotLights),S.push(M.numSpotLightMaps),S.push(M.numHemiLights),S.push(M.numRectAreaLights),S.push(M.numDirLightShadows),S.push(M.numPointLightShadows),S.push(M.numSpotLightShadows),S.push(M.numSpotLightShadowsWithMaps),S.push(M.numLightProbes),S.push(M.shadowMapType),S.push(M.toneMapping),S.push(M.numClippingPlanes),S.push(M.numClipIntersection),S.push(M.depthPacking)}function A(S,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),M.dispersion&&o.enable(20),M.batchingColor&&o.enable(21),S.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.reverseDepthBuffer&&o.enable(4),M.skinning&&o.enable(5),M.morphTargets&&o.enable(6),M.morphNormals&&o.enable(7),M.morphColors&&o.enable(8),M.premultipliedAlpha&&o.enable(9),M.shadowMapEnabled&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.decodeVideoTextureEmissive&&o.enable(20),M.alphaToCoverage&&o.enable(21),S.push(o.mask)}function y(S){let M=m[S.type],w;if(M){let B=Nn[M];w=zg.clone(B.uniforms)}else w=S.uniforms;return w}function b(S,M){let w;for(let B=0,U=u.length;B<U;B++){let k=u[B];if(k.cacheKey===M){w=k,++w.usedTimes;break}}return w===void 0&&(w=new Qy(n,M,S,r),u.push(w)),w}function T(S){if(--S.usedTimes===0){let M=u.indexOf(S);u[M]=u[u.length-1],u.pop(),S.destroy()}}function C(S){l.remove(S)}function D(){l.dispose()}return{getParameters:g,getProgramCacheKey:f,getUniforms:y,acquireProgram:b,releaseProgram:T,releaseShaderCache:C,programs:u,dispose:D}}function Jy(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function i(a){n.delete(a)}function s(a,o,l){n.get(a)[o]=l}function r(){n=new WeakMap}return{has:e,get:t,remove:i,update:s,dispose:r}}function jy(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function Xf(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Yf(){let n=[],e=0,t=[],i=[],s=[];function r(){e=0,t.length=0,i.length=0,s.length=0}function a(h,d,p,m,v,g){let f=n[e];return f===void 0?(f={id:h.id,object:h,geometry:d,material:p,groupOrder:m,renderOrder:h.renderOrder,z:v,group:g},n[e]=f):(f.id=h.id,f.object=h,f.geometry=d,f.material=p,f.groupOrder=m,f.renderOrder=h.renderOrder,f.z=v,f.group=g),e++,f}function o(h,d,p,m,v,g){let f=a(h,d,p,m,v,g);p.transmission>0?i.push(f):p.transparent===!0?s.push(f):t.push(f)}function l(h,d,p,m,v,g){let f=a(h,d,p,m,v,g);p.transmission>0?i.unshift(f):p.transparent===!0?s.unshift(f):t.unshift(f)}function c(h,d){t.length>1&&t.sort(h||jy),i.length>1&&i.sort(d||Xf),s.length>1&&s.sort(d||Xf)}function u(){for(let h=e,d=n.length;h<d;h++){let p=n[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:s,init:r,push:o,unshift:l,finish:u,sort:c}}function $y(){let n=new WeakMap;function e(i,s){let r=n.get(i),a;return r===void 0?(a=new Yf,n.set(i,[a])):s>=r.length?(a=new Yf,r.push(a)):a=r[s],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function eA(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new P,color:new Pe};break;case"SpotLight":t={position:new P,direction:new P,color:new Pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new P,color:new Pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new P,skyColor:new Pe,groundColor:new Pe};break;case"RectAreaLight":t={color:new Pe,position:new P,halfWidth:new P,halfHeight:new P};break}return n[e.id]=t,t}}}function tA(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}var nA=0;function iA(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function sA(n){let e=new eA,t=tA(),i={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 c=0;c<9;c++)i.probe.push(new P);let s=new P,r=new ct,a=new ct;function o(c){let u=0,h=0,d=0;for(let S=0;S<9;S++)i.probe[S].set(0,0,0);let p=0,m=0,v=0,g=0,f=0,x=0,A=0,y=0,b=0,T=0,C=0;c.sort(iA);for(let S=0,M=c.length;S<M;S++){let w=c[S],B=w.color,U=w.intensity,k=w.distance,H=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)u+=B.r*U,h+=B.g*U,d+=B.b*U;else if(w.isLightProbe){for(let O=0;O<9;O++)i.probe[O].addScaledVector(w.sh.coefficients[O],U);C++}else if(w.isDirectionalLight){let O=e.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){let Y=w.shadow,G=t.get(w);G.shadowIntensity=Y.intensity,G.shadowBias=Y.bias,G.shadowNormalBias=Y.normalBias,G.shadowRadius=Y.radius,G.shadowMapSize=Y.mapSize,i.directionalShadow[p]=G,i.directionalShadowMap[p]=H,i.directionalShadowMatrix[p]=w.shadow.matrix,x++}i.directional[p]=O,p++}else if(w.isSpotLight){let O=e.get(w);O.position.setFromMatrixPosition(w.matrixWorld),O.color.copy(B).multiplyScalar(U),O.distance=k,O.coneCos=Math.cos(w.angle),O.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),O.decay=w.decay,i.spot[v]=O;let Y=w.shadow;if(w.map&&(i.spotLightMap[b]=w.map,b++,Y.updateMatrices(w),w.castShadow&&T++),i.spotLightMatrix[v]=Y.matrix,w.castShadow){let G=t.get(w);G.shadowIntensity=Y.intensity,G.shadowBias=Y.bias,G.shadowNormalBias=Y.normalBias,G.shadowRadius=Y.radius,G.shadowMapSize=Y.mapSize,i.spotShadow[v]=G,i.spotShadowMap[v]=H,y++}v++}else if(w.isRectAreaLight){let O=e.get(w);O.color.copy(B).multiplyScalar(U),O.halfWidth.set(w.width*.5,0,0),O.halfHeight.set(0,w.height*.5,0),i.rectArea[g]=O,g++}else if(w.isPointLight){let O=e.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity),O.distance=w.distance,O.decay=w.decay,w.castShadow){let Y=w.shadow,G=t.get(w);G.shadowIntensity=Y.intensity,G.shadowBias=Y.bias,G.shadowNormalBias=Y.normalBias,G.shadowRadius=Y.radius,G.shadowMapSize=Y.mapSize,G.shadowCameraNear=Y.camera.near,G.shadowCameraFar=Y.camera.far,i.pointShadow[m]=G,i.pointShadowMap[m]=H,i.pointShadowMatrix[m]=w.shadow.matrix,A++}i.point[m]=O,m++}else if(w.isHemisphereLight){let O=e.get(w);O.skyColor.copy(w.color).multiplyScalar(U),O.groundColor.copy(w.groundColor).multiplyScalar(U),i.hemi[f]=O,f++}}g>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ue.LTC_FLOAT_1,i.rectAreaLTC2=ue.LTC_FLOAT_2):(i.rectAreaLTC1=ue.LTC_HALF_1,i.rectAreaLTC2=ue.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=d;let D=i.hash;(D.directionalLength!==p||D.pointLength!==m||D.spotLength!==v||D.rectAreaLength!==g||D.hemiLength!==f||D.numDirectionalShadows!==x||D.numPointShadows!==A||D.numSpotShadows!==y||D.numSpotMaps!==b||D.numLightProbes!==C)&&(i.directional.length=p,i.spot.length=v,i.rectArea.length=g,i.point.length=m,i.hemi.length=f,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=y+b-T,i.spotLightMap.length=b,i.numSpotLightShadowsWithMaps=T,i.numLightProbes=C,D.directionalLength=p,D.pointLength=m,D.spotLength=v,D.rectAreaLength=g,D.hemiLength=f,D.numDirectionalShadows=x,D.numPointShadows=A,D.numSpotShadows=y,D.numSpotMaps=b,D.numLightProbes=C,i.version=nA++)}function l(c,u){let h=0,d=0,p=0,m=0,v=0,g=u.matrixWorldInverse;for(let f=0,x=c.length;f<x;f++){let A=c[f];if(A.isDirectionalLight){let y=i.directional[h];y.direction.setFromMatrixPosition(A.matrixWorld),s.setFromMatrixPosition(A.target.matrixWorld),y.direction.sub(s),y.direction.transformDirection(g),h++}else if(A.isSpotLight){let y=i.spot[p];y.position.setFromMatrixPosition(A.matrixWorld),y.position.applyMatrix4(g),y.direction.setFromMatrixPosition(A.matrixWorld),s.setFromMatrixPosition(A.target.matrixWorld),y.direction.sub(s),y.direction.transformDirection(g),p++}else if(A.isRectAreaLight){let y=i.rectArea[m];y.position.setFromMatrixPosition(A.matrixWorld),y.position.applyMatrix4(g),a.identity(),r.copy(A.matrixWorld),r.premultiply(g),a.extractRotation(r),y.halfWidth.set(A.width*.5,0,0),y.halfHeight.set(0,A.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),m++}else if(A.isPointLight){let y=i.point[d];y.position.setFromMatrixPosition(A.matrixWorld),y.position.applyMatrix4(g),d++}else if(A.isHemisphereLight){let y=i.hemi[v];y.direction.setFromMatrixPosition(A.matrixWorld),y.direction.transformDirection(g),v++}}}return{setup:o,setupView:l,state:i}}function qf(n){let e=new sA(n),t=[],i=[];function s(u){c.camera=u,t.length=0,i.length=0}function r(u){t.push(u)}function a(u){i.push(u)}function o(){e.setup(t)}function l(u){e.setupView(t,u)}let c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:c,setupLights:o,setupLightsView:l,pushLight:r,pushShadow:a}}function rA(n){let e=new WeakMap;function t(s,r=0){let a=e.get(s),o;return a===void 0?(o=new qf(n),e.set(s,[o])):r>=a.length?(o=new qf(n),a.push(o)):o=a[r],o}function i(){e=new WeakMap}return{get:t,dispose:i}}var yc=class extends xn{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=ci,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Ac=class extends xn{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},aA=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,oA=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function lA(n,e,t){let i=new Cr,s=new K,r=new K,a=new Ke,o=new yc({depthPacking:jm}),l=new Ac,c={},u=t.maxTextureSize,h={[On]:Ct,[Ct]:On,[Lt]:Lt},d=new Je({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:aA,fragmentShader:oA}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let m=new Nt;m.setAttribute("position",new mt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new et(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ad;let f=this.type;this.render=function(T,C,D){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;let S=n.getRenderTarget(),M=n.getActiveCubeFace(),w=n.getActiveMipmapLevel(),B=n.state;B.setBlending(_t),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);let U=f!==$n&&this.type===$n,k=f===$n&&this.type!==$n;for(let H=0,O=T.length;H<O;H++){let Y=T[H],G=Y.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",Y,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;s.copy(G.mapSize);let ee=G.getFrameExtents();if(s.multiply(ee),r.copy(G.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/ee.x),s.x=r.x*ee.x,G.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/ee.y),s.y=r.y*ee.y,G.mapSize.y=r.y)),G.map===null||U===!0||k===!0){let re=this.type!==$n?{minFilter:Wt,magFilter:Wt}:{};G.map!==null&&G.map.dispose(),G.map=new at(s.x,s.y,re),G.map.texture.name=Y.name+".shadowMap",G.camera.updateProjectionMatrix()}n.setRenderTarget(G.map),n.clear();let ce=G.getViewportCount();for(let re=0;re<ce;re++){let Me=G.getViewport(re);a.set(r.x*Me.x,r.y*Me.y,r.x*Me.z,r.y*Me.w),B.viewport(a),G.updateMatrices(Y,re),i=G.getFrustum(),y(C,D,G.camera,Y,this.type)}G.isPointLightShadow!==!0&&this.type===$n&&x(G,D),G.needsUpdate=!1}f=this.type,g.needsUpdate=!1,n.setRenderTarget(S,M,w)};function x(T,C){let D=e.update(v);d.defines.VSM_SAMPLES!==T.blurSamples&&(d.defines.VSM_SAMPLES=T.blurSamples,p.defines.VSM_SAMPLES=T.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new at(s.x,s.y)),d.uniforms.shadow_pass.value=T.map.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,n.setRenderTarget(T.mapPass),n.clear(),n.renderBufferDirect(C,null,D,d,v,null),p.uniforms.shadow_pass.value=T.mapPass.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,n.setRenderTarget(T.map),n.clear(),n.renderBufferDirect(C,null,D,p,v,null)}function A(T,C,D,S){let M=null,w=D.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(w!==void 0)M=w;else if(M=D.isPointLight===!0?l:o,n.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0){let B=M.uuid,U=C.uuid,k=c[B];k===void 0&&(k={},c[B]=k);let H=k[U];H===void 0&&(H=M.clone(),k[U]=H,C.addEventListener("dispose",b)),M=H}if(M.visible=C.visible,M.wireframe=C.wireframe,S===$n?M.side=C.shadowSide!==null?C.shadowSide:C.side:M.side=C.shadowSide!==null?C.shadowSide:h[C.side],M.alphaMap=C.alphaMap,M.alphaTest=C.alphaTest,M.map=C.map,M.clipShadows=C.clipShadows,M.clippingPlanes=C.clippingPlanes,M.clipIntersection=C.clipIntersection,M.displacementMap=C.displacementMap,M.displacementScale=C.displacementScale,M.displacementBias=C.displacementBias,M.wireframeLinewidth=C.wireframeLinewidth,M.linewidth=C.linewidth,D.isPointLight===!0&&M.isMeshDistanceMaterial===!0){let B=n.properties.get(M);B.light=D}return M}function y(T,C,D,S,M){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===$n)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,T.matrixWorld);let U=e.update(T),k=T.material;if(Array.isArray(k)){let H=U.groups;for(let O=0,Y=H.length;O<Y;O++){let G=H[O],ee=k[G.materialIndex];if(ee&&ee.visible){let ce=A(T,ee,S,M);T.onBeforeShadow(n,T,C,D,U,ce,G),n.renderBufferDirect(D,null,U,ce,T,G),T.onAfterShadow(n,T,C,D,U,ce,G)}}}else if(k.visible){let H=A(T,k,S,M);T.onBeforeShadow(n,T,C,D,U,H,null),n.renderBufferDirect(D,null,U,H,T,null),T.onAfterShadow(n,T,C,D,U,H,null)}}let B=T.children;for(let U=0,k=B.length;U<k;U++)y(B[U],C,D,S,M)}function b(T){T.target.removeEventListener("dispose",b);for(let D in c){let S=c[D],M=T.target.uuid;M in S&&(S[M].dispose(),delete S[M])}}}var cA={[bl]:El,[wl]:Rl,[Tl]:Dl,[Os]:Cl,[El]:bl,[Rl]:wl,[Dl]:Tl,[Cl]:Os};function uA(n,e){function t(){let L=!1,fe=new Ke,X=null,J=new Ke(0,0,0,0);return{setMask:function(me){X!==me&&!L&&(n.colorMask(me,me,me,me),X=me)},setLocked:function(me){L=me},setClear:function(me,de,ze,Mt,kt){kt===!0&&(me*=Mt,de*=Mt,ze*=Mt),fe.set(me,de,ze,Mt),J.equals(fe)===!1&&(n.clearColor(me,de,ze,Mt),J.copy(fe))},reset:function(){L=!1,X=null,J.set(-1,0,0,0)}}}function i(){let L=!1,fe=!1,X=null,J=null,me=null;return{setReversed:function(de){if(fe!==de){let ze=e.get("EXT_clip_control");fe?ze.clipControlEXT(ze.LOWER_LEFT_EXT,ze.ZERO_TO_ONE_EXT):ze.clipControlEXT(ze.LOWER_LEFT_EXT,ze.NEGATIVE_ONE_TO_ONE_EXT);let Mt=me;me=null,this.setClear(Mt)}fe=de},getReversed:function(){return fe},setTest:function(de){de?oe(n.DEPTH_TEST):Ie(n.DEPTH_TEST)},setMask:function(de){X!==de&&!L&&(n.depthMask(de),X=de)},setFunc:function(de){if(fe&&(de=cA[de]),J!==de){switch(de){case bl:n.depthFunc(n.NEVER);break;case El:n.depthFunc(n.ALWAYS);break;case wl:n.depthFunc(n.LESS);break;case Os:n.depthFunc(n.LEQUAL);break;case Tl:n.depthFunc(n.EQUAL);break;case Cl:n.depthFunc(n.GEQUAL);break;case Rl:n.depthFunc(n.GREATER);break;case Dl:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}J=de}},setLocked:function(de){L=de},setClear:function(de){me!==de&&(fe&&(de=1-de),n.clearDepth(de),me=de)},reset:function(){L=!1,X=null,J=null,me=null,fe=!1}}}function s(){let L=!1,fe=null,X=null,J=null,me=null,de=null,ze=null,Mt=null,kt=null;return{setTest:function(ut){L||(ut?oe(n.STENCIL_TEST):Ie(n.STENCIL_TEST))},setMask:function(ut){fe!==ut&&!L&&(n.stencilMask(ut),fe=ut)},setFunc:function(ut,Sn,Vn){(X!==ut||J!==Sn||me!==Vn)&&(n.stencilFunc(ut,Sn,Vn),X=ut,J=Sn,me=Vn)},setOp:function(ut,Sn,Vn){(de!==ut||ze!==Sn||Mt!==Vn)&&(n.stencilOp(ut,Sn,Vn),de=ut,ze=Sn,Mt=Vn)},setLocked:function(ut){L=ut},setClear:function(ut){kt!==ut&&(n.clearStencil(ut),kt=ut)},reset:function(){L=!1,fe=null,X=null,J=null,me=null,de=null,ze=null,Mt=null,kt=null}}}let r=new t,a=new i,o=new s,l=new WeakMap,c=new WeakMap,u={},h={},d=new WeakMap,p=[],m=null,v=!1,g=null,f=null,x=null,A=null,y=null,b=null,T=null,C=new Pe(0,0,0),D=0,S=!1,M=null,w=null,B=null,U=null,k=null,H=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS),O=!1,Y=0,G=n.getParameter(n.VERSION);G.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(G)[1]),O=Y>=1):G.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),O=Y>=2);let ee=null,ce={},re=n.getParameter(n.SCISSOR_BOX),Me=n.getParameter(n.VIEWPORT),Le=new Ke().fromArray(re),q=new Ke().fromArray(Me);function te(L,fe,X,J){let me=new Uint8Array(4),de=n.createTexture();n.bindTexture(L,de),n.texParameteri(L,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(L,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ze=0;ze<X;ze++)L===n.TEXTURE_3D||L===n.TEXTURE_2D_ARRAY?n.texImage3D(fe,0,n.RGBA,1,1,J,0,n.RGBA,n.UNSIGNED_BYTE,me):n.texImage2D(fe+ze,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,me);return de}let ve={};ve[n.TEXTURE_2D]=te(n.TEXTURE_2D,n.TEXTURE_2D,1),ve[n.TEXTURE_CUBE_MAP]=te(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ve[n.TEXTURE_2D_ARRAY]=te(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ve[n.TEXTURE_3D]=te(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),oe(n.DEPTH_TEST),a.setFunc(Os),ne(!1),Ae(Qh),oe(n.CULL_FACE),I(_t);function oe(L){u[L]!==!0&&(n.enable(L),u[L]=!0)}function Ie(L){u[L]!==!1&&(n.disable(L),u[L]=!1)}function Oe(L,fe){return h[L]!==fe?(n.bindFramebuffer(L,fe),h[L]=fe,L===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=fe),L===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=fe),!0):!1}function Ne(L,fe){let X=p,J=!1;if(L){X=d.get(fe),X===void 0&&(X=[],d.set(fe,X));let me=L.textures;if(X.length!==me.length||X[0]!==n.COLOR_ATTACHMENT0){for(let de=0,ze=me.length;de<ze;de++)X[de]=n.COLOR_ATTACHMENT0+de;X.length=me.length,J=!0}}else X[0]!==n.BACK&&(X[0]=n.BACK,J=!0);J&&n.drawBuffers(X)}function tt(L){return m!==L?(n.useProgram(L),m=L,!0):!1}let j={[Zi]:n.FUNC_ADD,[Em]:n.FUNC_SUBTRACT,[wm]:n.FUNC_REVERSE_SUBTRACT};j[Tm]=n.MIN,j[Cm]=n.MAX;let se={[Rm]:n.ZERO,[Dm]:n.ONE,[Im]:n.SRC_COLOR,[Sl]:n.SRC_ALPHA,[Fm]:n.SRC_ALPHA_SATURATE,[Lm]:n.DST_COLOR,[Um]:n.DST_ALPHA,[Pm]:n.ONE_MINUS_SRC_COLOR,[_l]:n.ONE_MINUS_SRC_ALPHA,[Nm]:n.ONE_MINUS_DST_COLOR,[Bm]:n.ONE_MINUS_DST_ALPHA,[Om]:n.CONSTANT_COLOR,[km]:n.ONE_MINUS_CONSTANT_COLOR,[zm]:n.CONSTANT_ALPHA,[Hm]:n.ONE_MINUS_CONSTANT_ALPHA};function I(L,fe,X,J,me,de,ze,Mt,kt,ut){if(L===_t){v===!0&&(Ie(n.BLEND),v=!1);return}if(v===!1&&(oe(n.BLEND),v=!0),L!==bm){if(L!==g||ut!==S){if((f!==Zi||y!==Zi)&&(n.blendEquation(n.FUNC_ADD),f=Zi,y=Zi),ut)switch(L){case Ci:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case kn:n.blendFunc(n.ONE,n.ONE);break;case Zh:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Kh:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",L);break}else switch(L){case Ci:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case kn:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Zh:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Kh:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",L);break}x=null,A=null,b=null,T=null,C.set(0,0,0),D=0,g=L,S=ut}return}me=me||fe,de=de||X,ze=ze||J,(fe!==f||me!==y)&&(n.blendEquationSeparate(j[fe],j[me]),f=fe,y=me),(X!==x||J!==A||de!==b||ze!==T)&&(n.blendFuncSeparate(se[X],se[J],se[de],se[ze]),x=X,A=J,b=de,T=ze),(Mt.equals(C)===!1||kt!==D)&&(n.blendColor(Mt.r,Mt.g,Mt.b,kt),C.copy(Mt),D=kt),g=L,S=!1}function Ce(L,fe){L.side===Lt?Ie(n.CULL_FACE):oe(n.CULL_FACE);let X=L.side===Ct;fe&&(X=!X),ne(X),L.blending===Ci&&L.transparent===!1?I(_t):I(L.blending,L.blendEquation,L.blendSrc,L.blendDst,L.blendEquationAlpha,L.blendSrcAlpha,L.blendDstAlpha,L.blendColor,L.blendAlpha,L.premultipliedAlpha),a.setFunc(L.depthFunc),a.setTest(L.depthTest),a.setMask(L.depthWrite),r.setMask(L.colorWrite);let J=L.stencilWrite;o.setTest(J),J&&(o.setMask(L.stencilWriteMask),o.setFunc(L.stencilFunc,L.stencilRef,L.stencilFuncMask),o.setOp(L.stencilFail,L.stencilZFail,L.stencilZPass)),Ue(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),L.alphaToCoverage===!0?oe(n.SAMPLE_ALPHA_TO_COVERAGE):Ie(n.SAMPLE_ALPHA_TO_COVERAGE)}function ne(L){M!==L&&(L?n.frontFace(n.CW):n.frontFace(n.CCW),M=L)}function Ae(L){L!==Mm?(oe(n.CULL_FACE),L!==w&&(L===Qh?n.cullFace(n.BACK):L===Sm?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Ie(n.CULL_FACE),w=L}function le(L){L!==B&&(O&&n.lineWidth(L),B=L)}function Ue(L,fe,X){L?(oe(n.POLYGON_OFFSET_FILL),(U!==fe||k!==X)&&(n.polygonOffset(fe,X),U=fe,k=X)):Ie(n.POLYGON_OFFSET_FILL)}function xe(L){L?oe(n.SCISSOR_TEST):Ie(n.SCISSOR_TEST)}function R(L){L===void 0&&(L=n.TEXTURE0+H-1),ee!==L&&(n.activeTexture(L),ee=L)}function _(L,fe,X){X===void 0&&(ee===null?X=n.TEXTURE0+H-1:X=ee);let J=ce[X];J===void 0&&(J={type:void 0,texture:void 0},ce[X]=J),(J.type!==L||J.texture!==fe)&&(ee!==X&&(n.activeTexture(X),ee=X),n.bindTexture(L,fe||ve[L]),J.type=L,J.texture=fe)}function z(){let L=ce[ee];L!==void 0&&L.type!==void 0&&(n.bindTexture(L.type,null),L.type=void 0,L.texture=void 0)}function Q(){try{n.compressedTexImage2D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function $(){try{n.compressedTexImage3D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Z(){try{n.texSubImage2D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function be(){try{n.texSubImage3D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function he(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function ye(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Qe(){try{n.texStorage2D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function ie(){try{n.texStorage3D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Se(){try{n.texImage2D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Be(){try{n.texImage3D.apply(n,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Fe(L){Le.equals(L)===!1&&(n.scissor(L.x,L.y,L.z,L.w),Le.copy(L))}function _e(L){q.equals(L)===!1&&(n.viewport(L.x,L.y,L.z,L.w),q.copy(L))}function je(L,fe){let X=c.get(fe);X===void 0&&(X=new WeakMap,c.set(fe,X));let J=X.get(L);J===void 0&&(J=n.getUniformBlockIndex(fe,L.name),X.set(L,J))}function Ve(L,fe){let J=c.get(fe).get(L);l.get(fe)!==J&&(n.uniformBlockBinding(fe,J,L.__bindingPointIndex),l.set(fe,J))}function ft(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),u={},ee=null,ce={},h={},d=new WeakMap,p=[],m=null,v=!1,g=null,f=null,x=null,A=null,y=null,b=null,T=null,C=new Pe(0,0,0),D=0,S=!1,M=null,w=null,B=null,U=null,k=null,Le.set(0,0,n.canvas.width,n.canvas.height),q.set(0,0,n.canvas.width,n.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:oe,disable:Ie,bindFramebuffer:Oe,drawBuffers:Ne,useProgram:tt,setBlending:I,setMaterial:Ce,setFlipSided:ne,setCullFace:Ae,setLineWidth:le,setPolygonOffset:Ue,setScissorTest:xe,activeTexture:R,bindTexture:_,unbindTexture:z,compressedTexImage2D:Q,compressedTexImage3D:$,texImage2D:Se,texImage3D:Be,updateUBOMapping:je,uniformBlockBinding:Ve,texStorage2D:Qe,texStorage3D:ie,texSubImage2D:Z,texSubImage3D:be,compressedTexSubImage2D:he,compressedTexSubImage3D:ye,scissor:Fe,viewport:_e,reset:ft}}function Qf(n,e,t,i){let s=hA(i);switch(t){case fd:return n*e;case pd:return n*e;case md:return n*e*2;case Jc:return n*e/s.components*s.byteLength;case jc:return n*e/s.components*s.byteLength;case gd:return n*e*2/s.components*s.byteLength;case $c:return n*e*2/s.components*s.byteLength;case dd:return n*e*3/s.components*s.byteLength;case Rn:return n*e*4/s.components*s.byteLength;case eu:return n*e*4/s.components*s.byteLength;case wa:case Ta:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Ca:case Ra:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Nl:case Ol:return Math.max(n,16)*Math.max(e,8)/4;case Ll:case Fl:return Math.max(n,8)*Math.max(e,8)/2;case kl:case zl:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Hl:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Gl:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Vl:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Wl:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Xl:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Yl:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case ql:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Ql:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Zl:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Kl:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Jl:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case jl:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case $l:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case ec:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case tc:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Da:case nc:case ic:return Math.ceil(n/4)*Math.ceil(e/4)*16;case vd:case sc:return Math.ceil(n/4)*Math.ceil(e/4)*8;case rc:case ac:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function hA(n){switch(n){case bt:case cd:return{byteLength:1,components:1};case wr:case ud:case li:return{byteLength:2,components:1};case Zc:case Kc:return{byteLength:2,components:4};case si:case Qc:case Fn:return{byteLength:4,components:1};case hd:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}function fA(n,e,t,i,s,r,a){let o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new K,u=new WeakMap,h,d=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(R,_){return p?new OffscreenCanvas(R,_):Ua("canvas")}function v(R,_,z){let Q=1,$=xe(R);if(($.width>z||$.height>z)&&(Q=z/Math.max($.width,$.height)),Q<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){let Z=Math.floor(Q*$.width),be=Math.floor(Q*$.height);h===void 0&&(h=m(Z,be));let he=_?m(Z,be):h;return he.width=Z,he.height=be,he.getContext("2d").drawImage(R,0,0,Z,be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+Z+"x"+be+")."),he}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),R;return R}function g(R){return R.generateMipmaps}function f(R){n.generateMipmap(R)}function x(R){return R.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?n.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function A(R,_,z,Q,$=!1){if(R!==null){if(n[R]!==void 0)return n[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let Z=_;if(_===n.RED&&(z===n.FLOAT&&(Z=n.R32F),z===n.HALF_FLOAT&&(Z=n.R16F),z===n.UNSIGNED_BYTE&&(Z=n.R8)),_===n.RED_INTEGER&&(z===n.UNSIGNED_BYTE&&(Z=n.R8UI),z===n.UNSIGNED_SHORT&&(Z=n.R16UI),z===n.UNSIGNED_INT&&(Z=n.R32UI),z===n.BYTE&&(Z=n.R8I),z===n.SHORT&&(Z=n.R16I),z===n.INT&&(Z=n.R32I)),_===n.RG&&(z===n.FLOAT&&(Z=n.RG32F),z===n.HALF_FLOAT&&(Z=n.RG16F),z===n.UNSIGNED_BYTE&&(Z=n.RG8)),_===n.RG_INTEGER&&(z===n.UNSIGNED_BYTE&&(Z=n.RG8UI),z===n.UNSIGNED_SHORT&&(Z=n.RG16UI),z===n.UNSIGNED_INT&&(Z=n.RG32UI),z===n.BYTE&&(Z=n.RG8I),z===n.SHORT&&(Z=n.RG16I),z===n.INT&&(Z=n.RG32I)),_===n.RGB_INTEGER&&(z===n.UNSIGNED_BYTE&&(Z=n.RGB8UI),z===n.UNSIGNED_SHORT&&(Z=n.RGB16UI),z===n.UNSIGNED_INT&&(Z=n.RGB32UI),z===n.BYTE&&(Z=n.RGB8I),z===n.SHORT&&(Z=n.RGB16I),z===n.INT&&(Z=n.RGB32I)),_===n.RGBA_INTEGER&&(z===n.UNSIGNED_BYTE&&(Z=n.RGBA8UI),z===n.UNSIGNED_SHORT&&(Z=n.RGBA16UI),z===n.UNSIGNED_INT&&(Z=n.RGBA32UI),z===n.BYTE&&(Z=n.RGBA8I),z===n.SHORT&&(Z=n.RGBA16I),z===n.INT&&(Z=n.RGBA32I)),_===n.RGB&&z===n.UNSIGNED_INT_5_9_9_9_REV&&(Z=n.RGB9_E5),_===n.RGBA){let be=$?uo:nt.getTransfer(Q);z===n.FLOAT&&(Z=n.RGBA32F),z===n.HALF_FLOAT&&(Z=n.RGBA16F),z===n.UNSIGNED_BYTE&&(Z=be===ht?n.SRGB8_ALPHA8:n.RGBA8),z===n.UNSIGNED_SHORT_4_4_4_4&&(Z=n.RGBA4),z===n.UNSIGNED_SHORT_5_5_5_1&&(Z=n.RGB5_A1)}return(Z===n.R16F||Z===n.R32F||Z===n.RG16F||Z===n.RG32F||Z===n.RGBA16F||Z===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Z}function y(R,_){let z;return R?_===null||_===si||_===Di?z=n.DEPTH24_STENCIL8:_===Fn?z=n.DEPTH32F_STENCIL8:_===wr&&(z=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===si||_===Di?z=n.DEPTH_COMPONENT24:_===Fn?z=n.DEPTH_COMPONENT32F:_===wr&&(z=n.DEPTH_COMPONENT16),z}function b(R,_){return g(R)===!0||R.isFramebufferTexture&&R.minFilter!==Wt&&R.minFilter!==Vt?Math.log2(Math.max(_.width,_.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?_.mipmaps.length:1}function T(R){let _=R.target;_.removeEventListener("dispose",T),D(_),_.isVideoTexture&&u.delete(_)}function C(R){let _=R.target;_.removeEventListener("dispose",C),M(_)}function D(R){let _=i.get(R);if(_.__webglInit===void 0)return;let z=R.source,Q=d.get(z);if(Q){let $=Q[_.__cacheKey];$.usedTimes--,$.usedTimes===0&&S(R),Object.keys(Q).length===0&&d.delete(z)}i.remove(R)}function S(R){let _=i.get(R);n.deleteTexture(_.__webglTexture);let z=R.source,Q=d.get(z);delete Q[_.__cacheKey],a.memory.textures--}function M(R){let _=i.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),i.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let Q=0;Q<6;Q++){if(Array.isArray(_.__webglFramebuffer[Q]))for(let $=0;$<_.__webglFramebuffer[Q].length;$++)n.deleteFramebuffer(_.__webglFramebuffer[Q][$]);else n.deleteFramebuffer(_.__webglFramebuffer[Q]);_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer[Q])}else{if(Array.isArray(_.__webglFramebuffer))for(let Q=0;Q<_.__webglFramebuffer.length;Q++)n.deleteFramebuffer(_.__webglFramebuffer[Q]);else n.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&n.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let Q=0;Q<_.__webglColorRenderbuffer.length;Q++)_.__webglColorRenderbuffer[Q]&&n.deleteRenderbuffer(_.__webglColorRenderbuffer[Q]);_.__webglDepthRenderbuffer&&n.deleteRenderbuffer(_.__webglDepthRenderbuffer)}let z=R.textures;for(let Q=0,$=z.length;Q<$;Q++){let Z=i.get(z[Q]);Z.__webglTexture&&(n.deleteTexture(Z.__webglTexture),a.memory.textures--),i.remove(z[Q])}i.remove(R)}let w=0;function B(){w=0}function U(){let R=w;return R>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+s.maxTextures),w+=1,R}function k(R){let _=[];return _.push(R.wrapS),_.push(R.wrapT),_.push(R.wrapR||0),_.push(R.magFilter),_.push(R.minFilter),_.push(R.anisotropy),_.push(R.internalFormat),_.push(R.format),_.push(R.type),_.push(R.generateMipmaps),_.push(R.premultiplyAlpha),_.push(R.flipY),_.push(R.unpackAlignment),_.push(R.colorSpace),_.join()}function H(R,_){let z=i.get(R);if(R.isVideoTexture&&le(R),R.isRenderTargetTexture===!1&&R.version>0&&z.__version!==R.version){let Q=R.image;if(Q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{q(z,R,_);return}}t.bindTexture(n.TEXTURE_2D,z.__webglTexture,n.TEXTURE0+_)}function O(R,_){let z=i.get(R);if(R.version>0&&z.__version!==R.version){q(z,R,_);return}t.bindTexture(n.TEXTURE_2D_ARRAY,z.__webglTexture,n.TEXTURE0+_)}function Y(R,_){let z=i.get(R);if(R.version>0&&z.__version!==R.version){q(z,R,_);return}t.bindTexture(n.TEXTURE_3D,z.__webglTexture,n.TEXTURE0+_)}function G(R,_){let z=i.get(R);if(R.version>0&&z.__version!==R.version){te(z,R,_);return}t.bindTexture(n.TEXTURE_CUBE_MAP,z.__webglTexture,n.TEXTURE0+_)}let ee={[Ul]:n.REPEAT,[ji]:n.CLAMP_TO_EDGE,[Bl]:n.MIRRORED_REPEAT},ce={[Wt]:n.NEAREST,[Jm]:n.NEAREST_MIPMAP_NEAREST,[jr]:n.NEAREST_MIPMAP_LINEAR,[Vt]:n.LINEAR,[Vo]:n.LINEAR_MIPMAP_NEAREST,[ti]:n.LINEAR_MIPMAP_LINEAR},re={[eg]:n.NEVER,[ag]:n.ALWAYS,[tg]:n.LESS,[yd]:n.LEQUAL,[ng]:n.EQUAL,[rg]:n.GEQUAL,[ig]:n.GREATER,[sg]:n.NOTEQUAL};function Me(R,_){if(_.type===Fn&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===Vt||_.magFilter===Vo||_.magFilter===jr||_.magFilter===ti||_.minFilter===Vt||_.minFilter===Vo||_.minFilter===jr||_.minFilter===ti)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(R,n.TEXTURE_WRAP_S,ee[_.wrapS]),n.texParameteri(R,n.TEXTURE_WRAP_T,ee[_.wrapT]),(R===n.TEXTURE_3D||R===n.TEXTURE_2D_ARRAY)&&n.texParameteri(R,n.TEXTURE_WRAP_R,ee[_.wrapR]),n.texParameteri(R,n.TEXTURE_MAG_FILTER,ce[_.magFilter]),n.texParameteri(R,n.TEXTURE_MIN_FILTER,ce[_.minFilter]),_.compareFunction&&(n.texParameteri(R,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(R,n.TEXTURE_COMPARE_FUNC,re[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===Wt||_.minFilter!==jr&&_.minFilter!==ti||_.type===Fn&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||i.get(_).__currentAnisotropy){let z=e.get("EXT_texture_filter_anisotropic");n.texParameterf(R,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,s.getMaxAnisotropy())),i.get(_).__currentAnisotropy=_.anisotropy}}}function Le(R,_){let z=!1;R.__webglInit===void 0&&(R.__webglInit=!0,_.addEventListener("dispose",T));let Q=_.source,$=d.get(Q);$===void 0&&($={},d.set(Q,$));let Z=k(_);if(Z!==R.__cacheKey){$[Z]===void 0&&($[Z]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,z=!0),$[Z].usedTimes++;let be=$[R.__cacheKey];be!==void 0&&($[R.__cacheKey].usedTimes--,be.usedTimes===0&&S(_)),R.__cacheKey=Z,R.__webglTexture=$[Z].texture}return z}function q(R,_,z){let Q=n.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(Q=n.TEXTURE_2D_ARRAY),_.isData3DTexture&&(Q=n.TEXTURE_3D);let $=Le(R,_),Z=_.source;t.bindTexture(Q,R.__webglTexture,n.TEXTURE0+z);let be=i.get(Z);if(Z.version!==be.__version||$===!0){t.activeTexture(n.TEXTURE0+z);let he=nt.getPrimaries(nt.workingColorSpace),ye=_.colorSpace===vn?null:nt.getPrimaries(_.colorSpace),Qe=_.colorSpace===vn||he===ye?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Qe);let ie=v(_.image,!1,s.maxTextureSize);ie=Ue(_,ie);let Se=r.convert(_.format,_.colorSpace),Be=r.convert(_.type),Fe=A(_.internalFormat,Se,Be,_.colorSpace,_.isVideoTexture);Me(Q,_);let _e,je=_.mipmaps,Ve=_.isVideoTexture!==!0,ft=be.__version===void 0||$===!0,L=Z.dataReady,fe=b(_,ie);if(_.isDepthTexture)Fe=y(_.format===Ii,_.type),ft&&(Ve?t.texStorage2D(n.TEXTURE_2D,1,Fe,ie.width,ie.height):t.texImage2D(n.TEXTURE_2D,0,Fe,ie.width,ie.height,0,Se,Be,null));else if(_.isDataTexture)if(je.length>0){Ve&&ft&&t.texStorage2D(n.TEXTURE_2D,fe,Fe,je[0].width,je[0].height);for(let X=0,J=je.length;X<J;X++)_e=je[X],Ve?L&&t.texSubImage2D(n.TEXTURE_2D,X,0,0,_e.width,_e.height,Se,Be,_e.data):t.texImage2D(n.TEXTURE_2D,X,Fe,_e.width,_e.height,0,Se,Be,_e.data);_.generateMipmaps=!1}else Ve?(ft&&t.texStorage2D(n.TEXTURE_2D,fe,Fe,ie.width,ie.height),L&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ie.width,ie.height,Se,Be,ie.data)):t.texImage2D(n.TEXTURE_2D,0,Fe,ie.width,ie.height,0,Se,Be,ie.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){Ve&&ft&&t.texStorage3D(n.TEXTURE_2D_ARRAY,fe,Fe,je[0].width,je[0].height,ie.depth);for(let X=0,J=je.length;X<J;X++)if(_e=je[X],_.format!==Rn)if(Se!==null)if(Ve){if(L)if(_.layerUpdates.size>0){let me=Qf(_e.width,_e.height,_.format,_.type);for(let de of _.layerUpdates){let ze=_e.data.subarray(de*me/_e.data.BYTES_PER_ELEMENT,(de+1)*me/_e.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,X,0,0,de,_e.width,_e.height,1,Se,ze)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,X,0,0,0,_e.width,_e.height,ie.depth,Se,_e.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,X,Fe,_e.width,_e.height,ie.depth,0,_e.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ve?L&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,X,0,0,0,_e.width,_e.height,ie.depth,Se,Be,_e.data):t.texImage3D(n.TEXTURE_2D_ARRAY,X,Fe,_e.width,_e.height,ie.depth,0,Se,Be,_e.data)}else{Ve&&ft&&t.texStorage2D(n.TEXTURE_2D,fe,Fe,je[0].width,je[0].height);for(let X=0,J=je.length;X<J;X++)_e=je[X],_.format!==Rn?Se!==null?Ve?L&&t.compressedTexSubImage2D(n.TEXTURE_2D,X,0,0,_e.width,_e.height,Se,_e.data):t.compressedTexImage2D(n.TEXTURE_2D,X,Fe,_e.width,_e.height,0,_e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ve?L&&t.texSubImage2D(n.TEXTURE_2D,X,0,0,_e.width,_e.height,Se,Be,_e.data):t.texImage2D(n.TEXTURE_2D,X,Fe,_e.width,_e.height,0,Se,Be,_e.data)}else if(_.isDataArrayTexture)if(Ve){if(ft&&t.texStorage3D(n.TEXTURE_2D_ARRAY,fe,Fe,ie.width,ie.height,ie.depth),L)if(_.layerUpdates.size>0){let X=Qf(ie.width,ie.height,_.format,_.type);for(let J of _.layerUpdates){let me=ie.data.subarray(J*X/ie.data.BYTES_PER_ELEMENT,(J+1)*X/ie.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,J,ie.width,ie.height,1,Se,Be,me)}_.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ie.width,ie.height,ie.depth,Se,Be,ie.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Fe,ie.width,ie.height,ie.depth,0,Se,Be,ie.data);else if(_.isData3DTexture)Ve?(ft&&t.texStorage3D(n.TEXTURE_3D,fe,Fe,ie.width,ie.height,ie.depth),L&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ie.width,ie.height,ie.depth,Se,Be,ie.data)):t.texImage3D(n.TEXTURE_3D,0,Fe,ie.width,ie.height,ie.depth,0,Se,Be,ie.data);else if(_.isFramebufferTexture){if(ft)if(Ve)t.texStorage2D(n.TEXTURE_2D,fe,Fe,ie.width,ie.height);else{let X=ie.width,J=ie.height;for(let me=0;me<fe;me++)t.texImage2D(n.TEXTURE_2D,me,Fe,X,J,0,Se,Be,null),X>>=1,J>>=1}}else if(je.length>0){if(Ve&&ft){let X=xe(je[0]);t.texStorage2D(n.TEXTURE_2D,fe,Fe,X.width,X.height)}for(let X=0,J=je.length;X<J;X++)_e=je[X],Ve?L&&t.texSubImage2D(n.TEXTURE_2D,X,0,0,Se,Be,_e):t.texImage2D(n.TEXTURE_2D,X,Fe,Se,Be,_e);_.generateMipmaps=!1}else if(Ve){if(ft){let X=xe(ie);t.texStorage2D(n.TEXTURE_2D,fe,Fe,X.width,X.height)}L&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Se,Be,ie)}else t.texImage2D(n.TEXTURE_2D,0,Fe,Se,Be,ie);g(_)&&f(Q),be.__version=Z.version,_.onUpdate&&_.onUpdate(_)}R.__version=_.version}function te(R,_,z){if(_.image.length!==6)return;let Q=Le(R,_),$=_.source;t.bindTexture(n.TEXTURE_CUBE_MAP,R.__webglTexture,n.TEXTURE0+z);let Z=i.get($);if($.version!==Z.__version||Q===!0){t.activeTexture(n.TEXTURE0+z);let be=nt.getPrimaries(nt.workingColorSpace),he=_.colorSpace===vn?null:nt.getPrimaries(_.colorSpace),ye=_.colorSpace===vn||be===he?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ye);let Qe=_.isCompressedTexture||_.image[0].isCompressedTexture,ie=_.image[0]&&_.image[0].isDataTexture,Se=[];for(let J=0;J<6;J++)!Qe&&!ie?Se[J]=v(_.image[J],!0,s.maxCubemapSize):Se[J]=ie?_.image[J].image:_.image[J],Se[J]=Ue(_,Se[J]);let Be=Se[0],Fe=r.convert(_.format,_.colorSpace),_e=r.convert(_.type),je=A(_.internalFormat,Fe,_e,_.colorSpace),Ve=_.isVideoTexture!==!0,ft=Z.__version===void 0||Q===!0,L=$.dataReady,fe=b(_,Be);Me(n.TEXTURE_CUBE_MAP,_);let X;if(Qe){Ve&&ft&&t.texStorage2D(n.TEXTURE_CUBE_MAP,fe,je,Be.width,Be.height);for(let J=0;J<6;J++){X=Se[J].mipmaps;for(let me=0;me<X.length;me++){let de=X[me];_.format!==Rn?Fe!==null?Ve?L&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,me,0,0,de.width,de.height,Fe,de.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,me,je,de.width,de.height,0,de.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ve?L&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,me,0,0,de.width,de.height,Fe,_e,de.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,me,je,de.width,de.height,0,Fe,_e,de.data)}}}else{if(X=_.mipmaps,Ve&&ft){X.length>0&&fe++;let J=xe(Se[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,fe,je,J.width,J.height)}for(let J=0;J<6;J++)if(ie){Ve?L&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,Se[J].width,Se[J].height,Fe,_e,Se[J].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,je,Se[J].width,Se[J].height,0,Fe,_e,Se[J].data);for(let me=0;me<X.length;me++){let ze=X[me].image[J].image;Ve?L&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,me+1,0,0,ze.width,ze.height,Fe,_e,ze.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,me+1,je,ze.width,ze.height,0,Fe,_e,ze.data)}}else{Ve?L&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,Fe,_e,Se[J]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,je,Fe,_e,Se[J]);for(let me=0;me<X.length;me++){let de=X[me];Ve?L&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,me+1,0,0,Fe,_e,de.image[J]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+J,me+1,je,Fe,_e,de.image[J])}}}g(_)&&f(n.TEXTURE_CUBE_MAP),Z.__version=$.version,_.onUpdate&&_.onUpdate(_)}R.__version=_.version}function ve(R,_,z,Q,$,Z){let be=r.convert(z.format,z.colorSpace),he=r.convert(z.type),ye=A(z.internalFormat,be,he,z.colorSpace),Qe=i.get(_),ie=i.get(z);if(ie.__renderTarget=_,!Qe.__hasExternalTextures){let Se=Math.max(1,_.width>>Z),Be=Math.max(1,_.height>>Z);$===n.TEXTURE_3D||$===n.TEXTURE_2D_ARRAY?t.texImage3D($,Z,ye,Se,Be,_.depth,0,be,he,null):t.texImage2D($,Z,ye,Se,Be,0,be,he,null)}t.bindFramebuffer(n.FRAMEBUFFER,R),Ae(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Q,$,ie.__webglTexture,0,ne(_)):($===n.TEXTURE_2D||$>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Q,$,ie.__webglTexture,Z),t.bindFramebuffer(n.FRAMEBUFFER,null)}function oe(R,_,z){if(n.bindRenderbuffer(n.RENDERBUFFER,R),_.depthBuffer){let Q=_.depthTexture,$=Q&&Q.isDepthTexture?Q.type:null,Z=y(_.stencilBuffer,$),be=_.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,he=ne(_);Ae(_)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,he,Z,_.width,_.height):z?n.renderbufferStorageMultisample(n.RENDERBUFFER,he,Z,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,Z,_.width,_.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,be,n.RENDERBUFFER,R)}else{let Q=_.textures;for(let $=0;$<Q.length;$++){let Z=Q[$],be=r.convert(Z.format,Z.colorSpace),he=r.convert(Z.type),ye=A(Z.internalFormat,be,he,Z.colorSpace),Qe=ne(_);z&&Ae(_)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Qe,ye,_.width,_.height):Ae(_)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Qe,ye,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,ye,_.width,_.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ie(R,_){if(_&&_.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,R),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let Q=i.get(_.depthTexture);Q.__renderTarget=_,(!Q.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),H(_.depthTexture,0);let $=Q.__webglTexture,Z=ne(_);if(_.depthTexture.format===Ls)Ae(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,$,0,Z):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,$,0);else if(_.depthTexture.format===Ii)Ae(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,$,0,Z):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,$,0);else throw new Error("Unknown depthTexture format")}function Oe(R){let _=i.get(R),z=R.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==R.depthTexture){let Q=R.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),Q){let $=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,Q.removeEventListener("dispose",$)};Q.addEventListener("dispose",$),_.__depthDisposeCallback=$}_.__boundDepthTexture=Q}if(R.depthTexture&&!_.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");Ie(_.__webglFramebuffer,R)}else if(z){_.__webglDepthbuffer=[];for(let Q=0;Q<6;Q++)if(t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[Q]),_.__webglDepthbuffer[Q]===void 0)_.__webglDepthbuffer[Q]=n.createRenderbuffer(),oe(_.__webglDepthbuffer[Q],R,!1);else{let $=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Z=_.__webglDepthbuffer[Q];n.bindRenderbuffer(n.RENDERBUFFER,Z),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,Z)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=n.createRenderbuffer(),oe(_.__webglDepthbuffer,R,!1);else{let Q=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,$=_.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,$),n.framebufferRenderbuffer(n.FRAMEBUFFER,Q,n.RENDERBUFFER,$)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ne(R,_,z){let Q=i.get(R);_!==void 0&&ve(Q.__webglFramebuffer,R,R.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),z!==void 0&&Oe(R)}function tt(R){let _=R.texture,z=i.get(R),Q=i.get(_);R.addEventListener("dispose",C);let $=R.textures,Z=R.isWebGLCubeRenderTarget===!0,be=$.length>1;if(be||(Q.__webglTexture===void 0&&(Q.__webglTexture=n.createTexture()),Q.__version=_.version,a.memory.textures++),Z){z.__webglFramebuffer=[];for(let he=0;he<6;he++)if(_.mipmaps&&_.mipmaps.length>0){z.__webglFramebuffer[he]=[];for(let ye=0;ye<_.mipmaps.length;ye++)z.__webglFramebuffer[he][ye]=n.createFramebuffer()}else z.__webglFramebuffer[he]=n.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){z.__webglFramebuffer=[];for(let he=0;he<_.mipmaps.length;he++)z.__webglFramebuffer[he]=n.createFramebuffer()}else z.__webglFramebuffer=n.createFramebuffer();if(be)for(let he=0,ye=$.length;he<ye;he++){let Qe=i.get($[he]);Qe.__webglTexture===void 0&&(Qe.__webglTexture=n.createTexture(),a.memory.textures++)}if(R.samples>0&&Ae(R)===!1){z.__webglMultisampledFramebuffer=n.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let he=0;he<$.length;he++){let ye=$[he];z.__webglColorRenderbuffer[he]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,z.__webglColorRenderbuffer[he]);let Qe=r.convert(ye.format,ye.colorSpace),ie=r.convert(ye.type),Se=A(ye.internalFormat,Qe,ie,ye.colorSpace,R.isXRRenderTarget===!0),Be=ne(R);n.renderbufferStorageMultisample(n.RENDERBUFFER,Be,Se,R.width,R.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.RENDERBUFFER,z.__webglColorRenderbuffer[he])}n.bindRenderbuffer(n.RENDERBUFFER,null),R.depthBuffer&&(z.__webglDepthRenderbuffer=n.createRenderbuffer(),oe(z.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Z){t.bindTexture(n.TEXTURE_CUBE_MAP,Q.__webglTexture),Me(n.TEXTURE_CUBE_MAP,_);for(let he=0;he<6;he++)if(_.mipmaps&&_.mipmaps.length>0)for(let ye=0;ye<_.mipmaps.length;ye++)ve(z.__webglFramebuffer[he][ye],R,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+he,ye);else ve(z.__webglFramebuffer[he],R,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+he,0);g(_)&&f(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(be){for(let he=0,ye=$.length;he<ye;he++){let Qe=$[he],ie=i.get(Qe);t.bindTexture(n.TEXTURE_2D,ie.__webglTexture),Me(n.TEXTURE_2D,Qe),ve(z.__webglFramebuffer,R,Qe,n.COLOR_ATTACHMENT0+he,n.TEXTURE_2D,0),g(Qe)&&f(n.TEXTURE_2D)}t.unbindTexture()}else{let he=n.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(he=R.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(he,Q.__webglTexture),Me(he,_),_.mipmaps&&_.mipmaps.length>0)for(let ye=0;ye<_.mipmaps.length;ye++)ve(z.__webglFramebuffer[ye],R,_,n.COLOR_ATTACHMENT0,he,ye);else ve(z.__webglFramebuffer,R,_,n.COLOR_ATTACHMENT0,he,0);g(_)&&f(he),t.unbindTexture()}R.depthBuffer&&Oe(R)}function j(R){let _=R.textures;for(let z=0,Q=_.length;z<Q;z++){let $=_[z];if(g($)){let Z=x(R),be=i.get($).__webglTexture;t.bindTexture(Z,be),f(Z),t.unbindTexture()}}}let se=[],I=[];function Ce(R){if(R.samples>0){if(Ae(R)===!1){let _=R.textures,z=R.width,Q=R.height,$=n.COLOR_BUFFER_BIT,Z=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,be=i.get(R),he=_.length>1;if(he)for(let ye=0;ye<_.length;ye++)t.bindFramebuffer(n.FRAMEBUFFER,be.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ye,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,be.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+ye,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,be.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,be.__webglFramebuffer);for(let ye=0;ye<_.length;ye++){if(R.resolveDepthBuffer&&(R.depthBuffer&&($|=n.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&($|=n.STENCIL_BUFFER_BIT)),he){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,be.__webglColorRenderbuffer[ye]);let Qe=i.get(_[ye]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Qe,0)}n.blitFramebuffer(0,0,z,Q,0,0,z,Q,$,n.NEAREST),l===!0&&(se.length=0,I.length=0,se.push(n.COLOR_ATTACHMENT0+ye),R.depthBuffer&&R.resolveDepthBuffer===!1&&(se.push(Z),I.push(Z),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,I)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,se))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),he)for(let ye=0;ye<_.length;ye++){t.bindFramebuffer(n.FRAMEBUFFER,be.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ye,n.RENDERBUFFER,be.__webglColorRenderbuffer[ye]);let Qe=i.get(_[ye]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,be.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+ye,n.TEXTURE_2D,Qe,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,be.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.resolveDepthBuffer===!1&&l){let _=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[_])}}}function ne(R){return Math.min(s.maxSamples,R.samples)}function Ae(R){let _=i.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function le(R){let _=a.render.frame;u.get(R)!==_&&(u.set(R,_),R.update())}function Ue(R,_){let z=R.colorSpace,Q=R.format,$=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||z!==Hn&&z!==vn&&(nt.getTransfer(z)===ht?(Q!==Rn||$!==bt)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),_}function xe(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=U,this.resetTextureUnits=B,this.setTexture2D=H,this.setTexture2DArray=O,this.setTexture3D=Y,this.setTextureCube=G,this.rebindTextures=Ne,this.setupRenderTarget=tt,this.updateRenderTargetMipmap=j,this.updateMultisampleRenderTarget=Ce,this.setupDepthRenderbuffer=Oe,this.setupFrameBufferTexture=ve,this.useMultisampledRTT=Ae}function dA(n,e){function t(i,s=vn){let r,a=nt.getTransfer(s);if(i===bt)return n.UNSIGNED_BYTE;if(i===Zc)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Kc)return n.UNSIGNED_SHORT_5_5_5_1;if(i===hd)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===cd)return n.BYTE;if(i===ud)return n.SHORT;if(i===wr)return n.UNSIGNED_SHORT;if(i===Qc)return n.INT;if(i===si)return n.UNSIGNED_INT;if(i===Fn)return n.FLOAT;if(i===li)return n.HALF_FLOAT;if(i===fd)return n.ALPHA;if(i===dd)return n.RGB;if(i===Rn)return n.RGBA;if(i===pd)return n.LUMINANCE;if(i===md)return n.LUMINANCE_ALPHA;if(i===Ls)return n.DEPTH_COMPONENT;if(i===Ii)return n.DEPTH_STENCIL;if(i===Jc)return n.RED;if(i===jc)return n.RED_INTEGER;if(i===gd)return n.RG;if(i===$c)return n.RG_INTEGER;if(i===eu)return n.RGBA_INTEGER;if(i===wa||i===Ta||i===Ca||i===Ra)if(a===ht)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===wa)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ta)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Ca)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Ra)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===wa)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ta)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Ca)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Ra)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Ll||i===Nl||i===Fl||i===Ol)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===Ll)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Nl)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Fl)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Ol)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===kl||i===zl||i===Hl)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(i===kl||i===zl)return a===ht?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===Hl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Gl||i===Vl||i===Wl||i===Xl||i===Yl||i===ql||i===Ql||i===Zl||i===Kl||i===Jl||i===jl||i===$l||i===ec||i===tc)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(i===Gl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Vl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Wl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Xl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Yl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ql)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Ql)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Zl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Kl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Jl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===jl)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===$l)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ec)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===tc)return a===ht?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Da||i===nc||i===ic)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(i===Da)return a===ht?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===nc)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ic)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===vd||i===sc||i===rc||i===ac)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(i===Da)return r.COMPRESSED_RED_RGTC1_EXT;if(i===sc)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===rc)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===ac)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Di?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}var Mc=class extends Bt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},tn=class extends Ot{constructor(){super(),this.isGroup=!0,this.type="Group"}},pA={type:"move"},Sr=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new tn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new tn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new tn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,a=null,o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(let v of e.hand.values()){let g=t.getJointPose(v,i),f=this._getHandJoint(c,v);g!==null&&(f.matrix.fromArray(g.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=g.radius),f.visible=g!==null}let u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,m=.005;c.inputState.pinching&&d>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(pA)))}return o!==null&&(o.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let i=new tn;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},mA=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,gA=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x >= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`,Sc=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){let s=new Ft,r=e.properties.get(s);r.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,i=new Je({vertexShader:mA,fragmentShader:gA,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new et(new Gs(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},_c=class extends nn{constructor(e,t){super();let i=this,s=null,r=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,d=null,p=null,m=null,v=new Sc,g=t.getContextAttributes(),f=null,x=null,A=[],y=[],b=new K,T=null,C=new Bt;C.viewport=new Ke;let D=new Bt;D.viewport=new Ke;let S=[C,D],M=new Mc,w=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let te=A[q];return te===void 0&&(te=new Sr,A[q]=te),te.getTargetRaySpace()},this.getControllerGrip=function(q){let te=A[q];return te===void 0&&(te=new Sr,A[q]=te),te.getGripSpace()},this.getHand=function(q){let te=A[q];return te===void 0&&(te=new Sr,A[q]=te),te.getHandSpace()};function U(q){let te=y.indexOf(q.inputSource);if(te===-1)return;let ve=A[te];ve!==void 0&&(ve.update(q.inputSource,q.frame,c||a),ve.dispatchEvent({type:q.type,data:q.inputSource}))}function k(){s.removeEventListener("select",U),s.removeEventListener("selectstart",U),s.removeEventListener("selectend",U),s.removeEventListener("squeeze",U),s.removeEventListener("squeezestart",U),s.removeEventListener("squeezeend",U),s.removeEventListener("end",k),s.removeEventListener("inputsourceschange",H);for(let q=0;q<A.length;q++){let te=y[q];te!==null&&(y[q]=null,A[q].disconnect(te))}w=null,B=null,v.reset(),e.setRenderTarget(f),p=null,d=null,h=null,s=null,x=null,Le.stop(),i.isPresenting=!1,e.setPixelRatio(T),e.setSize(b.width,b.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){r=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(q){c=q},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return s},this.setSession=async function(q){if(s=q,s!==null){if(f=e.getRenderTarget(),s.addEventListener("select",U),s.addEventListener("selectstart",U),s.addEventListener("selectend",U),s.addEventListener("squeeze",U),s.addEventListener("squeezestart",U),s.addEventListener("squeezeend",U),s.addEventListener("end",k),s.addEventListener("inputsourceschange",H),g.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(b),s.renderState.layers===void 0){let te={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(s,t,te),s.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),x=new at(p.framebufferWidth,p.framebufferHeight,{format:Rn,type:bt,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil})}else{let te=null,ve=null,oe=null;g.depth&&(oe=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,te=g.stencil?Ii:Ls,ve=g.stencil?Di:si);let Ie={colorFormat:t.RGBA8,depthFormat:oe,scaleFactor:r};h=new XRWebGLBinding(s,t),d=h.createProjectionLayer(Ie),s.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),x=new at(d.textureWidth,d.textureHeight,{format:Rn,type:bt,depthTexture:new Vs(d.textureWidth,d.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,te),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await s.requestReferenceSpace(o),Le.setContext(s),Le.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return v.getDepthTexture()};function H(q){for(let te=0;te<q.removed.length;te++){let ve=q.removed[te],oe=y.indexOf(ve);oe>=0&&(y[oe]=null,A[oe].disconnect(ve))}for(let te=0;te<q.added.length;te++){let ve=q.added[te],oe=y.indexOf(ve);if(oe===-1){for(let Oe=0;Oe<A.length;Oe++)if(Oe>=y.length){y.push(ve),oe=Oe;break}else if(y[Oe]===null){y[Oe]=ve,oe=Oe;break}if(oe===-1)break}let Ie=A[oe];Ie&&Ie.connect(ve)}}let O=new P,Y=new P;function G(q,te,ve){O.setFromMatrixPosition(te.matrixWorld),Y.setFromMatrixPosition(ve.matrixWorld);let oe=O.distanceTo(Y),Ie=te.projectionMatrix.elements,Oe=ve.projectionMatrix.elements,Ne=Ie[14]/(Ie[10]-1),tt=Ie[14]/(Ie[10]+1),j=(Ie[9]+1)/Ie[5],se=(Ie[9]-1)/Ie[5],I=(Ie[8]-1)/Ie[0],Ce=(Oe[8]+1)/Oe[0],ne=Ne*I,Ae=Ne*Ce,le=oe/(-I+Ce),Ue=le*-I;if(te.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(Ue),q.translateZ(le),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),Ie[10]===-1)q.projectionMatrix.copy(te.projectionMatrix),q.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{let xe=Ne+le,R=tt+le,_=ne-Ue,z=Ae+(oe-Ue),Q=j*tt/R*xe,$=se*tt/R*xe;q.projectionMatrix.makePerspective(_,z,Q,$,xe,R),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function ee(q,te){te===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(te.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(s===null)return;let te=q.near,ve=q.far;v.texture!==null&&(v.depthNear>0&&(te=v.depthNear),v.depthFar>0&&(ve=v.depthFar)),M.near=D.near=C.near=te,M.far=D.far=C.far=ve,(w!==M.near||B!==M.far)&&(s.updateRenderState({depthNear:M.near,depthFar:M.far}),w=M.near,B=M.far),C.layers.mask=q.layers.mask|2,D.layers.mask=q.layers.mask|4,M.layers.mask=C.layers.mask|D.layers.mask;let oe=q.parent,Ie=M.cameras;ee(M,oe);for(let Oe=0;Oe<Ie.length;Oe++)ee(Ie[Oe],oe);Ie.length===2?G(M,C,D):M.projectionMatrix.copy(C.projectionMatrix),ce(q,M,oe)};function ce(q,te,ve){ve===null?q.matrix.copy(te.matrixWorld):(q.matrix.copy(ve.matrixWorld),q.matrix.invert(),q.matrix.multiply(te.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(te.projectionMatrix),q.projectionMatrixInverse.copy(te.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=Tr*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function(q){l=q,d!==null&&(d.fixedFoveation=q),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=q)},this.hasDepthSensing=function(){return v.texture!==null},this.getDepthSensingMesh=function(){return v.getMesh(M)};let re=null;function Me(q,te){if(u=te.getViewerPose(c||a),m=te,u!==null){let ve=u.views;p!==null&&(e.setRenderTargetFramebuffer(x,p.framebuffer),e.setRenderTarget(x));let oe=!1;ve.length!==M.cameras.length&&(M.cameras.length=0,oe=!0);for(let Oe=0;Oe<ve.length;Oe++){let Ne=ve[Oe],tt=null;if(p!==null)tt=p.getViewport(Ne);else{let se=h.getViewSubImage(d,Ne);tt=se.viewport,Oe===0&&(e.setRenderTargetTextures(x,se.colorTexture,d.ignoreDepthValues?void 0:se.depthStencilTexture),e.setRenderTarget(x))}let j=S[Oe];j===void 0&&(j=new Bt,j.layers.enable(Oe),j.viewport=new Ke,S[Oe]=j),j.matrix.fromArray(Ne.transform.matrix),j.matrix.decompose(j.position,j.quaternion,j.scale),j.projectionMatrix.fromArray(Ne.projectionMatrix),j.projectionMatrixInverse.copy(j.projectionMatrix).invert(),j.viewport.set(tt.x,tt.y,tt.width,tt.height),Oe===0&&(M.matrix.copy(j.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),oe===!0&&M.cameras.push(j)}let Ie=s.enabledFeatures;if(Ie&&Ie.includes("depth-sensing")){let Oe=h.getDepthInformation(ve[0]);Oe&&Oe.isValid&&Oe.texture&&v.init(e,Oe,s.renderState)}}for(let ve=0;ve<A.length;ve++){let oe=y[ve],Ie=A[ve];oe!==null&&Ie!==void 0&&Ie.update(oe,te,c||a)}re&&re(q,te),te.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:te}),m=null}let Le=new bd;Le.setAnimationLoop(Me),this.setAnimationLoop=function(q){re=q},this.dispose=function(){}}},qi=new Xt,vA=new ct;function xA(n,e){function t(g,f){g.matrixAutoUpdate===!0&&g.updateMatrix(),f.value.copy(g.matrix)}function i(g,f){f.color.getRGB(g.fogColor.value,_d(n)),f.isFog?(g.fogNear.value=f.near,g.fogFar.value=f.far):f.isFogExp2&&(g.fogDensity.value=f.density)}function s(g,f,x,A,y){f.isMeshBasicMaterial||f.isMeshLambertMaterial?r(g,f):f.isMeshToonMaterial?(r(g,f),h(g,f)):f.isMeshPhongMaterial?(r(g,f),u(g,f)):f.isMeshStandardMaterial?(r(g,f),d(g,f),f.isMeshPhysicalMaterial&&p(g,f,y)):f.isMeshMatcapMaterial?(r(g,f),m(g,f)):f.isMeshDepthMaterial?r(g,f):f.isMeshDistanceMaterial?(r(g,f),v(g,f)):f.isMeshNormalMaterial?r(g,f):f.isLineBasicMaterial?(a(g,f),f.isLineDashedMaterial&&o(g,f)):f.isPointsMaterial?l(g,f,x,A):f.isSpriteMaterial?c(g,f):f.isShadowMaterial?(g.color.value.copy(f.color),g.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function r(g,f){g.opacity.value=f.opacity,f.color&&g.diffuse.value.copy(f.color),f.emissive&&g.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.bumpMap&&(g.bumpMap.value=f.bumpMap,t(f.bumpMap,g.bumpMapTransform),g.bumpScale.value=f.bumpScale,f.side===Ct&&(g.bumpScale.value*=-1)),f.normalMap&&(g.normalMap.value=f.normalMap,t(f.normalMap,g.normalMapTransform),g.normalScale.value.copy(f.normalScale),f.side===Ct&&g.normalScale.value.negate()),f.displacementMap&&(g.displacementMap.value=f.displacementMap,t(f.displacementMap,g.displacementMapTransform),g.displacementScale.value=f.displacementScale,g.displacementBias.value=f.displacementBias),f.emissiveMap&&(g.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,g.emissiveMapTransform)),f.specularMap&&(g.specularMap.value=f.specularMap,t(f.specularMap,g.specularMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest);let x=e.get(f),A=x.envMap,y=x.envMapRotation;A&&(g.envMap.value=A,qi.copy(y),qi.x*=-1,qi.y*=-1,qi.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(qi.y*=-1,qi.z*=-1),g.envMapRotation.value.setFromMatrix4(vA.makeRotationFromEuler(qi)),g.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=f.reflectivity,g.ior.value=f.ior,g.refractionRatio.value=f.refractionRatio),f.lightMap&&(g.lightMap.value=f.lightMap,g.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,g.lightMapTransform)),f.aoMap&&(g.aoMap.value=f.aoMap,g.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,g.aoMapTransform))}function a(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform))}function o(g,f){g.dashSize.value=f.dashSize,g.totalSize.value=f.dashSize+f.gapSize,g.scale.value=f.scale}function l(g,f,x,A){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.size.value=f.size*x,g.scale.value=A*.5,f.map&&(g.map.value=f.map,t(f.map,g.uvTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function c(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.rotation.value=f.rotation,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function u(g,f){g.specular.value.copy(f.specular),g.shininess.value=Math.max(f.shininess,1e-4)}function h(g,f){f.gradientMap&&(g.gradientMap.value=f.gradientMap)}function d(g,f){g.metalness.value=f.metalness,f.metalnessMap&&(g.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,g.metalnessMapTransform)),g.roughness.value=f.roughness,f.roughnessMap&&(g.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,g.roughnessMapTransform)),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)}function p(g,f,x){g.ior.value=f.ior,f.sheen>0&&(g.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),g.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(g.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,g.sheenColorMapTransform)),f.sheenRoughnessMap&&(g.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,g.sheenRoughnessMapTransform))),f.clearcoat>0&&(g.clearcoat.value=f.clearcoat,g.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(g.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,g.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(g.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ct&&g.clearcoatNormalScale.value.negate())),f.dispersion>0&&(g.dispersion.value=f.dispersion),f.iridescence>0&&(g.iridescence.value=f.iridescence,g.iridescenceIOR.value=f.iridescenceIOR,g.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(g.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,g.iridescenceMapTransform)),f.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),f.transmission>0&&(g.transmission.value=f.transmission,g.transmissionSamplerMap.value=x.texture,g.transmissionSamplerSize.value.set(x.width,x.height),f.transmissionMap&&(g.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,g.transmissionMapTransform)),g.thickness.value=f.thickness,f.thicknessMap&&(g.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=f.attenuationDistance,g.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(g.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(g.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=f.specularIntensity,g.specularColor.value.copy(f.specularColor),f.specularColorMap&&(g.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,g.specularColorMapTransform)),f.specularIntensityMap&&(g.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,f){f.matcap&&(g.matcap.value=f.matcap)}function v(g,f){let x=e.get(f).light;g.referencePosition.value.setFromMatrixPosition(x.matrixWorld),g.nearDistance.value=x.shadow.camera.near,g.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function yA(n,e,t,i){let s={},r={},a=[],o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,A){let y=A.program;i.uniformBlockBinding(x,y)}function c(x,A){let y=s[x.id];y===void 0&&(m(x),y=u(x),s[x.id]=y,x.addEventListener("dispose",g));let b=A.program;i.updateUBOMapping(x,b);let T=e.render.frame;r[x.id]!==T&&(d(x),r[x.id]=T)}function u(x){let A=h();x.__bindingPointIndex=A;let y=n.createBuffer(),b=x.__size,T=x.usage;return n.bindBuffer(n.UNIFORM_BUFFER,y),n.bufferData(n.UNIFORM_BUFFER,b,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,A,y),y}function h(){for(let x=0;x<o;x++)if(a.indexOf(x)===-1)return a.push(x),x;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(x){let A=s[x.id],y=x.uniforms,b=x.__cache;n.bindBuffer(n.UNIFORM_BUFFER,A);for(let T=0,C=y.length;T<C;T++){let D=Array.isArray(y[T])?y[T]:[y[T]];for(let S=0,M=D.length;S<M;S++){let w=D[S];if(p(w,T,S,b)===!0){let B=w.__offset,U=Array.isArray(w.value)?w.value:[w.value],k=0;for(let H=0;H<U.length;H++){let O=U[H],Y=v(O);typeof O=="number"||typeof O=="boolean"?(w.__data[0]=O,n.bufferSubData(n.UNIFORM_BUFFER,B+k,w.__data)):O.isMatrix3?(w.__data[0]=O.elements[0],w.__data[1]=O.elements[1],w.__data[2]=O.elements[2],w.__data[3]=0,w.__data[4]=O.elements[3],w.__data[5]=O.elements[4],w.__data[6]=O.elements[5],w.__data[7]=0,w.__data[8]=O.elements[6],w.__data[9]=O.elements[7],w.__data[10]=O.elements[8],w.__data[11]=0):(O.toArray(w.__data,k),k+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,B,w.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(x,A,y,b){let T=x.value,C=A+"_"+y;if(b[C]===void 0)return typeof T=="number"||typeof T=="boolean"?b[C]=T:b[C]=T.clone(),!0;{let D=b[C];if(typeof T=="number"||typeof T=="boolean"){if(D!==T)return b[C]=T,!0}else if(D.equals(T)===!1)return D.copy(T),!0}return!1}function m(x){let A=x.uniforms,y=0,b=16;for(let C=0,D=A.length;C<D;C++){let S=Array.isArray(A[C])?A[C]:[A[C]];for(let M=0,w=S.length;M<w;M++){let B=S[M],U=Array.isArray(B.value)?B.value:[B.value];for(let k=0,H=U.length;k<H;k++){let O=U[k],Y=v(O),G=y%b,ee=G%Y.boundary,ce=G+ee;y+=ee,ce!==0&&b-ce<Y.storage&&(y+=b-ce),B.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),B.__offset=y,y+=Y.storage}}}let T=y%b;return T>0&&(y+=b-T),x.__size=y,x.__cache={},this}function v(x){let A={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(A.boundary=4,A.storage=4):x.isVector2?(A.boundary=8,A.storage=8):x.isVector3||x.isColor?(A.boundary=16,A.storage=12):x.isVector4?(A.boundary=16,A.storage=16):x.isMatrix3?(A.boundary=48,A.storage=48):x.isMatrix4?(A.boundary=64,A.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),A}function g(x){let A=x.target;A.removeEventListener("dispose",g);let y=a.indexOf(A.__bindingPointIndex);a.splice(y,1),n.deleteBuffer(s[A.id]),delete s[A.id],delete r[A.id]}function f(){for(let x in s)n.deleteBuffer(s[x]);a=[],s={},r={}}return{bind:l,update:c,dispose:f}}var Wa=class{constructor(e={}){let{canvas:t=_g(),context:i=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=a;let m=new Uint32Array(4),v=new Int32Array(4),g=null,f=null,x=[],A=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=$e,this.toneMapping=Ri,this.toneMappingExposure=1;let y=this,b=!1,T=0,C=0,D=null,S=-1,M=null,w=new Ke,B=new Ke,U=null,k=new Pe(0),H=0,O=t.width,Y=t.height,G=1,ee=null,ce=null,re=new Ke(0,0,O,Y),Me=new Ke(0,0,O,Y),Le=!1,q=new Cr,te=!1,ve=!1,oe=new ct,Ie=new ct,Oe=new P,Ne=new Ke,tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},j=!1;function se(){return D===null?G:1}let I=i;function Ce(E,N){return t.getContext(E,N)}try{let E={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine","three.js r170"),t.addEventListener("webglcontextlost",J,!1),t.addEventListener("webglcontextrestored",me,!1),t.addEventListener("webglcontextcreationerror",de,!1),I===null){let N="webgl2";if(I=Ce(N,E),I===null)throw Ce(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let ne,Ae,le,Ue,xe,R,_,z,Q,$,Z,be,he,ye,Qe,ie,Se,Be,Fe,_e,je,Ve,ft,L;function fe(){ne=new Lx(I),ne.init(),Ve=new dA(I,ne),Ae=new Rx(I,ne,e,Ve),le=new uA(I,ne),Ae.reverseDepthBuffer&&d&&le.buffers.depth.setReversed(!0),Ue=new Ox(I),xe=new Jy,R=new fA(I,ne,le,xe,Ae,Ve,Ue),_=new Ix(y),z=new Bx(y),Q=new Xg(I),ft=new Tx(I,Q),$=new Nx(I,Q,Ue,ft),Z=new zx(I,$,Q,Ue),Fe=new kx(I,Ae,R),ie=new Dx(xe),be=new Ky(y,_,z,ne,Ae,ft,ie),he=new xA(y,xe),ye=new $y,Qe=new rA(ne),Be=new wx(y,_,z,le,Z,p,l),Se=new lA(y,Z,Ae),L=new yA(I,Ue,Ae,le),_e=new Cx(I,ne,Ue),je=new Fx(I,ne,Ue),Ue.programs=be.programs,y.capabilities=Ae,y.extensions=ne,y.properties=xe,y.renderLists=ye,y.shadowMap=Se,y.state=le,y.info=Ue}fe();let X=new _c(y,I);this.xr=X,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let E=ne.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){let E=ne.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(E){E!==void 0&&(G=E,this.setSize(O,Y,!1))},this.getSize=function(E){return E.set(O,Y)},this.setSize=function(E,N,V=!0){if(X.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}O=E,Y=N,t.width=Math.floor(E*G),t.height=Math.floor(N*G),V===!0&&(t.style.width=E+"px",t.style.height=N+"px"),this.setViewport(0,0,E,N)},this.getDrawingBufferSize=function(E){return E.set(O*G,Y*G).floor()},this.setDrawingBufferSize=function(E,N,V){O=E,Y=N,G=V,t.width=Math.floor(E*V),t.height=Math.floor(N*V),this.setViewport(0,0,E,N)},this.getCurrentViewport=function(E){return E.copy(w)},this.getViewport=function(E){return E.copy(re)},this.setViewport=function(E,N,V,W){E.isVector4?re.set(E.x,E.y,E.z,E.w):re.set(E,N,V,W),le.viewport(w.copy(re).multiplyScalar(G).round())},this.getScissor=function(E){return E.copy(Me)},this.setScissor=function(E,N,V,W){E.isVector4?Me.set(E.x,E.y,E.z,E.w):Me.set(E,N,V,W),le.scissor(B.copy(Me).multiplyScalar(G).round())},this.getScissorTest=function(){return Le},this.setScissorTest=function(E){le.setScissorTest(Le=E)},this.setOpaqueSort=function(E){ee=E},this.setTransparentSort=function(E){ce=E},this.getClearColor=function(E){return E.copy(Be.getClearColor())},this.setClearColor=function(){Be.setClearColor.apply(Be,arguments)},this.getClearAlpha=function(){return Be.getClearAlpha()},this.setClearAlpha=function(){Be.setClearAlpha.apply(Be,arguments)},this.clear=function(E=!0,N=!0,V=!0){let W=0;if(E){let F=!1;if(D!==null){let ae=D.texture.format;F=ae===eu||ae===$c||ae===jc}if(F){let ae=D.texture.type,pe=ae===bt||ae===si||ae===wr||ae===Di||ae===Zc||ae===Kc,Ee=Be.getClearColor(),we=Be.getClearAlpha(),ke=Ee.r,He=Ee.g,Te=Ee.b;pe?(m[0]=ke,m[1]=He,m[2]=Te,m[3]=we,I.clearBufferuiv(I.COLOR,0,m)):(v[0]=ke,v[1]=He,v[2]=Te,v[3]=we,I.clearBufferiv(I.COLOR,0,v))}else W|=I.COLOR_BUFFER_BIT}N&&(W|=I.DEPTH_BUFFER_BIT),V&&(W|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),I.clear(W)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",J,!1),t.removeEventListener("webglcontextrestored",me,!1),t.removeEventListener("webglcontextcreationerror",de,!1),ye.dispose(),Qe.dispose(),xe.dispose(),_.dispose(),z.dispose(),Z.dispose(),ft.dispose(),L.dispose(),be.dispose(),X.dispose(),X.removeEventListener("sessionstart",Bu),X.removeEventListener("sessionend",Lu),ki.stop()};function J(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function me(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;let E=Ue.autoReset,N=Se.enabled,V=Se.autoUpdate,W=Se.needsUpdate,F=Se.type;fe(),Ue.autoReset=E,Se.enabled=N,Se.autoUpdate=V,Se.needsUpdate=W,Se.type=F}function de(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function ze(E){let N=E.target;N.removeEventListener("dispose",ze),Mt(N)}function Mt(E){kt(E),xe.remove(E)}function kt(E){let N=xe.get(E).programs;N!==void 0&&(N.forEach(function(V){be.releaseProgram(V)}),E.isShaderMaterial&&be.releaseShaderCache(E))}this.renderBufferDirect=function(E,N,V,W,F,ae){N===null&&(N=tt);let pe=F.isMesh&&F.matrixWorld.determinant()<0,Ee=Np(E,N,V,W,F);le.setMaterial(W,pe);let we=V.index,ke=1;if(W.wireframe===!0){if(we=$.getWireframeAttribute(V),we===void 0)return;ke=2}let He=V.drawRange,Te=V.attributes.position,it=He.start*ke,dt=(He.start+He.count)*ke;ae!==null&&(it=Math.max(it,ae.start*ke),dt=Math.min(dt,(ae.start+ae.count)*ke)),we!==null?(it=Math.max(it,0),dt=Math.min(dt,we.count)):Te!=null&&(it=Math.max(it,0),dt=Math.min(dt,Te.count));let gt=dt-it;if(gt<0||gt===1/0)return;ft.setup(F,W,Ee,V,we);let jt,ot=_e;if(we!==null&&(jt=Q.get(we),ot=je,ot.setIndex(jt)),F.isMesh)W.wireframe===!0?(le.setLineWidth(W.wireframeLinewidth*se()),ot.setMode(I.LINES)):ot.setMode(I.TRIANGLES);else if(F.isLine){let Re=W.linewidth;Re===void 0&&(Re=1),le.setLineWidth(Re*se()),F.isLineSegments?ot.setMode(I.LINES):F.isLineLoop?ot.setMode(I.LINE_LOOP):ot.setMode(I.LINE_STRIP)}else F.isPoints?ot.setMode(I.POINTS):F.isSprite&&ot.setMode(I.TRIANGLES);if(F.isBatchedMesh)if(F._multiDrawInstances!==null)ot.renderMultiDrawInstances(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount,F._multiDrawInstances);else if(ne.get("WEBGL_multi_draw"))ot.renderMultiDraw(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount);else{let Re=F._multiDrawStarts,Wn=F._multiDrawCounts,lt=F._multiDrawCount,_n=we?Q.get(we).bytesPerElement:1,hs=xe.get(W).currentProgram.getUniforms();for(let rn=0;rn<lt;rn++)hs.setValue(I,"_gl_DrawID",rn),ot.render(Re[rn]/_n,Wn[rn])}else if(F.isInstancedMesh)ot.renderInstances(it,gt,F.count);else if(V.isInstancedBufferGeometry){let Re=V._maxInstanceCount!==void 0?V._maxInstanceCount:1/0,Wn=Math.min(V.instanceCount,Re);ot.renderInstances(it,gt,Wn)}else ot.render(it,gt)};function ut(E,N,V){E.transparent===!0&&E.side===Lt&&E.forceSinglePass===!1?(E.side=Ct,E.needsUpdate=!0,Hr(E,N,V),E.side=On,E.needsUpdate=!0,Hr(E,N,V),E.side=Lt):Hr(E,N,V)}this.compile=function(E,N,V=null){V===null&&(V=E),f=Qe.get(V),f.init(N),A.push(f),V.traverseVisible(function(F){F.isLight&&F.layers.test(N.layers)&&(f.pushLight(F),F.castShadow&&f.pushShadow(F))}),E!==V&&E.traverseVisible(function(F){F.isLight&&F.layers.test(N.layers)&&(f.pushLight(F),F.castShadow&&f.pushShadow(F))}),f.setupLights();let W=new Set;return E.traverse(function(F){if(!(F.isMesh||F.isPoints||F.isLine||F.isSprite))return;let ae=F.material;if(ae)if(Array.isArray(ae))for(let pe=0;pe<ae.length;pe++){let Ee=ae[pe];ut(Ee,V,F),W.add(Ee)}else ut(ae,V,F),W.add(ae)}),A.pop(),f=null,W},this.compileAsync=function(E,N,V=null){let W=this.compile(E,N,V);return new Promise(F=>{function ae(){if(W.forEach(function(pe){xe.get(pe).currentProgram.isReady()&&W.delete(pe)}),W.size===0){F(E);return}setTimeout(ae,10)}ne.get("KHR_parallel_shader_compile")!==null?ae():setTimeout(ae,10)})};let Sn=null;function Vn(E){Sn&&Sn(E)}function Bu(){ki.stop()}function Lu(){ki.start()}let ki=new bd;ki.setAnimationLoop(Vn),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(E){Sn=E,X.setAnimationLoop(E),E===null?ki.stop():ki.start()},X.addEventListener("sessionstart",Bu),X.addEventListener("sessionend",Lu),this.render=function(E,N){if(N!==void 0&&N.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),X.enabled===!0&&X.isPresenting===!0&&(X.cameraAutoUpdate===!0&&X.updateCamera(N),N=X.getCamera()),E.isScene===!0&&E.onBeforeRender(y,E,N,D),f=Qe.get(E,A.length),f.init(N),A.push(f),Ie.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),q.setFromProjectionMatrix(Ie),ve=this.localClippingEnabled,te=ie.init(this.clippingPlanes,ve),g=ye.get(E,x.length),g.init(),x.push(g),X.enabled===!0&&X.isPresenting===!0){let ae=y.xr.getDepthSensingMesh();ae!==null&&To(ae,N,-1/0,y.sortObjects)}To(E,N,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(ee,ce),j=X.enabled===!1||X.isPresenting===!1||X.hasDepthSensing()===!1,j&&Be.addToRenderList(g,E),this.info.render.frame++,te===!0&&ie.beginShadows();let V=f.state.shadowsArray;Se.render(V,E,N),te===!0&&ie.endShadows(),this.info.autoReset===!0&&this.info.reset();let W=g.opaque,F=g.transmissive;if(f.setupLights(),N.isArrayCamera){let ae=N.cameras;if(F.length>0)for(let pe=0,Ee=ae.length;pe<Ee;pe++){let we=ae[pe];Fu(W,F,E,we)}j&&Be.render(E);for(let pe=0,Ee=ae.length;pe<Ee;pe++){let we=ae[pe];Nu(g,E,we,we.viewport)}}else F.length>0&&Fu(W,F,E,N),j&&Be.render(E),Nu(g,E,N);D!==null&&(R.updateMultisampleRenderTarget(D),R.updateRenderTargetMipmap(D)),E.isScene===!0&&E.onAfterRender(y,E,N),ft.resetDefaultState(),S=-1,M=null,A.pop(),A.length>0?(f=A[A.length-1],te===!0&&ie.setGlobalState(y.clippingPlanes,f.state.camera)):f=null,x.pop(),x.length>0?g=x[x.length-1]:g=null};function To(E,N,V,W){if(E.visible===!1)return;if(E.layers.test(N.layers)){if(E.isGroup)V=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(N);else if(E.isLight)f.pushLight(E),E.castShadow&&f.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||q.intersectsSprite(E)){W&&Ne.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Ie);let pe=Z.update(E),Ee=E.material;Ee.visible&&g.push(E,pe,Ee,V,Ne.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||q.intersectsObject(E))){let pe=Z.update(E),Ee=E.material;if(W&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Ne.copy(E.boundingSphere.center)):(pe.boundingSphere===null&&pe.computeBoundingSphere(),Ne.copy(pe.boundingSphere.center)),Ne.applyMatrix4(E.matrixWorld).applyMatrix4(Ie)),Array.isArray(Ee)){let we=pe.groups;for(let ke=0,He=we.length;ke<He;ke++){let Te=we[ke],it=Ee[Te.materialIndex];it&&it.visible&&g.push(E,pe,it,V,Ne.z,Te)}}else Ee.visible&&g.push(E,pe,Ee,V,Ne.z,null)}}let ae=E.children;for(let pe=0,Ee=ae.length;pe<Ee;pe++)To(ae[pe],N,V,W)}function Nu(E,N,V,W){let F=E.opaque,ae=E.transmissive,pe=E.transparent;f.setupLightsView(V),te===!0&&ie.setGlobalState(y.clippingPlanes,V),W&&le.viewport(w.copy(W)),F.length>0&&zr(F,N,V),ae.length>0&&zr(ae,N,V),pe.length>0&&zr(pe,N,V),le.buffers.depth.setTest(!0),le.buffers.depth.setMask(!0),le.buffers.color.setMask(!0),le.setPolygonOffset(!1)}function Fu(E,N,V,W){if((V.isScene===!0?V.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[W.id]===void 0&&(f.state.transmissionRenderTarget[W.id]=new at(1,1,{generateMipmaps:!0,type:ne.has("EXT_color_buffer_half_float")||ne.has("EXT_color_buffer_float")?li:bt,minFilter:ti,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:nt.workingColorSpace}));let ae=f.state.transmissionRenderTarget[W.id],pe=W.viewport||w;ae.setSize(pe.z,pe.w);let Ee=y.getRenderTarget();y.setRenderTarget(ae),y.getClearColor(k),H=y.getClearAlpha(),H<1&&y.setClearColor(16777215,.5),y.clear(),j&&Be.render(V);let we=y.toneMapping;y.toneMapping=Ri;let ke=W.viewport;if(W.viewport!==void 0&&(W.viewport=void 0),f.setupLightsView(W),te===!0&&ie.setGlobalState(y.clippingPlanes,W),zr(E,V,W),R.updateMultisampleRenderTarget(ae),R.updateRenderTargetMipmap(ae),ne.has("WEBGL_multisampled_render_to_texture")===!1){let He=!1;for(let Te=0,it=N.length;Te<it;Te++){let dt=N[Te],gt=dt.object,jt=dt.geometry,ot=dt.material,Re=dt.group;if(ot.side===Lt&&gt.layers.test(W.layers)){let Wn=ot.side;ot.side=Ct,ot.needsUpdate=!0,Ou(gt,V,W,jt,ot,Re),ot.side=Wn,ot.needsUpdate=!0,He=!0}}He===!0&&(R.updateMultisampleRenderTarget(ae),R.updateRenderTargetMipmap(ae))}y.setRenderTarget(Ee),y.setClearColor(k,H),ke!==void 0&&(W.viewport=ke),y.toneMapping=we}function zr(E,N,V){let W=N.isScene===!0?N.overrideMaterial:null;for(let F=0,ae=E.length;F<ae;F++){let pe=E[F],Ee=pe.object,we=pe.geometry,ke=W===null?pe.material:W,He=pe.group;Ee.layers.test(V.layers)&&Ou(Ee,N,V,we,ke,He)}}function Ou(E,N,V,W,F,ae){E.onBeforeRender(y,N,V,W,F,ae),E.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),F.onBeforeRender(y,N,V,W,E,ae),F.transparent===!0&&F.side===Lt&&F.forceSinglePass===!1?(F.side=Ct,F.needsUpdate=!0,y.renderBufferDirect(V,N,W,F,E,ae),F.side=On,F.needsUpdate=!0,y.renderBufferDirect(V,N,W,F,E,ae),F.side=Lt):y.renderBufferDirect(V,N,W,F,E,ae),E.onAfterRender(y,N,V,W,F,ae)}function Hr(E,N,V){N.isScene!==!0&&(N=tt);let W=xe.get(E),F=f.state.lights,ae=f.state.shadowsArray,pe=F.state.version,Ee=be.getParameters(E,F.state,ae,N,V),we=be.getProgramCacheKey(Ee),ke=W.programs;W.environment=E.isMeshStandardMaterial?N.environment:null,W.fog=N.fog,W.envMap=(E.isMeshStandardMaterial?z:_).get(E.envMap||W.environment),W.envMapRotation=W.environment!==null&&E.envMap===null?N.environmentRotation:E.envMapRotation,ke===void 0&&(E.addEventListener("dispose",ze),ke=new Map,W.programs=ke);let He=ke.get(we);if(He!==void 0){if(W.currentProgram===He&&W.lightsStateVersion===pe)return zu(E,Ee),He}else Ee.uniforms=be.getUniforms(E),E.onBeforeCompile(Ee,y),He=be.acquireProgram(Ee,we),ke.set(we,He),W.uniforms=Ee.uniforms;let Te=W.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Te.clippingPlanes=ie.uniform),zu(E,Ee),W.needsLights=Op(E),W.lightsStateVersion=pe,W.needsLights&&(Te.ambientLightColor.value=F.state.ambient,Te.lightProbe.value=F.state.probe,Te.directionalLights.value=F.state.directional,Te.directionalLightShadows.value=F.state.directionalShadow,Te.spotLights.value=F.state.spot,Te.spotLightShadows.value=F.state.spotShadow,Te.rectAreaLights.value=F.state.rectArea,Te.ltc_1.value=F.state.rectAreaLTC1,Te.ltc_2.value=F.state.rectAreaLTC2,Te.pointLights.value=F.state.point,Te.pointLightShadows.value=F.state.pointShadow,Te.hemisphereLights.value=F.state.hemi,Te.directionalShadowMap.value=F.state.directionalShadowMap,Te.directionalShadowMatrix.value=F.state.directionalShadowMatrix,Te.spotShadowMap.value=F.state.spotShadowMap,Te.spotLightMatrix.value=F.state.spotLightMatrix,Te.spotLightMap.value=F.state.spotLightMap,Te.pointShadowMap.value=F.state.pointShadowMap,Te.pointShadowMatrix.value=F.state.pointShadowMatrix),W.currentProgram=He,W.uniformsList=null,He}function ku(E){if(E.uniformsList===null){let N=E.currentProgram.getUniforms();E.uniformsList=Fs.seqWithValue(N.seq,E.uniforms)}return E.uniformsList}function zu(E,N){let V=xe.get(E);V.outputColorSpace=N.outputColorSpace,V.batching=N.batching,V.batchingColor=N.batchingColor,V.instancing=N.instancing,V.instancingColor=N.instancingColor,V.instancingMorph=N.instancingMorph,V.skinning=N.skinning,V.morphTargets=N.morphTargets,V.morphNormals=N.morphNormals,V.morphColors=N.morphColors,V.morphTargetsCount=N.morphTargetsCount,V.numClippingPlanes=N.numClippingPlanes,V.numIntersection=N.numClipIntersection,V.vertexAlphas=N.vertexAlphas,V.vertexTangents=N.vertexTangents,V.toneMapping=N.toneMapping}function Np(E,N,V,W,F){N.isScene!==!0&&(N=tt),R.resetTextureUnits();let ae=N.fog,pe=W.isMeshStandardMaterial?N.environment:null,Ee=D===null?y.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:Hn,we=(W.isMeshStandardMaterial?z:_).get(W.envMap||pe),ke=W.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,He=!!V.attributes.tangent&&(!!W.normalMap||W.anisotropy>0),Te=!!V.morphAttributes.position,it=!!V.morphAttributes.normal,dt=!!V.morphAttributes.color,gt=Ri;W.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(gt=y.toneMapping);let jt=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,ot=jt!==void 0?jt.length:0,Re=xe.get(W),Wn=f.state.lights;if(te===!0&&(ve===!0||E!==M)){let dn=E===M&&W.id===S;ie.setState(W,E,dn)}let lt=!1;W.version===Re.__version?(Re.needsLights&&Re.lightsStateVersion!==Wn.state.version||Re.outputColorSpace!==Ee||F.isBatchedMesh&&Re.batching===!1||!F.isBatchedMesh&&Re.batching===!0||F.isBatchedMesh&&Re.batchingColor===!0&&F.colorTexture===null||F.isBatchedMesh&&Re.batchingColor===!1&&F.colorTexture!==null||F.isInstancedMesh&&Re.instancing===!1||!F.isInstancedMesh&&Re.instancing===!0||F.isSkinnedMesh&&Re.skinning===!1||!F.isSkinnedMesh&&Re.skinning===!0||F.isInstancedMesh&&Re.instancingColor===!0&&F.instanceColor===null||F.isInstancedMesh&&Re.instancingColor===!1&&F.instanceColor!==null||F.isInstancedMesh&&Re.instancingMorph===!0&&F.morphTexture===null||F.isInstancedMesh&&Re.instancingMorph===!1&&F.morphTexture!==null||Re.envMap!==we||W.fog===!0&&Re.fog!==ae||Re.numClippingPlanes!==void 0&&(Re.numClippingPlanes!==ie.numPlanes||Re.numIntersection!==ie.numIntersection)||Re.vertexAlphas!==ke||Re.vertexTangents!==He||Re.morphTargets!==Te||Re.morphNormals!==it||Re.morphColors!==dt||Re.toneMapping!==gt||Re.morphTargetsCount!==ot)&&(lt=!0):(lt=!0,Re.__version=W.version);let _n=Re.currentProgram;lt===!0&&(_n=Hr(W,N,F));let hs=!1,rn=!1,sr=!1,vt=_n.getUniforms(),Bn=Re.uniforms;if(le.useProgram(_n.program)&&(hs=!0,rn=!0,sr=!0),W.id!==S&&(S=W.id,rn=!0),hs||M!==E){le.buffers.depth.getReversed()?(oe.copy(E.projectionMatrix),Eg(oe),wg(oe),vt.setValue(I,"projectionMatrix",oe)):vt.setValue(I,"projectionMatrix",E.projectionMatrix),vt.setValue(I,"viewMatrix",E.matrixWorldInverse);let pi=vt.map.cameraPosition;pi!==void 0&&pi.setValue(I,Oe.setFromMatrixPosition(E.matrixWorld)),Ae.logarithmicDepthBuffer&&vt.setValue(I,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial)&&vt.setValue(I,"isOrthographic",E.isOrthographicCamera===!0),M!==E&&(M=E,rn=!0,sr=!0)}if(F.isSkinnedMesh){vt.setOptional(I,F,"bindMatrix"),vt.setOptional(I,F,"bindMatrixInverse");let dn=F.skeleton;dn&&(dn.boneTexture===null&&dn.computeBoneTexture(),vt.setValue(I,"boneTexture",dn.boneTexture,R))}F.isBatchedMesh&&(vt.setOptional(I,F,"batchingTexture"),vt.setValue(I,"batchingTexture",F._matricesTexture,R),vt.setOptional(I,F,"batchingIdTexture"),vt.setValue(I,"batchingIdTexture",F._indirectTexture,R),vt.setOptional(I,F,"batchingColorTexture"),F._colorsTexture!==null&&vt.setValue(I,"batchingColorTexture",F._colorsTexture,R));let rr=V.morphAttributes;if((rr.position!==void 0||rr.normal!==void 0||rr.color!==void 0)&&Fe.update(F,V,_n),(rn||Re.receiveShadow!==F.receiveShadow)&&(Re.receiveShadow=F.receiveShadow,vt.setValue(I,"receiveShadow",F.receiveShadow)),W.isMeshGouraudMaterial&&W.envMap!==null&&(Bn.envMap.value=we,Bn.flipEnvMap.value=we.isCubeTexture&&we.isRenderTargetTexture===!1?-1:1),W.isMeshStandardMaterial&&W.envMap===null&&N.environment!==null&&(Bn.envMapIntensity.value=N.environmentIntensity),rn&&(vt.setValue(I,"toneMappingExposure",y.toneMappingExposure),Re.needsLights&&Fp(Bn,sr),ae&&W.fog===!0&&he.refreshFogUniforms(Bn,ae),he.refreshMaterialUniforms(Bn,W,G,Y,f.state.transmissionRenderTarget[E.id]),Fs.upload(I,ku(Re),Bn,R)),W.isShaderMaterial&&W.uniformsNeedUpdate===!0&&(Fs.upload(I,ku(Re),Bn,R),W.uniformsNeedUpdate=!1),W.isSpriteMaterial&&vt.setValue(I,"center",F.center),vt.setValue(I,"modelViewMatrix",F.modelViewMatrix),vt.setValue(I,"normalMatrix",F.normalMatrix),vt.setValue(I,"modelMatrix",F.matrixWorld),W.isShaderMaterial||W.isRawShaderMaterial){let dn=W.uniformsGroups;for(let pi=0,mi=dn.length;pi<mi;pi++){let Hu=dn[pi];L.update(Hu,_n),L.bind(Hu,_n)}}return _n}function Fp(E,N){E.ambientLightColor.needsUpdate=N,E.lightProbe.needsUpdate=N,E.directionalLights.needsUpdate=N,E.directionalLightShadows.needsUpdate=N,E.pointLights.needsUpdate=N,E.pointLightShadows.needsUpdate=N,E.spotLights.needsUpdate=N,E.spotLightShadows.needsUpdate=N,E.rectAreaLights.needsUpdate=N,E.hemisphereLights.needsUpdate=N}function Op(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(E,N,V){xe.get(E.texture).__webglTexture=N,xe.get(E.depthTexture).__webglTexture=V;let W=xe.get(E);W.__hasExternalTextures=!0,W.__autoAllocateDepthBuffer=V===void 0,W.__autoAllocateDepthBuffer||ne.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),W.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(E,N){let V=xe.get(E);V.__webglFramebuffer=N,V.__useDefaultFramebuffer=N===void 0},this.setRenderTarget=function(E,N=0,V=0){D=E,T=N,C=V;let W=!0,F=null,ae=!1,pe=!1;if(E){let we=xe.get(E);if(we.__useDefaultFramebuffer!==void 0)le.bindFramebuffer(I.FRAMEBUFFER,null),W=!1;else if(we.__webglFramebuffer===void 0)R.setupRenderTarget(E);else if(we.__hasExternalTextures)R.rebindTextures(E,xe.get(E.texture).__webglTexture,xe.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){let Te=E.depthTexture;if(we.__boundDepthTexture!==Te){if(Te!==null&&xe.has(Te)&&(E.width!==Te.image.width||E.height!==Te.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");R.setupDepthRenderbuffer(E)}}let ke=E.texture;(ke.isData3DTexture||ke.isDataArrayTexture||ke.isCompressedArrayTexture)&&(pe=!0);let He=xe.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(He[N])?F=He[N][V]:F=He[N],ae=!0):E.samples>0&&R.useMultisampledRTT(E)===!1?F=xe.get(E).__webglMultisampledFramebuffer:Array.isArray(He)?F=He[V]:F=He,w.copy(E.viewport),B.copy(E.scissor),U=E.scissorTest}else w.copy(re).multiplyScalar(G).floor(),B.copy(Me).multiplyScalar(G).floor(),U=Le;if(le.bindFramebuffer(I.FRAMEBUFFER,F)&&W&&le.drawBuffers(E,F),le.viewport(w),le.scissor(B),le.setScissorTest(U),ae){let we=xe.get(E.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+N,we.__webglTexture,V)}else if(pe){let we=xe.get(E.texture),ke=N||0;I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,we.__webglTexture,V||0,ke)}S=-1},this.readRenderTargetPixels=function(E,N,V,W,F,ae,pe){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ee=xe.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&pe!==void 0&&(Ee=Ee[pe]),Ee){le.bindFramebuffer(I.FRAMEBUFFER,Ee);try{let we=E.texture,ke=we.format,He=we.type;if(!Ae.textureFormatReadable(ke)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ae.textureTypeReadable(He)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=E.width-W&&V>=0&&V<=E.height-F&&I.readPixels(N,V,W,F,Ve.convert(ke),Ve.convert(He),ae)}finally{let we=D!==null?xe.get(D).__webglFramebuffer:null;le.bindFramebuffer(I.FRAMEBUFFER,we)}}},this.readRenderTargetPixelsAsync=async function(E,N,V,W,F,ae,pe){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ee=xe.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&pe!==void 0&&(Ee=Ee[pe]),Ee){let we=E.texture,ke=we.format,He=we.type;if(!Ae.textureFormatReadable(ke))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ae.textureTypeReadable(He))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(N>=0&&N<=E.width-W&&V>=0&&V<=E.height-F){le.bindFramebuffer(I.FRAMEBUFFER,Ee);let Te=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,Te),I.bufferData(I.PIXEL_PACK_BUFFER,ae.byteLength,I.STREAM_READ),I.readPixels(N,V,W,F,Ve.convert(ke),Ve.convert(He),0);let it=D!==null?xe.get(D).__webglFramebuffer:null;le.bindFramebuffer(I.FRAMEBUFFER,it);let dt=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await bg(I,dt,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,Te),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,ae),I.deleteBuffer(Te),I.deleteSync(dt),ae}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(E,N=null,V=0){E.isTexture!==!0&&(xr("WebGLRenderer: copyFramebufferToTexture function signature has changed."),N=arguments[0]||null,E=arguments[1]);let W=Math.pow(2,-V),F=Math.floor(E.image.width*W),ae=Math.floor(E.image.height*W),pe=N!==null?N.x:0,Ee=N!==null?N.y:0;R.setTexture2D(E,0),I.copyTexSubImage2D(I.TEXTURE_2D,V,0,0,pe,Ee,F,ae),le.unbindTexture()},this.copyTextureToTexture=function(E,N,V=null,W=null,F=0){E.isTexture!==!0&&(xr("WebGLRenderer: copyTextureToTexture function signature has changed."),W=arguments[0]||null,E=arguments[1],N=arguments[2],F=arguments[3]||0,V=null);let ae,pe,Ee,we,ke,He,Te,it,dt,gt=E.isCompressedTexture?E.mipmaps[F]:E.image;V!==null?(ae=V.max.x-V.min.x,pe=V.max.y-V.min.y,Ee=V.isBox3?V.max.z-V.min.z:1,we=V.min.x,ke=V.min.y,He=V.isBox3?V.min.z:0):(ae=gt.width,pe=gt.height,Ee=gt.depth||1,we=0,ke=0,He=0),W!==null?(Te=W.x,it=W.y,dt=W.z):(Te=0,it=0,dt=0);let jt=Ve.convert(N.format),ot=Ve.convert(N.type),Re;N.isData3DTexture?(R.setTexture3D(N,0),Re=I.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(R.setTexture2DArray(N,0),Re=I.TEXTURE_2D_ARRAY):(R.setTexture2D(N,0),Re=I.TEXTURE_2D),I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,N.flipY),I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),I.pixelStorei(I.UNPACK_ALIGNMENT,N.unpackAlignment);let Wn=I.getParameter(I.UNPACK_ROW_LENGTH),lt=I.getParameter(I.UNPACK_IMAGE_HEIGHT),_n=I.getParameter(I.UNPACK_SKIP_PIXELS),hs=I.getParameter(I.UNPACK_SKIP_ROWS),rn=I.getParameter(I.UNPACK_SKIP_IMAGES);I.pixelStorei(I.UNPACK_ROW_LENGTH,gt.width),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,gt.height),I.pixelStorei(I.UNPACK_SKIP_PIXELS,we),I.pixelStorei(I.UNPACK_SKIP_ROWS,ke),I.pixelStorei(I.UNPACK_SKIP_IMAGES,He);let sr=E.isDataArrayTexture||E.isData3DTexture,vt=N.isDataArrayTexture||N.isData3DTexture;if(E.isRenderTargetTexture||E.isDepthTexture){let Bn=xe.get(E),rr=xe.get(N),dn=xe.get(Bn.__renderTarget),pi=xe.get(rr.__renderTarget);le.bindFramebuffer(I.READ_FRAMEBUFFER,dn.__webglFramebuffer),le.bindFramebuffer(I.DRAW_FRAMEBUFFER,pi.__webglFramebuffer);for(let mi=0;mi<Ee;mi++)sr&&I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,xe.get(E).__webglTexture,F,He+mi),E.isDepthTexture?(vt&&I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,xe.get(N).__webglTexture,F,dt+mi),I.blitFramebuffer(we,ke,ae,pe,Te,it,ae,pe,I.DEPTH_BUFFER_BIT,I.NEAREST)):vt?I.copyTexSubImage3D(Re,F,Te,it,dt+mi,we,ke,ae,pe):I.copyTexSubImage2D(Re,F,Te,it,dt+mi,we,ke,ae,pe);le.bindFramebuffer(I.READ_FRAMEBUFFER,null),le.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else vt?E.isDataTexture||E.isData3DTexture?I.texSubImage3D(Re,F,Te,it,dt,ae,pe,Ee,jt,ot,gt.data):N.isCompressedArrayTexture?I.compressedTexSubImage3D(Re,F,Te,it,dt,ae,pe,Ee,jt,gt.data):I.texSubImage3D(Re,F,Te,it,dt,ae,pe,Ee,jt,ot,gt):E.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,F,Te,it,ae,pe,jt,ot,gt.data):E.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,F,Te,it,gt.width,gt.height,jt,gt.data):I.texSubImage2D(I.TEXTURE_2D,F,Te,it,ae,pe,jt,ot,gt);I.pixelStorei(I.UNPACK_ROW_LENGTH,Wn),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,lt),I.pixelStorei(I.UNPACK_SKIP_PIXELS,_n),I.pixelStorei(I.UNPACK_SKIP_ROWS,hs),I.pixelStorei(I.UNPACK_SKIP_IMAGES,rn),F===0&&N.generateMipmaps&&I.generateMipmap(Re),le.unbindTexture()},this.copyTextureToTexture3D=function(E,N,V=null,W=null,F=0){return E.isTexture!==!0&&(xr("WebGLRenderer: copyTextureToTexture3D function signature has changed."),V=arguments[0]||null,W=arguments[1]||null,E=arguments[2],N=arguments[3],F=arguments[4]||0),xr('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(E,N,V,W,F)},this.initRenderTarget=function(E){xe.get(E).__webglFramebuffer===void 0&&R.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?R.setTextureCube(E,0):E.isData3DTexture?R.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?R.setTexture2DArray(E,0):R.setTexture2D(E,0),le.unbindTexture()},this.resetState=function(){T=0,C=0,D=null,le.reset(),ft.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ni}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorspace=nt._getDrawingBufferColorSpace(e),t.unpackColorSpace=nt._getUnpackColorSpace()}};var ai=class extends Ot{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 Xt,this.environmentIntensity=1,this.environmentRotation=new Xt,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}};var bc=class extends Ft{constructor(e=null,t=1,i=1,s,r,a,o,l,c=Wt,u=Wt,h,d){super(null,a,o,l,c,u,s,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var oi=class extends mt{constructor(e,t,i,s=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},Is=new ct,Zf=new ct,ya=[],Kf=new ri,AA=new ct,mr=new et,gr=new Pi,Xa=class extends et{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new oi(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<i;s++)this.setMatrixAt(s,AA)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ri),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Is),Kf.copy(e.boundingBox).applyMatrix4(Is),this.boundingBox.union(Kf)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Pi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Is),gr.copy(e.boundingSphere).applyMatrix4(Is),this.boundingSphere.union(gr)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let i=t.morphTargetInfluences,s=this.morphTexture.source.data.data,r=i.length+1,a=e*r+1;for(let o=0;o<i.length;o++)i[o]=s[a+o]}raycast(e,t){let i=this.matrixWorld,s=this.count;if(mr.geometry=this.geometry,mr.material=this.material,mr.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),gr.copy(this.boundingSphere),gr.applyMatrix4(i),e.ray.intersectsSphere(gr)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,Is),Zf.multiplyMatrices(i,Is),mr.matrixWorld=Zf,mr.raycast(e,ya);for(let a=0,o=ya.length;a<o;a++){let l=ya[a];l.instanceId=r,l.object=this,t.push(l)}ya.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new oi(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){let i=t.morphTargetInfluences,s=i.length+1;this.morphTexture===null&&(this.morphTexture=new bc(new Float32Array(s*this.count),s,this.count,Jc,Fn));let r=this.morphTexture.source.data.data,a=0;for(let c=0;c<i.length;c++)a+=i[c];let o=this.geometry.morphTargetsRelative?1:1-a,l=s*e;r[l]=o,r.set(i,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}};var Ec=class extends xn{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new Pe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Jf=new ct,wc=new Na,Aa=new Pi,Ma=new P,Ya=class extends Ot{constructor(e=new Nt,t=new Ec){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let i=this.geometry,s=this.matrixWorld,r=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Aa.copy(i.boundingSphere),Aa.applyMatrix4(s),Aa.radius+=r,e.ray.intersectsSphere(Aa)===!1)return;Jf.copy(s).invert(),wc.copy(e.ray).applyMatrix4(Jf);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,h=i.attributes.position;if(c!==null){let d=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let m=d,v=p;m<v;m++){let g=c.getX(m);Ma.fromBufferAttribute(h,g),jf(Ma,g,l,s,e,t,this)}}else{let d=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let m=d,v=p;m<v;m++)Ma.fromBufferAttribute(h,m),jf(Ma,m,l,s,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){let o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}};function jf(n,e,t,i,s,r,a){let o=wc.distanceSqToPoint(n);if(o<t){let l=new P;wc.closestPointToPoint(n,l),l.applyMatrix4(i);let c=s.ray.origin.distanceTo(l);if(c<s.near||c>s.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}var yn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,s=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),s=0,r=i.length,a;t?a=t:a=e*i[r-1];let o=0,l=r-1,c;for(;o<=l;)if(s=Math.floor(o+(l-o)/2),c=i[s]-a,c<0)o=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,i[s]===a)return s/(r-1);let u=i[s],d=i[s+1]-u,p=(a-u)/d;return(s+p)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);let a=this.getPoint(s),o=this.getPoint(r),l=t||(a.isVector2?new K:new P);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new P,s=[],r=[],a=[],o=new P,l=new ct;for(let p=0;p<=e;p++){let m=p/e;s[p]=this.getTangentAt(m,new P)}r[0]=new P,a[0]=new P;let c=Number.MAX_VALUE,u=Math.abs(s[0].x),h=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),d<=c&&i.set(0,0,1),o.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],o),a[0].crossVectors(s[0],r[0]);for(let p=1;p<=e;p++){if(r[p]=r[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(s[p-1],s[p]),o.length()>Number.EPSILON){o.normalize();let m=Math.acos(Tt(s[p-1].dot(s[p]),-1,1));r[p].applyMatrix4(l.makeRotationAxis(o,m))}a[p].crossVectors(s[p],r[p])}if(t===!0){let p=Math.acos(Tt(r[0].dot(r[e]),-1,1));p/=e,s[0].dot(o.crossVectors(r[0],r[e]))>0&&(p=-p);for(let m=1;m<=e;m++)r[m].applyMatrix4(l.makeRotationAxis(s[m],p*m)),a[m].crossVectors(s[m],r[m])}return{tangents:s,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Rr=class extends yn{constructor(e=0,t=0,i=1,s=1,r=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new K){let i=t,s=Math.PI*2,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(a?r=0:r=s),this.aClockwise===!0&&!a&&(r===s?r=-s:r=r-s);let o=this.aStartAngle+e*r,l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=l-this.aX,p=c-this.aY;l=d*u-p*h+this.aX,c=d*h+p*u+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},Tc=class extends Rr{constructor(e,t,i,s,r,a){super(e,t,i,i,s,r,a),this.isArcCurve=!0,this.type="ArcCurve"}};function iu(){let n=0,e=0,t=0,i=0;function s(r,a,o,l){n=r,e=o,t=-3*r+3*a-2*o-l,i=2*r-2*a+o+l}return{initCatmullRom:function(r,a,o,l,c){s(a,o,c*(o-r),c*(l-a))},initNonuniformCatmullRom:function(r,a,o,l,c,u,h){let d=(a-r)/c-(o-r)/(c+u)+(o-a)/u,p=(o-a)/u-(l-a)/(u+h)+(l-o)/h;d*=u,p*=u,s(a,o,d,p)},calc:function(r){let a=r*r,o=a*r;return n+e*r+t*a+i*o}}}var Sa=new P,vl=new iu,xl=new iu,yl=new iu,Cc=class extends yn{constructor(e=[],t=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=s}getPoint(e,t=new P){let i=t,s=this.points,r=s.length,a=(r-(this.closed?0:1))*e,o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,u;this.closed||o>0?c=s[(o-1)%r]:(Sa.subVectors(s[0],s[1]).add(s[0]),c=Sa);let h=s[o%r],d=s[(o+1)%r];if(this.closed||o+2<r?u=s[(o+2)%r]:(Sa.subVectors(s[r-1],s[r-2]).add(s[r-1]),u=Sa),this.curveType==="centripetal"||this.curveType==="chordal"){let p=this.curveType==="chordal"?.5:.25,m=Math.pow(c.distanceToSquared(h),p),v=Math.pow(h.distanceToSquared(d),p),g=Math.pow(d.distanceToSquared(u),p);v<1e-4&&(v=1),m<1e-4&&(m=v),g<1e-4&&(g=v),vl.initNonuniformCatmullRom(c.x,h.x,d.x,u.x,m,v,g),xl.initNonuniformCatmullRom(c.y,h.y,d.y,u.y,m,v,g),yl.initNonuniformCatmullRom(c.z,h.z,d.z,u.z,m,v,g)}else this.curveType==="catmullrom"&&(vl.initCatmullRom(c.x,h.x,d.x,u.x,this.tension),xl.initCatmullRom(c.y,h.y,d.y,u.y,this.tension),yl.initCatmullRom(c.z,h.z,d.z,u.z,this.tension));return i.set(vl.calc(l),xl.calc(l),yl.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let s=e.points[t];this.points.push(s.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let s=this.points[t];e.points.push(s.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let s=e.points[t];this.points.push(new P().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function $f(n,e,t,i,s){let r=(i-e)*.5,a=(s-t)*.5,o=n*n,l=n*o;return(2*t-2*i+r+a)*l+(-3*t+3*i-2*r-a)*o+r*n+t}function MA(n,e){let t=1-n;return t*t*e}function SA(n,e){return 2*(1-n)*n*e}function _A(n,e){return n*n*e}function _r(n,e,t,i){return MA(n,e)+SA(n,t)+_A(n,i)}function bA(n,e){let t=1-n;return t*t*t*e}function EA(n,e){let t=1-n;return 3*t*t*n*e}function wA(n,e){return 3*(1-n)*n*n*e}function TA(n,e){return n*n*n*e}function br(n,e,t,i,s){return bA(n,e)+EA(n,t)+wA(n,i)+TA(n,s)}var qa=class extends yn{constructor(e=new K,t=new K,i=new K,s=new K){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=s}getPoint(e,t=new K){let i=t,s=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(br(e,s.x,r.x,a.x,o.x),br(e,s.y,r.y,a.y,o.y)),i}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}},Rc=class extends yn{constructor(e=new P,t=new P,i=new P,s=new P){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=s}getPoint(e,t=new P){let i=t,s=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(br(e,s.x,r.x,a.x,o.x),br(e,s.y,r.y,a.y,o.y),br(e,s.z,r.z,a.z,o.z)),i}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}},Qa=class extends yn{constructor(e=new K,t=new K){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new K){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new K){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}},Dc=class extends yn{constructor(e=new P,t=new P){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new P){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new P){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}},Za=class extends yn{constructor(e=new K,t=new K,i=new K){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new K){let i=t,s=this.v0,r=this.v1,a=this.v2;return i.set(_r(e,s.x,r.x,a.x),_r(e,s.y,r.y,a.y)),i}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}},Ic=class extends yn{constructor(e=new P,t=new P,i=new P){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new P){let i=t,s=this.v0,r=this.v1,a=this.v2;return i.set(_r(e,s.x,r.x,a.x),_r(e,s.y,r.y,a.y),_r(e,s.z,r.z,a.z)),i}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}},Ka=class extends yn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new K){let i=t,s=this.points,r=(s.length-1)*e,a=Math.floor(r),o=r-a,l=s[a===0?a:a-1],c=s[a],u=s[a>s.length-2?s.length-1:a+1],h=s[a>s.length-3?s.length-1:a+2];return i.set($f(o,l.x,c.x,u.x,h.x),$f(o,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let s=e.points[t];this.points.push(s.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let s=this.points[t];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let s=e.points[t];this.points.push(new K().fromArray(s))}return this}},Pc=Object.freeze({__proto__:null,ArcCurve:Tc,CatmullRomCurve3:Cc,CubicBezierCurve:qa,CubicBezierCurve3:Rc,EllipseCurve:Rr,LineCurve:Qa,LineCurve3:Dc,QuadraticBezierCurve:Za,QuadraticBezierCurve3:Ic,SplineCurve:Ka}),Uc=class extends yn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Pc[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=i){let a=s[r]-i,o=this.curves[r],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}r++}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 i=0,s=this.curves.length;i<s;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let s=0,r=this.curves;s<r.length;s++){let a=r[s],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){let u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let s=e.curves[t];this.curves.push(s.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let s=this.curves[t];e.curves.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let s=e.curves[t];this.curves.push(new Pc[s.type]().fromJSON(s))}return this}},Ja=class extends Uc{constructor(e){super(),this.type="Path",this.currentPoint=new K,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new Qa(this.currentPoint.clone(),new K(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,s){let r=new Za(this.currentPoint.clone(),new K(e,t),new K(i,s));return this.curves.push(r),this.currentPoint.set(i,s),this}bezierCurveTo(e,t,i,s,r,a){let o=new qa(this.currentPoint.clone(),new K(e,t),new K(i,s),new K(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new Ka(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,s,r,a){let o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,i,s,r,a),this}absarc(e,t,i,s,r,a){return this.absellipse(e,t,i,i,s,r,a),this}ellipse(e,t,i,s,r,a,o,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,s,r,a,o,l),this}absellipse(e,t,i,s,r,a,o,l){let c=new Rr(e,t,i,s,r,a,o,l);if(this.curves.length>0){let h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);let u=c.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}},ja=class n extends Nt{constructor(e=[new K(0,-.5),new K(.5,0),new K(0,.5)],t=12,i=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:s},t=Math.floor(t),s=Tt(s,0,Math.PI*2);let r=[],a=[],o=[],l=[],c=[],u=1/t,h=new P,d=new K,p=new P,m=new P,v=new P,g=0,f=0;for(let x=0;x<=e.length-1;x++)switch(x){case 0:g=e[x+1].x-e[x].x,f=e[x+1].y-e[x].y,p.x=f*1,p.y=-g,p.z=f*0,v.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case e.length-1:l.push(v.x,v.y,v.z);break;default:g=e[x+1].x-e[x].x,f=e[x+1].y-e[x].y,p.x=f*1,p.y=-g,p.z=f*0,m.copy(p),p.x+=v.x,p.y+=v.y,p.z+=v.z,p.normalize(),l.push(p.x,p.y,p.z),v.copy(m)}for(let x=0;x<=t;x++){let A=i+x*u*s,y=Math.sin(A),b=Math.cos(A);for(let T=0;T<=e.length-1;T++){h.x=e[T].x*y,h.y=e[T].y,h.z=e[T].x*b,a.push(h.x,h.y,h.z),d.x=x/t,d.y=T/(e.length-1),o.push(d.x,d.y);let C=l[3*T+0]*y,D=l[3*T+1],S=l[3*T+0]*b;c.push(C,D,S)}}for(let x=0;x<t;x++)for(let A=0;A<e.length-1;A++){let y=A+x*e.length,b=y,T=y+e.length,C=y+e.length+1,D=y+1;r.push(b,T,D),r.push(C,D,T)}this.setIndex(r),this.setAttribute("position",new xt(a,3)),this.setAttribute("uv",new xt(o,2)),this.setAttribute("normal",new xt(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.points,e.segments,e.phiStart,e.phiLength)}};var $a=class n extends Nt{constructor(e=1,t=1,i=1,s=32,r=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:s,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:l};let c=this;s=Math.floor(s),r=Math.floor(r);let u=[],h=[],d=[],p=[],m=0,v=[],g=i/2,f=0;x(),a===!1&&(e>0&&A(!0),t>0&&A(!1)),this.setIndex(u),this.setAttribute("position",new xt(h,3)),this.setAttribute("normal",new xt(d,3)),this.setAttribute("uv",new xt(p,2));function x(){let y=new P,b=new P,T=0,C=(t-e)/i;for(let D=0;D<=r;D++){let S=[],M=D/r,w=M*(t-e)+e;for(let B=0;B<=s;B++){let U=B/s,k=U*l+o,H=Math.sin(k),O=Math.cos(k);b.x=w*H,b.y=-M*i+g,b.z=w*O,h.push(b.x,b.y,b.z),y.set(H,C,O).normalize(),d.push(y.x,y.y,y.z),p.push(U,1-M),S.push(m++)}v.push(S)}for(let D=0;D<s;D++)for(let S=0;S<r;S++){let M=v[S][D],w=v[S+1][D],B=v[S+1][D+1],U=v[S][D+1];(e>0||S!==0)&&(u.push(M,w,U),T+=3),(t>0||S!==r-1)&&(u.push(w,B,U),T+=3)}c.addGroup(f,T,0),f+=T}function A(y){let b=m,T=new K,C=new P,D=0,S=y===!0?e:t,M=y===!0?1:-1;for(let B=1;B<=s;B++)h.push(0,g*M,0),d.push(0,M,0),p.push(.5,.5),m++;let w=m;for(let B=0;B<=s;B++){let k=B/s*l+o,H=Math.cos(k),O=Math.sin(k);C.x=S*O,C.y=g*M,C.z=S*H,h.push(C.x,C.y,C.z),d.push(0,M,0),T.x=H*.5+.5,T.y=O*.5*M+.5,p.push(T.x,T.y),m++}for(let B=0;B<s;B++){let U=b+B,k=w+B;y===!0?u.push(k,k+1,U):u.push(k+1,k,U),D+=3}c.addGroup(f,D,y===!0?1:2),f+=D}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var eo=class n extends Nt{constructor(e=[],t=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:s};let r=[],a=[];o(s),c(i),u(),this.setAttribute("position",new xt(r,3)),this.setAttribute("normal",new xt(r.slice(),3)),this.setAttribute("uv",new xt(a,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function o(x){let A=new P,y=new P,b=new P;for(let T=0;T<t.length;T+=3)p(t[T+0],A),p(t[T+1],y),p(t[T+2],b),l(A,y,b,x)}function l(x,A,y,b){let T=b+1,C=[];for(let D=0;D<=T;D++){C[D]=[];let S=x.clone().lerp(y,D/T),M=A.clone().lerp(y,D/T),w=T-D;for(let B=0;B<=w;B++)B===0&&D===T?C[D][B]=S:C[D][B]=S.clone().lerp(M,B/w)}for(let D=0;D<T;D++)for(let S=0;S<2*(T-D)-1;S++){let M=Math.floor(S/2);S%2===0?(d(C[D][M+1]),d(C[D+1][M]),d(C[D][M])):(d(C[D][M+1]),d(C[D+1][M+1]),d(C[D+1][M]))}}function c(x){let A=new P;for(let y=0;y<r.length;y+=3)A.x=r[y+0],A.y=r[y+1],A.z=r[y+2],A.normalize().multiplyScalar(x),r[y+0]=A.x,r[y+1]=A.y,r[y+2]=A.z}function u(){let x=new P;for(let A=0;A<r.length;A+=3){x.x=r[A+0],x.y=r[A+1],x.z=r[A+2];let y=g(x)/2/Math.PI+.5,b=f(x)/Math.PI+.5;a.push(y,1-b)}m(),h()}function h(){for(let x=0;x<a.length;x+=6){let A=a[x+0],y=a[x+2],b=a[x+4],T=Math.max(A,y,b),C=Math.min(A,y,b);T>.9&&C<.1&&(A<.2&&(a[x+0]+=1),y<.2&&(a[x+2]+=1),b<.2&&(a[x+4]+=1))}}function d(x){r.push(x.x,x.y,x.z)}function p(x,A){let y=x*3;A.x=e[y+0],A.y=e[y+1],A.z=e[y+2]}function m(){let x=new P,A=new P,y=new P,b=new P,T=new K,C=new K,D=new K;for(let S=0,M=0;S<r.length;S+=9,M+=6){x.set(r[S+0],r[S+1],r[S+2]),A.set(r[S+3],r[S+4],r[S+5]),y.set(r[S+6],r[S+7],r[S+8]),T.set(a[M+0],a[M+1]),C.set(a[M+2],a[M+3]),D.set(a[M+4],a[M+5]),b.copy(x).add(A).add(y).divideScalar(3);let w=g(b);v(T,M+0,x,w),v(C,M+2,A,w),v(D,M+4,y,w)}}function v(x,A,y,b){b<0&&x.x===1&&(a[A]=x.x-1),y.x===0&&y.z===0&&(a[A]=b/2/Math.PI+.5)}function g(x){return Math.atan2(x.z,-x.x)}function f(x){return Math.atan2(-x.y,Math.sqrt(x.x*x.x+x.z*x.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.vertices,e.indices,e.radius,e.details)}};var Dr=class extends Ja{constructor(e){super(e),this.uuid=is(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,s=this.holes.length;i<s;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let s=e.holes[t];this.holes.push(s.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let s=this.holes[t];e.holes.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let s=e.holes[t];this.holes.push(new Ja().fromJSON(s))}return this}},CA={triangulate:function(n,e,t=2){let i=e&&e.length,s=i?e[0]*t:n.length,r=Rd(n,0,s,t,!0),a=[];if(!r||r.next===r.prev)return a;let o,l,c,u,h,d,p;if(i&&(r=UA(n,e,r,t)),n.length>80*t){o=c=n[0],l=u=n[1];for(let m=t;m<s;m+=t)h=n[m],d=n[m+1],h<o&&(o=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=Math.max(c-o,u-l),p=p!==0?32767/p:0}return Ir(r,a,t,o,l,p,0),a}};function Rd(n,e,t,i,s){let r,a;if(s===WA(n,e,t,i)>0)for(r=e;r<t;r+=i)a=ed(r,n[r],n[r+1],a);else for(r=t-i;r>=e;r-=i)a=ed(r,n[r],n[r+1],a);return a&&fo(a,a.next)&&(Ur(a),a=a.next),a}function es(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(fo(t,t.next)||At(t.prev,t,t.next)===0)){if(Ur(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Ir(n,e,t,i,s,r,a){if(!n)return;!a&&r&&OA(n,i,s,r);let o=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,r?DA(n,i,s,r):RA(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Ur(n),n=c.next,o=c.next;continue}if(n=c,n===o){a?a===1?(n=IA(es(n),e,t),Ir(n,e,t,i,s,r,2)):a===2&&PA(n,e,t,i,s,r):Ir(es(n),e,t,i,s,r,1);break}}}function RA(n){let e=n.prev,t=n,i=n.next;if(At(e,t,i)>=0)return!1;let s=e.x,r=t.x,a=i.x,o=e.y,l=t.y,c=i.y,u=s<r?s<a?s:a:r<a?r:a,h=o<l?o<c?o:c:l<c?l:c,d=s>r?s>a?s:a:r>a?r:a,p=o>l?o>c?o:c:l>c?l:c,m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=h&&m.y<=p&&Bs(s,o,r,l,a,c,m.x,m.y)&&At(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function DA(n,e,t,i){let s=n.prev,r=n,a=n.next;if(At(s,r,a)>=0)return!1;let o=s.x,l=r.x,c=a.x,u=s.y,h=r.y,d=a.y,p=o<l?o<c?o:c:l<c?l:c,m=u<h?u<d?u:d:h<d?h:d,v=o>l?o>c?o:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,f=Bc(p,m,e,t,i),x=Bc(v,g,e,t,i),A=n.prevZ,y=n.nextZ;for(;A&&A.z>=f&&y&&y.z<=x;){if(A.x>=p&&A.x<=v&&A.y>=m&&A.y<=g&&A!==s&&A!==a&&Bs(o,u,l,h,c,d,A.x,A.y)&&At(A.prev,A,A.next)>=0||(A=A.prevZ,y.x>=p&&y.x<=v&&y.y>=m&&y.y<=g&&y!==s&&y!==a&&Bs(o,u,l,h,c,d,y.x,y.y)&&At(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;A&&A.z>=f;){if(A.x>=p&&A.x<=v&&A.y>=m&&A.y<=g&&A!==s&&A!==a&&Bs(o,u,l,h,c,d,A.x,A.y)&&At(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;y&&y.z<=x;){if(y.x>=p&&y.x<=v&&y.y>=m&&y.y<=g&&y!==s&&y!==a&&Bs(o,u,l,h,c,d,y.x,y.y)&&At(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function IA(n,e,t){let i=n;do{let s=i.prev,r=i.next.next;!fo(s,r)&&Dd(s,i,i.next,r)&&Pr(s,r)&&Pr(r,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(r.i/t|0),Ur(i),Ur(i.next),i=n=r),i=i.next}while(i!==n);return es(i)}function PA(n,e,t,i,s,r){let a=n;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&HA(a,o)){let l=Id(a,o);a=es(a,a.next),l=es(l,l.next),Ir(a,e,t,i,s,r,0),Ir(l,e,t,i,s,r,0);return}o=o.next}a=a.next}while(a!==n)}function UA(n,e,t,i){let s=[],r,a,o,l,c;for(r=0,a=e.length;r<a;r++)o=e[r]*i,l=r<a-1?e[r+1]*i:n.length,c=Rd(n,o,l,i,!1),c===c.next&&(c.steiner=!0),s.push(zA(c));for(s.sort(BA),r=0;r<s.length;r++)t=LA(s[r],t);return t}function BA(n,e){return n.x-e.x}function LA(n,e){let t=NA(n,e);if(!t)return e;let i=Id(t,n);return es(i,i.next),es(t,t.next)}function NA(n,e){let t=e,i=-1/0,s,r=n.x,a=n.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){let d=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>i&&(i=d,s=t.x<t.next.x?t:t.next,d===r))return s}t=t.next}while(t!==e);if(!s)return null;let o=s,l=s.x,c=s.y,u=1/0,h;t=s;do r>=t.x&&t.x>=l&&r!==t.x&&Bs(a<c?r:i,a,l,c,a<c?i:r,a,t.x,t.y)&&(h=Math.abs(a-t.y)/(r-t.x),Pr(t,n)&&(h<u||h===u&&(t.x>s.x||t.x===s.x&&FA(s,t)))&&(s=t,u=h)),t=t.next;while(t!==o);return s}function FA(n,e){return At(n.prev,n,e.prev)<0&&At(e.next,n,n.next)<0}function OA(n,e,t,i){let s=n;do s.z===0&&(s.z=Bc(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,kA(s)}function kA(n){let e,t,i,s,r,a,o,l,c=1;do{for(t=n,n=null,r=null,a=0;t;){for(a++,i=t,o=0,e=0;e<c&&(o++,i=i.nextZ,!!i);e++);for(l=c;o>0||l>0&&i;)o!==0&&(l===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,o--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;t=i}r.nextZ=null,c*=2}while(a>1);return n}function Bc(n,e,t,i,s){return n=(n-t)*s|0,e=(e-i)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function zA(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Bs(n,e,t,i,s,r,a,o){return(s-a)*(e-o)>=(n-a)*(r-o)&&(n-a)*(i-o)>=(t-a)*(e-o)&&(t-a)*(r-o)>=(s-a)*(i-o)}function HA(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!GA(n,e)&&(Pr(n,e)&&Pr(e,n)&&VA(n,e)&&(At(n.prev,n,e.prev)||At(n,e.prev,e))||fo(n,e)&&At(n.prev,n,n.next)>0&&At(e.prev,e,e.next)>0)}function At(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function fo(n,e){return n.x===e.x&&n.y===e.y}function Dd(n,e,t,i){let s=ba(At(n,e,t)),r=ba(At(n,e,i)),a=ba(At(t,i,n)),o=ba(At(t,i,e));return!!(s!==r&&a!==o||s===0&&_a(n,t,e)||r===0&&_a(n,i,e)||a===0&&_a(t,n,i)||o===0&&_a(t,e,i))}function _a(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function ba(n){return n>0?1:n<0?-1:0}function GA(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Dd(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Pr(n,e){return At(n.prev,n,n.next)<0?At(n,e,n.next)>=0&&At(n,n.prev,e)>=0:At(n,e,n.prev)<0||At(n,n.next,e)<0}function VA(n,e){let t=n,i=!1,s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function Id(n,e){let t=new Lc(n.i,n.x,n.y),i=new Lc(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function ed(n,e,t,i){let s=new Lc(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Ur(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Lc(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function WA(n,e,t,i){let s=0;for(let r=e,a=t-i;r<t;r+=i)s+=(n[a]-n[r])*(n[r+1]+n[a+1]),a=r;return s}var Er=class n{static area(e){let t=e.length,i=0;for(let s=t-1,r=0;r<t;s=r++)i+=e[s].x*e[r].y-e[r].x*e[s].y;return i*.5}static isClockWise(e){return n.area(e)<0}static triangulateShape(e,t){let i=[],s=[],r=[];td(e),nd(i,e);let a=e.length;t.forEach(td);for(let l=0;l<t.length;l++)s.push(a),a+=t[l].length,nd(i,t[l]);let o=CA.triangulate(i,s);for(let l=0;l<o.length;l+=3)r.push(o.slice(l,l+3));return r}};function td(n){let e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function nd(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}var to=class n extends Nt{constructor(e=new Dr([new K(.5,.5),new K(-.5,.5),new K(-.5,-.5),new K(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let i=this,s=[],r=[];for(let o=0,l=e.length;o<l;o++){let c=e[o];a(c)}this.setAttribute("position",new xt(s,3)),this.setAttribute("uv",new xt(r,2)),this.computeVertexNormals();function a(o){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:p-.1,v=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3,f=t.extrudePath,x=t.UVGenerator!==void 0?t.UVGenerator:XA,A,y=!1,b,T,C,D;f&&(A=f.getSpacedPoints(u),y=!0,d=!1,b=f.computeFrenetFrames(u,!1),T=new P,C=new P,D=new P),d||(g=0,p=0,m=0,v=0);let S=o.extractPoints(c),M=S.shape,w=S.holes;if(!Er.isClockWise(M)){M=M.reverse();for(let j=0,se=w.length;j<se;j++){let I=w[j];Er.isClockWise(I)&&(w[j]=I.reverse())}}let U=Er.triangulateShape(M,w),k=M;for(let j=0,se=w.length;j<se;j++){let I=w[j];M=M.concat(I)}function H(j,se,I){return se||console.error("THREE.ExtrudeGeometry: vec does not exist"),j.clone().addScaledVector(se,I)}let O=M.length,Y=U.length;function G(j,se,I){let Ce,ne,Ae,le=j.x-se.x,Ue=j.y-se.y,xe=I.x-j.x,R=I.y-j.y,_=le*le+Ue*Ue,z=le*R-Ue*xe;if(Math.abs(z)>Number.EPSILON){let Q=Math.sqrt(_),$=Math.sqrt(xe*xe+R*R),Z=se.x-Ue/Q,be=se.y+le/Q,he=I.x-R/$,ye=I.y+xe/$,Qe=((he-Z)*R-(ye-be)*xe)/(le*R-Ue*xe);Ce=Z+le*Qe-j.x,ne=be+Ue*Qe-j.y;let ie=Ce*Ce+ne*ne;if(ie<=2)return new K(Ce,ne);Ae=Math.sqrt(ie/2)}else{let Q=!1;le>Number.EPSILON?xe>Number.EPSILON&&(Q=!0):le<-Number.EPSILON?xe<-Number.EPSILON&&(Q=!0):Math.sign(Ue)===Math.sign(R)&&(Q=!0),Q?(Ce=-Ue,ne=le,Ae=Math.sqrt(_)):(Ce=le,ne=Ue,Ae=Math.sqrt(_/2))}return new K(Ce/Ae,ne/Ae)}let ee=[];for(let j=0,se=k.length,I=se-1,Ce=j+1;j<se;j++,I++,Ce++)I===se&&(I=0),Ce===se&&(Ce=0),ee[j]=G(k[j],k[I],k[Ce]);let ce=[],re,Me=ee.concat();for(let j=0,se=w.length;j<se;j++){let I=w[j];re=[];for(let Ce=0,ne=I.length,Ae=ne-1,le=Ce+1;Ce<ne;Ce++,Ae++,le++)Ae===ne&&(Ae=0),le===ne&&(le=0),re[Ce]=G(I[Ce],I[Ae],I[le]);ce.push(re),Me=Me.concat(re)}for(let j=0;j<g;j++){let se=j/g,I=p*Math.cos(se*Math.PI/2),Ce=m*Math.sin(se*Math.PI/2)+v;for(let ne=0,Ae=k.length;ne<Ae;ne++){let le=H(k[ne],ee[ne],Ce);oe(le.x,le.y,-I)}for(let ne=0,Ae=w.length;ne<Ae;ne++){let le=w[ne];re=ce[ne];for(let Ue=0,xe=le.length;Ue<xe;Ue++){let R=H(le[Ue],re[Ue],Ce);oe(R.x,R.y,-I)}}}let Le=m+v;for(let j=0;j<O;j++){let se=d?H(M[j],Me[j],Le):M[j];y?(C.copy(b.normals[0]).multiplyScalar(se.x),T.copy(b.binormals[0]).multiplyScalar(se.y),D.copy(A[0]).add(C).add(T),oe(D.x,D.y,D.z)):oe(se.x,se.y,0)}for(let j=1;j<=u;j++)for(let se=0;se<O;se++){let I=d?H(M[se],Me[se],Le):M[se];y?(C.copy(b.normals[j]).multiplyScalar(I.x),T.copy(b.binormals[j]).multiplyScalar(I.y),D.copy(A[j]).add(C).add(T),oe(D.x,D.y,D.z)):oe(I.x,I.y,h/u*j)}for(let j=g-1;j>=0;j--){let se=j/g,I=p*Math.cos(se*Math.PI/2),Ce=m*Math.sin(se*Math.PI/2)+v;for(let ne=0,Ae=k.length;ne<Ae;ne++){let le=H(k[ne],ee[ne],Ce);oe(le.x,le.y,h+I)}for(let ne=0,Ae=w.length;ne<Ae;ne++){let le=w[ne];re=ce[ne];for(let Ue=0,xe=le.length;Ue<xe;Ue++){let R=H(le[Ue],re[Ue],Ce);y?oe(R.x,R.y+A[u-1].y,A[u-1].x+I):oe(R.x,R.y,h+I)}}}q(),te();function q(){let j=s.length/3;if(d){let se=0,I=O*se;for(let Ce=0;Ce<Y;Ce++){let ne=U[Ce];Ie(ne[2]+I,ne[1]+I,ne[0]+I)}se=u+g*2,I=O*se;for(let Ce=0;Ce<Y;Ce++){let ne=U[Ce];Ie(ne[0]+I,ne[1]+I,ne[2]+I)}}else{for(let se=0;se<Y;se++){let I=U[se];Ie(I[2],I[1],I[0])}for(let se=0;se<Y;se++){let I=U[se];Ie(I[0]+O*u,I[1]+O*u,I[2]+O*u)}}i.addGroup(j,s.length/3-j,0)}function te(){let j=s.length/3,se=0;ve(k,se),se+=k.length;for(let I=0,Ce=w.length;I<Ce;I++){let ne=w[I];ve(ne,se),se+=ne.length}i.addGroup(j,s.length/3-j,1)}function ve(j,se){let I=j.length;for(;--I>=0;){let Ce=I,ne=I-1;ne<0&&(ne=j.length-1);for(let Ae=0,le=u+g*2;Ae<le;Ae++){let Ue=O*Ae,xe=O*(Ae+1),R=se+Ce+Ue,_=se+ne+Ue,z=se+ne+xe,Q=se+Ce+xe;Oe(R,_,z,Q)}}}function oe(j,se,I){l.push(j),l.push(se),l.push(I)}function Ie(j,se,I){Ne(j),Ne(se),Ne(I);let Ce=s.length/3,ne=x.generateTopUV(i,s,Ce-3,Ce-2,Ce-1);tt(ne[0]),tt(ne[1]),tt(ne[2])}function Oe(j,se,I,Ce){Ne(j),Ne(se),Ne(Ce),Ne(se),Ne(I),Ne(Ce);let ne=s.length/3,Ae=x.generateSideWallUV(i,s,ne-6,ne-3,ne-2,ne-1);tt(Ae[0]),tt(Ae[1]),tt(Ae[3]),tt(Ae[1]),tt(Ae[2]),tt(Ae[3])}function Ne(j){s.push(l[j*3+0]),s.push(l[j*3+1]),s.push(l[j*3+2])}function tt(j){r.push(j.x),r.push(j.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return YA(t,i,e)}static fromJSON(e,t){let i=[];for(let r=0,a=e.shapes.length;r<a;r++){let o=t[e.shapes[r]];i.push(o)}let s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new Pc[s.type]().fromJSON(s)),new n(i,e.options)}},XA={generateTopUV:function(n,e,t,i,s){let r=e[t*3],a=e[t*3+1],o=e[i*3],l=e[i*3+1],c=e[s*3],u=e[s*3+1];return[new K(r,a),new K(o,l),new K(c,u)]},generateSideWallUV:function(n,e,t,i,s,r){let a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],h=e[i*3+2],d=e[s*3],p=e[s*3+1],m=e[s*3+2],v=e[r*3],g=e[r*3+1],f=e[r*3+2];return Math.abs(o-u)<Math.abs(a-c)?[new K(a,1-l),new K(c,1-h),new K(d,1-m),new K(v,1-f)]:[new K(o,1-l),new K(u,1-h),new K(p,1-m),new K(g,1-f)]}};function YA(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,s=n.length;i<s;i++){let r=n[i];t.shapes.push(r.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var no=class n extends eo{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,s=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(s,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new n(e.radius,e.detail)}},io=class n extends eo{constructor(e=1,t=0){let i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,s,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new n(e.radius,e.detail)}};var Bi=class n extends Nt{constructor(e=1,t=32,i=16,s=0,r=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:s,phiLength:r,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let l=Math.min(a+o,Math.PI),c=0,u=[],h=new P,d=new P,p=[],m=[],v=[],g=[];for(let f=0;f<=i;f++){let x=[],A=f/i,y=0;f===0&&a===0?y=.5/t:f===i&&l===Math.PI&&(y=-.5/t);for(let b=0;b<=t;b++){let T=b/t;h.x=-e*Math.cos(s+T*r)*Math.sin(a+A*o),h.y=e*Math.cos(a+A*o),h.z=e*Math.sin(s+T*r)*Math.sin(a+A*o),m.push(h.x,h.y,h.z),d.copy(h).normalize(),v.push(d.x,d.y,d.z),g.push(T+y,1-A),x.push(c++)}u.push(x)}for(let f=0;f<i;f++)for(let x=0;x<t;x++){let A=u[f][x+1],y=u[f][x],b=u[f+1][x],T=u[f+1][x+1];(f!==0||a>0)&&p.push(A,y,T),(f!==i-1||l<Math.PI)&&p.push(y,b,T)}this.setIndex(p),this.setAttribute("position",new xt(m,3)),this.setAttribute("normal",new xt(v,3)),this.setAttribute("uv",new xt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var It=class extends xn{static get type(){return"MeshStandardMaterial"}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.color=new Pe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xd,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xt,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Br=class extends It{static get type(){return"MeshPhysicalMaterial"}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new K(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Tt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Pe(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 Pe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};function Ea(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function qA(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Ws=class{constructor(e,t,i,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,s=t[i],r=t[i-1];n:{e:{let a;t:{i:if(!(e<s)){for(let o=i+2;;){if(s===void 0){if(e<r)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(r=s,s=t[++i],e<s)break e}a=t.length;break t}if(!(e>=r)){let o=t[1];e<o&&(i=2,r=o);for(let l=i-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(s=r,r=t[--i-1],e>=r)break e}a=i,i=0;break t}break n}for(;i<a;){let o=i+a>>>1;e<t[o]?a=o:i=o+1}if(s=t[i],r=t[i-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,s)}return this.interpolate_(i,r,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=e*s;for(let a=0;a!==s;++a)t[a]=i[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Nc=class extends Ws{constructor(e,t,i,s){super(e,t,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Jh,endingEnd:Jh}}intervalChanged_(e,t,i){let s=this.parameterPositions,r=e-2,a=e+1,o=s[r],l=s[a];if(o===void 0)switch(this.getSettings_().endingStart){case jh:r=e,o=2*t-i;break;case $h:r=s.length-2,o=t+s[r]-s[r+1];break;default:r=e,o=i}if(l===void 0)switch(this.getSettings_().endingEnd){case jh:a=e,l=2*i-t;break;case $h:a=1,l=i+s[1]-s[0];break;default:a=e-1,l=t}let c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-i),this._offsetPrev=r*u,this._offsetNext=a*u}interpolate_(e,t,i,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,m=(i-t)/(s-t),v=m*m,g=v*m,f=-d*g+2*d*v-d*m,x=(1+d)*g+(-1.5-2*d)*v+(-.5+d)*m+1,A=(-1-p)*g+(1.5+p)*v+.5*m,y=p*g-p*v;for(let b=0;b!==o;++b)r[b]=f*a[u+b]+x*a[c+b]+A*a[l+b]+y*a[h+b];return r}},Fc=class extends Ws{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(i-t)/(s-t),h=1-u;for(let d=0;d!==o;++d)r[d]=a[c+d]*h+a[l+d]*u;return r}},Oc=class extends Ws{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e){return this.copySampleValue_(e-1)}},Dn=class{constructor(e,t,i,s){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ea(t,this.TimeBufferType),this.values=Ea(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:Ea(e.times,Array),values:Ea(e.values,Array)};let s=e.getInterpolation();s!==e.DefaultInterpolation&&(i.interpolation=s)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new Oc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Fc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Nc(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ia:t=this.InterpolantFactoryMethodDiscrete;break;case oc:t=this.InterpolantFactoryMethodLinear;break;case Wo:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ia;case this.InterpolantFactoryMethodLinear:return oc;case this.InterpolantFactoryMethodSmooth:return Wo}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,s=t.length;i!==s;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,s=t.length;i!==s;++i)t[i]*=e}return this}trim(e,t){let i=this.times,s=i.length,r=0,a=s-1;for(;r!==s&&i[r]<e;)++r;for(;a!==-1&&i[a]>t;)--a;if(++a,r!==0||a!==s){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=i.slice(r,a),this.values=this.values.slice(r*o,a*o)}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 i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){let l=i[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(s!==void 0&&qA(s))for(let o=0,l=s.length;o!==l;++o){let c=s[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===Wo,r=e.length-1,a=1;for(let o=1;o<r;++o){let l=!1,c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(s)l=!0;else{let h=o*i,d=h-i,p=h+i;for(let m=0;m!==i;++m){let v=t[h+m];if(v!==t[d+m]||v!==t[p+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];let h=o*i,d=a*i;for(let p=0;p!==i;++p)t[d+p]=t[h+p]}++a}}if(r>0){e[a]=e[r];for(let o=r*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}};Dn.prototype.TimeBufferType=Float32Array;Dn.prototype.ValueBufferType=Float32Array;Dn.prototype.DefaultInterpolation=oc;var ts=class extends Dn{constructor(e,t,i){super(e,t,i)}};ts.prototype.ValueTypeName="bool";ts.prototype.ValueBufferType=Array;ts.prototype.DefaultInterpolation=Ia;ts.prototype.InterpolantFactoryMethodLinear=void 0;ts.prototype.InterpolantFactoryMethodSmooth=void 0;var kc=class extends Dn{};kc.prototype.ValueTypeName="color";var zc=class extends Dn{};zc.prototype.ValueTypeName="number";var Hc=class extends Ws{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(s-t),c=e*o;for(let u=c+o;c!==u;c+=4)zn.slerpFlat(r,0,a,c-o,a,c,l);return r}},so=class extends Dn{InterpolantFactoryMethodLinear(e){return new Hc(this.times,this.values,this.getValueSize(),e)}};so.prototype.ValueTypeName="quaternion";so.prototype.InterpolantFactoryMethodSmooth=void 0;var ns=class extends Dn{constructor(e,t,i){super(e,t,i)}};ns.prototype.ValueTypeName="string";ns.prototype.ValueBufferType=Array;ns.prototype.DefaultInterpolation=Ia;ns.prototype.InterpolantFactoryMethodLinear=void 0;ns.prototype.InterpolantFactoryMethodSmooth=void 0;var Gc=class extends Dn{};Gc.prototype.ValueTypeName="vector";var Vc=class{constructor(e,t,i){let s=this,r=!1,a=0,o=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){o++,r===!1&&s.onStart!==void 0&&s.onStart(u,a,o),r=!0},this.itemEnd=function(u){a++,s.onProgress!==void 0&&s.onProgress(u,a,o),a===o&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(u){s.onError!==void 0&&s.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){let h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){let p=c[h],m=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return m}return null}}},QA=new Vc,Wc=class{constructor(e){this.manager=e!==void 0?e:QA,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(s,r){i.load(e,s,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};Wc.DEFAULT_MATERIAL_NAME="__DEFAULT";var Lr=class extends Ot{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Pe(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}};var Al=new ct,id=new P,sd=new P,ro=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.map=null,this.mapPass=null,this.matrix=new ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Cr,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new Ke(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;id.setFromMatrixPosition(e.matrixWorld),t.position.copy(id),sd.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(sd),t.updateMatrixWorld(),Al.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Al),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Al)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}};var rd=new ct,vr=new P,Ml=new P,Xc=class extends ro{constructor(){super(new Bt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new K(4,2),this._viewportCount=6,this._viewports=[new Ke(2,1,1,1),new Ke(0,1,1,1),new Ke(3,1,1,1),new Ke(1,1,1,1),new Ke(3,0,1,1),new Ke(1,0,1,1)],this._cubeDirections=[new P(1,0,0),new P(-1,0,0),new P(0,0,1),new P(0,0,-1),new P(0,1,0),new P(0,-1,0)],this._cubeUps=[new P(0,1,0),new P(0,1,0),new P(0,1,0),new P(0,1,0),new P(0,0,1),new P(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,s=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),vr.setFromMatrixPosition(e.matrixWorld),i.position.copy(vr),Ml.copy(i.position),Ml.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Ml),i.updateMatrixWorld(),s.makeTranslation(-vr.x,-vr.y,-vr.z),rd.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rd)}},Li=class extends Lr{constructor(e,t,i=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new Xc}get power(){return this.intensity*4*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}},Yc=class extends ro{constructor(){super(new Ga(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},ao=class extends Lr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ot.DEFAULT_UP),this.updateMatrix(),this.target=new Ot,this.shadow=new Yc}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},oo=class extends Lr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var lo=class extends Nt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}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}};var su="\\[\\]\\.:\\/",ZA=new RegExp("["+su+"]","g"),ru="[^"+su+"]",KA="[^"+su.replace("\\.","")+"]",JA=/((?:WC+[\/:])*)/.source.replace("WC",ru),jA=/(WCOD+)?/.source.replace("WCOD",KA),$A=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ru),e1=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ru),t1=new RegExp("^"+JA+jA+$A+e1+"$"),n1=["material","materials","bones","map"],qc=class{constructor(e,t,i){let s=i||yt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},yt=class n{constructor(e,t,i){this.path=t,this.parsedPath=i||n.parseTrackName(t),this.node=n.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new n.Composite(e,t,i):new n(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ZA,"")}static parseTrackName(e){let t=t1.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=i.nodeName.substring(s+1);n1.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(r){for(let a=0;a<r.length;a++){let o=r[a];if(o.name===t||o.uuid===t)return o;let l=i(o.children);if(l)return l}return null},s=i(e.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)e[t++]=i[s]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,s=t.propertyName,r=t.propertyIndex;if(e||(e=n.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let a=e[s];if(a===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+s+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=s;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};yt.Composite=qc;yt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};yt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};yt.prototype.GetterByBindingType=[yt.prototype._getValue_direct,yt.prototype._getValue_array,yt.prototype._getValue_arrayElement,yt.prototype._getValue_toArray];yt.prototype.SetterByBindingTypeAndVersioning=[[yt.prototype._setValue_direct,yt.prototype._setValue_direct_setNeedsUpdate,yt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_array,yt.prototype._setValue_array_setNeedsUpdate,yt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_arrayElement,yt.prototype._setValue_arrayElement_setNeedsUpdate,yt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_fromArray,yt.prototype._setValue_fromArray_setNeedsUpdate,yt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var wb=new Float32Array(1);var De=class n{constructor(e){this.value=e}clone(){return new n(this.value.clone===void 0?this.value:this.value.clone())}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"170"}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="170");var Pd={distance:1200,tiltDegrees:12,near:10,far:4e3};function Ud(){let n=new Bt,e=1,t=1;function i(r=0,a=0,o=0){let{distance:l,near:c,far:u}=Pd,h=l*Math.tan(Ad.degToRad(Pd.tiltDegrees)),d=c/l;n.position.set(r,-h+a,l),n.rotation.set(0,0,o),n.updateMatrixWorld(),n.projectionMatrix.makePerspective(-e/2*d,e/2*d,(t/2+h)*d,(-t/2+h)*d,c,u),n.projectionMatrixInverse.copy(n.projectionMatrix).invert()}function s(r,a){e=r,t=a,i()}return{camera:n,setPlayfield:s,update:i}}var Bd=`
  varying vec2 vUv;
  void main() {
    vUv = uv;
    gl_Position = vec4(position.xy, 0.9999, 1.0);
  }
`,i1=`
  uniform float uTime;
  uniform vec2 uAspect;
  uniform vec3 uColorA;
  uniform vec3 uColorB;
  uniform vec2 uSeed;
  uniform vec2 uParallax;
  uniform vec4 uBody;        // x, y, radius, kind
  uniform vec3 uBodyA;
  uniform vec3 uBodyB;
  uniform vec3 uLightDir;
  uniform float uBodyMix;    // 0\u20131 fade for sector changes
  varying vec2 vUv;

  float hash(vec2 p) {
    p = fract(p * vec2(123.34, 456.21));
    p += dot(p, p + 45.32);
    return fract(p.x * p.y);
  }
  float noise(vec2 p) {
    vec2 i = floor(p), f = fract(p);
    vec2 u = f * f * (3.0 - 2.0 * f);
    return mix(mix(hash(i), hash(i + vec2(1, 0)), u.x),
               mix(hash(i + vec2(0, 1)), hash(i + vec2(1, 1)), u.x), u.y);
  }
  float fbm(vec2 p) {
    float v = 0.0, a = 0.5;
    mat2 r = mat2(0.8, -0.6, 0.6, 0.8);
    for (int i = 0; i < 5; i++) { v += a * noise(p); p = r * p * 2.02; a *= 0.5; }
    return v;
  }

  void main() {
    vec2 p = (vUv - 0.5) * uAspect * 2.4 + uSeed + uParallax * 0.35;
    float t = uTime * 0.015;
    vec2 q = vec2(fbm(p + vec2(0.0, t)), fbm(p + vec2(5.2, 1.3) - t));
    vec2 r = vec2(fbm(p + 3.0 * q + vec2(1.7, 9.2) + t * 0.6), fbm(p + 3.0 * q + vec2(8.3, 2.8)));
    float n = fbm(p + 2.5 * r);

    float cloud = smoothstep(0.42, 1.0, n);
    vec3 col = mix(uColorA, uColorB, smoothstep(0.25, 0.8, r.x)) * cloud;
    col += uColorB * pow(cloud, 4.0) * 1.5;               // bright filaments
    float dust = smoothstep(0.55, 0.78, fbm(p * 1.7 - r + 11.0));
    col *= 1.0 - dust * 0.65;                               // dark dust lanes

    col += vec3(0.0012, 0.0012, 0.0035);

    // ---- Distant body (backdrop planet or star) ----
    vec2 bp = (vUv - 0.5) * uAspect * 2.4 + uParallax * 0.12 - uBody.xy;
    float br = uBody.z;
    float d = length(bp) / br;
    vec3 L = normalize(uLightDir);
    vec3 body = vec3(0.0);
    float cover = 0.0;

    if (uBody.w < 1.5) {
      if (d < 1.0) {
        vec3 n = vec3(bp / br, sqrt(1.0 - d * d));
        float lit = smoothstep(-0.15, 0.6, dot(n, L));
        float swirl = fbm(n.xy * 3.0 + uTime * 0.004);
        float bands = uBody.w < 0.5
          ? fbm(vec2(n.y * 7.0 + swirl * 1.6, n.x * 0.6))          // gas giant bands
          : fbm(n.xy * 4.5 + swirl);                                 // icy mottling
        vec3 surf = mix(uBodyA, uBodyB, smoothstep(0.25, 0.75, bands));
        body = surf * (0.008 + lit * 0.2);
        cover = smoothstep(1.0, 0.985, d);
      }
      // Atmospheric rim, brighter on the lit side.
      vec3 rn = normalize(vec3(bp, 0.0));
      float rimLit = smoothstep(-0.2, 0.8, dot(rn, L));
      float atmo = exp(-abs(d - 1.0) * 26.0) * (0.02 + rimLit * 0.22);
      body += uBodyB * atmo;

      if (uBody.w > 0.5) {
        // Tilted ring: hidden where it passes behind the planet.
        vec2 rp = mat2(0.94, -0.34, 0.34, 0.94) * bp;
        float e = length(vec2(rp.x, rp.y * 4.2)) / br;
        float ring = smoothstep(1.45, 1.5, e) * (1.0 - smoothstep(2.1, 2.2, e));
        ring *= 0.55 + 0.45 * sin(e * 40.0);
        bool behind = rp.y > 0.0 && d < 1.0;
        if (!behind) {
          body = mix(body, uBodyB * (0.03 + rimLit * 0.14), ring * 0.8);
          cover = max(cover, ring * 0.8);
        }
      }
    } else {
      // Star: hot disk, limb darkening and a soft corona.
      float limb = d < 1.0 ? sqrt(1.0 - d * d) : 0.0;
      body = uBodyA * (0.35 + 0.65 * limb) * step(d, 1.0);
      cover = smoothstep(1.0, 0.95, d);
      float corona = exp(-max(d - 1.0, 0.0) * 2.2) * (1.0 + 0.25 * sin(atan(bp.y, bp.x) * 9.0 + uTime * 0.3));
      body += uBodyB * corona * 0.3 * step(1.0, d);
    }

    col = mix(col, body, cover * uBodyMix) + body * (1.0 - cover) * uBodyMix;
    gl_FragColor = vec4(col, 1.0);
  }
`,au=2.4;function Ld(n,e){let t=i=>{let s=i/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4};return e.set(t(n[0])*au,t(n[1])*au,t(n[2])*au)}function Nd(){let n={uTime:{value:0},uAspect:{value:new K(1,1)},uColorA:{value:new P},uColorB:{value:new P},uSeed:{value:new K},uParallax:{value:new K},uBody:{value:new Ke},uBodyA:{value:new P},uBodyB:{value:new P},uLightDir:{value:new P(0,1,1)},uBodyMix:{value:0}},e=new Gs(2,2),t=new at(1,1,{type:li,depthBuffer:!1}),i=new ai,s=new Ui,r=new et(e,new Je({vertexShader:Bd,fragmentShader:i1,uniforms:n,depthTest:!1,depthWrite:!1}));r.frustumCulled=!1,i.add(r);let a=new et(e,new Je({vertexShader:Bd,fragmentShader:`
      uniform sampler2D map;
      varying vec2 vUv;
      void main() { gl_FragColor = texture2D(map, vUv); }
    `,uniforms:{map:{value:t.texture}},depthTest:!1,depthWrite:!1}));a.frustumCulled=!1,a.renderOrder=-100;let o=new P,l=new P,c=null,u=null;function h(p){let m=p.backdrop;n.uBody.value.set(m.x,m.y,m.radius,m.kind),n.uBodyA.value.fromArray(m.colorA),n.uBodyB.value.fromArray(m.colorB),n.uLightDir.value.fromArray(p.lightDir),u=p}function d(){n.uSeed.value.set(Math.random()*100,Math.random()*100)}return d(),{mesh:a,reseed:d,bodyUniforms:{uBody:n.uBody,uBodyMix:n.uBodyMix,uAspect:n.uAspect},resize(p,m,v=1,g=.5){n.uAspect.value.set(p/Math.max(p,m),m/Math.max(p,m)).multiplyScalar(1.6),t.setSize(Math.max(1,Math.round(p*v*g)),Math.max(1,Math.round(m*v*g)))},renderOffscreen(p){let m=p.getRenderTarget();p.setRenderTarget(t),p.render(i,s),p.setRenderTarget(m)},update(p,m,v,g){if(Ld(v.nebulaA,o),Ld(v.nebulaB,l),c===null)n.uColorA.value.copy(o),n.uColorB.value.copy(l);else{let x=1-Math.exp(-p*1.5);n.uColorA.value.lerp(o,x),n.uColorB.value.lerp(l,x)}c=v.name,u||h(v);let f=n.uBodyMix;u!==v?(f.value=Math.max(0,f.value-p*1.2),f.value===0&&h(v)):f.value=Math.min(1,f.value+p*.8),n.uTime.value=m,n.uParallax.value.copy(g)}}}var Ni=900,s1=`
  attribute vec2 aUv;
  attribute float aSize;
  attribute float aLayer;
  attribute float aTwinkle;
  attribute float aPhase;
  attribute vec3 aColor;
  uniform float uTime;
  uniform float uPixelRatio;
  uniform vec2 uParallax;
  uniform vec4 uBody;
  uniform float uBodyMix;
  uniform vec2 uAspect;
  varying vec3 vColor;
  varying float vAlpha;
  void main() {
    vec2 uv = fract(aUv - uParallax * (0.2 + aLayer * 0.4));
    gl_Position = vec4(uv * 2.0 - 1.0, 0.9995, 1.0);
    vAlpha = max(0.08, 0.4 + 0.4 * sin(uTime * aTwinkle + aPhase));
    // Hidden behind the backdrop planet (same mapping as the nebula shader).
    vec2 bp = (uv - 0.5) * uAspect * 2.4 + uParallax * 0.12 - uBody.xy;
    if (length(bp) < uBody.z * 1.02) vAlpha *= 1.0 - uBodyMix;
    vColor = aColor * (1.0 + aLayer * 0.8);
    gl_PointSize = aSize * uPixelRatio * (aLayer > 1.5 ? 3.0 : 2.0);
  }
`,r1=`
  varying vec3 vColor;
  varying float vAlpha;
  void main() {
    float d = length(gl_PointCoord - 0.5) * 2.0;
    float core = smoothstep(0.55, 0.0, d);
    float halo = exp(-d * d * 4.0) * 0.35;
    float a = (core + halo) * vAlpha;
    if (a < 0.004) discard;
    gl_FragColor = vec4(vColor, a);
  }
`;function Fd(n){let e=new Float32Array(Ni*2),t=new Float32Array(Ni),i=new Float32Array(Ni),s=new Float32Array(Ni),r=new Float32Array(Ni),a=new Float32Array(Ni*3);for(let h=0;h<Ni;h++){let d=Math.random(),p=d<.65?0:d<.92?1:2;e[h*2]=Math.random(),e[h*2+1]=Math.random(),i[h]=p,t[h]=p===0?.5+Math.random()*.7:p===1?.8+Math.random()*1:1.2+Math.random()*1.4,s[h]=.4+Math.random()*1.6,r[h]=Math.random()*Math.PI*2;let m=Math.random(),[v,g,f]=m<.08?[.55,.65,1]:m<.15?[1,.75,.55]:[1,1,1];a.set([v,g,f],h*3)}let o=new Nt;o.setAttribute("position",new mt(new Float32Array(Ni*3),3)),o.setAttribute("aUv",new mt(e,2)),o.setAttribute("aSize",new mt(t,1)),o.setAttribute("aLayer",new mt(i,1)),o.setAttribute("aTwinkle",new mt(s,1)),o.setAttribute("aPhase",new mt(r,1)),o.setAttribute("aColor",new mt(a,3));let l={uTime:{value:0},uPixelRatio:{value:1},uParallax:{value:new K},...n},c=new Je({vertexShader:s1,fragmentShader:r1,uniforms:l,transparent:!0,depthWrite:!1,depthTest:!0,blending:kn}),u=new Ya(o,c);return u.frustumCulled=!1,u.renderOrder=-50,{points:u,setPixelRatio(h){l.uPixelRatio.value=h},update(h,d){l.uTime.value=h,l.uParallax.value.copy(d)}}}var qe={glow:0,spark:1,ring:2,shard:3},a1=`
  attribute vec3 iPos;
  attribute float iSize;
  attribute vec4 iColor;
  attribute vec3 iParams; // shape, rotation, extra
  varying vec2 vUv;
  varying vec4 vColor;
  varying vec2 vShape;
  void main() {
    float c = cos(iParams.y), s = sin(iParams.y);
    vec2 corner = vec2(c * position.x - s * position.y, s * position.x + c * position.y);
    vec4 mv = modelViewMatrix * vec4(iPos, 1.0);
    mv.xy += corner * iSize;
    gl_Position = projectionMatrix * mv;
    vUv = position.xy;
    vColor = iColor;
    vShape = iParams.xz;
  }
`,o1=`
  varying vec2 vUv;
  varying vec4 vColor;
  varying vec2 vShape;

  float edge(vec2 a, vec2 b, vec2 p) {
    vec2 e = b - a, q = p - a;
    return e.x * q.y - e.y * q.x;
  }

  void main() {
    float d = length(vUv);
    float a;
    if (vShape.x < 0.5) {            // soft glow
      a = exp(-d * d * 3.5) * (1.0 - smoothstep(0.8, 1.0, d));
    } else if (vShape.x < 1.5) {     // spark: hot core + halo
      float core = smoothstep(0.4, 0.0, d);
      float halo = exp(-d * d * 6.0) * 0.55;
      a = clamp(core + halo, 0.0, 1.0) * (1.0 - smoothstep(0.85, 1.0, d));
    } else if (vShape.x < 2.5) {     // ring with thickness vShape.y (uv units)
      float t = max(vShape.y, 0.01);
      float aa = fwidth(d);
      a = 1.0 - smoothstep(t * 0.5, t * 0.5 + aa, abs(d - (1.0 - t * 0.5)));
    } else {                         // irregular debris shard
      vec2 p0 = vec2(-1.0, -0.6), p1 = vec2(1.0, -0.3), p2 = vec2(0.6, 1.0), p3 = vec2(-0.7, 0.5);
      float m = min(min(edge(p0, p1, vUv), edge(p1, p2, vUv)), min(edge(p2, p3, vUv), edge(p3, p0, vUv)));
      a = smoothstep(0.0, fwidth(m) * 1.5, m);
    }
    if (a < 0.003) discard;
    gl_FragColor = vec4(vColor.rgb, vColor.a * a);
  }
`,Od=[["iPos",3],["iSize",1],["iColor",4],["iParams",3]];function ou({capacity:n=1024,blending:e=kn,renderOrder:t=10}={}){let i=new lo;i.setAttribute("position",new xt([-1,-1,0,1,-1,0,1,1,0,-1,1,0],3)),i.setIndex([0,1,2,0,2,3]);let s=new Je({vertexShader:a1,fragmentShader:o1,transparent:!0,depthWrite:!1,depthTest:!0,blending:e,side:Lt}),r=new et(i,s);r.frustumCulled=!1,r.renderOrder=t;let a=0,o=0,l={};function c(u){a>0&&i.dispose();for(let[h,d]of Od){let p=new Float32Array(u*d);l[h]&&p.set(l[h].array);let m=new oi(p,d);m.setUsage(Xs),l[h]=m,i.setAttribute(h,m)}a=u}return c(n),{mesh:r,get count(){return o},begin(){o=0},push(u,h,d,p,m,v,g,f,x=qe.glow,A=0,y=0){o>=a&&c(a*2);let b=o++,T=l.iPos.array,C=l.iSize.array,D=l.iColor.array,S=l.iParams.array;T[b*3]=u,T[b*3+1]=h,T[b*3+2]=d,C[b]=p,D[b*4]=m,D[b*4+1]=v,D[b*4+2]=g,D[b*4+3]=f,S[b*3]=x,S[b*3+1]=A,S[b*3+2]=y},end(){i.instanceCount=o,r.visible=o>0;for(let[u,h]of Od){let d=l[u];d.clearUpdateRanges(),d.addUpdateRange(0,o*h),d.needsUpdate=!0}}}}var ss=new Float32Array(256);for(let n=0;n<256;n++){let e=n/255;ss[n]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}var po=[0,0,0];function mo(n,e=1){return po[0]=ss[n[0]]*e,po[1]=ss[n[1]]*e,po[2]=ss[n[2]]*e,po}function Yt(n,e=1){let t=parseInt(n.slice(1),16);return[ss[t>>16&255]*e,ss[t>>8&255]*e,ss[t&255]*e]}var lu=Yt("#fff4cc",4),cu=Yt("#ffc832",1.2),uu=Yt("#ffb020",1.8),hu=Yt("#ff8c1e",1.2),l1=16/60,go=30,qs=Yt("#9fe6ff",1.4);function kd(n,e,t,i){for(let s=1;s<n.length;s++){let r=n[s-1],a=n[s],o=a.x-r.x,l=a.y-r.y;if(Math.abs(o)>e||Math.abs(l)>e)continue;let c=Math.max(1,Math.ceil(Math.hypot(o,l)/t));for(let u=0;u<c;u++){let h=u/c;i(r.x+o*h,r.y+l*h,(s-1+h)/(n.length-1),r,a,h)}}}function zd(n,{alpha:e},t,i){let{width:s,height:r}=n.world,a=Math.min(s,r)/2,{fx:o}=n;for(let l of n.frostFields){let c=Math.min(1,l.life/l.maxLife*1.5);t.push(l.x,l.y,-20,l.r,qs[0]*.35,qs[1]*.35,qs[2]*.35,.35*c,qe.glow),t.push(l.x,l.y,-18,l.r,qs[0],qs[1],qs[2],.35*c,qe.ring,0,2/l.r)}kd(o.engineTrail,a,3,(l,c,u,h,d,p)=>{let m=(h.life+(d.life-h.life)*p)/l1;t.push(l,c,-2,2+m*3,hu[0],hu[1],hu[2],.35*m,qe.glow)});for(let l of n.missiles){let c=wt(l.prevX,l.x,e,s),u=wt(l.prevY,l.y,e,r),h=l.trail.length?[...l.trail,{x:c,y:u}]:[];kd(h,a,1.5,(d,p,m)=>{t.push(d,p,0,1.4+m*2,uu[0],uu[1],uu[2],.08+m*.35,qe.spark)}),t.push(c,u,1,5,lu[0],lu[1],lu[2],1,qe.spark),t.push(c,u,0,14,cu[0],cu[1],cu[2],.35,qe.glow)}for(let l of o.particles){let c=l.life/l.maxLife;if(l.kind==="spark"){let u=mo(l.rgb,2.4);t.push(l.x,l.y,go,l.size*c*1.8,u[0],u[1],u[2],c,qe.spark)}else{let u=mo(l.rgb,1.1);i.push(l.x,l.y,go,l.size*c*1.1,u[0],u[1],u[2],c,qe.shard,-l.rot),t.push(l.x,l.y,go-1,l.size*c*2,u[0],u[1],u[2],c*.25,qe.glow)}}for(let l of o.shockwaves){let c=mo(l.rgb,1.8);t.push(l.x,l.y,go,l.r,c[0],c[1],c[2],l.alpha,qe.ring,0,2.5/Math.max(l.r,1))}}function vo(n,e,t,i,s,r=[]){r.length=0;let a=[0],o=[0];n<t?a.push(i):n>i-t&&a.push(-i),e<t?o.push(s):e>s-t&&o.push(-s);for(let l of a)for(let c of o)r.push(l,c);return r}function Hd(n,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},i=n.getIndex(),s=n.getAttribute("position"),r=i?i.count:s.count,a=0,o=Object.keys(n.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let x=0,A=o.length;x<A;x++){let y=o[x],b=n.attributes[y];l[y]=new b.constructor(new b.array.constructor(b.count*b.itemSize),b.itemSize,b.normalized);let T=n.morphAttributes[y];T&&(c[y]||(c[y]=[]),T.forEach((C,D)=>{let S=new C.array.constructor(C.count*C.itemSize);c[y][D]=new C.constructor(S,C.itemSize,C.normalized)}))}let p=e*.5,m=Math.log10(1/e),v=Math.pow(10,m),g=p*v;for(let x=0;x<r;x++){let A=i?i.getX(x):x,y="";for(let b=0,T=o.length;b<T;b++){let C=o[b],D=n.getAttribute(C),S=D.itemSize;for(let M=0;M<S;M++)y+=`${~~(D[h[M]](A)*v+g)},`}if(y in t)u.push(t[y]);else{for(let b=0,T=o.length;b<T;b++){let C=o[b],D=n.getAttribute(C),S=n.morphAttributes[C],M=D.itemSize,w=l[C],B=c[C];for(let U=0;U<M;U++){let k=h[U],H=d[U];if(w[H](a,D[k](A)),S)for(let O=0,Y=S.length;O<Y;O++)B[O][H](a,S[O][k](A))}}t[y]=a,u.push(a),a++}}let f=n.clone();for(let x in n.attributes){let A=l[x];if(f.setAttribute(x,new A.constructor(A.array.slice(0,a*A.itemSize),A.itemSize,A.normalized)),x in c)for(let y=0;y<c[x].length;y++){let b=c[x][y];f.morphAttributes[x][y]=new b.constructor(b.array.slice(0,a*b.itemSize),b.itemSize,b.normalized)}}return f.setIndex(u),f}function c1(n,e,t,i){let s=Math.imul(n,374761393)+Math.imul(e,668265263)+Math.imul(t,1440662683)+Math.imul(i,1274126177)|0;return s=Math.imul(s^s>>>13,1274126177),((s^s>>>16)>>>0)/4294967296}var fu=n=>n*n*(3-2*n),rs=(n,e,t)=>n+(e-n)*t;function Qs(n,e,t,i=0){let s=Math.floor(n),r=Math.floor(e),a=Math.floor(t),o=fu(n-s),l=fu(e-r),c=fu(t-a),u=(h,d,p)=>c1(s+h,r+d,a+p,i);return rs(rs(rs(u(0,0,0),u(1,0,0),o),rs(u(0,1,0),u(1,1,0),o),l),rs(rs(u(0,0,1),u(1,0,1),o),rs(u(0,1,1),u(1,1,1),o),l),c)}function xo(n,e,t,i=0,s=4){let r=0,a=.5,o=1;for(let l=0;l<s;l++)r+=a*Qs(n*o,e*o,t*o,i+l*31),o*=2.03,a*=.5;return r}function Fi(n){let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=Math.imul(e^e>>>15,e|1);return t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function as(n){let e=new no(1,n);return e.deleteAttribute("normal"),e.deleteAttribute("uv"),e=Hd(e),e}function Gd(n){let e=n()*2-1,t=n()*Math.PI*2,i=Math.sqrt(1-e*e);return new P(i*Math.cos(t),i*Math.sin(t),e)}function os(n,e,t,i,s){let r=n.attributes.position,a=new Float32Array(r.count*3),o=new P;for(let p=0;p<r.count;p++){o.fromBufferAttribute(r,p).normalize();let m=e(o),v=t(o,m);r.setXYZ(p,o.x*m,o.y*m,o.z*m),a[p*3]=a[p*3+1]=a[p*3+2]=v}n.setAttribute("color",new mt(a,3));let l=Gd(s),c=new zn().setFromUnitVectors(new P(1,0,0),l),u=new ct().compose(new P,c,new P(i,1/Math.sqrt(i),1/Math.sqrt(i))),h=new ct().makeRotationFromQuaternion(c.clone().invert());n.applyMatrix4(h).applyMatrix4(u),n.computeBoundingSphere();let d=1/n.boundingSphere.radius;return n.scale(d*1.04,d*1.04,d*1.04),n.computeVertexNormals(),n.computeBoundingSphere(),n}function u1(n){let e=Fi(n),t=Array.from({length:5+Math.floor(e()*4)},()=>({c:Gd(e),r:.25+e()*.35,depth:.06+e()*.08})),i=s=>{let r=0;for(let a of t){let o=Math.acos(Math.min(1,s.dot(a.c)))/a.r;o<1?r-=(1-o*o)*a.depth:o<1.5&&(r+=Math.exp(-(((o-1.1)/.18)**2))*a.depth*.35)}return r};return os(as(3),s=>1+(xo(s.x*1.7,s.y*1.7,s.z*1.7,n)-.5)*.55+i(s),(s,r)=>Math.max(.3,Math.min(1,.72+(r-1)*2.2)),1.15+e()*.25,e)}function h1(n){let e=Fi(n);return os(as(1),t=>.75+Qs(t.x*2.6+9,t.y*2.6,t.z*2.6,n)*.55,(t,i)=>Math.max(.55,Math.min(1,.8+(i-1)*1.2)),1.35+e()*.35,e)}function f1(n){let e=Fi(n);return os(as(3),t=>1+(xo(t.x*1.3,t.y*1.3,t.z*1.3,n,3)-.5)*.16,()=>1,1.05+e()*.08,e)}function d1(n){let e=Fi(n);return os(as(2),t=>.86+Math.round(xo(t.x*1.4,t.y*1.4,t.z*1.4,n,2)*6)/6*.28,(t,i)=>Math.max(.45,Math.min(1,.7+(i-1)*2)),1.1+e()*.15,e)}function p1(n){let e=Fi(n);return os(as(3),t=>1+Math.sin(t.y*14)*.025+(Qs(t.x*2,t.y*2,t.z*2,n)-.5)*.06,()=>1,1+e()*.05,e)}function m1(n){let e=Fi(n);return os(as(0),t=>.75+Qs(t.x*3+2,t.y*3,t.z*3,n)*.5,()=>.9,2+e()*.4,e)}function g1(n){let e=Fi(n);return os(as(1),t=>.85+Qs(t.x*2.5,t.y*2.5,t.z*2.5,n)*.3,()=>.9,1.15,e)}var v1={rock:u1,ice:h1,plasma:f1,metal:d1,magnetic:p1,crystal:m1,comet:g1};function Vd(n,e){return v1[n](1e3+e*7919+n.length*131)}var Wd=`
  float hash13(vec3 p) {
    p = fract(p * 0.1031);
    p += dot(p, p.zyx + 31.32);
    return fract((p.x + p.y) * p.z);
  }
  float vnoise3(vec3 p) {
    vec3 i = floor(p), f = fract(p);
    vec3 u = f * f * (3.0 - 2.0 * f);
    return mix(
      mix(mix(hash13(i), hash13(i + vec3(1, 0, 0)), u.x), mix(hash13(i + vec3(0, 1, 0)), hash13(i + vec3(1, 1, 0)), u.x), u.y),
      mix(mix(hash13(i + vec3(0, 0, 1)), hash13(i + vec3(1, 0, 1)), u.x), mix(hash13(i + vec3(0, 1, 1)), hash13(i + vec3(1, 1, 1)), u.x), u.y),
      u.z);
  }
  // 3 octaves; normalised to roughly 0\u20131.
  float fbm3(vec3 p) {
    float v = 0.0, a = 0.5;
    for (int i = 0; i < 3; i++) { v += a * vnoise3(p); p = p * 2.03 + 17.1; a *= 0.5; }
    return v / 0.875;
  }
  // 2 octaves, for cheap surface grain.
  float fbm3lo(vec3 p) {
    return (vnoise3(p) * 0.5 + vnoise3(p * 2.03 + 17.1) * 0.25) / 0.75;
  }
`;function Xd(){return{uTime:{value:0},uRimColor:{value:new Pe(16755268)}}}var x1=`
  attribute float aFlash;
  varying float vFlash;
  varying vec3 vObjPos;
`,y1=`
  vObjPos = position;
  vFlash = aFlash;
`,A1=`
  uniform float uTime;
  uniform vec3 uRimColor;
  varying float vFlash;
  varying vec3 vObjPos;
  ${Wd}
`,M1={rock:{diffuse:`
      float grain = fbm3lo(vObjPos * 6.0);
      float speck = smoothstep(0.7, 0.8, grain);
      diffuseColor.rgb *= (0.7 + 0.55 * grain) * (1.0 - speck * 0.25);
    `,emission:`
      float fres = pow(1.0 - saturate(dot(normal, normalize(vViewPosition))), 3.0);
      totalEmissiveRadiance = uRimColor * fres * 0.45;
    `},ice:{diffuse:`
      diffuseColor.rgb *= 0.75;
    `,emission:`
      float fres = pow(1.0 - saturate(dot(normal, normalize(vViewPosition))), 2.5);
      float n = fbm3lo(vObjPos * 3.0 + 4.0);
      float crack = 1.0 - smoothstep(0.0, 0.03, abs(n - 0.5));
      vec3 cell = floor(vObjPos * 26.0);
      float h = hash13(cell);
      float glint = step(0.82, h) * smoothstep(0.9, 1.0, sin(h * 80.0 + uTime * 2.5 + dot(normal, vec3(4.0))) * 0.5 + 0.5);
      totalEmissiveRadiance = vColor * (0.06 + 0.22 * (1.0 - fres))
        + vec3(0.65, 0.92, 1.0) * (fres * 0.9 + crack * 0.55)
        + vec3(3.5) * glint;
    `},metal:{diffuse:`
      vec3 g = abs(fract(vObjPos * 3.5) - 0.5);
      float seam = smoothstep(0.46, 0.5, max(g.x, max(g.y, g.z)));
      diffuseColor.rgb *= 1.0 - seam * 0.55;
    `,emission:`
      float fres = pow(1.0 - saturate(dot(normal, normalize(vViewPosition))), 3.0);
      totalEmissiveRadiance = uRimColor * fres * 0.25;
    `},magnetic:{diffuse:`
      diffuseColor.rgb *= 0.5;
    `,emission:`
      float fres = pow(1.0 - saturate(dot(normal, normalize(vViewPosition))), 2.0);
      float band = smoothstep(0.82, 1.0, sin(vObjPos.y * 16.0 - uTime * 5.0) * 0.5 + 0.5);
      totalEmissiveRadiance = vec3(0.35, 0.65, 1.8) * (band * 1.6 + fres * 0.6);
    `},crystal:{diffuse:`
      diffuseColor.rgb *= 0.6;
    `,emission:`
      float fres = pow(1.0 - saturate(dot(normal, normalize(vViewPosition))), 2.0);
      float h = hash13(floor(vObjPos * 14.0));
      float glint = step(0.7, h) * smoothstep(0.85, 1.0, sin(h * 70.0 + uTime * 4.0) * 0.5 + 0.5);
      totalEmissiveRadiance = vColor * (0.5 + fres * 1.4) + vec3(3.0) * glint;
    `},comet:{diffuse:`
      diffuseColor.rgb *= 0.8;
    `,emission:`
      float fres = pow(1.0 - saturate(dot(normal, normalize(vViewPosition))), 2.0);
      totalEmissiveRadiance = vec3(0.7, 0.95, 1.2) * (0.9 + fres * 1.5);
    `},plasma:{diffuse:`
      diffuseColor.rgb = vec3(0.025, 0.018, 0.022) + diffuseColor.rgb * 0.05;
    `,emission:`
      float seed = vColor.r * 13.0 + vColor.b * 7.0;
      vec3 q = vObjPos * 2.2 + vec3(0.0, uTime * 0.22, seed);
      float n = fbm3(q + vnoise3(q * 1.6) * 1.3);
      float vein = 1.0 - smoothstep(0.0, 0.028, abs(n - 0.5));
      float halo = 1.0 - smoothstep(0.0, 0.12, abs(n - 0.5));
      float heat = 0.5 + 0.5 * sin(uTime * 3.0 + seed);
      float fres = pow(1.0 - saturate(dot(normal, normalize(vViewPosition))), 2.0);
      totalEmissiveRadiance = vColor * (vein * (2.6 + heat * 2.0) + halo * 0.12 + fres * 0.12);
    `}};function Zs(n,e,t){let i=M1[e];return n.onBeforeCompile=s=>{Object.assign(s.uniforms,t),s.vertexShader=s.vertexShader.replace("#include <common>",`#include <common>
${x1}`).replace("#include <begin_vertex>",`#include <begin_vertex>
${y1}`),s.fragmentShader=s.fragmentShader.replace("#include <common>",`#include <common>
${A1}`).replace("#include <color_fragment>",`#include <color_fragment>
${i.diffuse}`).replace("#include <emissivemap_fragment>",`#include <emissivemap_fragment>
${i.emission}
totalEmissiveRadiance += vec3(1.1) * vFlash;`)},n.customProgramCacheKey=()=>`asteroid-${e}`,n}function Yd(n,e){return Zs(n==="metal"?new It({color:16777215,roughness:.32,metalness:.85,flatShading:!0,vertexColors:!0}):n==="magnetic"?new It({color:16777215,roughness:.3,metalness:.6,flatShading:!1,vertexColors:!0}):n==="crystal"||n==="comet"?new Br({color:16777215,roughness:.1,metalness:.05,flatShading:!0,vertexColors:!0,transparent:n==="crystal",opacity:.85,clearcoat:1,clearcoatRoughness:.05}):n==="rock"?new It({color:16777215,roughness:.95,metalness:.04,flatShading:!0,vertexColors:!0}):n==="ice"?new Br({color:16777215,roughness:.14,metalness:.1,flatShading:!0,vertexColors:!0,transparent:!0,opacity:.9,clearcoat:1,clearcoatRoughness:.08}):new It({color:16777215,roughness:.45,metalness:.1,flatShading:!1,vertexColors:!0}),n,e)}var yo=6,S1=["rock","ice","plasma","metal","magnetic","crystal","comet"],_1=.12,b1={rock:0,metal:0,ice:.2,magnetic:.18,crystal:.3,comet:.45},du=[.55,.95,1.4],pu=[.4,.75,1.6],E1=50,qd=1.3,w1=.18,Qd=7,T1={rock:{h:30/360,s:.18,l:.45},ice:{h:202/360,s:.75,l:.62},plasma:{h:38/360,s:1,l:.5},metal:{h:0,s:0,l:.7},magnetic:{h:230/360,s:.8,l:.35},crystal:{h:55/360,s:.9,l:.7},comet:{h:200/360,s:.3,l:.9}};function Zd(n){let e=Xd(),t=[],i=new Map;for(let x of S1){let A=Yd(x,e);for(let y=0;y<yo;y++){let b={geometry:Vd(x,y),material:A,mesh:null,flash:null,capacity:0,items:[]};t.push(b),i.set(`${x}:${y}`,b)}}let s=new Map,r=new Ot,a=[],o=null;function l(x,A){if(A<=x.capacity)return;let y=Math.max(16,x.capacity);for(;y<A;)y*=2;x.mesh&&(n.remove(x.mesh),x.mesh.dispose(),x.geometry.dispose()),x.flash=new oi(new Float32Array(y),1),x.flash.setUsage(Xs),x.geometry.setAttribute("aFlash",x.flash);let b=new Xa(x.geometry,x.material,y);b.instanceMatrix.setUsage(Xs),b.instanceColor=new oi(new Float32Array(y*3),3),b.instanceColor.setUsage(Xs),b.frustumCulled=!1,b.count=0,n.add(b),x.mesh=b,x.capacity=y}function c(){for(let x of t)x.items.length=0}function u(x,A,y,b,T,C,D,S,M=0){i.get(`${x}:${A}`).items.push(C,y,b,T,D,S,M)}function h(){for(let x of t){let A=x.items.length/Qd;if(A===0&&!x.mesh)continue;l(x,A);let{mesh:y,items:b,flash:T}=x;for(let C=0;C<A;C++){let D=C*Qd;r.position.set(b[D+1],b[D+2],b[D+3]),r.rotation.copy(b[D]),r.scale.setScalar(b[D+4]),r.updateMatrix(),y.setMatrixAt(C,r.matrix),y.setColorAt(C,b[D+5]),T.array[C]=b[D+6]}y.count=A,y.visible=A>0,y.instanceMatrix.needsUpdate=!0,y.instanceColor.needsUpdate=!0,T.needsUpdate=!0}}function d(x,A,y){let b=A==="colorblind"?T1[x.type]:null;return b?y.setHSL(b.h,b.s,b.l+(x.light-.55)*.3):y.setHSL(x.hue,x.sat,x.light)}function p(x,A,y){let b=s.get(x.id);return b&&b.palette!==y&&(d(x,y,b.color),b.palette=y),b||(b={palette:y,rotation:new Xt(Math.random()*6.28,Math.random()*6.28,Math.random()*6.28),depthZ:(Math.random()-.5)*E1,variant:x.id%yo,color:d(x,y,new Pe),born:A},s.set(x.id,b)),b}function m(x,A){let y=s.get(x);y&&(y.hitAt=A)}function v(x,{alpha:A,frameSeconds:y,now:b,theme:T,effects:C},D){let{width:S,height:M}=x.world,w=x.paused||x.hitStop>0?0:y;e.uTime.value=b,T.accent!==o&&(o=T.accent,e.uRimColor.value.set(o));let B=new Set;for(let U of x.asteroids){B.add(U.id);let k=p(U,b,C.palette);k.rotation.x+=U.spin.x*w,k.rotation.y+=U.spin.y*w,k.rotation.z+=U.spin.z*w;let H=wt(U.prevX,U.x,A,S),O=wt(U.prevY,U.y,A,M),Y=U.type==="plasma"?1+Math.sin(b*4+U.pulsePhase)*.06:1,G=U.fromSplit?Math.max(0,1-(b-k.born)/w1):0,ee=k.hitAt?Math.max(0,1-(b-k.hitAt)/_1):0,ce=Math.max(G,ee)*C.flashScale,re=b1[U.type]??.14+Math.sin(b*6+U.pulsePhase)*.06,{r:Me,g:Le,b:q}=k.color;U.type==="comet"&&g(U,H,O,D),U.type==="magnetic"&&f(U,H,O,b,D),vo(H,O,U.size*qd,S,M,a);for(let te=0;te<a.length;te+=2){let ve=H+a[te],oe=O+a[te+1];u(U.type,k.variant,ve,oe,k.depthZ,k.rotation,U.size*Y,k.color,ce),re>0&&D.push(ve,oe,k.depthZ-U.size,U.size*qd*Y,Me,Le,q,re,qe.glow)}}for(let U of s.keys())B.has(U)||s.delete(U)}function g(x,A,y,b){let T=Math.hypot(x.vx,x.vy)||1,C=-x.vx/T,D=-x.vy/T;for(let S=0;S<18;S++){let M=S/17,w=8+M*80,B=Math.sin(S*1.7)*M*6;b.push(A+C*w-D*B,y+D*w+C*B,-4,(1-M)*11+3,du[0]*2.2,du[1]*2.2,du[2]*2.2,(1-M)*.5,qe.glow)}}function f(x,A,y,b,T){for(let D=0;D<2;D++){let S=(b*.5+D*.5)%1,M=x.size+(280-x.size)*(1-S);T.push(A,y,-6,M,pu[0],pu[1],pu[2],.12*Math.sin(S*Math.PI),qe.ring,0,1.5/M)}}for(let x of t)l(x,16);return{begin:c,add:u,update:v,end:h,onHit:m}}var C1=`
  varying vec3 vNormalV;
  varying vec3 vViewDir;
  varying vec3 vObj;
  void main() {
    vObj = position;
    vec4 mv = modelViewMatrix * vec4(position, 1.0);
    vNormalV = normalize(normalMatrix * normal);
    vViewDir = normalize(-mv.xyz);
    gl_Position = projectionMatrix * mv;
  }
`,R1=`
  uniform float uStrength;
  uniform float uTime;
  uniform vec3 uColor;
  varying vec3 vNormalV;
  varying vec3 vViewDir;
  varying vec3 vObj;

  float hexDist(vec2 p) {
    p = abs(p);
    return max(dot(p, normalize(vec2(1.0, 1.732))), p.x);
  }
  vec2 hexCell(vec2 uv) {
    vec2 r = vec2(1.0, 1.732), h = r * 0.5;
    vec2 a = mod(uv, r) - h;
    vec2 b = mod(uv - h, r) - h;
    return dot(a, a) < dot(b, b) ? a : b;
  }

  void main() {
    float fres = pow(1.0 - abs(dot(normalize(vNormalV), normalize(vViewDir))), 2.2);
    vec2 gv = hexCell(vObj.xy * 0.45 + vec2(0.0, uTime * 0.6));
    float edge = smoothstep(0.38, 0.48, hexDist(gv));
    float sweep = 0.5 + 0.5 * sin(vObj.y * 0.35 - uTime * 6.0);
    float a = (fres * 0.85 + edge * (0.12 + 0.5 * fres) * (0.6 + 0.4 * sweep)) * uStrength;
    if (a < 0.003) discard;
    gl_FragColor = vec4(uColor, a);
  }
`;function Ao(n){let e={uStrength:{value:0},uTime:{value:0},uColor:{value:new Pe(.45,.8,1).multiplyScalar(1.8)}},t=new et(new Bi(n,32,16),new Je({vertexShader:C1,fragmentShader:R1,uniforms:e,transparent:!0,depthWrite:!1,blending:kn,side:Lt}));return t.scale.z=.6,t.renderOrder=25,{mesh:t,setColor(i,s,r){e.uColor.value.setRGB(i,s,r)},update(i,s){e.uStrength.value=i,e.uTime.value=s,t.visible=i>.001}}}var D1=.5,I1=.07,Ks=Yt("#fff1c4",6),mu=[[5,4.6,3.2],[4,1.9,.25],[2.4,.45,.04],[1,.08,0]];function gu(n,e,t=.8){let i=new Dr(n.map(([r,a])=>new K(r,a))),s=new to(i,{depth:e,bevelEnabled:!0,bevelThickness:t,bevelSize:t*.7,bevelSegments:1});return s.translate(0,0,-e/2),s}function P1(n){let e=new It({color:3842280,metalness:.6,roughness:.32,flatShading:!0,emissive:670300,emissiveIntensity:.8}),t=new It({color:12577279,metalness:.1,roughness:.05,emissive:8377599,emissiveIntensity:1.6}),i=new et(gu([[19,0],[-9,-10],[-4,0],[-9,10]],5,1.4),e),s=new et(new Bi(1,12,8),t);s.scale.set(6,2.4,2.2),s.position.set(9,0,3.2);let r=new et(gu([[-4,-8.5],[-8,-9.5],[-6,-4]],6.5,.5),n),a=new et(gu([[-4,8.5],[-6,4],[-8,9.5]],6.5,.5),n),o=new tn;o.add(i,s,r,a);let l=new tn;return l.add(o),l}function Kd(n){let e=new It({color:16755268,emissive:16755268,emissiveIntensity:1.4,metalness:.3,roughness:.4,flatShading:!0}),t=P1(e);n.add(t);let i=[0,1,2].map(()=>{let f=t.clone(!0);return f.visible=!1,n.add(f),f}),s=new Li(16747050,0,360,0);n.add(s);let r=Ao(pt.radius+10);n.add(r.mesh);let a=0,o=Yt("#ffb428",3),l=[],c=0,u=null,h=0,d=0,p=[],m=0;function v(f,x,A,y){f.position.set(x-Math.cos(y)*m,A-Math.sin(y)*m,0),f.rotation.z=y,f.children[0].rotation.x=c}function g(f,{alpha:x,frameSeconds:A,now:y,theme:b},T){let{ship:C,world:D}=f,S=f.paused?0:A;b.accent!==u&&(u=b.accent,e.color.set(u),e.emissive.set(u));let M=Math.ceil(C.invulnerable*60),w=C.alive&&!C.jump&&(M===0||Math.floor(M/4)%2===1),B=wt(C.prevX,C.x,x,D.width),U=wt(C.prevY,C.y,x,D.height),k=C.prevAngle+(C.angle-C.prevAngle)*x,H=(C.angle-C.prevAngle)*60/pt.turnRate;c+=(Math.max(-1,Math.min(1,H))*D1-c)*(1-Math.exp(-S*10)),t.visible=w,v(t,B,U,k),vo(B,U,C.radius+8,D.width,D.height,l),i.forEach((re,Me)=>{let Le=(Me+1)*2;re.visible=w&&Le<l.length,re.visible&&v(re,B+l[Le],U+l[Le+1],k)});let O=Math.cos(k),Y=Math.sin(k),G=w&&C.boosting&&f.mode==="playing";h+=((G?1:0)-h)*(1-Math.exp(-S*14)),s.intensity=h*(f.paused?3:2.6+Math.random()*.8),s.position.set(B-O*22,U-Y*22,30);let ee=!C.alive||C.jump?0:C.shieldActive?1.15:C.invulnerable>0?Math.min(1,C.invulnerable/.4):0;a+=(ee-a)*(1-Math.exp(-A*12)),r.mesh.position.set(B,U,0),r.update(a*(.85+Math.sin(y*20)*.15),y);for(let re=p.length-1;re>=0;re--){let Me=p[re];Me.t+=S;let Le=Me.t/.45;if(Le>=1){p.splice(re,1);continue}let q=Me.kind==="out"?46*(1-Le)+4:6+60*Le;T.push(Me.x,Me.y,8,q,1.2,2.2,4,(1-Le)*.9,qe.ring,0,3/q),T.push(Me.x,Me.y,6,26*(1-Le)+6,2,3,4.5,(1-Le)*.8,qe.spark)}if(w&&C.heat>55){let re=(C.heat-55)/45,Me=C.overheated?.6+.4*Math.sin(y*30):1;T.push(B+O*12,U+Y*12,6,5+re*5,3.5,.5,.1,re*.8*Me,qe.spark)}if(d=Math.max(0,d-S/I1),m*=Math.exp(-S*25),!w)return;if(d>0){let re=B+O*21,Me=U+Y*21;T.push(re,Me,4,9*d,Ks[0],Ks[1],Ks[2],d,qe.spark),T.push(re+O*6,Me+Y*6,4,5*d,Ks[0],Ks[1]*.8,Ks[2]*.5,d*.8,qe.spark)}if(G&&!f.paused){let re=.8+Math.sin(f.time*54)*.2,Me=(16+Math.random()*10)*re;for(let Le=0;Le<=6;Le++){let q=Le/6,te=mu[Math.min(mu.length-1,Math.floor(q*(mu.length-1)+.5))],ve=5+Me*q;T.push(B-O*ve,U-Y*ve,0,5.5*(1-q)+2,te[0],te[1],te[2],.9-q*.5,qe.spark)}}let ce=.7+Math.sin(f.time*7.2)*.3;T.push(B+O*4,U+Y*4,6,4.5,o[0],o[1],o[2],ce*.8,qe.spark)}return{update:g,onShoot(){d=1,m=2.5},onHyperspace(f){p.push({x:f.x,y:f.y,t:0,kind:f.type==="hyperspaceOut"?"out":"in"})}}}var Jd=2,U1=new Pe(.18,.17,.16);function jd(n,e){let t=[],i=[],s=Array.from({length:Jd},()=>{let u=new Li(16777215,0,300,0);return n.add(u),{light:u,peak:0,age:1/0}}),r=0;function a(u,h,d,p){let m=s[r++%Jd];m.light.position.set(u,h,60),m.light.color.copy(d),m.peak=p,m.age=0}function o(u){let h=new Pe().setHSL(u.hue,u.sat,u.light),d=u.size>30?10:u.size>15?7:4;for(let m=0;m<d;m++){let v=Math.random()*Math.PI*2,g=60+Math.random()*170,f=.6+Math.random()*.7;t.push({type:u.asteroidType,variant:Math.floor(Math.random()*yo),x:u.x+Math.cos(v)*u.size*.35,y:u.y+Math.sin(v)*u.size*.35,z:0,vx:u.vx*.5+Math.cos(v)*g,vy:u.vy*.5+Math.sin(v)*g,vz:(Math.random()-.25)*220,rotation:new Xt(Math.random()*6.28,Math.random()*6.28,Math.random()*6.28),spin:[(Math.random()-.5)*12,(Math.random()-.5)*12,(Math.random()-.5)*12],scale:u.size*(.13+Math.random()*.16),life:f,maxLife:f,color:h})}let p=h.clone().lerp(U1,.55);for(let m=0;m<3;m++)i.push({x:u.x+(Math.random()-.5)*u.size*.5,y:u.y+(Math.random()-.5)*u.size*.5,vx:u.vx*.3+(Math.random()-.5)*40,vy:u.vy*.3+(Math.random()-.5)*40,from:u.size*.5,to:u.size*(1.6+Math.random()*.6),life:.9,maxLife:.9,color:p});a(u.x,u.y,h,2.5+u.size/10)}function l(u){let h=new Pe(.3,.8,1);a(u.x,u.y,h,9);for(let d=0;d<4;d++)i.push({x:u.x,y:u.y,vx:(Math.random()-.5)*60,vy:(Math.random()-.5)*60,from:10,to:70+Math.random()*40,life:1.1,maxLife:1.1,color:h.clone().multiplyScalar(.4)})}function c(u,{frameSeconds:h,effects:d},p){let m=u.paused||u.hitStop>0?0:h,v=Math.pow(.4,m);for(let g=t.length-1;g>=0;g--){let f=t[g];if(f.life-=m,f.life<=0){t.splice(g,1);continue}f.x+=f.vx*m,f.y+=f.vy*m,f.z+=f.vz*m,f.vx*=v,f.vy*=v,f.vz*=v,f.rotation.x+=f.spin[0]*m,f.rotation.y+=f.spin[1]*m,f.rotation.z+=f.spin[2]*m;let x=f.maxLife-f.life,A=Math.min(1,f.life/(f.maxLife*.35));e.add(f.type,f.variant,f.x,f.y,f.z,f.rotation,f.scale*A,f.color,Math.max(0,1-x/.12)*.7*d.flashScale)}for(let g=i.length-1;g>=0;g--){let f=i[g];if(f.life-=m,f.life<=0){i.splice(g,1);continue}f.x+=f.vx*m,f.y+=f.vy*m;let x=1-f.life/f.maxLife,A=1-(1-x)**3,y=f.from+(f.to-f.from)*A;p.push(f.x,f.y,-15,y,f.color.r,f.color.g,f.color.b,.32*(1-x),qe.glow)}for(let g of s)g.age+=m,g.light.intensity=g.age<1?g.peak*Math.exp(-g.age*12)*(.4+.6*d.flashScale):0}return{onAsteroidDestroyed:o,onShipDestroyed:l,update:c}}var vu={big:{accent:6160288,light:Yt("#7dffb0",3)},small:{accent:16732026,light:Yt("#ff6b8a",3)}},Js=Yt("#ff5a7a",3.5),xu=Yt("#fff0f4",4);function B1(){let n=[[0,-3],[6,-3.2],[14,-1.2],[22,0],[14,1.6],[8,3],[0,3.2]].map(([t,i])=>new K(t/22,i/22)),e=new ja(n,24);return e.rotateX(Math.PI/2),e}function $d(n,e){let t=B1(),i=new Bi(.42,16,8,0,Math.PI*2,0,Math.PI/2).rotateX(Math.PI/2).translate(0,0,.1),s=new It({color:10134708,metalness:.8,roughness:.3}),r={big:new It({color:1127202,emissive:vu.big.accent,emissiveIntensity:1.2,roughness:.1}),small:new It({color:3346712,emissive:vu.small.accent,emissiveIntensity:1.4,roughness:.1})},a=new Map,o=new $a(.55,.75,.9,10).rotateX(Math.PI/2),l=new $i(1.4,.28,.28).translate(.7,0,.2),c=new It({color:3817290,metalness:.7,roughness:.35,emissive:16733472,emissiveIntensity:.25}),u=[],h=Ao(Pt.boss.radius+14);h.mesh.scale.z=.5,h.setColor?.(1.8,.5,.4),n.add(h.mesh);let d=new Xt,p=new Pe;function m(f){let x=a.get(f.id);if(!x){x=new tn;let A=new et(t,s),y=new et(i,r[f.kind]);x.add(A,y),x.scale.setScalar(f.radius),n.add(x),a.set(f.id,x)}return x}function v(f){if(!u[f]){let x=new tn;x.add(new et(o,c),new et(l,c)),x.scale.setScalar(Pt.boss.turretRadius),n.add(x),u[f]=x}return u[f]}function g(f,{alpha:x,now:A,frameSeconds:y},b){let{world:T,ship:C}=f,D=T.width,S=T.height,M=new Set;for(let H of f.enemies){M.add(H.id);let O=m(H),Y=wt(H.prevX,H.x,x,D),G=wt(H.prevY,H.y,x,S);O.position.set(Y,G,10),O.rotation.set(.35+Math.sign(H.vy)*.2,Math.sign(H.vx)*.15,A*2.5);let ee=vu[H.kind].light;for(let ce=0;ce<6;ce++){let re=A*3+ce/6*Math.PI*2,Me=.5+.5*Math.sin(A*12+ce*2);b.push(Y+Math.cos(re)*H.radius*.85,G+Math.sin(re)*H.radius*.45,14,3,ee[0],ee[1],ee[2],.5+Me*.5,qe.spark)}b.push(Y,G,0,H.radius*2.2,ee[0]*.3,ee[1]*.3,ee[2]*.3,.25,qe.glow)}for(let[H,O]of a)M.has(H)||(n.remove(O),a.delete(H));for(let H of f.enemyShots){let O=wt(H.prevX,H.x,x,D),Y=wt(H.prevY,H.y,x,S),G=Math.hypot(H.vx,H.vy)||1;for(let ee=1;ee<=4;ee++)b.push(O-H.vx/G*ee*4,Y-H.vy/G*ee*4,2,4-ee*.6,Js[0],Js[1],Js[2],.5-ee*.1,qe.spark);b.push(O,Y,3,6,xu[0],xu[1],xu[2],1,qe.spark),b.push(O,Y,0,14,Js[0]*.4,Js[1]*.4,Js[2]*.4,.35,qe.glow)}let w=f.boss;if(u.forEach(H=>{H.visible=!1}),!w){h.update(0,A);return}let B=wt(w.prevX,w.x,x,D),U=wt(w.prevY,w.y,x,S);d.set(.5,.25,w.angle),p.setHSL(w.hue,w.sat,w.light*(.7+.3*(w.hp/w.maxHp)));let k=1-w.hp/w.maxHp;e.add(w.type,0,B,U,-10,d,w.radius,p,Math.max(0,Math.sin(A*9)*k*.25)),b.push(B,U,-40,w.radius*1.4,w.rgb[0]/255,w.rgb[1]/255,w.rgb[2]/255,.1+k*.15,qe.glow),w.turrets.forEach((H,O)=>{if(!H.alive)return;let Y=Yr({...w,x:B,y:U},H),G=v(O);G.visible=!0,G.position.set(Y.x,Y.y,18),G.rotation.set(0,0,Math.atan2(C.y-Y.y,C.x-Y.x));let ee=Math.max(0,1-H.cooldown/.4);b.push(Y.x,Y.y,26,6+ee*6,3,1.2,.4,.3+ee*.7,qe.spark)}),h.mesh.position.set(B,U,0),h.update(w.shieldTimer>0?.9+Math.sin(A*14)*.1:0,A)}return{update:g}}function ep(n){let e=new io(7,0),t={},i={};for(let[a,o]of Object.entries(on))t[a]=new It({color:o.color,emissive:o.color,emissiveIntensity:1.6,roughness:.2,metalness:.3,flatShading:!0}),i[a]=Yt(o.color,2.5);let s=new Map;function r(a,{alpha:o,now:l},c){let{world:u}=a,h=new Set;for(let d of a.pickups){h.add(d.id);let p=s.get(d.id);p||(p=new et(e,t[d.kind]),n.add(p),s.set(d.id,p));let m=wt(d.prevX,d.x,o,u.width),v=wt(d.prevY,d.y,o,u.height),g=d.life>3||Math.floor(l*8)%2===0;if(p.visible=g,p.position.set(m,v,20+Math.sin(l*3+d.id)*3),p.rotation.set(l*1.3,l*2.1,0),!g)continue;let f=i[d.kind],x=(l*1.2+d.id*.37)%1;c.push(m,v,10,12+x*14,f[0],f[1],f[2],.6*(1-x),qe.ring,0,1.5/(12+x*14)),c.push(m,v,5,22,f[0]*.4,f[1]*.4,f[2]*.4,.35,qe.glow)}for(let[d,p]of s)h.has(d)||(n.remove(p),s.delete(d))}return{update:r}}var yu=1/1e3,L1=1e3,N1=class{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}get autoReset(){return this._autoReset}set autoReset(n){typeof document<"u"&&document.hidden!==void 0&&(n?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=n)}get delta(){return this._delta*yu}get fixedDelta(){return this._fixedDelta*yu}set fixedDelta(n){this._fixedDelta=n*L1}get elapsed(){return this._elapsed*yu}update(n){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(n!==void 0?n: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(n){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},F1=(()=>{let n=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]),t=new Nt;return t.setAttribute("position",new mt(n,3)),t.setAttribute("uv",new mt(e,2)),t})(),An=class Su{static get fullscreenGeometry(){return F1}constructor(e="Pass",t=new ai,i=new Ui){this.name=e,this.renderer=null,this.scene=t,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){let t=this.fullscreenMaterial;t!==null&&(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 this.screen!==null?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;t!==null?t.material=e:(t=new et(Su.fullscreenGeometry,e),t.frustumCulled=!1,this.scene===null&&(this.scene=new ai),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=ci){}render(e,t,i,s,r){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,i){}dispose(){for(let e of Object.keys(this)){let t=this[e];(t instanceof at||t instanceof xn||t instanceof Ft||t instanceof Su)&&this[e].dispose()}this.fullscreenMaterial!==null&&this.fullscreenMaterial.dispose()}},O1=class extends An{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(n,e,t,i,s){let r=n.state.buffers.stencil;r.setLocked(!1),r.setTest(!1)}},k1=`#include <common>
#include <dithering_pars_fragment>
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;
#include <colorspace_fragment>
#include <dithering_fragment>
}`,_u="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",sp=class extends Je{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new De(null),opacity:new De(1)},blending:_t,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:k1,vertexShader:_u})}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}getOpacity(n){return this.uniforms.opacity.value}setOpacity(n){this.uniforms.opacity.value=n}},rp=class extends An{constructor(n,e=!0){super("CopyPass"),this.fullscreenMaterial=new sp,this.needsSwap=!1,this.renderTarget=n,n===void 0&&(this.renderTarget=new at(1,1,{minFilter:Vt,magFilter:Vt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(n){this.autoResize=n}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(n){this.autoResize=n}render(n,e,t,i,s){this.fullscreenMaterial.inputBuffer=e.texture,n.setRenderTarget(this.renderToScreen?null:this.renderTarget),n.render(this.scene,this.camera)}setSize(n,e){this.autoResize&&this.renderTarget.setSize(n,e)}initialize(n,e,t){t!==void 0&&(this.renderTarget.texture.type=t,t!==bt?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":n!==null&&n.outputColorSpace===$e&&(this.renderTarget.texture.colorSpace=$e))}},tp=new Pe,ap=class extends An{constructor(n=!0,e=!0,t=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=n,this.depth=e,this.stencil=t,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(n,e,t){this.color=n,this.depth=e,this.stencil=t}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(n){this.overrideClearColor=n}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(n){this.overrideClearAlpha=n}render(n,e,t,i,s){let r=this.overrideClearColor,a=this.overrideClearAlpha,o=n.getClearAlpha(),l=r!==null,c=a>=0;l?(n.getClearColor(tp),n.setClearColor(r,c?a:o)):c&&n.setClearAlpha(a),n.setRenderTarget(this.renderToScreen?null:e),n.clear(this.color,this.depth,this.stencil),l?n.setClearColor(tp,o):c&&n.setClearAlpha(o)}},z1=class extends An{constructor(n,e){super("MaskPass",n,e),this.needsSwap=!1,this.clearPass=new ap(!1,!1,!0),this.inverse=!1}set mainScene(n){this.scene=n}set mainCamera(n){this.camera=n}get inverted(){return this.inverse}set inverted(n){this.inverse=n}get clear(){return this.clearPass.enabled}set clear(n){this.clearPass.enabled=n}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(n){this.inverted=n}render(n,e,t,i,s){let r=n.getContext(),a=n.state.buffers,o=this.scene,l=this.camera,c=this.clearPass,u=this.inverted?0:1,h=1-u;a.color.setMask(!1),a.depth.setMask(!1),a.color.setLocked(!0),a.depth.setLocked(!0),a.stencil.setTest(!0),a.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),a.stencil.setFunc(r.ALWAYS,u,4294967295),a.stencil.setClear(h),a.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(n,null):(c.render(n,e),c.render(n,t))),this.renderToScreen?(n.setRenderTarget(null),n.render(o,l)):(n.setRenderTarget(e),n.render(o,l),n.setRenderTarget(t),n.render(o,l)),a.color.setLocked(!1),a.depth.setLocked(!1),a.stencil.setLocked(!1),a.stencil.setFunc(r.EQUAL,1,4294967295),a.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),a.stencil.setLocked(!0)}},op=class{constructor(n=null,{depthBuffer:e=!0,stencilBuffer:t=!1,multisampling:i=0,frameBufferType:s}={}){this.renderer=null,this.inputBuffer=this.createBuffer(e,t,s,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new rp,this.depthTexture=null,this.passes=[],this.timer=new N1,this.autoRenderToScreen=!0,this.setRenderer(n)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(n){let e=this.inputBuffer,t=this.multisampling;t>0&&n>0?(this.inputBuffer.samples=n,this.outputBuffer.samples=n,this.inputBuffer.dispose(),this.outputBuffer.dispose()):t!==n&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,n),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(n){if(this.renderer=n,n!==null){let e=n.getSize(new K),t=n.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;i===bt&&n.outputColorSpace===$e&&(this.inputBuffer.texture.colorSpace=$e,this.outputBuffer.texture.colorSpace=$e,this.inputBuffer.dispose(),this.outputBuffer.dispose()),n.autoClear=!1,this.setSize(e.width,e.height);for(let s of this.passes)s.initialize(n,t,i)}}replaceRenderer(n,e=!0){let t=this.renderer,i=t.domElement.parentNode;return this.setRenderer(n),e&&i!==null&&(i.removeChild(t.domElement),i.appendChild(n.domElement)),t}createDepthTexture(){let n=this.depthTexture=new Vs;return this.inputBuffer.depthTexture=n,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(n.format=Ii,n.type=Di):n.type=si,n}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(let n of this.passes)n.setDepthTexture(null)}}createBuffer(n,e,t,i){let s=this.renderer,r=s===null?new K:s.getDrawingBufferSize(new K),a={minFilter:Vt,magFilter:Vt,stencilBuffer:e,depthBuffer:n,type:t},o=new at(r.width,r.height,a);return i>0&&(o.ignoreDepthForMultisampleCopy=!1,o.samples=i),t===bt&&s!==null&&s.outputColorSpace===$e&&(o.texture.colorSpace=$e),o.texture.name="EffectComposer.Buffer",o.texture.generateMipmaps=!1,o}setMainScene(n){for(let e of this.passes)e.mainScene=n}setMainCamera(n){for(let e of this.passes)e.mainCamera=n}addPass(n,e){let t=this.passes,i=this.renderer,s=i.getDrawingBufferSize(new K),r=i.getContext().getContextAttributes().alpha,a=this.inputBuffer.texture.type;if(n.setRenderer(i),n.setSize(s.width,s.height),n.initialize(i,r,a),this.autoRenderToScreen&&(t.length>0&&(t[t.length-1].renderToScreen=!1),n.renderToScreen&&(this.autoRenderToScreen=!1)),e!==void 0?t.splice(e,0,n):t.push(n),this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!0),n.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){let o=this.createDepthTexture();for(n of t)n.setDepthTexture(o)}else n.setDepthTexture(this.depthTexture)}removePass(n){let e=this.passes,t=e.indexOf(n);if(t!==-1&&e.splice(t,1).length>0){if(this.depthTexture!==null){let r=(o,l)=>o||l.needsDepthTexture;e.reduce(r,!1)||(n.getDepthTexture()===this.depthTexture&&n.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&t===e.length&&(n.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){let n=this.passes;this.deleteDepthTexture(),n.length>0&&(this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!1),this.passes=[])}render(n){let e=this.renderer,t=this.copyPass,i=this.inputBuffer,s=this.outputBuffer,r=!1,a,o,l;n===void 0&&(this.timer.update(),n=this.timer.getDelta());for(let c of this.passes)c.enabled&&(c.render(e,i,s,n,r),c.needsSwap&&(r&&(t.renderToScreen=c.renderToScreen,a=e.getContext(),o=e.state.buffers.stencil,o.setFunc(a.NOTEQUAL,1,4294967295),t.render(e,i,s,n,r),o.setFunc(a.EQUAL,1,4294967295)),l=i,i=s,s=l),c instanceof z1?r=!0:c instanceof O1&&(r=!1))}setSize(n,e,t){let i=this.renderer,s=i.getSize(new K);(n===void 0||e===void 0)&&(n=s.width,e=s.height),(s.width!==n||s.height!==e)&&i.setSize(n,e,t);let r=i.getDrawingBufferSize(new K);this.inputBuffer.setSize(r.width,r.height),this.outputBuffer.setSize(r.width,r.height);for(let a of this.passes)a.setSize(r.width,r.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(let n of this.passes)n.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),An.fullscreenGeometry.dispose()}},ui={NONE:0,DEPTH:1,CONVOLUTION:2},st={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"},H1=class{constructor(){this.shaderParts=new Map([[st.FRAGMENT_HEAD,null],[st.FRAGMENT_MAIN_UV,null],[st.FRAGMENT_MAIN_IMAGE,null],[st.VERTEX_HEAD,null],[st.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=ui.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=Hn}};var Au=!1,np=class{constructor(n=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(n),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case Lt:t=this.materialsFlatShadedDoubleSide;break;case Ct:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded;break}else switch(e.material.side){case Lt:t=this.materialsDoubleSide;break;case Ct:t=this.materialsBackSide;break;default:t=this.materials;break}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(n){if(!(n instanceof Je))return n.clone();let e=n.uniforms,t=new Map;for(let s in e){let r=e[s].value;r.isRenderTargetTexture&&(e[s].value=null,t.set(s,r))}let i=n.clone();for(let s of t)e[s[0]].value=s[1],i.uniforms[s[0]].value=s[1];return i}setMaterial(n){if(this.disposeMaterials(),this.material=n,n!==null){let e=this.materials=[this.cloneMaterial(n),this.cloneMaterial(n),this.cloneMaterial(n)];for(let t of e)t.uniforms=Object.assign({},n.uniforms),t.side=On;e[2].skinning=!0,this.materialsBackSide=e.map(t=>{let i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.side=Ct,i}),this.materialsDoubleSide=e.map(t=>{let i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.side=Lt,i}),this.materialsFlatShaded=e.map(t=>{let i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=e.map(t=>{let i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i.side=Ct,i}),this.materialsFlatShadedDoubleSide=e.map(t=>{let i=this.cloneMaterial(t);return i.uniforms=Object.assign({},n.uniforms),i.flatShading=!0,i.side=Lt,i})}}render(n,e,t){let i=n.shadowMap.enabled;if(n.shadowMap.enabled=!1,Au){let s=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),n.render(e,t);for(let r of s)r[0].material=r[1];this.meshCount!==s.size&&s.clear()}else{let s=e.overrideMaterial;e.overrideMaterial=this.material,n.render(e,t),e.overrideMaterial=s}n.shadowMap.enabled=i}disposeMaterials(){if(this.material!==null){let n=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(let e of n)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return Au}static set workaroundEnabled(n){Au=n}};var Oi=-1,Gn=class extends nn{constructor(n,e=Oi,t=Oi,i=1){super(),this.resizable=n,this.baseSize=new K(1,1),this.preferredSize=new K(e,t),this.target=this.preferredSize,this.s=i,this.effectiveSize=new K,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){let n=this.baseSize,e=this.preferredSize,t=this.effectiveSize,i=this.scale;e.width!==Oi?t.width=e.width:e.height!==Oi?t.width=Math.round(e.height*(n.width/Math.max(n.height,1))):t.width=Math.round(n.width*i),e.height!==Oi?t.height=e.height:e.width!==Oi?t.height=Math.round(e.width/Math.max(n.width/Math.max(n.height,1),1)):t.height=Math.round(n.height*i)}get width(){return this.effectiveSize.width}set width(n){this.preferredWidth=n}get height(){return this.effectiveSize.height}set height(n){this.preferredHeight=n}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(n){this.s!==n&&(this.s=n,this.preferredSize.setScalar(Oi),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(n){this.scale=n}get baseWidth(){return this.baseSize.width}set baseWidth(n){this.baseSize.width!==n&&(this.baseSize.width=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(n){this.baseWidth=n}get baseHeight(){return this.baseSize.height}set baseHeight(n){this.baseSize.height!==n&&(this.baseSize.height=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(n){this.baseHeight=n}setBaseSize(n,e){(this.baseSize.width!==n||this.baseSize.height!==e)&&(this.baseSize.set(n,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(n){this.preferredSize.width!==n&&(this.preferredSize.width=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(n){this.preferredWidth=n}get preferredHeight(){return this.preferredSize.height}set preferredHeight(n){this.preferredSize.height!==n&&(this.preferredSize.height=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(n){this.preferredHeight=n}setPreferredSize(n,e){(this.preferredSize.width!==n||this.preferredSize.height!==e)&&(this.preferredSize.set(n,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(n){this.s=n.scale,this.baseSize.set(n.baseWidth,n.baseHeight),this.preferredSize.set(n.preferredWidth,n.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return Oi}};var Xe={SKIP:9,SET:30,ADD:0,ALPHA:1,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},G1="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(x.rgb+y.rgb,y.a),opacity);}",V1="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,y.a*opacity);}",W1="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),opacity);}",X1="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),opacity);}",Y1="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),opacity);}",q1="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),opacity);}",Q1="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),opacity);}",Z1="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),opacity);}",K1="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),opacity);}",J1="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),opacity);}",j1="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),opacity);}",$1="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),opacity);}",eM="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),opacity);}",tM="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(1.0-y.rgb,y.a),opacity);}",nM="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),opacity);}",iM="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),opacity);}",sM="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),opacity);}",rM="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),opacity);}",aM="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),opacity);}",oM="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),opacity);}",lM="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,vec4(x.rgb*y.rgb,y.a),opacity);}",cM="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),opacity);}",uM="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}",hM="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),opacity);}",fM="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),opacity);}",dM="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),opacity);}",pM="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),opacity);}",mM="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),opacity);}",gM="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),opacity);}",vM="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}",xM="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),opacity);}",yM="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),opacity);}",AM=new Map([[Xe.ADD,G1],[Xe.ALPHA,V1],[Xe.AVERAGE,W1],[Xe.COLOR,X1],[Xe.COLOR_BURN,Y1],[Xe.COLOR_DODGE,q1],[Xe.DARKEN,Q1],[Xe.DIFFERENCE,Z1],[Xe.DIVIDE,K1],[Xe.DST,null],[Xe.EXCLUSION,J1],[Xe.HARD_LIGHT,j1],[Xe.HARD_MIX,$1],[Xe.HUE,eM],[Xe.INVERT,tM],[Xe.INVERT_RGB,nM],[Xe.LIGHTEN,iM],[Xe.LINEAR_BURN,sM],[Xe.LINEAR_DODGE,rM],[Xe.LINEAR_LIGHT,aM],[Xe.LUMINOSITY,oM],[Xe.MULTIPLY,lM],[Xe.NEGATION,cM],[Xe.NORMAL,uM],[Xe.OVERLAY,hM],[Xe.PIN_LIGHT,fM],[Xe.REFLECT,dM],[Xe.SATURATION,pM],[Xe.SCREEN,mM],[Xe.SOFT_LIGHT,gM],[Xe.SRC,vM],[Xe.SUBTRACT,xM],[Xe.VIVID_LIGHT,yM]]),MM=class extends nn{constructor(n,e=1){super(),this._blendFunction=n,this.opacity=new De(e)}getOpacity(){return this.opacity.value}setOpacity(n){this.opacity.value=n}get blendFunction(){return this._blendFunction}set blendFunction(n){this._blendFunction=n,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(n){this.blendFunction=n}getShaderCode(){return AM.get(this.blendFunction)}};var $s=class extends nn{constructor(n,e,{attributes:t=ui.NONE,blendFunction:i=Xe.NORMAL,defines:s=new Map,uniforms:r=new Map,extensions:a=null,vertexShader:o=null}={}){super(),this.name=n,this.renderer=null,this.attributes=t,this.fragmentShader=e,this.vertexShader=o,this.defines=s,this.uniforms=r,this.extensions=a,this.blendMode=new MM(i),this.blendMode.addEventListener("change",l=>this.setChanged()),this._inputColorSpace=Hn,this._outputColorSpace=vn}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(n){this._inputColorSpace=n,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(n){this._outputColorSpace=n,this.setChanged()}set mainScene(n){}set mainCamera(n){}getName(){return this.name}setRenderer(n){this.renderer=n}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(n){this.attributes=n,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(n){this.fragmentShader=n,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(n){this.vertexShader=n,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(n,e=ci){}update(n,e,t){}setSize(n,e){}initialize(n,e,t){}dispose(){for(let n of Object.keys(this)){let e=this[n];(e instanceof at||e instanceof xn||e instanceof Ft||e instanceof An)&&this[n].dispose()}}};var bu={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},SM=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
varying 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;
#include <colorspace_fragment>
}`,_M="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);}",bM=[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])],EM=class extends Je{constructor(n=new Ke){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new De(null),texelSize:new De(new Ke),scale:new De(1),kernel:new De(0)},blending:_t,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:SM,vertexShader:_M}),this.setTexelSize(n.x,n.y),this.kernelSize=bu.MEDIUM}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.inputBuffer=n}get kernelSequence(){return bM[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(n){this.uniforms.scale.value=n}getScale(){return this.uniforms.scale.value}setScale(n){this.uniforms.scale.value=n}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(n){this.uniforms.kernel.value=n}setKernel(n){this.kernel=n}setTexelSize(n,e){this.uniforms.texelSize.value.set(n,e,n*.5,e*.5)}setSize(n,e){let t=1/n,i=1/e;this.uniforms.texelSize.value.set(t,i,t*.5,i*.5)}},wM=class extends An{constructor({kernelSize:n=bu.MEDIUM,resolutionScale:e=.5,width:t=Gn.AUTO_SIZE,height:i=Gn.AUTO_SIZE,resolutionX:s=t,resolutionY:r=i}={}){super("KawaseBlurPass"),this.renderTargetA=new at(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";let a=this.resolution=new Gn(this,s,r,e);a.addEventListener("change",o=>this.setSize(a.baseWidth,a.baseHeight)),this._blurMaterial=new EM,this._blurMaterial.kernelSize=n,this.copyMaterial=new sp}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(n){this._blurMaterial=n}get dithering(){return this.copyMaterial.dithering}set dithering(n){this.copyMaterial.dithering=n}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(n){this.blurMaterial.kernelSize=n}get width(){return this.resolution.width}set width(n){this.resolution.preferredWidth=n}get height(){return this.resolution.height}set height(n){this.resolution.preferredHeight=n}get scale(){return this.blurMaterial.scale}set scale(n){this.blurMaterial.scale=n}getScale(){return this.blurMaterial.scale}setScale(n){this.blurMaterial.scale=n}getKernelSize(){return this.kernelSize}setKernelSize(n){this.kernelSize=n}getResolutionScale(){return this.resolution.scale}setResolutionScale(n){this.resolution.scale=n}render(n,e,t,i,s){let r=this.scene,a=this.camera,o=this.renderTargetA,l=this.renderTargetB,c=this.blurMaterial,u=c.kernelSequence,h=e;this.fullscreenMaterial=c;for(let d=0,p=u.length;d<p;++d){let m=(d&1)===0?o:l;c.kernel=u[d],c.inputBuffer=h.texture,n.setRenderTarget(m),n.render(r,a),h=m}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=h.texture,n.setRenderTarget(this.renderToScreen?null:t),n.render(r,a)}setSize(n,e){let t=this.resolution;t.setBaseSize(n,e);let i=t.width,s=t.height;this.renderTargetA.setSize(i,s),this.renderTargetB.setSize(i,s),this.blurMaterial.setSize(n,e)}initialize(n,e,t){t!==void 0&&(this.renderTargetA.texture.type=t,this.renderTargetB.texture.type=t,t!==bt?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):n!==null&&n.outputColorSpace===$e&&(this.renderTargetA.texture.colorSpace=$e,this.renderTargetB.texture.colorSpace=$e))}static get AUTO_SIZE(){return Gn.AUTO_SIZE}},TM=`#include <common>
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#ifdef RANGE
uniform vec2 range;
#elif defined(THRESHOLD)
uniform float threshold;uniform float smoothing;
#endif
varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);float mask=1.0;
#ifdef RANGE
float low=step(range.x,l);float high=step(l,range.y);mask=low*high;
#elif defined(THRESHOLD)
mask=smoothstep(threshold,threshold+smoothing,l);
#endif
#ifdef COLOR
gl_FragColor=texel*mask;
#else
gl_FragColor=vec4(l*mask);
#endif
}`,CM=class extends Je{constructor(n=!1,e=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:"170".replace(/\D+/g,"")},uniforms:{inputBuffer:new De(null),threshold:new De(0),smoothing:new De(1),range:new De(null)},blending:_t,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:TM,vertexShader:_u}),this.colorOutput=n,this.luminanceRange=e}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}get threshold(){return this.uniforms.threshold.value}set threshold(n){this.smoothing>0||n>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=n}getThreshold(){return this.threshold}setThreshold(n){this.threshold=n}get smoothing(){return this.uniforms.smoothing.value}set smoothing(n){this.threshold>0||n>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=n}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(n){this.smoothing=n}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(n){}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(n){n?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(n){return this.colorOutput}setColorOutputEnabled(n){this.colorOutput=n}get useRange(){return this.luminanceRange!==null}set useRange(n){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(n){n!==null?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=n,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(n){this.luminanceRange=n}},lp=class extends An{constructor({renderTarget:n,luminanceRange:e,colorOutput:t,resolutionScale:i=1,width:s=Gn.AUTO_SIZE,height:r=Gn.AUTO_SIZE,resolutionX:a=s,resolutionY:o=r}={}){super("LuminancePass"),this.fullscreenMaterial=new CM(t,e),this.needsSwap=!1,this.renderTarget=n,this.renderTarget===void 0&&(this.renderTarget=new at(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");let l=this.resolution=new Gn(this,a,o,i);l.addEventListener("change",c=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(n,e,t,i,s){let r=this.fullscreenMaterial;r.inputBuffer=e.texture,n.setRenderTarget(this.renderToScreen?null:this.renderTarget),n.render(this.scene,this.camera)}setSize(n,e){let t=this.resolution;t.setBaseSize(n,e),this.renderTarget.setSize(t.width,t.height)}initialize(n,e,t){t!==void 0&&t!==bt&&(this.renderTarget.texture.type=t,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},RM=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#define WEIGHT_INNER 0.125
#define WEIGHT_OUTER 0.0555555
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;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;
#include <colorspace_fragment>
}`,DM="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);}",IM=class extends Je{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new De(null),texelSize:new De(new K)},blending:_t,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:RM,vertexShader:DM})}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setSize(n,e){this.uniforms.texelSize.value.set(1/n,1/e)}},PM=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;
#else
uniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;
#endif
uniform 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);
#include <colorspace_fragment>
}`,UM="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);}",BM=class extends Je{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new De(null),supportBuffer:new De(null),texelSize:new De(new K),radius:new De(.85)},blending:_t,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:PM,vertexShader:UM})}set inputBuffer(n){this.uniforms.inputBuffer.value=n}set supportBuffer(n){this.uniforms.supportBuffer.value=n}get radius(){return this.uniforms.radius.value}set radius(n){this.uniforms.radius.value=n}setSize(n,e){this.uniforms.texelSize.value.set(1/n,1/e)}},LM=class extends An{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new at(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new IM,this.upsamplingMaterial=new BM,this.resolution=new K}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(n){if(this.levels!==n){let e=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let t=0;t<n;++t){let i=e.clone();i.texture.name="Downsampling.Mipmap"+t,this.downsamplingMipmaps.push(i)}this.upsamplingMipmaps.push(e);for(let t=1,i=n-1;t<i;++t){let s=e.clone();s.texture.name="Upsampling.Mipmap"+t,this.upsamplingMipmaps.push(s)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(n){this.upsamplingMaterial.radius=n}render(n,e,t,i,s){let{scene:r,camera:a}=this,{downsamplingMaterial:o,upsamplingMaterial:l}=this,{downsamplingMipmaps:c,upsamplingMipmaps:u}=this,h=e;this.fullscreenMaterial=o;for(let d=0,p=c.length;d<p;++d){let m=c[d];o.setSize(h.width,h.height),o.inputBuffer=h.texture,n.setRenderTarget(m),n.render(r,a),h=m}this.fullscreenMaterial=l;for(let d=u.length-1;d>=0;--d){let p=u[d];l.setSize(h.width,h.height),l.inputBuffer=h.texture,l.supportBuffer=c[d].texture,n.setRenderTarget(p),n.render(r,a),h=p}}setSize(n,e){let t=this.resolution;t.set(n,e);let i=t.width,s=t.height;for(let r=0,a=this.downsamplingMipmaps.length;r<a;++r)i=Math.round(i*.5),s=Math.round(s*.5),this.downsamplingMipmaps[r].setSize(i,s),r<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[r].setSize(i,s)}initialize(n,e,t){if(t!==void 0){let i=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(let s of i)s.texture.type=t;if(t!==bt)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(n!==null&&n.outputColorSpace===$e)for(let s of i)s.texture.colorSpace=$e}}dispose(){super.dispose();for(let n of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))n.dispose()}},NM=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D map;
#else
uniform lowp sampler2D map;
#endif
uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 texel=texture2D(map,uv);outputColor=vec4(texel.rgb*intensity,max(inputColor.a,texel.a));}`,cp=class extends $s{constructor({blendFunction:n=Xe.SCREEN,luminanceThreshold:e=1,luminanceSmoothing:t=.03,mipmapBlur:i=!0,intensity:s=1,radius:r=.85,levels:a=8,kernelSize:o=bu.LARGE,resolutionScale:l=.5,width:c=Gn.AUTO_SIZE,height:u=Gn.AUTO_SIZE,resolutionX:h=c,resolutionY:d=u}={}){super("BloomEffect",NM,{blendFunction:n,uniforms:new Map([["map",new De(null)],["intensity",new De(s)]])}),this.renderTarget=new at(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new wM({kernelSize:o}),this.luminancePass=new lp({colorOutput:!0}),this.luminanceMaterial.threshold=e,this.luminanceMaterial.smoothing=t,this.mipmapBlurPass=new LM,this.mipmapBlurPass.enabled=i,this.mipmapBlurPass.radius=r,this.mipmapBlurPass.levels=a,this.uniforms.get("map").value=i?this.mipmapBlurPass.texture:this.renderTarget.texture;let p=this.resolution=new Gn(this,h,d,l);p.addEventListener("change",m=>this.setSize(p.baseWidth,p.baseHeight))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(n){this.resolution.preferredWidth=n}get height(){return this.resolution.height}set height(n){this.resolution.preferredHeight=n}get dithering(){return this.blurPass.dithering}set dithering(n){this.blurPass.dithering=n}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(n){this.blurPass.kernelSize=n}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(n){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(n){this.uniforms.get("intensity").value=n}getIntensity(){return this.intensity}setIntensity(n){this.intensity=n}getResolutionScale(){return this.resolution.scale}setResolutionScale(n){this.resolution.scale=n}update(n,e,t){let i=this.renderTarget,s=this.luminancePass;s.enabled?(s.render(n,e),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(n,s.renderTarget):this.blurPass.render(n,s.renderTarget,i)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(n,e):this.blurPass.render(n,e,i)}setSize(n,e){let t=this.resolution;t.setBaseSize(n,e),this.renderTarget.setSize(t.width,t.height),this.blurPass.resolution.copy(t),this.luminancePass.setSize(n,e),this.mipmapBlurPass.setSize(n,e)}initialize(n,e,t){this.blurPass.initialize(n,e,t),this.luminancePass.initialize(n,e,t),this.mipmapBlurPass.initialize(n,e,t),t!==void 0&&(this.renderTarget.texture.type=t,n!==null&&n.outputColorSpace===$e&&(this.renderTarget.texture.colorSpace=$e))}};var up=class extends An{constructor(n,e,t=null){super("RenderPass",n,e),this.needsSwap=!1,this.clearPass=new ap,this.overrideMaterialManager=t===null?null:new np(t),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(n){this.scene=n}set mainCamera(n){this.camera=n}get renderToScreen(){return super.renderToScreen}set renderToScreen(n){super.renderToScreen=n,this.clearPass.renderToScreen=n}get overrideMaterial(){let n=this.overrideMaterialManager;return n!==null?n.material:null}set overrideMaterial(n){let e=this.overrideMaterialManager;n!==null?e!==null?e.setMaterial(n):this.overrideMaterialManager=new np(n):e!==null&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(n){this.overrideMaterial=n}get clear(){return this.clearPass.enabled}set clear(n){this.clearPass.enabled=n}getSelection(){return this.selection}setSelection(n){this.selection=n}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(n){this.ignoreBackground=n}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(n){this.skipShadowMapUpdate=n}getClearPass(){return this.clearPass}render(n,e,t,i,s){let r=this.scene,a=this.camera,o=this.selection,l=a.layers.mask,c=r.background,u=n.shadowMap.autoUpdate,h=this.renderToScreen?null:e;o!==null&&a.layers.set(o.getLayer()),this.skipShadowMapUpdate&&(n.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(r.background=null),this.clearPass.enabled&&this.clearPass.render(n,e),n.setRenderTarget(h),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(n,r,a):n.render(r,a),a.layers.mask=l,r.background=c,n.shadowMap.autoUpdate=u}};var Jt={LINEAR:0,REINHARD:1,REINHARD2:2,REINHARD2_ADAPTIVE:3,UNCHARTED2:4,OPTIMIZED_CINEON:5,CINEON:5,ACES_FILMIC:6,AGX:7,NEUTRAL:8},Nr={DEFAULT:0,ESKIL:1};var FM=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*(1.0+time)));
#ifdef PREMULTIPLY
outputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a);
#else
outputColor=vec4(noise,inputColor.a);
#endif
}`,hp=class extends $s{constructor({blendFunction:n=Xe.SCREEN,premultiply:e=!1}={}){super("NoiseEffect",FM,{blendFunction:n}),this.premultiply=e}get premultiply(){return this.defines.has("PREMULTIPLY")}set premultiply(n){this.premultiply!==n&&(n?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}isPremultiplied(){return this.premultiply}setPremultiplied(n){this.premultiply=n}};var OE=Math.PI*.5;var OM=`#include <packing>
#define packFloatToRGBA(v) packDepthToRGBA(v)
#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)
uniform 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));
#if __VERSION__ < 300
float l1=texture2DLodEXT(luminanceBuffer1,vUv,MIP_LEVEL_1X1).r;
#else
float l1=textureLod(luminanceBuffer1,vUv,MIP_LEVEL_1X1).r;
#endif
l0=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);}`,kM=class extends Je{constructor(){super({name:"AdaptiveLuminanceMaterial",defines:{MIP_LEVEL_1X1:"0.0"},uniforms:{luminanceBuffer0:new De(null),luminanceBuffer1:new De(null),minLuminance:new De(.01),deltaTime:new De(0),tau:new De(1)},extensions:{shaderTextureLOD:!0},blending:_t,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:OM,vertexShader:_u})}set luminanceBuffer0(n){this.uniforms.luminanceBuffer0.value=n}setLuminanceBuffer0(n){this.uniforms.luminanceBuffer0.value=n}set luminanceBuffer1(n){this.uniforms.luminanceBuffer1.value=n}setLuminanceBuffer1(n){this.uniforms.luminanceBuffer1.value=n}set mipLevel1x1(n){this.defines.MIP_LEVEL_1X1=n.toFixed(1),this.needsUpdate=!0}setMipLevel1x1(n){this.mipLevel1x1=n}set deltaTime(n){this.uniforms.deltaTime.value=n}setDeltaTime(n){this.uniforms.deltaTime.value=n}get minLuminance(){return this.uniforms.minLuminance.value}set minLuminance(n){this.uniforms.minLuminance.value=n}getMinLuminance(){return this.uniforms.minLuminance.value}setMinLuminance(n){this.uniforms.minLuminance.value=n}get adaptationRate(){return this.uniforms.tau.value}set adaptationRate(n){this.uniforms.tau.value=n}getAdaptationRate(){return this.uniforms.tau.value}setAdaptationRate(n){this.uniforms.tau.value=n}},zM=class extends An{constructor(n,{minLuminance:e=.01,adaptationRate:t=1}={}){super("AdaptiveLuminancePass"),this.fullscreenMaterial=new kM,this.needsSwap=!1,this.renderTargetPrevious=new at(1,1,{minFilter:Wt,magFilter:Wt,depthBuffer:!1}),this.renderTargetPrevious.texture.name="Luminance.Previous";let i=this.fullscreenMaterial;i.luminanceBuffer0=this.renderTargetPrevious.texture,i.luminanceBuffer1=n,i.minLuminance=e,i.adaptationRate=t,this.renderTargetAdapted=this.renderTargetPrevious.clone(),this.renderTargetAdapted.texture.name="Luminance.Adapted",this.copyPass=new rp(this.renderTargetPrevious,!1)}get texture(){return this.renderTargetAdapted.texture}getTexture(){return this.renderTargetAdapted.texture}set mipLevel1x1(n){this.fullscreenMaterial.mipLevel1x1=n}get adaptationRate(){return this.fullscreenMaterial.adaptationRate}set adaptationRate(n){this.fullscreenMaterial.adaptationRate=n}render(n,e,t,i,s){this.fullscreenMaterial.deltaTime=i,n.setRenderTarget(this.renderToScreen?null:this.renderTargetAdapted),n.render(this.scene,this.camera),this.copyPass.render(n,this.renderTargetAdapted)}},HM=`#include <tonemapping_pars_fragment>
uniform float whitePoint;
#if TONE_MAPPING_MODE == 2 || TONE_MAPPING_MODE == 3
uniform float middleGrey;
#if TONE_MAPPING_MODE == 3
uniform lowp sampler2D luminanceBuffer;
#else
uniform float averageLuminance;
#endif
vec3 Reinhard2ToneMapping(vec3 color){color*=toneMappingExposure;float l=luminance(color);
#if TONE_MAPPING_MODE == 3
float lumAvg=unpackRGBAToFloat(texture2D(luminanceBuffer,vec2(0.5)));
#else
float lumAvg=averageLuminance;
#endif
float lumScaled=(l*middleGrey)/max(lumAvg,1e-6);float lumCompressed=lumScaled*(1.0+lumScaled/(whitePoint*whitePoint));lumCompressed/=(1.0+lumScaled);return clamp(lumCompressed*color,0.0,1.0);}
#elif TONE_MAPPING_MODE == 4
#define A 0.15
#define B 0.50
#define C 0.10
#define D 0.20
#define E 0.02
#define F 0.30
vec3 Uncharted2Helper(const in vec3 x){return((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}vec3 Uncharted2ToneMapping(vec3 color){color*=toneMappingExposure;return clamp(Uncharted2Helper(color)/Uncharted2Helper(vec3(whitePoint)),0.0,1.0);}
#endif
void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){
#if TONE_MAPPING_MODE == 2 || TONE_MAPPING_MODE == 3
outputColor=vec4(Reinhard2ToneMapping(inputColor.rgb),inputColor.a);
#elif TONE_MAPPING_MODE == 4
outputColor=vec4(Uncharted2ToneMapping(inputColor.rgb),inputColor.a);
#else
outputColor=vec4(toneMapping(inputColor.rgb),inputColor.a);
#endif
}`,fp=class extends $s{constructor({blendFunction:n=Xe.SRC,adaptive:e=!1,mode:t=e?Jt.REINHARD2_ADAPTIVE:Jt.AGX,resolution:i=256,maxLuminance:s=4,whitePoint:r=s,middleGrey:a=.6,minLuminance:o=.01,averageLuminance:l=1,adaptationRate:c=1}={}){super("ToneMappingEffect",HM,{blendFunction:n,uniforms:new Map([["luminanceBuffer",new De(null)],["maxLuminance",new De(s)],["whitePoint",new De(r)],["middleGrey",new De(a)],["averageLuminance",new De(l)]])}),this.renderTargetLuminance=new at(1,1,{minFilter:ti,depthBuffer:!1}),this.renderTargetLuminance.texture.generateMipmaps=!0,this.renderTargetLuminance.texture.name="Luminance",this.luminancePass=new lp({renderTarget:this.renderTargetLuminance}),this.adaptiveLuminancePass=new zM(this.luminancePass.texture,{minLuminance:o,adaptationRate:c}),this.uniforms.get("luminanceBuffer").value=this.adaptiveLuminancePass.texture,this.resolution=i,this.mode=t}get mode(){return Number(this.defines.get("TONE_MAPPING_MODE"))}set mode(n){if(this.mode===n)return;let t="170".replace(/\D+/g,"")>=168?"CineonToneMapping(texel)":"OptimizedCineonToneMapping(texel)";switch(this.defines.clear(),this.defines.set("TONE_MAPPING_MODE",n.toFixed(0)),n){case Jt.LINEAR:this.defines.set("toneMapping(texel)","LinearToneMapping(texel)");break;case Jt.REINHARD:this.defines.set("toneMapping(texel)","ReinhardToneMapping(texel)");break;case Jt.CINEON:case Jt.OPTIMIZED_CINEON:this.defines.set("toneMapping(texel)",t);break;case Jt.ACES_FILMIC:this.defines.set("toneMapping(texel)","ACESFilmicToneMapping(texel)");break;case Jt.AGX:this.defines.set("toneMapping(texel)","AgXToneMapping(texel)");break;case Jt.NEUTRAL:this.defines.set("toneMapping(texel)","NeutralToneMapping(texel)");break;default:this.defines.set("toneMapping(texel)","texel");break}this.adaptiveLuminancePass.enabled=n===Jt.REINHARD2_ADAPTIVE,this.setChanged()}getMode(){return this.mode}setMode(n){this.mode=n}get whitePoint(){return this.uniforms.get("whitePoint").value}set whitePoint(n){this.uniforms.get("whitePoint").value=n}get middleGrey(){return this.uniforms.get("middleGrey").value}set middleGrey(n){this.uniforms.get("middleGrey").value=n}get averageLuminance(){return this.uniforms.get("averageLuminance").value}set averageLuminance(n){this.uniforms.get("averageLuminance").value=n}get adaptiveLuminanceMaterial(){return this.adaptiveLuminancePass.fullscreenMaterial}getAdaptiveLuminanceMaterial(){return this.adaptiveLuminanceMaterial}get resolution(){return this.luminancePass.resolution.width}set resolution(n){let e=Math.max(0,Math.ceil(Math.log2(n))),t=Math.pow(2,e);this.luminancePass.resolution.setPreferredSize(t,t),this.adaptiveLuminanceMaterial.mipLevel1x1=e}getResolution(){return this.resolution}setResolution(n){this.resolution=n}get adaptive(){return this.mode===Jt.REINHARD2_ADAPTIVE}set adaptive(n){this.mode=n?Jt.REINHARD2_ADAPTIVE:Jt.REINHARD2}get adaptationRate(){return this.adaptiveLuminanceMaterial.adaptationRate}set adaptationRate(n){this.adaptiveLuminanceMaterial.adaptationRate=n}get distinction(){return console.warn(this.name,"distinction was removed."),1}set distinction(n){console.warn(this.name,"distinction was removed.")}update(n,e,t){this.adaptiveLuminancePass.enabled&&(this.luminancePass.render(n,e),this.adaptiveLuminancePass.render(n,null,null,t))}initialize(n,e,t){this.adaptiveLuminancePass.initialize(n,e,t)}},GM=`uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb;
#if VIGNETTE_TECHNIQUE == 0
float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));
#else
vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));
#endif
outputColor=vec4(color,inputColor.a);}`,dp=class extends $s{constructor({blendFunction:n,eskil:e=!1,technique:t=e?Nr.ESKIL:Nr.DEFAULT,offset:i=.5,darkness:s=.5}={}){super("VignetteEffect",GM,{blendFunction:n,defines:new Map([["VIGNETTE_TECHNIQUE",t.toFixed(0)]]),uniforms:new Map([["offset",new De(i)],["darkness",new De(s)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(n){this.technique!==n&&(this.defines.set("VIGNETTE_TECHNIQUE",n.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Nr.ESKIL}set eskil(n){this.technique=n?Nr.ESKIL:Nr.DEFAULT}getTechnique(){return this.technique}setTechnique(n){this.technique=n}get offset(){return this.uniforms.get("offset").value}set offset(n){this.uniforms.get("offset").value=n}getOffset(){return this.offset}setOffset(n){this.offset=n}get darkness(){return this.uniforms.get("darkness").value}set darkness(n){this.uniforms.get("darkness").value=n}getDarkness(){return this.darkness}setDarkness(n){this.darkness=n}};var VM=`#include <common>
#include <packing>
#include <dithering_pars_fragment>
#define packFloatToRGBA(v) packDepthToRGBA(v)
#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#if DEPTH_PACKING == 3201
uniform lowp sampler2D depthBuffer;
#elif defined(GL_FRAGMENT_PRECISION_HIGH)
uniform highp sampler2D depthBuffer;
#else
uniform mediump sampler2D depthBuffer;
#endif
uniform 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){
#if DEPTH_PACKING == 3201
return unpackRGBAToDepth(texture2D(depthBuffer,uv));
#else
return texture2D(depthBuffer,uv).r;
#endif
}float getViewZ(const in float depth){
#ifdef PERSPECTIVE_CAMERA
return perspectiveDepthToViewZ(depth,cameraNear,cameraFar);
#else
return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
#endif
}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;
#ifdef ENCODE_OUTPUT
#include <colorspace_fragment>
#endif
#include <dithering_fragment>
}`,WM="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);}",XM=class extends Je{constructor(n,e,t,i,s=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:"170".replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new De(null),depthBuffer:new De(null),resolution:new De(new K),texelSize:new De(new K),cameraNear:new De(.3),cameraFar:new De(1e3),aspect:new De(1),time:new De(0)},blending:_t,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:s}),n&&this.setShaderParts(n),e&&this.setDefines(e),t&&this.setUniforms(t),this.copyCameraSettings(i)}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(n){this.uniforms.depthBuffer.value=n}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(n){this.defines.DEPTH_PACKING=n.toFixed(0),this.needsUpdate=!0}setDepthBuffer(n,e=ci){this.depthBuffer=n,this.depthPacking=e}setShaderData(n){this.setShaderParts(n.shaderParts),this.setDefines(n.defines),this.setUniforms(n.uniforms),this.setExtensions(n.extensions)}setShaderParts(n){return this.fragmentShader=VM.replace(st.FRAGMENT_HEAD,n.get(st.FRAGMENT_HEAD)||"").replace(st.FRAGMENT_MAIN_UV,n.get(st.FRAGMENT_MAIN_UV)||"").replace(st.FRAGMENT_MAIN_IMAGE,n.get(st.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader=WM.replace(st.VERTEX_HEAD,n.get(st.VERTEX_HEAD)||"").replace(st.VERTEX_MAIN_SUPPORT,n.get(st.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(n){for(let e of n.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(n){for(let e of n.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(n){this.extensions={};for(let e of n)this.extensions[e]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(n){this.encodeOutput!==n&&(n?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(n){return this.encodeOutput}setOutputEncodingEnabled(n){this.encodeOutput=n}get time(){return this.uniforms.time.value}set time(n){this.uniforms.time.value=n}setDeltaTime(n){this.uniforms.time.value+=n}adoptCameraSettings(n){this.copyCameraSettings(n)}copyCameraSettings(n){n&&(this.uniforms.cameraNear.value=n.near,this.uniforms.cameraFar.value=n.far,n instanceof Bt?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(n,e){let t=this.uniforms;t.resolution.value.set(n,e),t.texelSize.value.set(1/n,1/e),t.aspect.value=n/e}static get Section(){return st}};var WE=Number("170".replace(/\D+/g,"")),ls=255/256,XE=new Float32Array([ls/256**3,ls/256**2,ls/256,ls]),YE=new Float32Array([ls,ls/256,ls/256**2,1/256**3]);function ip(n,e,t){for(let i of e){let s="$1"+n+i.charAt(0).toUpperCase()+i.slice(1),r=new RegExp("([^\\.])(\\b"+i+"\\b)","g");for(let a of t.entries())a[1]!==null&&t.set(a[0],a[1].replace(r,s))}}function YM(n,e,t){let i=e.getFragmentShader(),s=e.getVertexShader(),r=i!==void 0&&/mainImage/.test(i),a=i!==void 0&&/mainUv/.test(i);if(t.attributes|=e.getAttributes(),i===void 0)throw new Error(`Missing fragment shader (${e.name})`);if(a&&(t.attributes&ui.CONVOLUTION)!==0)throw new Error(`Effects that transform UVs are incompatible with convolution effects (${e.name})`);if(!r&&!a)throw new Error(`Could not find mainImage or mainUv function (${e.name})`);{let o=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,l=t.shaderParts,c=l.get(st.FRAGMENT_HEAD)||"",u=l.get(st.FRAGMENT_MAIN_UV)||"",h=l.get(st.FRAGMENT_MAIN_IMAGE)||"",d=l.get(st.VERTEX_HEAD)||"",p=l.get(st.VERTEX_MAIN_SUPPORT)||"",m=new Set,v=new Set;if(a&&(u+=`	${n}MainUv(UV);
`,t.uvTransformation=!0),s!==null&&/mainSupport/.test(s)){let x=/mainSupport *\([\w\s]*?uv\s*?\)/.test(s);p+=`	${n}MainSupport(`,p+=x?`vUv);
`:`);
`;for(let A of s.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(let y of A[1].split(/\s*,\s*/))t.varyings.add(y),m.add(y),v.add(y);for(let A of s.matchAll(o))v.add(A[1])}for(let x of i.matchAll(o))v.add(x[1]);for(let x of e.defines.keys())v.add(x.replace(/\([\w\s,]*\)/g,""));for(let x of e.uniforms.keys())v.add(x);v.delete("while"),v.delete("for"),v.delete("if"),e.uniforms.forEach((x,A)=>t.uniforms.set(n+A.charAt(0).toUpperCase()+A.slice(1),x)),e.defines.forEach((x,A)=>t.defines.set(n+A.charAt(0).toUpperCase()+A.slice(1),x));let g=new Map([["fragment",i],["vertex",s]]);ip(n,v,t.defines),ip(n,v,g),i=g.get("fragment"),s=g.get("vertex");let f=e.blendMode;if(t.blendModes.set(f.blendFunction,f),r){e.inputColorSpace!==null&&e.inputColorSpace!==t.colorSpace&&(h+=e.inputColorSpace===$e?`color0 = sRGBTransferOETF(color0);
	`:`color0 = sRGBToLinear(color0);
	`),e.outputColorSpace!==vn?t.colorSpace=e.outputColorSpace:e.inputColorSpace!==null&&(t.colorSpace=e.inputColorSpace);let x=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;h+=`${n}MainImage(color0, UV, `,(t.attributes&ui.DEPTH)!==0&&x.test(i)&&(h+="depth, ",t.readDepth=!0),h+=`color1);
	`;let A=n+"BlendOpacity";t.uniforms.set(A,f.opacity),h+=`color0 = blend${f.blendFunction}(color0, color1, ${A});

	`,c+=`uniform float ${A};

`}if(c+=i+`
`,s!==null&&(d+=s+`
`),l.set(st.FRAGMENT_HEAD,c),l.set(st.FRAGMENT_MAIN_UV,u),l.set(st.FRAGMENT_MAIN_IMAGE,h),l.set(st.VERTEX_HEAD,d),l.set(st.VERTEX_MAIN_SUPPORT,p),e.extensions!==null)for(let x of e.extensions)t.extensions.add(x)}}var Eu=class extends An{constructor(n,...e){super("EffectPass"),this.fullscreenMaterial=new XM(null,null,null,n),this.listener=t=>this.handleEvent(t),this.effects=[],this.setEffects(e),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(n){for(let e of this.effects)e.mainScene=n}set mainCamera(n){this.fullscreenMaterial.copyCameraSettings(n);for(let e of this.effects)e.mainCamera=n}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(n){this.fullscreenMaterial.encodeOutput=n}get dithering(){return this.fullscreenMaterial.dithering}set dithering(n){let e=this.fullscreenMaterial;e.dithering=n,e.needsUpdate=!0}setEffects(n){for(let e of this.effects)e.removeEventListener("change",this.listener);this.effects=n.sort((e,t)=>t.attributes-e.attributes);for(let e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){let n=new H1,e=0;for(let a of this.effects)if(a.blendMode.blendFunction===Xe.DST)n.attributes|=a.getAttributes()&ui.DEPTH;else{if((n.attributes&a.getAttributes()&ui.CONVOLUTION)!==0)throw new Error(`Convolution effects cannot be merged (${a.name})`);YM("e"+e++,a,n)}let t=n.shaderParts.get(st.FRAGMENT_HEAD),i=n.shaderParts.get(st.FRAGMENT_MAIN_IMAGE),s=n.shaderParts.get(st.FRAGMENT_MAIN_UV),r=/\bblend\b/g;for(let a of n.blendModes.values())t+=a.getShaderCode().replace(r,`blend${a.blendFunction}`)+`
`;(n.attributes&ui.DEPTH)!==0?(n.readDepth&&(i=`float depth = readDepth(UV);

	`+i),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,n.colorSpace===$e&&(i+=`color0 = sRGBToLinear(color0);
	`),n.uvTransformation?(s=`vec2 transformedUv = vUv;
`+s,n.defines.set("UV","transformedUv")):n.defines.set("UV","vUv"),n.shaderParts.set(st.FRAGMENT_HEAD,t),n.shaderParts.set(st.FRAGMENT_MAIN_IMAGE,i),n.shaderParts.set(st.FRAGMENT_MAIN_UV,s);for(let[a,o]of n.shaderParts)o!==null&&n.shaderParts.set(a,o.trim().replace(/^#/,`
#`));this.skipRendering=e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(n)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(n,e=ci){this.fullscreenMaterial.depthBuffer=n,this.fullscreenMaterial.depthPacking=e;for(let t of this.effects)t.setDepthTexture(n,e)}render(n,e,t,i,s){for(let r of this.effects)r.update(n,e,i);if(!this.skipRendering||this.renderToScreen){let r=this.fullscreenMaterial;r.inputBuffer=e.texture,r.time+=i*this.timeScale,n.setRenderTarget(this.renderToScreen?null:t),n.render(this.scene,this.camera)}}setSize(n,e){this.fullscreenMaterial.setSize(n,e);for(let t of this.effects)t.setSize(n,e)}initialize(n,e,t){this.renderer=n;for(let i of this.effects)i.initialize(n,e,t);this.updateMaterial(),t!==void 0&&t!==bt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(let n of this.effects)n.removeEventListener("change",this.listener),n.dispose()}handleEvent(n){switch(n.type){case"change":this.recompile();break}}};var QE=[new Float32Array(3),new Float32Array(3)],ZE=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],KE=[[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])]];var JE=[new Float32Array(2),new Float32Array(2)];var jE=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),$E=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],ew=[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])],tw=[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])];var nw=new Map([[qt(0,0,0,0),new Float32Array([0,0,0,0])],[qt(0,0,0,1),new Float32Array([0,0,0,1])],[qt(0,0,1,0),new Float32Array([0,0,1,0])],[qt(0,0,1,1),new Float32Array([0,0,1,1])],[qt(0,1,0,0),new Float32Array([0,1,0,0])],[qt(0,1,0,1),new Float32Array([0,1,0,1])],[qt(0,1,1,0),new Float32Array([0,1,1,0])],[qt(0,1,1,1),new Float32Array([0,1,1,1])],[qt(1,0,0,0),new Float32Array([1,0,0,0])],[qt(1,0,0,1),new Float32Array([1,0,0,1])],[qt(1,0,1,0),new Float32Array([1,0,1,0])],[qt(1,0,1,1),new Float32Array([1,0,1,1])],[qt(1,1,0,0),new Float32Array([1,1,0,0])],[qt(1,1,0,1),new Float32Array([1,1,0,1])],[qt(1,1,1,0),new Float32Array([1,1,1,0])],[qt(1,1,1,1),new Float32Array([1,1,1,1])]]);function Mu(n,e,t){return n+(e-n)*t}function qt(n,e,t,i){let s=Mu(n,e,.75),r=Mu(t,i,1-.25);return Mu(s,r,1-.125)}var er=4,qM=`
  uniform vec4 waves[${er}];
  uniform float aspect;
  uniform vec2 aberration;

  void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
    vec2 p = uv;
    for (int i = 0; i < ${er}; i++) {
      vec4 w = waves[i];
      if (w.w <= 0.0) continue;
      vec2 d = p - w.xy;
      d.x *= aspect;
      float dist = length(d);
      float band = 1.0 - smoothstep(0.0, 0.035, abs(dist - w.z));
      vec2 dir = d / max(dist, 1e-4);
      dir.x /= aspect;
      p -= dir * band * w.w;
    }

    vec2 fromCentre = (p - 0.5) * vec2(aspect, 1.0);
    vec2 offset = aberration * smoothstep(0.25, 1.0, length(fromCentre));
    vec4 g = texture2D(inputBuffer, p);
    float r = texture2D(inputBuffer, p + offset).r;
    float b = texture2D(inputBuffer, p - offset).b;
    outputColor = vec4(r, g.g, b, g.a);
  }
`,Mo=class extends $s{constructor(){super("LensEffect",qM,{attributes:ui.CONVOLUTION,uniforms:new Map([["waves",new De(Array.from({length:er},()=>new Ke))],["aspect",new De(1)],["aberration",new De(new K)]])})}setWaves(e,t,i){this.uniforms.get("aspect").value=t/i;let s=this.uniforms.get("waves").value;for(let r=0;r<er;r++){let a=e[r];a?s[r].set(a.x/t,1-a.y/i,a.r/i,a.strength):s[r].set(0,0,0,0)}}setAberration(e,t){this.uniforms.get("aberration").value.set(e,t)}};function pp(n,e,t){let i=n.getPixelRatio()>=1.5?0:Math.min(4,n.capabilities.maxSamples),s=new op(n,{frameBufferType:li,multisampling:i}),r=new cp({mipmapBlur:!0,levels:6,luminanceThreshold:.7,luminanceSmoothing:.25,intensity:1.3,radius:.72}),a=new fp({mode:Jt.ACES_FILMIC}),o=new Mo,l=new dp({offset:.3,darkness:.62}),c=new hp({blendFunction:Xe.OVERLAY,premultiply:!1});c.blendMode.opacity.value=.05;let u={render:new up(e,t),bloom:new Eu(t,r,a),finish:new Eu(t,o,l,c)};return Object.values(u).forEach(h=>s.addPass(h)),{composer:s,passes:u,setSize:(h,d)=>s.setSize(h,d),setQuality(h,d){s.multisampling=d<1.5?Math.min(h.msaa,n.capabilities.maxSamples):0,r.mipmapBlurPass.levels=h.bloomLevels},update(h,d,p,m){let v=Math.min(h,20)*22e-5;o.setAberration(v,v*.6),o.setWaves(d,p,m)},render:h=>s.render(h)}}var tr={low:{label:"Low",maxPixelRatio:1,msaa:0,bloomLevels:4,nebulaScale:.35,particleCap:1500},medium:{label:"Medium",maxPixelRatio:1.25,msaa:0,bloomLevels:5,nebulaScale:.45,particleCap:3e3},high:{label:"High",maxPixelRatio:1.5,msaa:4,bloomLevels:6,nebulaScale:.5,particleCap:6e3},ultra:{label:"Ultra",maxPixelRatio:2,msaa:4,bloomLevels:8,nebulaScale:.75,particleCap:1e4}};function mp(n){let e=n.getContext(),t=n.capabilities,i=window.matchMedia?.("(pointer: coarse)").matches,s=navigator.deviceMemory??8,r=e.getExtension("WEBGL_debug_renderer_info"),a=r?String(e.getParameter(r.UNMASKED_RENDERER_WEBGL)):"";return/swiftshader|llvmpipe|software/i.test(a)||s<=2?"low":i||s<=4||t.maxTextureSize<8192?"medium":"high"}function gp({min:n=.6,max:e=1,step:t=.1,budgetMs:i=1e3/58}={}){let s=e,r=[],a=0,o=0,l=0,c=0;return{get scale(){return s},reset(){s=e,r=[],a=0,o=0,l=0},sample(u){if(c+=u,r.push(u*1e3>i),r.length<60)return null;r.length>60&&r.shift();let h=r.filter(Boolean).length/r.length;return l>0&&(l-=u,h>.2)?(l=0,o=c+30,s=Math.max(n,+(s-t).toFixed(2)),r=[],s):h>.2&&s>n?(s=Math.max(n,+(s-t).toFixed(2)),r=[],a=0,s):(a=h<.03?a+u:0,a>10&&s<e&&c>o?(s=Math.min(e,+(s+t).toFixed(2)),a=0,l=3,r=[],s):null)}}}var vp=.035,QM=.0012;function xp(n){let e=new Wa({canvas:n,antialias:!1,stencil:!1,powerPreference:"high-performance"});e.info.autoReset=!1;let t=tr.high,i=1,s=()=>Math.max(.5,Math.min(window.devicePixelRatio||1,t.maxPixelRatio)*i);e.setPixelRatio(s());let r=new ai,a=Ud(),o=new tn;o.scale.set(1,-1,1),r.add(o),r.add(new oo(8952319,.35));let l=new ao(16777215,1.7);r.add(l);let c=new Li(16755268,2.2,0,0);c.position.set(400,-300,300),r.add(c);let u=Nd(),h=Fd(u.bodyUniforms);r.add(u.mesh,h.points);let d=ou({capacity:4096,blending:kn,renderOrder:20}),p=ou({capacity:1024,blending:Ci,renderOrder:19});o.add(p.mesh,d.mesh);let m=Zd(o),v=Kd(o),g=jd(o,m),f=$d(o,m),x=ep(o),A=[],y=pp(e,r,a.camera);e.compile(r,a.camera);let b=new K,T=1,C=1,D=null;function S(w,B){w<=0||B<=0||(T=w,C=B,a.setPlayfield(w,B),o.position.set(-w/2,B/2,0),y.setSize(w,B),u.resize(w,B,e.getPixelRatio(),t.nebulaScale),h.setPixelRatio(e.getPixelRatio()))}function M(w,B){let U=w.paused?0:B.frameSeconds,{shakeScale:k,flashScale:H}=B.effects,O=w.paused?0:w.fx.shake*k;if(a.update((Math.random()-.5)*O,(Math.random()-.5)*O,(Math.random()-.5)*O*QM),B.theme.accent!==D){D=B.theme.accent,c.color.set(D);let[Y,G,ee]=B.theme.lightDir;l.position.set(Y*800,G*800,ee*800)}b.x+=w.ship.vx*U/T*vp,b.y-=w.ship.vy*U/C*vp,u.update(B.frameSeconds,B.now,B.theme,b),h.update(B.now,b),d.begin(),p.begin(),m.begin(),m.update(w,B,d),g.update(w,B,p),f.update(w,B,d),m.end(),x.update(w,B,d),v.update(w,B,d),zd(w,B,d,p),d.end(),p.end(),A.length=0;for(let Y of w.fx.shockwaves)A.push({x:Y.x,y:Y.y,r:Y.r,strength:Y.alpha*.007*H});A.sort((Y,G)=>G.strength-Y.strength).length=Math.min(A.length,er),y.update(w.paused?0:w.fx.shake*H,A,T,C),e.info.reset(),u.renderOffscreen(e),y.render(B.frameSeconds)}return{resize:S,render:M,reseedBackground:()=>u.reseed(),get renderer(){return e},setQuality(w){t=tr[w]??tr.high,e.setPixelRatio(s()),y.setQuality(t,e.getPixelRatio()),S(T,C)},setRenderScale(w){i=w,e.setPixelRatio(s()),S(T,C)},get pixelRatio(){return e.getPixelRatio()},debugHandles:{scene:r,playfield:o,nebula:u.mesh,stars:h.points,post:y},onEvent(w){w.type==="asteroidDestroyed"?g.onAsteroidDestroyed(w):w.type==="shipDestroyed"?g.onShipDestroyed(w):w.type==="shoot"?v.onShoot(w):w.type==="asteroidHit"?m.onHit(w.id,performance.now()/1e3):w.type==="hyperspaceOut"||w.type==="hyperspaceIn"?v.onHyperspace(w):w.type==="bossDestroyed"?(g.onAsteroidDestroyed({...w,asteroidType:w.bossType,size:w.radius,vx:0,vy:0}),g.onAsteroidDestroyed({...w,asteroidType:w.bossType,size:w.radius*.7,vx:0,vy:0})):w.type==="enemyDestroyed"&&g.onShipDestroyed(w)},stats:()=>({calls:e.info.render.calls,triangles:e.info.render.triangles,sprites:d.count+p.count})}}var Fr=n=>`${Math.max(0,Math.min(100,n*100)).toFixed(1)}%`,ZM='<svg viewBox="0 0 20 20"><path d="M10 1 L18 18 L10 13.5 L2 18 Z" fill="#5ab4ff" stroke="#bfe9ff" stroke-width="1"/></svg>',KM=7;function yp(n=document){let e=c=>n.getElementById(c),t={score:e("score"),lives:e("lives"),level:e("level"),sector:e("sectorName"),controls:e("controls"),popups:e("popups"),gameOver:e("gameOver"),gameOverText:e("gameOverText"),levelUp:e("levelUp"),levelUpKicker:e("levelUpKicker"),levelUpText:e("levelUpText"),levelUpSubtitle:e("levelUpSubtitle"),levelUpThreats:e("levelUpThreats"),levelUpBoss:e("levelUpBoss"),paused:e("paused"),combo:e("combo"),comboMult:e("comboMult"),comboCount:e("comboCount"),comboBar:e("comboBar"),wave:e("wave"),bossBar:e("bossBar"),bossName:e("bossName"),bossFill:e("bossFill"),heatMeter:e("heatMeter"),heatFill:e("heatFill"),shieldMeter:e("shieldMeter"),shieldFill:e("shieldFill"),jumpMeter:e("jumpMeter"),jumpFill:e("jumpFill"),buffs:e("buffs"),toast:e("toast"),upgrade:e("upgrade"),cards:e("cards"),runStats:e("runStats")},i=0,s=null,r=null,a={lives:null,score:null,level:null,accent:null,hint:null,wave:null,buffs:null,mult:1},o=0,l=(c,u)=>c.classList.toggle("visible",u);return{update(c,u,h){o+=(c.score-o)*(1-Math.exp(-h*12)),Math.abs(c.score-o)<.5&&(o=c.score);let d=Math.round(o).toLocaleString("en-US");d!==a.score&&(t.score.textContent=a.score=d),c.lives!==a.lives&&(a.lives=c.lives,t.lives.innerHTML=ZM.repeat(Math.max(0,c.lives))),c.level!==a.level&&(a.level=c.level,t.level.textContent=c.level,t.sector.textContent=u.title),u.accent!==a.accent&&(a.accent=u.accent,n.documentElement.style.setProperty("--accent",u.accent));let p=c.combo;t.combo.classList.toggle("on",p.count>=2),p.multiplier!==a.mult&&(a.mult=p.multiplier,t.comboMult.textContent=`\xD7${p.multiplier}`,t.combo.classList.remove("bump"),t.combo.offsetWidth,p.multiplier>1&&t.combo.classList.add("bump")),t.comboCount.textContent=p.count>=2?`${p.count} CHAIN`:"",t.comboBar.style.width=Fr(p.timer/Hi.window);let m=c.boss?"BOSS":`WAVE ${Math.min(c.wave,mn(c).waves)} / ${mn(c).waves}`;if(m!==a.wave&&(a.wave=m,t.wave.textContent=m,t.wave.classList.toggle("boss",!!c.boss)),t.bossBar.classList.toggle("visible",!!c.boss),c.boss){let y=mn(c).boss.name;t.bossName.textContent!==y&&(t.bossName.textContent=y),t.bossFill.style.width=Fr(c.boss.hp/c.boss.maxHp),t.bossBar.classList.toggle("shielded",c.boss.shieldTimer>0)}let{ship:v,stats:g}=c;t.heatFill.style.width=Fr(v.heat/bn.maxHeat),t.heatMeter.classList.toggle("hot",v.heat>70),t.heatMeter.classList.toggle("locked",v.overheated),t.shieldFill.style.width=Fr(v.energy/g.shieldMax),t.shieldMeter.classList.toggle("active",v.shieldActive);let f=v.jumpCooldown<=0;t.jumpFill.style.width=Fr(1-v.jumpCooldown/(gi.cooldown*g.jumpCooldownMul)),t.jumpMeter.classList.toggle("ready",f);let x=Object.entries(v.buffs).map(([y,b])=>`${y}:${Math.ceil(b)}`).join(",");x!==a.buffs&&(a.buffs=x,t.buffs.innerHTML=Object.entries(v.buffs).map(([y,b])=>`<span class="buff" style="color:${on[y].color}">${on[y].label} ${Math.ceil(b)}</span>`).join(""));let A=c.paused||c.mode==="playing"&&c.time<KM||c.mode==="over";A!==a.hint&&(a.hint=A,t.controls.classList.toggle("hidden",!A))},popScore(c,u,h,d){let p=n.createElement("span");p.className=h>=200?"pop big":"pop",p.textContent=`+${h}`,p.style.left=`${c}px`,p.style.top=`${u}px`,p.style.color=`hsl(${Math.round(d*360)}, 95%, 72%)`,p.addEventListener("animationend",()=>p.remove(),{once:!0}),t.popups.appendChild(p)},toast(c,u="var(--accent)"){t.toast.textContent=c,t.toast.style.color=u,t.toast.classList.remove("show"),t.toast.offsetWidth,t.toast.classList.add("show")},showUpgrades(c,u,h){s=c,i=0,r=h;let d=()=>{t.cards.innerHTML=c.map((p,m)=>{let v=fs[p],g=u[p]??0,f=Array.from({length:v.max},(x,A)=>`<i class="${A<g?"on":A===g?"next":""}"></i>`).join("");return`<div class="card ${m===i?"selected":""}" data-index="${m}">
            <div class="card-key">${m+1}</div>
            <div class="card-name">${v.name}</div>
            <div class="card-desc">${v.desc}</div>
            <div class="card-level">${f}</div>
          </div>`}).join("")};this._renderCards=d,d(),l(t.upgrade,!0)},upgradeNav(c){if(!s)return!1;if(c==="left")i=(i+s.length-1)%s.length;else if(c==="right")i=(i+1)%s.length;else return c==="confirm"?(r?.(i),!0):typeof c=="number"&&c<s.length?(r?.(c),!0):!1;return this._renderCards?.(),!0},hideUpgrades(){s=null,l(t.upgrade,!1)},cardsElement:t.cards,showLevelUp(c,u){let h=qn[(u-1)%qn.length],d=or[(u-1)%or.length],p=yi({level:u});t.levelUpKicker.textContent=`SECTOR ${u}${p?` \xB7 LAP ${p+1}`:""}`,t.levelUpText.textContent=d.title,t.levelUpSubtitle.textContent=c?.subtitle??"";let m=Object.entries(h.weights).sort((v,g)=>g[1]-v[1]).map(([v])=>{let g=en[v];return`<li><i style="background:hsl(${(g.color.hue[0]+g.color.hue[1])/2}, ${g.color.sat*100}%, ${g.color.light*100}%)"></i><b>${g.label}</b><span>${g.blurb}</span></li>`});h.comets>0&&m.push(`<li><i style="background:#bff4ff"></i><b>${en.comet.label}</b><span>${en.comet.blurb}</span></li>`),h.saucers.small>0?m.push('<li><i style="background:#ff6b8a"></i><b>Hunter</b><span>Small saucer that aims at you</span></li>'):h.saucers.big>0&&m.push('<li><i style="background:#7dffb0"></i><b>Saucer</b><span>Sprays shots at random</span></li>'),t.levelUpThreats.innerHTML=m.join(""),t.levelUpBoss.innerHTML=`${h.waves} waves, then <b>${h.boss.name}</b>`,l(t.levelUp,!0)},hideLevelUp:()=>l(t.levelUp,!1),showGameOver(c,u){if(t.gameOverText.textContent=c?"YOU WIN!":"GAME OVER",u){let h=Math.floor(u.time/60),d=Math.floor(u.time%60).toString().padStart(2,"0");t.runStats.innerHTML=`
          <span>Score</span><b>${u.score.toLocaleString("en-US")}</b>
          <span>Best (${u.mode})</span><b>${u.best.toLocaleString("en-US")}</b>
          <span>Sector reached</span><b>${u.sector}</b>
          <span>Longest chain</span><b>${u.bestCombo}</b>
          <span>Accuracy</span><b>${u.shots?Math.round(u.hits/u.shots*100):0}%</b>
          <span>Kills</span><b>${u.kills}</b>
          <span>Time</span><b>${h}:${d}</b>
          ${u.upgrades.length?`<span>Upgrades</span><b class="upgrades">${u.upgrades.join(", ")}</b>`:""}
          ${u.rank===1?'<span class="best">NEW BEST</span>':u.rank?`<span class="best">#${u.rank} ALL-TIME</span>`:""}`}t.gameOver.classList.toggle("panel-danger",!c),l(t.gameOver,!0)},showPaused:c=>l(t.paused,c),setBindings(c,u){let h=d=>c[d].slice(0,2).map(p=>`<b>${u(p)}</b>`).join(" / ");t.controls.innerHTML=[`<span>${h("left")} ${h("right")} turn</span>`,`<span>${h("thrust")} thrust</span>`,`<span>${h("fire")} fire</span>`,`<span>${h("hyperspace")} jump</span>`,`<span>${h("shield")} shield</span>`,`<span>${h("pause")} pause</span>`].join("")},reset(){l(t.gameOver,!1),l(t.levelUp,!1),l(t.paused,!1),l(t.upgrade,!1),s=null,t.popups.replaceChildren()}}}var wu=[{id:"resume",label:"Resume",type:"action"},{key:"masterVolume",label:"Master volume",type:"range"},{key:"musicVolume",label:"Music",type:"range"},{key:"sfxVolume",label:"Effects",type:"range"},{key:"shake",label:"Screen shake",type:"choice",labels:{full:"Full",reduced:"Reduced",off:"Off"}},{key:"flashes",label:"Flashes",type:"choice",labels:{full:"Full",reduced:"Reduced"}},{key:"palette",label:"Colours",type:"choice",labels:{standard:"Standard",colorblind:"Colour-blind safe"}},{key:"quality",label:"Graphics",type:"choice",labels:{auto:"Auto",low:"Low",medium:"Medium",high:"High",ultra:"Ultra"}},{key:"gameSpeed",label:"Game speed",type:"choice",labels:{1:"100%",.75:"75%"}},{key:"fireMode",label:"Fire",type:"choice",labels:{hold:"Hold to auto-fire",tap:"Tap per shot"}},{key:"assist",label:"Flight assist",type:"choice",labels:{false:"Off",true:"On"}},{id:"controls",label:"Controls\u2026",type:"action"}],JM=[["left","Turn left"],["right","Turn right"],["thrust","Thrust"],["fire","Fire"],["hyperspace","Hyperspace"],["shield","Shield (hold)"],["pause","Pause"],["restart","Restart"]],jM={ArrowLeft:"\u2190",ArrowRight:"\u2192",ArrowUp:"\u2191",ArrowDown:"\u2193",Space:"Space",Escape:"Esc",Enter:"Enter",ShiftLeft:"L-Shift",ShiftRight:"R-Shift",ControlLeft:"L-Ctrl",ControlRight:"R-Ctrl",AltLeft:"L-Alt",AltRight:"R-Alt",Tab:"Tab",Backspace:"Backspace"},hi=n=>jM[n]??n.replace(/^Key|^Digit|^Numpad/,"");function Tu({root:n,settings:e,onResume:t,onQuit:i,sfx:s,resumeLabel:r="Resume"}){let a=!1,o="main",l=0,c=null;function u(){if(o==="main"){let f=wu.map(x=>x.id==="resume"?{...x,label:r}:x);return i?[...f,{id:"quit",label:"Quit to title",type:"action"}]:f}return[...JM.map(([f,x])=>({id:`bind:${f}`,action:f,label:x,type:"binding"})),{id:"resetKeys",label:"Reset to defaults",type:"action"},{id:"back",label:"\u2190 Back",type:"action"}]}function h(f,x){if(f.type==="range"){let A=x[f.key];return`<button class="menu-arrow" data-dir="-1" aria-label="Decrease">\u25C0</button><span class="menu-bars">${Array.from({length:10},(b,T)=>`<i class="${T<Math.round(A*10)?"on":""}"></i>`).join("")}</span><button class="menu-arrow" data-dir="1" aria-label="Increase">\u25B6</button>`}return f.type==="choice"?`<button class="menu-arrow" data-dir="-1" aria-label="Previous">\u25C0</button><span class="menu-choice">${f.labels[String(x[f.key])]}</span><button class="menu-arrow" data-dir="1" aria-label="Next">\u25B6</button>`:f.type==="binding"?c===f.action?'<span class="menu-key waiting">Press a key\u2026 (Esc cancels)</span>':x.bindings[f.action].map(A=>`<span class="menu-key">${hi(A)}</span>`).join(""):""}function d(){if(!a)return;let f=e.get(),x=u();l=Math.min(l,x.length-1),n.innerHTML=x.map((A,y)=>`
      <li class="menu-item ${y===l?"selected":""} type-${A.type}" data-index="${y}">
        <span class="menu-label">${A.label}</span>
        <span class="menu-value">${h(A,f)}</span>
      </li>`).join("")}function p(f){let x=u()[l];if(x.type==="range")e.nudge(x.key,f);else if(x.type==="choice")e.cycle(x.key,f);else return;s?.uiMove()}function m(){let f=u()[l];if(f.type==="choice"||f.type==="range")return p(1);if(s?.uiSelect(),f.id==="resume")return t();if(f.id==="quit")return i?.();f.id==="controls"?(o="controls",l=0):f.id==="back"?(o="main",l=wu.findIndex(x=>x.id==="controls")):f.id==="resetKeys"?e.resetBindings():f.type==="binding"&&(c=f.action),d()}function v(f){let x=u().length;l=(l+f+x)%x,s?.uiMove(),d()}function g(){return o==="controls"?(o="main",l=wu.findIndex(f=>f.id==="controls"),d(),!0):!1}return n.addEventListener("click",f=>{let x=f.target.closest(".menu-item");if(!x)return;l=Number(x.dataset.index);let A=f.target.closest(".menu-arrow");A?p(Number(A.dataset.dir)):m(),d()}),e.subscribe(d),{open(f){a=f,o="main",l=0,c=null,f&&d()},handleKey(f){if(!a)return!1;if(c)return f.preventDefault(),f.code!=="Escape"&&e.bind(c,f.code),c=null,s?.uiSelect(),d(),!0;switch(f.code){case"ArrowUp":return f.preventDefault(),v(-1),!0;case"ArrowDown":return f.preventDefault(),v(1),!0;case"ArrowLeft":return f.preventDefault(),p(-1),!0;case"ArrowRight":return f.preventDefault(),p(1),!0;case"Enter":case"Space":return f.preventDefault(),m(),!0;case"Escape":case"Backspace":return g();default:return!1}},navigate(f){a&&(f.up&&v(-1),f.down&&v(1),f.left&&p(-1),f.right&&p(1),f.confirm&&m(),f.back&&!g()&&t())}}}var Ap="ASTEROID FIELD",Mp="Break the belt. Survive the core.";var nr=["campaign","endless","daily"],$M={campaign:"Campaign",endless:"Endless",daily:"Daily Challenge"},Sp=n=>n.toLocaleString("en-US");function _p({doc:n=document,settings:e,highScores:t,settingsMenu:i,sfx:s,onStart:r,onTutorial:a}){let o=S=>n.getElementById(S),l=o("title"),c=o("titleMenu"),u={scores:o("titleScores"),howto:o("titleHowto"),settings:o("titleSettings")},h=o("titleHint");o("titleLogo").textContent=Ap,o("titleTagline").textContent=Mp;let d=!1,p="main",m=0,v="campaign",g=()=>new Date().toISOString().slice(0,10),f=()=>[{id:"campaign",label:"Campaign",sub:"Three sectors \xB7 bosses \xB7 upgrades",best:t.best("campaign")},{id:"endless",label:"Endless",sub:"Sectors loop, harder every lap",best:t.best("endless")},{id:"daily",label:"Daily Challenge",sub:`${g()} \xB7 the same run for everyone`,best:t.best("daily")},{id:"scores",label:"High Scores"},{id:"howto",label:"How to Play"},{id:"settings",label:"Settings"}];function x(){c.innerHTML=f().map((S,M)=>`
      <li class="menu-item title-item ${M===m?"selected":""} ${S.sub?"mode":""}" data-index="${M}">
        <span class="menu-label">${S.label}${S.sub?`<small>${S.sub}</small>`:""}</span>
        <span class="menu-value">${S.best?`<span class="title-best">BEST ${Sp(S.best)}</span>`:""}</span>
      </li>`).join("")}function A(){let S=t.list(v);u.scores.innerHTML=`
      <div class="score-tabs">${nr.map(M=>`<button class="score-tab ${M===v?"on":""}" data-mode="${M}">${$M[M]}</button>`).join("")}</div>
      ${S.length?`<ol class="score-list">${S.map((M,w)=>`
        <li><span class="rank">${w+1}</span><b>${Sp(M.score)}</b><span>Sector ${M.sector}</span><span class="date">${M.date??""}</span></li>`).join("")}</ol>`:'<p class="score-empty">No runs yet. Go set the bar.</p>'}
      <button class="title-back" data-back>\u2190 Back</button>`}function y(){let S=e.get().bindings,M=U=>S[U].slice(0,2).map(k=>`<kbd>${hi(k)}</kbd>`).join(" "),w=Object.entries(en).map(([,U])=>`
      <li><i style="background:hsl(${(U.color.hue[0]+U.color.hue[1])/2}, ${U.color.sat*100}%, ${U.color.light*100}%)"></i><b>${U.label}</b><span>${U.blurb}</span></li>`).join(""),B=Object.values(on).map(U=>`<li><i style="background:${U.color}"></i><b>${U.label}</b></li>`).join("");u.howto.innerHTML=`
      <div class="howto-grid">
        <section><h3>Controls</h3><ul class="howto-keys">
          <li>${M("left")} ${M("right")}<span>Turn</span></li>
          <li>${M("thrust")}<span>Thrust</span></li>
          <li>${M("fire")}<span>Fire (hold to auto-fire)</span></li>
          <li>${M("hyperspace")}<span>Hyperspace</span></li>
          <li>${M("shield")}<span>Shield (hold)</span></li>
          <li>${M("pause")}<span>Pause &amp; settings</span></li>
        </ul>
        <p class="howto-note">Gamepad and touch work too. Firing builds <b>heat</b>; the shield drains <b>energy</b>; quick kills build a <b>combo</b>.</p></section>
        <section><h3>Threats</h3><ul class="howto-legend">${w}</ul>
          <h3>Pickups</h3><ul class="howto-legend pickups">${B}</ul></section>
      </div>
      <div class="howto-actions"><button class="title-back" data-tutorial>Play the tutorial</button><button class="title-back" data-back>\u2190 Back</button></div>`}function b(S){p=S,c.hidden=S!=="main";for(let[M,w]of Object.entries(u))w.hidden=M!==S;i.open(S==="settings"),h.textContent={main:"\u2191 \u2193 select \xB7 Enter start",scores:"\u2190 \u2192 switch mode \xB7 Esc back",howto:"Enter play tutorial \xB7 Esc back",settings:"\u2191 \u2193 select \xB7 \u2190 \u2192 change \xB7 Esc back"}[S],S==="main"&&x(),S==="scores"&&A(),S==="howto"&&y()}function T(){let S=f()[m];s.uiSelect(),nr.includes(S.id)?r(S.id):b(S.id)}function C(S){m=(m+S+f().length)%f().length,s.uiMove(),x()}function D(S){v=nr[(nr.indexOf(v)+S+nr.length)%nr.length],s.uiMove(),A()}return l.addEventListener("click",S=>{let M=S.target.closest(".title-item");if(M){m=Number(M.dataset.index),T();return}let w=S.target.closest(".score-tab");if(w){v=w.dataset.mode,A();return}if(S.target.closest("[data-tutorial]")){a();return}S.target.closest("[data-back]")&&b("main")}),{get visible(){return d},show(){d=!0,l.classList.add("visible"),b("main")},hide(){d=!1,l.classList.remove("visible"),i.open(!1)},back:()=>b("main"),handleKey(S){if(!d)return!1;let M=S.code,w=M==="Escape"||M==="Backspace";if(p==="settings")return i.handleKey(S)||w&&b("main"),!0;if(p==="main")if(M==="ArrowUp")C(-1);else if(M==="ArrowDown")C(1);else if(M==="Enter"||M==="Space")T();else return!0;else p==="scores"?M==="ArrowLeft"?D(-1):M==="ArrowRight"?D(1):(w||M==="Enter")&&b("main"):p==="howto"&&(M==="Enter"?a():w&&b("main"));return S.preventDefault(),!0},navigate(S){if(d){if(p==="settings"){i.navigate(S);return}p==="main"?(S.up&&C(-1),S.down&&C(1),S.confirm&&T()):p==="scores"?(S.left&&D(-1),S.right&&D(1),(S.back||S.confirm)&&b("main")):p==="howto"&&(S.confirm&&a(),S.back&&b("main"))}}}}var bp={gamepad:{turn:"Left stick",thrust:"RT",fire:"A",shield:"LT (hold)",hyperspace:"LB",skip:"Start"},touch:{turn:"Left stick",thrust:"THRUST",fire:"FIRE",shield:"SHIELD (hold)",hyperspace:"JUMP",skip:""}},ir=[{id:"turn",text:n=>`${n("turn")} to turn`,done:n=>n.turned>Math.PI*.9},{id:"thrust",text:n=>`${n("thrust")} to thrust`,done:n=>n.thrust>.7},{id:"fire",text:n=>`${n("fire")} to fire \u2014 hold for auto-fire, but watch the heat`,done:n=>n.shots>=4},{id:"shield",text:n=>`${n("shield")} for the shield \u2014 it smashes small rocks`,done:n=>n.shield>.5},{id:"hyperspace",text:n=>`${n("hyperspace")} to hyperspace out of trouble`,done:n=>n.jumps>=1},{id:"go",text:()=>"Clear the field. Chain kills for a combo. Good hunting.",done:n=>n.stepTime>3}];function Ep({root:n,getDevice:e,getBindings:t,onFinish:i,sfx:s}){let r=!1,a=null,o=0,l=null,c=0,u=0,h="";function d(v){let g=e();if(bp[g])return`<kbd>${bp[g][v]}</kbd>`;let f=t();return v==="turn"?`${f.left.slice(0,1).map(x=>`<kbd>${hi(x)}</kbd>`).join("")} ${f.right.slice(0,1).map(x=>`<kbd>${hi(x)}</kbd>`).join("")}`:v==="skip"?"<kbd>Enter</kbd>":`<kbd>${hi(f[v][0])}</kbd>`}function p(){if(!r)return;let v=ir[o],g=d("skip"),f=`<span class="step">${u>0?"\u2713 NICE":`${o+1} / ${ir.length}`}</span>
      <span>${v.text(d)}</span>${g&&o<ir.length-1?`<span class="skip">${g} skip</span>`:""}`;f!==h&&(n.innerHTML=f,h=f),n.classList.toggle("done",u>0)}function m(){r&&(r=!1,a&&(a.options.training=!1),n.classList.remove("visible"),i())}return{get active(){return r},start(v,{training:g=!0}={}){a=v,r=!0,o=0,u=0,l={turned:0,thrust:0,shots:0,shield:0,jumps:0,stepTime:0},c=v.ship.angle,a.options.training=g,h="",n.classList.add("visible"),p()},skip:m,stop(){r&&(r=!1,a&&(a.options.training=!1),n.classList.remove("visible"))},onEvent(v){r&&(v.type==="shoot"&&l.shots++,v.type==="hyperspaceOut"&&l.jumps++)},update(v){if(!r)return;let g=a.mode==="playing"&&!a.paused;if(n.classList.toggle("visible",g),!g)return;let{ship:f}=a;if(l.turned+=Math.abs(f.angle-c),c=f.angle,f.boosting&&(l.thrust+=v),f.shieldActive&&(l.shield+=v),l.stepTime+=v,u>0){if(u-=v,u<=0&&(o++,l.stepTime=0,o>=ir.length))return m()}else if(ir[o].done(l)){if(o===ir.length-1)return m();u=.7,s?.uiSelect()}p()}}}var eS=200,tS=5e3,nS=["rock","ice","plasma"];function wp(n,e,t){let i=t.has("debug")||t.has("stress"),s=t.has("stress"),r=null;i&&(r=document.createElement("div"),r.className="debug",document.body.appendChild(r));let a=[],o={sim:0,render:0},l=0;function c(){let{rng:u,fxRng:h,world:d}=n;for(n.ship.invulnerable=999;n.asteroids.length<eS;){let m=nS[n.asteroids.length%3];n.asteroids.push(xi(n,{x:u.next()*d.width,y:u.next()*d.height,size:8+u.next()*22,vx:u.signed(160),vy:u.signed(160),type:m,hue:(m==="rock"?30:m==="ice"?200:315)/360,sat:.7,light:.55}))}let p=Math.min(tS,n.fx.particleCap);for(let m=0;n.fx.particles.length<p&&m<1e3;m++)ln(n.fx,h,h.next()*d.width,h.next()*d.height,[255,200,120],40)}return{beforeFrame(){s&&n.mode!=="over"&&c()},afterFrame(u,h,{simMs:d=0,renderMs:p=0,quality:m=""}={}){if(o.sim+=(d-o.sim)*.05,o.render+=(p-o.render)*.05,!r||(a.push(u),a.length>120&&a.shift(),h-l<.25))return;l=h;let v=a.reduce((x,A)=>x+A,0)/a.length,g=Math.max(...a),f=e.stats();r.textContent=[`fps        ${(1/v).toFixed(0)}`,`frame avg  ${(v*1e3).toFixed(1)} ms  worst ${(g*1e3).toFixed(1)} ms`,`cpu sim    ${o.sim.toFixed(2)} ms  render ${o.render.toFixed(2)} ms`,`quality    ${m}`,`draw calls ${f.calls}`,`triangles  ${f.triangles}`,`sprites    ${f.sprites}`,`asteroids  ${n.asteroids.length}`,`particles  ${n.fx.particles.length}`,`seed       ${n.seed}`].join(`
`)},stats:()=>{let u=a.reduce((h,d)=>h+d,0)/Math.max(1,a.length);return{fps:1/u,avgMs:u*1e3,worstMs:Math.max(...a)*1e3,cpuSimMs:o.sim,cpuRenderMs:o.render,...e.stats()}}}}var fi=new URLSearchParams(location.search),sS=["campaign","endless","daily"],Eo=()=>Math.random()*2**32>>>0,rS=n=>fi.has("seed")?Number(fi.get("seed"))>>>0:n==="daily"?Nh():Eo(),Mn=Uh(void 0,{reducedMotion:window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}),Cu=Lh(),Dp=n=>({autoFire:n.fireMode==="hold",assist:n.assist}),ge=Ch({width:innerWidth,height:innerHeight,seed:Eo(),options:Dp(Mn.get()),runMode:"endless"}),cs=Wh(),Ye=Xh(cs),Pn=qh(cs);cs.onUnlock(()=>Pn.start());var Uu=()=>cs.unlock(),wo="keyboard";window.addEventListener("pointerdown",n=>{Uu(),n.pointerType==="touch"&&(wo="touch")});var Ip=Oh(window,{onFirstInput:()=>{Uu(),wo="keyboard"}}),In=kh(),aS=zh({onFirstTouch:Uu}),Ru=Hh({keyboard:Ip,gamepad:In,touch:aS,getShipAngle:()=>ge.ship.angle}),oS=Vh(),fn=xp(document.getElementById("game")),rt=yp(),Du=wp(ge,fn,fi),Or=Tu({root:document.getElementById("menu"),settings:Mn,sfx:Ye,onResume:()=>Zr(ge,!1),onQuit:()=>kr()}),us=null,lS=Tu({root:document.getElementById("titleSettingsMenu"),settings:Mn,sfx:Ye,resumeLabel:"\u2190 Back",onResume:()=>us.back()});us=_p({settings:Mn,highScores:Cu,sfx:Ye,settingsMenu:lS,onStart:n=>bo(n),onTutorial:()=>bo("campaign",{tutorial:!0})});var di=Ep({root:document.getElementById("coach"),getDevice:()=>wo,getBindings:()=>Mn.get().bindings,onFinish:()=>Mn.set("tutorialDone",!0),sfx:Ye}),cS=mp(fn.renderer),Pp=gp(),_o=null;function uS(n){let e=n.quality==="auto"?cS:n.quality;e!==_o&&(_o=e,Pp.reset(),fn.setRenderScale(1),fn.setQuality(e))}var Up=zo(Mn.get()),Iu=1;Mn.subscribe(n=>{uS(n),Ip.setBindings(n.bindings),rt.setBindings(n.bindings,hi),cs.setVolumes(n),ge.options={...Dp(n),training:ge.options?.training??!1},Up=zo(n),Iu=n.gameSpeed});var Un="title",Tp=0;function kr(){Un="title",di.stop(),qr(ge,{seed:Eo(),runMode:"endless"}),ge.options.training=!1,rt.reset(),document.body.classList.add("screen-title"),us.show(),fn.reseedBackground(),Pn.setSector(0),Pn.start()}function bo(n,{tutorial:e=!1}={}){Un="game",us.hide(),document.body.classList.remove("screen-title"),rt.reset(),qr(ge,{seed:rS(n),runMode:sS.includes(n)?n:"campaign",intro:!0}),ge.options.training=!1,Ye.uiSelect(),Pn.start(),e||n==="campaign"&&!Mn.get().tutorialDone?di.start(ge,{training:e}):di.stop()}function Bp(){bo(ge.runMode)}document.getElementById("gameOver").addEventListener("click",n=>{n.target.closest("[data-action]")?.dataset.action==="title"?kr():Bp()});var Cp={Digit1:0,Digit2:1,Digit3:2,Numpad1:0,Numpad2:1,Numpad3:2,ArrowLeft:"left",ArrowRight:"right",Enter:"confirm",Space:"confirm"};window.addEventListener("keydown",n=>{let e=()=>{n.preventDefault(),n.stopPropagation()};if(Un==="title"){us.handleKey(n)&&e();return}if(Or.handleKey(n))return e();if(ge.mode==="over"&&(n.code==="Escape"||n.code==="KeyT")){e(),kr();return}if(ge.mode==="upgrade"&&!ge.paused&&n.code in Cp){e(),!n.repeat&&rt.upgradeNav(Cp[n.code])&&Ye.uiMove();return}di.active&&!ge.paused&&n.code==="Enter"&&(e(),di.skip())},!0);rt.cardsElement.addEventListener("click",n=>{let e=n.target.closest(".card");e&&rt.upgradeNav(Number(e.dataset.index))});function Lp(){Rh(ge,innerWidth,innerHeight),fn.resize(innerWidth,innerHeight)}addEventListener("resize",Lp);Lp();document.addEventListener("visibilitychange",()=>{document.hidden&&Un==="game"&&Zr(ge,!0)});function hS(){for(let n of ge.events)if(fn.onEvent(n),Un!=="title")switch(di.onEvent(n),n.type){case"runStarted":fn.reseedBackground(),Pn.setSector(0);break;case"shoot":Ye.shoot(n),In.rumble(0,.12,35);break;case"bounce":Ye.bounce(n);break;case"asteroidDestroyed":Ye.asteroidBreak(n),rt.popScore(n.x,n.y,n.points,n.hue),In.rumble(n.size>25?.35:.1,.3,n.size>25?120:60);break;case"asteroidHit":Ye.clank(n);break;case"deflect":Ye.deflect(n);break;case"blast":Ye.blast(n),In.rumble(.5,.4,180);break;case"comboUp":Ye.comboUp(n.multiplier),rt.toast(`\xD7${n.multiplier} COMBO`);break;case"overheated":Ye.overheated(),rt.toast("OVERHEAT","#ff6b4b");break;case"dryFire":Ye.dryFire();break;case"hyperspaceOut":Ye.hyperspace(!0);break;case"hyperspaceIn":Ye.hyperspace(!1),n.misjump&&rt.toast("MISJUMP","#ff9a5a");break;case"shieldOn":Ye.shieldOn();break;case"shieldOff":Ye.shieldOff();break;case"shieldHit":case"shieldRam":Ye.shieldHit(n),In.rumble(.2,.3,60);break;case"pickupCollected":Ye.pickup(),rt.toast(on[n.kind].label,on[n.kind].color);break;case"enemySpawned":rt.toast(n.kind==="small"?"HUNTER INBOUND":"SAUCER INBOUND","#ff8a7a");break;case"enemyShot":Ye.enemyShot(n);break;case"enemyDestroyed":Ye.asteroidBreak({size:30,x:n.x,y:n.y}),n.points&&rt.popScore(n.x,n.y,n.points,.95),In.rumble(.4,.4,120);break;case"cometIncoming":rt.toast("COMET","#bff4ff");break;case"waveStarted":n.boss?(Ye.bossRoar(),rt.toast("BOSS INCOMING","#ff6b6b"),In.rumble(.6,.6,600)):n.wave>1&&(Ye.waveChime(),rt.toast(`WAVE ${n.wave}`));break;case"bossHit":Ye.clank(n);break;case"bossShieldHit":Ye.deflect(n);break;case"bossPhase":Ye.bossRoar(),rt.toast("SHIELDS UP","#ff8aa0");break;case"turretDestroyed":Ye.blast(n),rt.popScore(n.x,n.y,n.points,.08);break;case"bossDestroyed":Ye.blast(n),Ye.shipExplosion(n),rt.popScore(n.x,n.y,n.points,.12),rt.toast("BOSS DESTROYED"),In.rumble(1,1,700);break;case"upgradeOffered":Ye.levelUp(),rt.showUpgrades(n.choices,ge.upgrades,e=>Ru.choose(e));break;case"upgradeChosen":Ye.uiSelect(),rt.hideUpgrades();break;case"shipDestroyed":Ye.shipExplosion(n),In.rumble(.9,.6,350);break;case"levelUp":n.level>1&&Ye.levelUp(),rt.showLevelUp(n.intro,n.level),fn.reseedBackground(),Pn.setSector((n.level-1)%3);break;case"transitionEnded":rt.hideLevelUp();break;case"paused":rt.showPaused(!0),Or.open(!0);break;case"resumed":rt.showPaused(!1),Or.open(!1);break;case"gameOver":di.stop(),Ye.gameOver(),rt.showGameOver(!1,Rp()),Pn.stop();break;case"won":Ye.win(),rt.showGameOver(!0,Rp()),Pn.stop(3);break}ge.events.length=0}function Rp(){let n=ge.score>0?Cu.record(ge.runMode,{score:ge.score,sector:ge.level}):null;return{score:ge.score,best:Cu.best(ge.runMode),rank:n,mode:ge.runMode,sector:ge.level,bestCombo:ge.combo.best,time:ge.runTime,shots:ge.tally.shots,hits:ge.tally.hits,kills:ge.tally.kills,upgrades:Object.entries(ge.upgrades).map(([e,t])=>`${fs[e].name}${t>1?` \xD7${t}`:""}`)}}var So=0;function fS(){if(Un==="title")return .25;if(ge.mode!=="playing")return .15;let{ship:n,world:e}=ge,t=1/0;for(let a of ge.asteroids){let o=Math.hypot(Ze(a.x-n.x,e.width),Ze(a.y-n.y,e.height))-a.size;o<t&&(t=o)}let i=Math.max(0,Math.min(1,1-t/260)),s=Math.min(1,ge.asteroids.length/14),r=ge.boss?.45:0;return Math.min(1,.15+s*.3+i*.45+(ge.level-1)%3*.12+(ge.lives===1?.1:0)+r)}var Pu=0,dS=Gu({hz:60,step:n=>{let e=performance.now();if(Un==="title")Ru.snapshot(),Oo(ge,oS(ge),n);else{let t=Ru.snapshot();ge.mode==="over"&&t.pressed.restart?Bp():Oo(ge,t,n)}Pu+=performance.now()-e}});Vu(dS,({alpha:n,frameSeconds:e,now:t})=>{In.poll();let i=In.takeMenu();if(Object.values(i).some(Boolean)&&(wo="gamepad"),Un==="title"?(us.navigate(i),ge.mode==="over"&&(Tp+=e)>2.5&&(Tp=0,qr(ge,{seed:Eo(),runMode:"endless"}))):ge.paused?Or.navigate(i):ge.mode==="upgrade"?(i.left&&rt.upgradeNav("left"),i.right&&rt.upgradeNav("right"),i.confirm&&rt.upgradeNav("confirm")):ge.mode==="over"&&i.back&&kr(),ge.fx.particleCap=tr[_o].particleCap,Mn.get().quality==="auto"&&!ge.paused){let o=Pp.sample(e);o!==null&&fn.setRenderScale(o)}Du.beforeFrame(),hS();let s=qu((ge.level-1)%3+1),r=performance.now();fn.render(ge,{alpha:ge.paused?1:n,frameSeconds:e,now:t,theme:s,effects:Up});let a=performance.now()-r;Un==="game"&&(rt.update(ge,s,e),di.update(e*Iu)),cs.setListener(ge.ship.x,ge.ship.y,ge.world.width,ge.world.height),Ye.setThrust(Un==="game"&&ge.mode==="playing"&&!ge.paused&&ge.ship.boosting),So+=(fS()-So)*(1-Math.exp(-e*1.5)),Pn.setIntensity(So),Pn.setMuffled(ge.paused||ge.mode==="transition"||ge.mode==="upgrade"),Du.afterFrame(e,t,{simMs:Pu,renderMs:a,quality:`${_o}${Mn.get().quality==="auto"?" (auto)":""} @ ${fn.pixelRatio.toFixed(2)}\xD7`}),Pu=0},{timeScale:()=>Un==="game"?Iu:1});fi.has("mode")||fi.has("play")||fi.has("stress")?bo(fi.get("mode")??"campaign"):kr();window.__game=ge;window.__debug=Du;window.__settings=Mn;(fi.has("debug")||fi.has("stress"))&&(window.__render=fn.debugHandles,window.__audio={engine:cs,music:Pn,get intensity(){return So}},window.__menu=Or,window.__title=us,window.__tutorial=di);})();
/*! Bundled license information:

three/build/three.module.js:
  (**
   * @license
   * Copyright 2010-2024 Three.js Authors
   * SPDX-License-Identifier: MIT
   *)

postprocessing/build/index.js:
  (**
   * postprocessing v6.37.8 build Fri Sep 12 2025
   * https://github.com/pmndrs/postprocessing
   * Copyright 2015-2025 Raoul van Rüschen
   * @license Zlib
   *)
*/
</script>
  <script>
  (() => {
    document.querySelectorAll("[data-back-to-games]").forEach(link => {
      link.addEventListener("pointerdown", e => e.stopPropagation());
      link.addEventListener("click", e => {
        e.stopPropagation();
        try {
          localStorage.setItem("archive_menu_hidden", "false");
          window.parent?.dispatchEvent(new Event("archive-menu-toggle"));
        } catch {}
      });
    });
    document.querySelectorAll("[data-github-link]").forEach(link => {
      link.addEventListener("pointerdown", e => e.stopPropagation());
      link.addEventListener("click", e => e.stopPropagation());
    });
    async function toggleFull() {
      try {
        const pDoc = window.parent?.document;
        const fsEl = pDoc?.fullscreenElement || document.fullscreenElement;
        if (!fsEl) {
          const target = window.frameElement || document.documentElement;
          await target.requestFullscreen();
        } else if (pDoc?.fullscreenElement) {
          await pDoc.exitFullscreen();
        } else if (document.fullscreenElement) {
          await document.exitFullscreen();
        }
      } catch {
        try {
          if (!document.fullscreenElement) await document.documentElement.requestFullscreen();
          else await document.exitFullscreen();
        } catch {}
      }
    }
    document.querySelectorAll("[data-fullscreen-toggle]").forEach(btn => {
      btn.addEventListener("pointerdown", e => e.stopPropagation());
      btn.addEventListener("click", e => {
        e.stopPropagation();
        btn.blur();
        void toggleFull();
      });
    });
  })();
  </script>
</body>
</html>
MikeHiggins.me.uk LinkedIn GitHub Bluesky Contra Upwork
© 2026 Mike Higgins. All rights reserved.