three实现三维树林生存塔防策略游戏代码

代码语言:html

所属分类:其他

代码由minimax-m3.1-flash ai生成,可能有错误,仅供参考:点击查看提示词

代码描述:三维树林生存塔防策略游戏

代码标签: three 三维 树林 生存 塔防 策略 游戏 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<title>荒野守卫 · 3D 生存塔防</title>
<style>
/* ================================================================
 *  荒野守卫 · 3D 生存塔防   —— 界面样式
 *  设计基调:深色半透明玻璃面板 + 琥珀/天蓝双色强调
 * ================================================================ */

:root {
  --bg-panel: rgba(12, 16, 22, 0.72);
  --bg-panel-solid: rgba(12, 16, 22, 0.94);
  --stroke: rgba(255, 255, 255, 0.10);
  --stroke-strong: rgba(255, 255, 255, 0.20);
  --text: #e8edf3;
  --text-dim: #93a1b2;
  --amber: #f2b134;
  --sky: #6ec6ff;
  --green: #5fd08a;
  --red: #ff6b6b;
  --purple: #b08bff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05070a;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; }
canvas { display: block; width: 100%; height: 100%; }

/* ---------- 通用面板 ---------- */
.panel {
  position: absolute;
  background: var(--bg-panel);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
  color: var(--text);
}
.panel h3 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
}
.hidden { display: none !important; }

/* ---------- 左上角:生存状态面板 ---------- */
#survival {
  top: 14px; left: 14px; width: 232px;
}
.surv-row { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.surv-row:last-child { margin-bottom: 0; }
.surv-icon { width: 18px; text-align: center; font-size: 13px; opacity: .9; }
.surv-label { width: 34px; font-size: 12px; color: var(--text-dim); }
.surv-track {
  flex: 1; height: 11px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden; position: relative;
  border: 1px solid rgba(0, 0, 0, .25);
}
.surv-fill {
  display: block;          /* <i> 默认是行内元素,必须转块级才能撑满高度 */
  height: 100%; width: 100%; border-radius: 6px;
  transition: width .18s linear, background .3s;
}
.surv-val { width: 30px; text-align: right; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.surv-row.low .surv-val { color: var(--red); }
.surv-row.low .surv-track { box-shadow: 0 0 0 1px rgba(255, 107, 107, .55); }

#hp-row .surv-fill { background: linear-gradient(90deg, #d64545, #ff8080); }

/* ---------- 顶部中间:昼夜与波次 ---------- */
#clock {
  top: 14px; left: 50%; transform: translateX(-50%);
  min-width: 260px; text-align: center; padding: 8px 18px;
}
#clock .phase { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
#clock .phase.day { color: var(--amber); }
#clock .phase.night { color: #8fb6ff; }
#clock .sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; letter-spacing: .5px; }
#clock .wave { color: var(--red); font-weight: 700; }

/* ---------- 右上角:资源 ---------- */
#resources {
  top: 14px; right: 14px; min-width: 176px;
}
.res-line { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; padding: 2.5px 0; }
.res-line .nm { color: var(--text-dim); }
.res-line .vl { font-variant-numeric: tabular-nums; font-weight: 600; }
.res-line .vl.bump { color: var(--green); }

/* ---------- 准星 ---------- */
#crosshair {
  position: absolute; left: 50%; top: 50%; width: 16px; height: 16px;
  margin: -8px 0 0 -8px; pointer-events: none; opacity: .75;
}
#crosshair::before, #crosshair::after {
  content: ""; position: absolute; background: #fff; box-shadow: 0 0 3px #000;
}
#crosshair::before { left: 7px; top: 0; width: 2px; height: 16px; }
#crosshair::after { top: 7px; left: 0; height: 2px; width: 16px; }
#crosshair.hide { display: none; }

/* ---------- 底部中间:交互提示 ---------- */
#prompt {
  left: 50%; bottom: 96px; transform: translateX(-50%);
  padding: 7px 16px; font-size: 13px; letter-spacing: .5px;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
#prompt .key {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 4px;
  background: rgba(255, 255, 255, .14); border: 1px solid var(--stroke-strong);
  font-size: 11px; font-weight: 700; text-align: center;
}
#prompt .chop-bar { width: 120px; height: 6px; border-radius: 4px; background: rgba(0,0,0,.5); overflow: hidden; display:none; }
#prompt .chop-bar > i { display:block; height:100%; width:0%; background: var(--amber); }

/* ---------- 底部左侧:快捷栏 ---------- */
#slots {
  position: absolute; left: 14px; bottom: 14px;
  display: flex; gap: 8px; z-index: 20;
}
.slot {
  width: 58px; padding: 6px 4px; text-align: center; border-radius: 8px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke);
  cursor: pointer; transition: .15s;
}
.slot:hover { background: rgba(255, 255, 255, .12); border-color: var(--stroke-strong); }
.slot .ic { font-size: 19px; line-height: 1.2; }
.slot .nm { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.slot .ct { font-size: 10px; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.slot .num { font-size: 9px; color: var(--text-dim); }
.slot.empty { opacity: .38; }

/* ---------- 右侧:建造菜单 ---------- */
#build {
  top: 50%; right: 14px; transform: translateY(-50%);
  width: 236px; max-height: 76vh; overflow-y: auto;
}
#build .b-item {
  display: flex; gap: 9px; align-items: flex-start; padding: 8px;
  border-radius: 8px; border: 1px solid transparent; cursor: pointer; transition: .15s;
}
#build .b-item:hover { background: rgba(255, 255, 255, .07); }
#build .b-item.sel { background: rgba(110, 198, 255, .14); border-color: rgba(110, 198, 255, .5); }
#build .b-item.locked { opacity: .42; }
#build .b-ic { font-size: 20px; width: 26px; text-align: center; }
#build .b-nm { font-size: 13px; font-weight: 600; }
#build .b-desc { font-size: 11px; color: var(--text-dim); margin: 2px 0 4px; line-height: 1.35; }
.cost { display: inline-block; font-size: 11px; margin-right: 7px; color: var(--text-dim); }
.cost.ok { color: var(--green); }
.cost.no { color: var(--red); }
.hint { font-size: 11px; color: var(--text-dim); line-height: 1.6; }
.hint b { color: var(--sky); font-weight: 600; }

/* ---------- 弹窗:背包 / 制作 ---------- */
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--bg-panel-solid);
  border: 1px solid var(--stroke); border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  backdrop-filter: blur(10px); padding: 16px 18px; z-index: 40;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 15px; letter-spacing: 1px; }
.modal-head .x {
  cursor: pointer; font-size: 18px; line-height: 1; color: var(--text-dim);
  width: 24px; height: 24px; text-align: center; border-radius: 5px;
}
.modal-head .x:hover { background: rgba(255,255,255,.1); color: #fff; }
#bag { width: 520px; }
.eq-row { display: flex; gap: 9px; margin-bottom: 12px; }
.eq-slot {
  flex: 1; text-align: center; padding: 8px 4px; border-radius: 8px;
  background: rgba(255,255,255,.05); border: 1px dashed var(--stroke-strong); font-size: 11px;
}
.eq-slot .ic { font-size: 20px; }
.eq-slot .nm { color: var(--text-dim); margin-top: 3px; }
.eq-slot.filled { border-style: solid; background: rgba(110,198,255,.12); }
.bag-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.bag-cell {
  background: rgba(255,255,255,.05); border: 1px solid var(--stroke); border-radius: 8px;
  padding: 9px 4px; text-align: center; cursor: pointer; transition: .15s; position: relative;
}
.bag-cell:hover { background: rgba(255,255,255,.12); border-color: var(--stroke-strong); }
.bag-cell .ic { font-size: 22px; }
.bag-cell .nm { font-size: 10.5px; margin-top: 3px; }
.bag-cell .ct { font-size: 11px; font-weight: 700; color: var(--amber); }
.bag-cell .use {
  position: absolute; top: 3px; right: 4px; font-size: 9px; color: var(--sky);
  opacity: 0; transition: .15s;
}
.bag-cell:hover .use { opacity: 1; }
.modal-foot { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; }
.btn {
  padding: 6px 13px; border-radius: 7px; font-size: 12px; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid var(--stroke); transition: .15s;
}
.btn:hover { background: rgba(255,255,255,.17); }
.btn.primary { background: rgba(110,198,255,.22); border-color: rgba(110,198,255,.5); color: #dff1ff; }
.btn.primary:hover { background: rgba(110,198,255,.34); }
.btn:disabled, .btn.disabled { opacity: .4; cursor: not-allowed; }

#craft { width: 470px; }
.recipe {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border: 1px solid var(--stroke); border-radius: 9px; margin-bottom: 8px; background: rgba(255,255,255,.04);
}
.recipe .ric { font-size: 22px; width: 30px; text-align: center; }
.recipe .rnm { font-size: 13px; font-weight: 600; }
.recipe .rdesc { font-size: 11px; color: var(--text-dim); margin: 2px 0 5px; }
.recipe .rbtn { margin-left: auto; }
.recipe .rreq { flex: 1; }

/* ---------- 提示消息 ---------- */
#toasts {
  position: absolute; left: 50%; top: 108px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 30;
}
.toast {
  padding: 6px 14px; border-radius: 20px; font-size: 12.5px;
  background: rgba(12,16,22,.86); border: 1px solid var(--stroke);
  animation: toastIn .25s ease-out;
}
.toast.good { color: var(--green); }
.toast.bad { color: var(--red); }
.toast.info { color: var(--sky); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 全屏遮罩(开始 / 结束) ---------- */
#overlay {
  position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: radial-gradient(circle at 50% 42%, rgba(24, 32, 44, .82), rgba(4, 6, 9, .96));
  backdrop-filter: blur(4px); text-align: center; padding: 20px;
}
#overlay h1 { font-size: 40px; margin: 0; letter-spacing: 8px; color: var(--amber); text-shadow: 0 4px 26px rgba(242,177,52,.35); }
#overlay h2 { font-size: 22px; margin: 0; letter-spacing: 3px; color: var(--red); }
#overlay p { margin: 0; max-width: 560px; font-size: 13.5px; line-height: 1.9; color: var(--text-dim); }
#overlay .keys { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; max-width: 640px; margin-top: 4px; }
#overlay .keys span { font-size: 12px; color: var(--text-dim); }
#overlay .keys b {
  display: inline-block; padding: 1px 7px; border-radius: 4px; margin-right: 5px;
  background: rgba(255,255,255,.12); border: 1px solid var(--stroke-strong); color: var(--text); font-size: 11px;
}
#overlay .start {
  margin-top: 14px; padding: 12px 42px; font-size: 15px; letter-spacing: 3px; cursor: pointer;
  border-radius: 9px; border: 1px solid rgba(242,177,52,.55); color: #ffe9bd;
  background: linear-gradient(180deg, rgba(242,177,52,.28), rgba(242,177,52,.12));
}
#overlay .start:hover { background: linear-gradient(180deg, rgba(242,177,52,.42), rgba(242,177,52,.2)); }
#overlay .tip { font-size: 11.5px; color: rgba(147,161,178,.72); }

/* ---------- 建造模式提示条 ---------- */
#buildbar {
  left: 50%; bottom: 20px; transform: translateX(-50%);
  padding: 8px 18px; font-size: 12.5px; display: flex; gap: 16px; align-items: center; z-index: 20;
}
#buildbar .ok { color: var(--green); }
#buildbar .no { color: var(--red); }

/* ---------- 伤害/寒冷提示 ---------- */
#statuswarn {
  position: absolute; inset: 0; pointer-events: none; z-index: 25; opacity: 0;
  transition: opacity .4s; background: radial-gradient(circle at 50% 50%, transparent 45%, rgba(120, 0, 0, .55) 100%);
}
#statuswarn.show { opacity: 1; }
#statuswarn.cold { background: radial-gradient(circle at 50% 50%, transparent 45%, rgba(0, 60, 120, .55) 100%); }

#fps {
  position: absolute; right: 14px; bottom: 14px; font-size: 11px; color: var(--text-dim);
  background: rgba(12,16,22,.6); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--stroke);
  font-variant-numeric: tabular-nums;
}

</style>
</head>
<body>
<div id="app">
  <div id="scene-root"></div>

  <!-- 生存状态面板 -->
  <div class="panel" id="survival">
    <h3>生存状态</h3>
    <div class="surv-row" id="row-hunger"><span class="surv-icon">🍖</span><span class="surv-label">饥饿</span><span class="surv-track"><i class="surv-fill" id="bar-hunger"></i></span><span class="surv-val" id="val-hunger">100</span></div>
    <div class="surv-row" id="row-thirst"><span class="surv-icon">💧</span><span class="surv-label">口渴</span><span class="surv-track"><i class="surv-fill" id="bar-thirst"></i></span><span class="surv-val" id="val-thirst">100</span></div>
    <div class="surv-row" id="row-warm"><span class="surv-icon">🔥</span><span class="surv-label">温暖</span><span class="surv-track"><i class="surv-fill" id="bar-warm"></i></span><span class="surv-val" id="val-warm">100</span></div>
    <div class="surv-row" id="row-stam"><span class="surv-icon">⚡</span><span class="surv-label">体力</span><span class="surv-track"><i class="surv-fill" id="bar-stam"></i></span><span class="surv-val" id="val-stam">100</span></div>
    <div class="surv-row" id="row-hp"><span class="surv-icon">❤️</span><span class="surv-label">生命</span><span class="surv-track"><i class="surv-fill" id="bar-hp"></i></span><span class="surv-val" id="val-hp">100</span></div>
  </div>

  <!-- 昼夜时钟 -->
  <div class="panel" id="clock">
    <div class="phase day" id="phase-name">☀ 第 1 天 · 白天</div>
    <div class="sub" id="phase-sub">距天黑还有 96 秒</div>
  </div>

  <!-- 资源 -->
  <div class="panel" id="resources">
    <div class="res-line"><span class="nm">🪵 木材</span><span class="vl" id="r-wood">0</span></div>
    <div class="res-line"><span class="nm">🪨 石头</span><span class="vl" id="r-stone">0</span></div>
    <div class="res-line"><span class="nm">🌿 草药</span><span class="vl" id="r-herb">0</span></div>
    <div class="res-line"><span class="nm">🥩 兽肉</span><span class="vl" id="r-meat">0</span></div>
    <div class="res-line"><span class="nm">🟤 兽皮</span><span class="vl" id="r-hide">0</span></div>
    <div class="res-line"><span class="nm">🏹 箭矢</span><span class="vl" id="r-arrow">0</span></div>
  </div>

  <!-- 准星 -->
  <div id="crosshair"></div>

  <!-- 交互提示 -->
  <div class="panel hidden" id="prompt">
    <span id="prompt-text"></span>
    <span class="chop-bar" id="chop-bar"><i></i></span>
  </div>

  <!-- 快捷栏 -->
  <div id="slots"></div>

  <!-- 建造菜单 -->
  <div class="panel hidden" id="build">
    <h3>建造 · B</h3>
    <div id="build-list"></div>
    <div class="hint" style="margin-top:8px">
      选择建筑后进入放置模式:<b>移动鼠标</b>调整位置,<b>Q/E</b>旋转 90°,<b>左键</b>确认放置,<b>右键/Esc</b>取消。<br/>
      木拒马可以阻挡怪物路线,请用它封堵营地侧面的缺口。
    </div>
  </div>

  <!-- 背包 -->
  <div class="modal hidden" id="bag">
    <div class="modal-head"><h2>背包 · 整理与装备</h2><span class="x" id="bag-close">✕</span></div>
    <div class="eq-row" id="equip-row"></div>
    <div class="bag-grid" id="bag-grid"></div>
    <div class="modal-foot">
      <span class="hint">点击物品使用 · 「整理」按类型排序</span>
      <span>
        <span class="btn" id="bag-sort">整理</span>
        <span class="btn primary" id="bag-done">关闭 (I)</span>
      </span>
    </div>
  </div>

  <!-- 制作 -->
  <div class="modal hidden" id="craft">
    <div class="modal-head"><h2>工作台 · 制作</h2><span class="x" id="craft-close">✕</span></div>
    <div id="craft-list"></div>
    <div class="modal-foot">
      <span class="hint" id="craft-hint">靠近工作台后可在此制作道具</span>
      <span class="btn primary" id="craft-done">关闭 (C)</span>
    </div>
  </div>

  <!-- 建造提示条 -->
  <div class="panel hidden" id="buildbar">
    <span id="buildbar-txt"></span>
    <span class="hint"><b>Q/E</b> 旋转 · <b>左键</b> 放置 · <b>右键拖动</b> 转视角 · <b>Esc</b> 取消</span>
  </div>

  <div id="toasts"></div>
  <div id="statuswarn"></div>
  <div id="fps">--</div>

  <!-- 开始 / 结束遮罩 -->
  <div id="overlay">
    <h1 id="ov-title">荒野守卫</h1>
    <h2 id="ov-sub" class="hidden"></h2>
    <p id="ov-desc">白天在荒野中采集物资、建造防御;夜幕降临时,怪物会一波波扑向营地中央的木屋。<br/>熬过漫长的夜晚,直到天亮,然后继续活着。</p>
    <div class="keys">
      <span><b>WASD</b>移动</span>
      <span><b>Shift</b>疾跑</span>
      <span><b>鼠标</b>转视角</span>
      <span><b>左键</b>斧击</span>
      <span><b>右键</b>射箭</span>
      <span><b>E</b>采集/交互</span>
      <span><b>B</b>建造</span>
      <span><b>I</b>背包</span>
      <span><b>1-4</b>快捷道具</span>
      <span><b>Esc</b>关闭</span>
    </div>
    <div class="start" id="ov-start">进入荒野</div>
    <div class="tip" id="ov-tip">提示:点击后将锁定鼠标;按 Esc 释放鼠标。</div>
  </div>
</div>

<script>
var THREE=(()=>{var cc=Object.defineProperty;var yp=Object.getOwnPropertyDescriptor;var Mp=Object.getOwnPropertyNames;var Sp=Object.prototype.hasOwnProperty;var bp=(s,t)=>{for(var e in t)cc(s,e,{get:t[e],enumerable:!0})},Ep=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Mp(t))!Sp.call(s,i)&&i!==e&&cc(s,i,{get:()=>t[i],enumerable:!(n=yp(t,i))||n.enumerable});return s};var Ap=s=>Ep(cc({},"__esModule",{value:!0}),s);var hy={};bp(hy,{ACESFilmicToneMapping:()=>vf,AddEquation:()=>Jn,AddOperation:()=>mf,AdditiveAnimationBlendMode:()=>Kh,AdditiveBlending:()=>qc,AgXToneMapping:()=>Mf,AlphaFormat:()=>Af,AlwaysCompare:()=>qf,AlwaysDepth:()=>cf,AlwaysStencilFunc:()=>bl,AmbientLight:()=>ko,AnimationAction:()=>Ko,AnimationClip:()=>Fi,AnimationLoader:()=>th,AnimationMixer:()=>_h,AnimationObjectGroup:()=>gh,AnimationUtils:()=>Yv,ArcCurve:()=>so,ArrayCamera:()=>Wa,ArrowHelper:()=>zh,AttachedBindMode:()=>Kc,Audio:()=>Jo,AudioAnalyser:()=>ph,AudioContext:()=>Ur,AudioListener:()=>dh,AudioLoader:()=>hh,AxesHelper:()=>Vh,BackSide:()=>Ve,BasicDepthPacking:()=>Ff,BasicShadowMap:()=>Cp,BatchedMesh:()=>eo,Bone:()=>pr,BooleanKeyframeTrack:()=>Vn,Box2:()=>Th,Box3:()=>we,Box3Helper:()=>Fh,BoxGeometry:()=>Ri,BoxHelper:()=>Oh,BufferAttribute:()=>Zt,BufferGeometry:()=>Ft,BufferGeometryLoader:()=>Yo,ByteType:()=>bf,Cache:()=>In,Camera:()=>xs,CameraHelper:()=>Nh,CanvasTexture:()=>Jl,CapsuleGeometry:()=>ho,CatmullRomCurve3:()=>ro,CineonToneMapping:()=>xf,CircleGeometry:()=>uo,ClampToEdgeWrapping:()=>Ue,Clock:()=>Zo,Color:()=>ft,ColorKeyframeTrack:()=>Cr,ColorManagement:()=>jt,CompressedArrayTexture:()=>Yl,CompressedCubeTexture:()=>Zl,CompressedTexture:()=>ys,CompressedTextureLoader:()=>eh,ConeGeometry:()=>fo,ConstantAlphaFactor:()=>rf,ConstantColorFactor:()=>nf,CubeCamera:()=>Ha,CubeReflectionMapping:()=>Bn,CubeRefractionMapping:()=>ti,CubeTexture:()=>Ci,CubeTextureLoader:()=>nh,CubeUVReflectionMapping:()=>bs,CubicBezierCurve:()=>gr,CubicBezierCurve3:()=>ao,CubicInterpolant:()=>Do,CullFaceBack:()=>Xc,CullFaceFront:()=>Hd,CullFaceFrontBack:()=>Rp,CullFaceNone:()=>kd,Curve:()=>$e,CurvePath:()=>lo,CustomBlending:()=>Wd,CustomToneMapping:()=>yf,CylinderGeometry:()=>Ss,Cylindrical:()=>Ah,Data3DTexture:()=>sr,DataArrayTexture:()=>ms,DataTexture:()=>Nn,DataTextureLoader:()=>ih,DataUtils:()=>Um,DecrementStencilOp:()=>Bp,DecrementWrapStencilOp:()=>Vp,DefaultLoadingManager:()=>up,DepthFormat:()=>Qn,DepthStencilFormat:()=>wi,DepthTexture:()=>hr,DetachedBindMode:()=>Sf,DirectionalLight:()=>Vo,DirectionalLightHelper:()=>Dh,DiscreteInterpolant:()=>No,DisplayP3ColorSpace:()=>ec,DodecahedronGeometry:()=>po,DoubleSide:()=>pn,DstAlphaFactor:()=>Kd,DstColorFactor:()=>jd,DynamicCopyUsage:()=>em,DynamicDrawUsage:()=>Jp,DynamicReadUsage:()=>Qp,EdgesGeometry:()=>mo,EllipseCurve:()=>Ms,EqualCompare:()=>Hf,EqualDepth:()=>hf,EqualStencilFunc:()=>Wp,EquirectangularReflectionMapping:()=>Xs,EquirectangularRefractionMapping:()=>qs,Euler:()=>rr,EventDispatcher:()=>ln,ExtrudeGeometry:()=>go,FileLoader:()=>hn,Float16BufferAttribute:()=>Dl,Float32BufferAttribute:()=>xt,Float64BufferAttribute:()=>Nl,FloatType:()=>on,Fog:()=>Za,FogExp2:()=>Ya,FramebufferTexture:()=>ql,FrontSide:()=>Fn,Frustum:()=>Pi,GLBufferAttribute:()=>Mh,GLSL1:()=>im,GLSL3:()=>El,GreaterCompare:()=>Gf,GreaterDepth:()=>df,GreaterEqualCompare:()=>Xf,GreaterEqualDepth:()=>uf,GreaterEqualStencilFunc:()=>Zp,GreaterStencilFunc:()=>qp,GridHelper:()=>Lh,Group:()=>$n,HalfFloatType:()=>ds,HemisphereLight:()=>Fo,HemisphereLightHelper:()=>Ih,IcosahedronGeometry:()=>_o,ImageBitmapLoader:()=>lh,ImageLoader:()=>Bi,ImageUtils:()=>ir,IncrementStencilOp:()=>Fp,IncrementWrapStencilOp:()=>zp,InstancedBufferAttribute:()=>zn,InstancedBufferGeometry:()=>qo,InstancedInterleavedBuffer:()=>yh,InstancedMesh:()=>to,Int16BufferAttribute:()=>Ll,Int32BufferAttribute:()=>Ul,Int8BufferAttribute:()=>Cl,IntType:()=>Wh,InterleavedBuffer:()=>Ii,InterleavedBufferAttribute:()=>ii,Interpolant:()=>Di,InterpolateDiscrete:()=>Js,InterpolateLinear:()=>$s,InterpolateSmooth:()=>Na,InvertStencilOp:()=>kp,KeepStencilOp:()=>vi,KeyframeTrack:()=>Ke,LOD:()=>Ka,LatheGeometry:()=>Mr,Layers:()=>gs,LessCompare:()=>kf,LessDepth:()=>lf,LessEqualCompare:()=>jh,LessEqualDepth:()=>Ws,LessEqualStencilFunc:()=>Xp,LessStencilFunc:()=>Gp,Light:()=>vn,LightProbe:()=>Wo,Line:()=>xn,Line3:()=>wh,LineBasicMaterial:()=>Re,LineCurve:()=>_r,LineCurve3:()=>oo,LineDashedMaterial:()=>Uo,LineLoop:()=>no,LineSegments:()=>en,LinearDisplayP3ColorSpace:()=>Nr,LinearEncoding:()=>Qh,LinearFilter:()=>pe,LinearInterpolant:()=>Rr,LinearMipMapLinearFilter:()=>Dp,LinearMipMapNearestFilter:()=>Up,LinearMipmapLinearFilter:()=>ei,LinearMipmapNearestFilter:()=>Gh,LinearSRGBColorSpace:()=>gn,LinearToneMapping:()=>gf,LinearTransfer:()=>Qs,Loader:()=>Ne,LoaderUtils:()=>Lr,LoadingManager:()=>Pr,LoopOnce:()=>If,LoopPingPong:()=>Uf,LoopRepeat:()=>Lf,LuminanceAlphaFormat:()=>wf,LuminanceFormat:()=>Tf,MOUSE:()=>Tp,Material:()=>Te,MaterialLoader:()=>Xo,MathUtils:()=>xm,Matrix3:()=>Gt,Matrix4:()=>It,MaxEquation:()=>$c,Mesh:()=>me,MeshBasicMaterial:()=>_n,MeshDepthMaterial:()=>ur,MeshDistanceMaterial:()=>dr,MeshLambertMaterial:()=>Io,MeshMatcapMaterial:()=>Lo,MeshNormalMaterial:()=>Po,MeshPhongMaterial:()=>Ro,MeshPhysicalMaterial:()=>wo,MeshStandardMaterial:()=>wr,MeshToonMaterial:()=>Co,MinEquation:()=>Jc,MirroredRepeatWrapping:()=>Zs,MixOperation:()=>pf,MultiplyBlending:()=>Zc,MultiplyOperation:()=>Dr,NearestFilter:()=>fe,NearestMipMapLinearFilter:()=>Lp,NearestMipMapNearestFilter:()=>Ip,NearestMipmapLinearFilter:()=>Bs,NearestMipmapNearestFilter:()=>Ba,NeverCompare:()=>Vf,NeverDepth:()=>of,NeverStencilFunc:()=>Hp,NoBlending:()=>Ln,NoColorSpace:()=>Ye,NoToneMapping:()=>Un,NormalAnimationBlendMode:()=>tc,NormalBlending:()=>Ai,NotEqualCompare:()=>Wf,NotEqualDepth:()=>ff,NotEqualStencilFunc:()=>Yp,NumberKeyframeTrack:()=>Ni,Object3D:()=>$t,ObjectLoader:()=>ch,ObjectSpaceNormalMap:()=>zf,OctahedronGeometry:()=>Ar,OneFactor:()=>Zd,OneMinusConstantAlphaFactor:()=>af,OneMinusConstantColorFactor:()=>sf,OneMinusDstAlphaFactor:()=>Qd,OneMinusDstColorFactor:()=>tf,OneMinusSrcAlphaFactor:()=>Fa,OneMinusSrcColorFactor:()=>$d,OrthographicCamera:()=>vs,P3Primaries:()=>tr,PCFShadowMap:()=>Hh,PCFSoftShadowMap:()=>Gd,PMREMGenerator:()=>lr,Path:()=>Li,PerspectiveCamera:()=>xe,Plane:()=>fn,PlaneGeometry:()=>cr,PlaneHelper:()=>Bh,PointLight:()=>zo,PointLightHelper:()=>Ph,Points:()=>io,PointsMaterial:()=>mr,PolarGridHelper:()=>Uh,PolyhedronGeometry:()=>si,PositionalAudio:()=>fh,PropertyBinding:()=>Qt,PropertyMixer:()=>$o,QuadraticBezierCurve:()=>xr,QuadraticBezierCurve3:()=>vr,Quaternion:()=>De,QuaternionKeyframeTrack:()=>ri,QuaternionLinearInterpolant:()=>Oo,RED_GREEN_RGTC2_Format:()=>Ml,RED_RGTC1_Format:()=>Pf,REVISION:()=>dy,RGBADepthPacking:()=>Bf,RGBAFormat:()=>He,RGBAIntegerFormat:()=>Jh,RGBA_ASTC_10x10_Format:()=>ml,RGBA_ASTC_10x5_Format:()=>dl,RGBA_ASTC_10x6_Format:()=>fl,RGBA_ASTC_10x8_Format:()=>pl,RGBA_ASTC_12x10_Format:()=>gl,RGBA_ASTC_12x12_Format:()=>_l,RGBA_ASTC_4x4_Format:()=>sl,RGBA_ASTC_5x4_Format:()=>rl,RGBA_ASTC_5x5_Format:()=>al,RGBA_ASTC_6x5_Format:()=>ol,RGBA_ASTC_6x6_Format:()=>cl,RGBA_ASTC_8x5_Format:()=>ll,RGBA_ASTC_8x6_Format:()=>hl,RGBA_ASTC_8x8_Format:()=>ul,RGBA_BPTC_Format:()=>Da,RGBA_ETC2_EAC_Format:()=>il,RGBA_PVRTC_2BPPV1_Format:()=>el,RGBA_PVRTC_4BPPV1_Format:()=>tl,RGBA_S3TC_DXT1_Format:()=>Ia,RGBA_S3TC_DXT3_Format:()=>La,RGBA_S3TC_DXT5_Format:()=>Ua,RGB_BPTC_SIGNED_Format:()=>xl,RGB_BPTC_UNSIGNED_Format:()=>vl,RGB_ETC1_Format:()=>$h,RGB_ETC2_Format:()=>nl,RGB_PVRTC_2BPPV1_Format:()=>jc,RGB_PVRTC_4BPPV1_Format:()=>Qc,RGB_S3TC_DXT1_Format:()=>Pa,RGFormat:()=>Cf,RGIntegerFormat:()=>Zh,RawShaderMaterial:()=>To,Ray:()=>ni,Raycaster:()=>Sh,Rec709Primaries:()=>js,RectAreaLight:()=>Ho,RedFormat:()=>Rf,RedIntegerFormat:()=>Yh,ReinhardToneMapping:()=>_f,RenderTarget:()=>ka,RepeatWrapping:()=>Ys,ReplaceStencilOp:()=>Op,ReverseSubtractEquation:()=>qd,RingGeometry:()=>xo,SIGNED_RED_GREEN_RGTC2_Format:()=>Sl,SIGNED_RED_RGTC1_Format:()=>yl,SRGBColorSpace:()=>_e,SRGBTransfer:()=>se,Scene:()=>Ja,ShaderChunk:()=>Vt,ShaderLib:()=>an,ShaderMaterial:()=>tn,ShadowMaterial:()=>Ao,Shape:()=>On,ShapeGeometry:()=>vo,ShapePath:()=>kh,ShapeUtils:()=>mn,ShortType:()=>Ef,Skeleton:()=>ja,SkeletonHelper:()=>Ch,SkinnedMesh:()=>Qa,Source:()=>Cn,Sphere:()=>Ae,SphereGeometry:()=>Tr,Spherical:()=>Eh,SphericalHarmonics3:()=>Go,SplineCurve:()=>yr,SpotLight:()=>Bo,SpotLightHelper:()=>Rh,Sprite:()=>$a,SpriteMaterial:()=>fr,SrcAlphaFactor:()=>Oa,SrcAlphaSaturateFactor:()=>ef,SrcColorFactor:()=>Jd,StaticCopyUsage:()=>tm,StaticDrawUsage:()=>er,StaticReadUsage:()=>Kp,StereoCamera:()=>uh,StreamCopyUsage:()=>nm,StreamDrawUsage:()=>$p,StreamReadUsage:()=>jp,StringKeyframeTrack:()=>kn,SubtractEquation:()=>Xd,SubtractiveBlending:()=>Yc,TOUCH:()=>wp,TangentSpaceNormalMap:()=>ai,TetrahedronGeometry:()=>yo,Texture:()=>ve,TextureLoader:()=>sh,TorusGeometry:()=>Mo,TorusKnotGeometry:()=>So,Triangle:()=>Pn,TriangleFanDrawMode:()=>Of,TriangleStripDrawMode:()=>Nf,TrianglesDrawMode:()=>Df,TubeGeometry:()=>bo,TwoPassDoubleSide:()=>Pp,UVMapping:()=>Qo,Uint16BufferAttribute:()=>ar,Uint32BufferAttribute:()=>or,Uint8BufferAttribute:()=>Pl,Uint8ClampedBufferAttribute:()=>Il,Uniform:()=>xh,UniformsGroup:()=>vh,UniformsLib:()=>at,UniformsUtils:()=>Kf,UnsignedByteType:()=>Dn,UnsignedInt248Type:()=>Kn,UnsignedIntType:()=>Rn,UnsignedShort4444Type:()=>Xh,UnsignedShort5551Type:()=>qh,UnsignedShortType:()=>jo,VSMShadowMap:()=>dn,Vector2:()=>Z,Vector3:()=>w,Vector4:()=>te,VectorKeyframeTrack:()=>Oi,VideoTexture:()=>Xl,WebGL1Renderer:()=>qa,WebGL3DRenderTarget:()=>wl,WebGLArrayRenderTarget:()=>Tl,WebGLCoordinateSystem:()=>cn,WebGLCubeRenderTarget:()=>Ga,WebGLMultipleRenderTargets:()=>Rl,WebGLRenderTarget:()=>Je,WebGLRenderer:()=>Xa,WebGLUtils:()=>sp,WebGPUCoordinateSystem:()=>fs,WireframeGeometry:()=>Eo,WrapAroundEnding:()=>Ks,ZeroCurvatureEnding:()=>Si,ZeroFactor:()=>Yd,ZeroSlopeEnding:()=>bi,ZeroStencilOp:()=>Np,_SRGBAFormat:()=>za,createCanvasElement:()=>Zf,mergeGeometries:()=>pp,sRGBEncoding:()=>jn});var dy="160",Tp={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},wp={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},kd=0,Xc=1,Hd=2,Rp=3,Cp=0,Hh=1,Gd=2,dn=3,Fn=0,Ve=1,pn=2,Pp=2,Ln=0,Ai=1,qc=2,Yc=3,Zc=4,Wd=5,Jn=100,Xd=101,qd=102,Jc=103,$c=104,Yd=200,Zd=201,Jd=202,$d=203,Oa=204,Fa=205,Kd=206,Qd=207,jd=208,tf=209,ef=210,nf=211,sf=212,rf=213,af=214,of=0,cf=1,lf=2,Ws=3,hf=4,uf=5,df=6,ff=7,Dr=0,pf=1,mf=2,Un=0,gf=1,_f=2,xf=3,vf=4,yf=5,Mf=6,Kc="attached",Sf="detached",Qo=300,Bn=301,ti=302,Xs=303,qs=304,bs=306,Ys=1e3,Ue=1001,Zs=1002,fe=1003,Ba=1004,Ip=1004,Bs=1005,Lp=1005,pe=1006,Gh=1007,Up=1007,ei=1008,Dp=1008,Dn=1009,bf=1010,Ef=1011,jo=1012,Wh=1013,Rn=1014,on=1015,ds=1016,Xh=1017,qh=1018,Kn=1020,Af=1021,He=1023,Tf=1024,wf=1025,Qn=1026,wi=1027,Rf=1028,Yh=1029,Cf=1030,Zh=1031,Jh=1033,Pa=33776,Ia=33777,La=33778,Ua=33779,Qc=35840,jc=35841,tl=35842,el=35843,$h=36196,nl=37492,il=37496,sl=37808,rl=37809,al=37810,ol=37811,cl=37812,ll=37813,hl=37814,ul=37815,dl=37816,fl=37817,pl=37818,ml=37819,gl=37820,_l=37821,Da=36492,xl=36494,vl=36495,Pf=36283,yl=36284,Ml=36285,Sl=36286,If=2200,Lf=2201,Uf=2202,Js=2300,$s=2301,Na=2302,Si=2400,bi=2401,Ks=2402,tc=2500,Kh=2501,Df=0,Nf=1,Of=2,Qh=3e3,jn=3001,Ff=3200,Bf=3201,ai=0,zf=1,Ye="",_e="srgb",gn="srgb-linear",ec="display-p3",Nr="display-p3-linear",Qs="linear",se="srgb",js="rec709",tr="p3",Np=0,vi=7680,Op=7681,Fp=7682,Bp=7683,zp=34055,Vp=34056,kp=5386,Hp=512,Gp=513,Wp=514,Xp=515,qp=516,Yp=517,Zp=518,bl=519,Vf=512,kf=513,Hf=514,jh=515,Gf=516,Wf=517,Xf=518,qf=519,er=35044,Jp=35048,$p=35040,Kp=35045,Qp=35049,jp=35041,tm=35046,em=35050,nm=35042,im="100",El="300 es",za=1035,cn=2e3,fs=2001,ln=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let i=this._listeners[t];if(i!==void 0){let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let n=this._listeners[t.type];if(n!==void 0){t.target=this;let i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,t);t.target=null}}},Pe=["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"],du=1234567,Ti=Math.PI/180,ps=180/Math.PI;function Ze(){let s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Pe[s&255]+Pe[s>>8&255]+Pe[s>>16&255]+Pe[s>>24&255]+"-"+Pe[t&255]+Pe[t>>8&255]+"-"+Pe[t>>16&15|64]+Pe[t>>24&255]+"-"+Pe[e&63|128]+Pe[e>>8&255]+"-"+Pe[e>>16&255]+Pe[e>>24&255]+Pe[n&255]+Pe[n>>8&255]+Pe[n>>16&255]+Pe[n>>24&255]).toLowerCase()}function he(s,t,e){return Math.max(t,Math.min(e,s))}function tu(s,t){return(s%t+t)%t}function sm(s,t,e,n,i){return n+(s-t)*(i-n)/(e-t)}function rm(s,t,e){return s!==t?(e-s)/(t-s):0}function zs(s,t,e){return(1-e)*s+e*t}function am(s,t,e,n){return zs(s,t,1-Math.exp(-e*n))}function om(s,t=1){return t-Math.abs(tu(s,t*2)-t)}function cm(s,t,e){return s<=t?0:s>=e?1:(s=(s-t)/(e-t),s*s*(3-2*s))}function lm(s,t,e){return s<=t?0:s>=e?1:(s=(s-t)/(e-t),s*s*s*(s*(s*6-15)+10))}function hm(s,t){return s+Math.floor(Math.random()*(t-s+1))}function um(s,t){return s+Math.random()*(t-s)}function dm(s){return s*(.5-Math.random())}function fm(s){s!==void 0&&(du=s);let t=du+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function pm(s){return s*Ti}function mm(s){return s*ps}function Al(s){return(s&s-1)===0&&s!==0}function gm(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Va(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function _m(s,t,e,n,i){let r=Math.cos,a=Math.sin,o=r(e/2),c=a(e/2),l=r((t+n)/2),h=a((t+n)/2),u=r((t-n)/2),d=a((t-n)/2),f=r((n-t)/2),m=a((n-t)/2);switch(i){case"XYX":s.set(o*h,c*u,c*d,o*l);break;case"YZY":s.set(c*d,o*h,c*u,o*l);break;case"ZXZ":s.set(c*u,c*d,o*h,o*l);break;case"XZX":s.set(o*h,c*m,c*f,o*l);break;case"YXY":s.set(c*f,o*h,c*m,o*l);break;case"ZYZ":s.set(c*m,c*f,o*h,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ge(s,t){switch(t.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function kt(s,t){switch(t.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}var xm={DEG2RAD:Ti,RAD2DEG:ps,generateUUID:Ze,clamp:he,euclideanModulo:tu,mapLinear:sm,inverseLerp:rm,lerp:zs,damp:am,pingpong:om,smoothstep:cm,smootherstep:lm,randInt:hm,randFloat:um,randFloatSpread:dm,seededRandom:fm,degToRad:pm,radToDeg:mm,isPowerOfTwo:Al,ceilPowerOfTwo:gm,floorPowerOfTwo:Va,setQuaternionFromProperEuler:_m,normalize:kt,denormalize:Ge},Z=class s{constructor(t=0,e=0){s.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(he(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Gt=class s{constructor(t,e,n,i,r,a,o,c,l){s.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,r,a,o,c,l)}set(t,e,n,i,r,a,o,c,l){let h=this.elements;return h[0]=t,h[1]=i,h[2]=o,h[3]=e,h[4]=r,h[5]=c,h[6]=n,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],v=i[1],x=i[4],y=i[7],C=i[2],T=i[5],R=i[8];return r[0]=a*_+o*v+c*C,r[3]=a*g+o*x+c*T,r[6]=a*p+o*y+c*R,r[1]=l*_+h*v+u*C,r[4]=l*g+h*x+u*T,r[7]=l*p+h*y+u*R,r[2]=d*_+f*v+m*C,r[5]=d*g+f*x+m*T,r[8]=d*p+f*y+m*R,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8];return e*a*h-e*o*l-n*r*h+n*o*c+i*r*l-i*a*c}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8],u=h*a-o*l,d=o*c-h*r,f=l*r-a*c,m=e*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/m;return t[0]=u*_,t[1]=(i*l-h*n)*_,t[2]=(o*n-i*a)*_,t[3]=d*_,t[4]=(h*e-i*c)*_,t[5]=(i*r-o*e)*_,t[6]=f*_,t[7]=(n*c-l*e)*_,t[8]=(a*e-n*r)*_,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,a,o){let c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+t,-i*l,i*c,-i*(-l*a+c*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(lc.makeScale(t,e)),this}rotate(t){return this.premultiply(lc.makeRotation(-t)),this}translate(t,e){return this.premultiply(lc.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},lc=new Gt;function Yf(s){for(let t=s.length-1;t>=0;--t)if(s[t]>=65535)return!0;return!1}var vm={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function as(s,t){return new vm[s](t)}function nr(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function Zf(){let s=nr("canvas");return s.style.display="block",s}var fu={};function Vs(s){s in fu||(fu[s]=!0,console.warn(s))}var pu=new Gt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),mu=new Gt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Br={[gn]:{transfer:Qs,primaries:js,toReference:s=>s,fromReference:s=>s},[_e]:{transfer:se,primaries:js,toReference:s=>s.convertSRGBToLinear(),fromReference:s=>s.convertLinearToSRGB()},[Nr]:{transfer:Qs,primaries:tr,toReference:s=>s.applyMatrix3(mu),fromReference:s=>s.applyMatrix3(pu)},[ec]:{transfer:se,primaries:tr,toReference:s=>s.convertSRGBToLinear().applyMatrix3(mu),fromReference:s=>s.applyMatrix3(pu).convertLinearToSRGB()}},ym=new Set([gn,Nr]),jt={enabled:!0,_workingColorSpace:gn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(s){if(!ym.has(s))throw new Error(`Unsupported working color space, "${s}".`);this._workingColorSpace=s},convert:function(s,t,e){if(this.enabled===!1||t===e||!t||!e)return s;let n=Br[t].toReference,i=Br[e].fromReference;return i(n(s))},fromWorkingColorSpace:function(s,t){return this.convert(s,this._workingColorSpace,t)},toWorkingColorSpace:function(s,t){return this.convert(s,t,this._workingColorSpace)},getPrimaries:function(s){return Br[s].primaries},getTransfer:function(s){return s===Ye?Qs:Br[s].transfer}};function hs(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function hc(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var zi,ir=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{zi===void 0&&(zi=nr("canvas")),zi.width=t.width,zi.height=t.height;let n=zi.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=zi}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=nr("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=hs(r[a]/255)*255;return n.putImageData(i,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(hs(e[n]/255)*255):e[n]=hs(e[n]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Mm=0,Cn=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Mm++}),this.uuid=Ze(),this.data=t,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(uc(i[a].image)):r.push(uc(i[a]))}else r=uc(i);n.url=r}return e||(t.images[this.uuid]=n),n}};function uc(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?ir.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Sm=0,ve=class s extends ln{constructor(t=s.DEFAULT_IMAGE,e=s.DEFAULT_MAPPING,n=Ue,i=Ue,r=pe,a=ei,o=He,c=Dn,l=s.DEFAULT_ANISOTROPY,h=Ye){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Sm++}),this.uuid=Ze(),this.name="",this.source=new Cn(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Z(0,0),this.repeat=new Z(1,1),this.center=new Z(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof h=="string"?this.colorSpace=h:(Vs("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=h===jn?_e:Ye),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}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(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Qo)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ys:t.x=t.x-Math.floor(t.x);break;case Ue:t.x=t.x<0?0:1;break;case Zs:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Ys:t.y=t.y-Math.floor(t.y);break;case Ue:t.y=t.y<0?0:1;break;case Zs:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Vs("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===_e?jn:Qh}set encoding(t){Vs("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===jn?_e:Ye}};ve.DEFAULT_IMAGE=null;ve.DEFAULT_MAPPING=Qo;ve.DEFAULT_ANISOTROPY=1;var te=class s{constructor(t=0,e=0,n=0,i=1){s.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r,c=t.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],m=c[9],_=c[2],g=c[6],p=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(m+g)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let x=(l+1)/2,y=(f+1)/2,C=(p+1)/2,T=(h+d)/4,R=(u+_)/4,U=(m+g)/4;return x>y&&x>C?x<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(x),i=T/n,r=R/n):y>C?y<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(y),n=T/i,r=U/i):C<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(C),n=R/r,i=U/r),this.set(n,i,r,e),this}let v=Math.sqrt((g-m)*(g-m)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(u-_)/v,this.z=(d-h)/v,this.w=Math.acos((l+f+p-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},ka=class extends ln{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new te(0,0,t,e),this.scissorTest=!1,this.viewport=new te(0,0,t,e);let i={width:t,height:e,depth:1};n.encoding!==void 0&&(Vs("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===jn?_e:Ye),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pe,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new ve(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps,this.texture.internalFormat=n.internalFormat,this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}setSize(t,e,n=1){(this.width!==t||this.height!==e||this.depth!==n)&&(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new Cn(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Je=class extends ka{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}},ms=class extends ve{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=fe,this.minFilter=fe,this.wrapR=Ue,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Tl=class extends Je{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new ms(null,t,e,n),this.texture.isRenderTargetTexture=!0}},sr=class extends ve{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=fe,this.minFilter=fe,this.wrapR=Ue,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},wl=class extends Je{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new sr(null,t,e,n),this.texture.isRenderTargetTexture=!0}},Rl=class extends Je{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLMultipleRenderTargets=!0;let r=this.texture;this.texture=[];for(let a=0;a<n;a++)this.texture[a]=r.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=t,this.texture[i].image.height=e,this.texture[i].image.depth=n;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.texture.length=0;for(let e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone(),this.texture[e].isRenderTargetTexture=!0;return this}},De=class{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,a,o){let c=n[i+0],l=n[i+1],h=n[i+2],u=n[i+3],d=r[a+0],f=r[a+1],m=r[a+2],_=r[a+3];if(o===0){t[e+0]=c,t[e+1]=l,t[e+2]=h,t[e+3]=u;return}if(o===1){t[e+0]=d,t[e+1]=f,t[e+2]=m,t[e+3]=_;return}if(u!==_||c!==d||l!==f||h!==m){let g=1-o,p=c*d+l*f+h*m+u*_,v=p>=0?1:-1,x=1-p*p;if(x>Number.EPSILON){let C=Math.sqrt(x),T=Math.atan2(C,p*v);g=Math.sin(g*T)/C,o=Math.sin(o*T)/C}let y=o*v;if(c=c*g+d*y,l=l*g+f*y,h=h*g+m*y,u=u*g+_*y,g===1-o){let C=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=C,l*=C,h*=C,u*=C}}t[e]=c,t[e+1]=l,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,i,r,a){let o=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=r[a],d=r[a+1],f=r[a+2],m=r[a+3];return t[e]=o*m+h*u+c*f-l*d,t[e+1]=c*m+h*d+l*u-o*f,t[e+2]=l*m+h*f+o*d-c*u,t[e+3]=h*m-o*u-c*d-l*f,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,i=t._y,r=t._z,a=t._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(i/2),u=o(r/2),d=c(n/2),f=c(i/2),m=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u+d*f*m;break;case"YZX":this._x=d*h*u+l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u-d*f*m;break;case"XZY":this._x=d*h*u-l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],o=e[5],c=e[9],l=e[2],h=e[6],u=e[10],d=n+o+u;if(d>0){let f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-c)*f,this._y=(r-l)*f,this._z=(a-i)*f}else if(n>o&&n>u){let f=2*Math.sqrt(1+n-o-u);this._w=(h-c)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(r+l)/f}else if(o>u){let f=2*Math.sqrt(1+o-n-u);this._w=(r-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(c+h)/f}else{let f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(r+l)/f,this._y=(c+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(he(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let i=Math.min(1,e/n);return this.slerp(t,i),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,i=t._y,r=t._z,a=t._w,o=e._x,c=e._y,l=e._z,h=e._w;return this._x=n*h+a*o+i*l-r*c,this._y=i*h+a*c+r*o-n*l,this._z=r*h+a*l+n*c-i*o,this._w=a*h-n*o-i*c-r*l,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let n=this._x,i=this._y,r=this._z,a=this._w,o=a*t._w+n*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;let c=1-o*o;if(c<=Number.EPSILON){let f=1-e;return this._w=f*a+e*this._w,this._x=f*n+e*this._x,this._y=f*i+e*this._y,this._z=f*r+e*this._z,this.normalize(),this}let l=Math.sqrt(c),h=Math.atan2(l,o),u=Math.sin((1-e)*h)/l,d=Math.sin(e*h)/l;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},w=class s{constructor(t=0,e=0,n=0){s.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(gu.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(gu.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(t){let e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,o=t.z,c=t.w,l=2*(a*i-o*n),h=2*(o*e-r*i),u=2*(r*n-a*e);return this.x=e+c*l+a*u-o*h,this.y=n+c*h+o*l-r*u,this.z=i+c*u+r*h-a*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,c=e.z;return this.x=i*c-r*o,this.y=r*a-n*c,this.z=n*o-i*a,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return dc.copy(this).projectOnVector(t),this.sub(dc)}reflect(t){return this.sub(dc.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(he(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},dc=new w,gu=new De,we=class{constructor(t=new w(1/0,1/0,1/0),e=new w(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(nn.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(nn.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=nn.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let r=n.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,nn):nn.fromBufferAttribute(r,a),nn.applyMatrix4(t.matrixWorld),this.expandByPoint(nn);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),zr.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),zr.copy(n.boundingBox)),zr.applyMatrix4(t.matrixWorld),this.union(zr)}let i=t.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,nn),nn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ts),Vr.subVectors(this.max,Ts),Vi.subVectors(t.a,Ts),ki.subVectors(t.b,Ts),Hi.subVectors(t.c,Ts),Hn.subVectors(ki,Vi),Gn.subVectors(Hi,ki),li.subVectors(Vi,Hi);let e=[0,-Hn.z,Hn.y,0,-Gn.z,Gn.y,0,-li.z,li.y,Hn.z,0,-Hn.x,Gn.z,0,-Gn.x,li.z,0,-li.x,-Hn.y,Hn.x,0,-Gn.y,Gn.x,0,-li.y,li.x,0];return!fc(e,Vi,ki,Hi,Vr)||(e=[1,0,0,0,1,0,0,0,1],!fc(e,Vi,ki,Hi,Vr))?!1:(kr.crossVectors(Hn,Gn),e=[kr.x,kr.y,kr.z],fc(e,Vi,ki,Hi,Vr))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,nn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(nn).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Mn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Mn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Mn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Mn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Mn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Mn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Mn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Mn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Mn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Mn=[new w,new w,new w,new w,new w,new w,new w,new w],nn=new w,zr=new we,Vi=new w,ki=new w,Hi=new w,Hn=new w,Gn=new w,li=new w,Ts=new w,Vr=new w,kr=new w,hi=new w;function fc(s,t,e,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){hi.fromArray(s,r);let o=i.x*Math.abs(hi.x)+i.y*Math.abs(hi.y)+i.z*Math.abs(hi.z),c=t.dot(hi),l=e.dot(hi),h=n.dot(hi);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}var bm=new we,ws=new w,pc=new w,Ae=class{constructor(t=new w,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):bm.setFromPoints(t).getCenter(n);let i=0;for(let r=0,a=t.length;r<a;r++)i=Math.max(i,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ws.subVectors(t,this.center);let e=ws.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(ws,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(pc.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ws.copy(t.center).add(pc)),this.expandByPoint(ws.copy(t.center).sub(pc))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Sn=new w,mc=new w,Hr=new w,Wn=new w,gc=new w,Gr=new w,_c=new w,ni=class{constructor(t=new w,e=new w(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Sn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Sn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Sn.copy(this.origin).addScaledVector(this.direction,e),Sn.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){mc.copy(t).add(e).multiplyScalar(.5),Hr.copy(e).sub(t).normalize(),Wn.copy(this.origin).sub(mc);let r.........完整代码请登录后点击上方下载按钮下载查看

网友评论0