Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
Refactor apps-sdk studio viewer and update OpenAI store submission
nirholas19c37912528c
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex ab4a999ff..57d1f2e11 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -142,7 +142,7 @@ Every top-level directory in the monorepo, what it is, and where to look. File c| `x402-modal-sdk/` | ~17 | `@three-ws/x402-modal` v0.2.0 — lighter modal variant. || `pump-fun-skills/` | ~75 | `@three-ws/pumpfun-skills` — pump.fun launch/trade as composable agent tools. || `chat-plugin/` | ~14 | `@three-ws/chat-plugin` v1.0.0 — LobeHub sidebar plugin rendering an embodied avatar (`manifest.json`, TS). |-| `apps-sdk/` | ~4 | Unversioned raw helpers: `embodiment/` + `studio-viewer/` (no `package.json` — see Known Gaps). |+| `apps-sdk/` | ~4 | Unversioned raw helpers: `embodiment/` living-agent-body engine (no `package.json` — see Known Gaps). The ChatGPT inline widget itself lives in `api/_mcp-studio/component.js`. |### On-chain & Distribution@@ -1931,7 +1931,7 @@ Full test-suite layout (runners, per-directory counts, heaviest-tested subsystem| Group | Examples | Purpose ||-------|----------|---------|-| Build | `build-animations.mjs`, `build-vercel.mjs`, `build-pages.mjs`, `build-cache.mjs`, `build-apps-sdk-viewer.mjs` | Asset/clip baking, Vercel function bundling, changelog/pages generation |+| Build | `build-animations.mjs`, `build-vercel.mjs`, `build-pages.mjs`, `build-cache.mjs`, `build-artifact-viewer.mjs` | Asset/clip baking, Vercel function bundling, changelog/pages generation || Schema & migration | `apply-migrations.mjs`, `apply-schema.mjs`, `apply-siwx-migration.mjs`, `apply-delegations-schema.js` | Apply `api/_lib/migrations/` to Neon || Backfill | `backfill-agent-wallets.mjs`, `backfill-erc8004.mjs`, `backfill-avatar-thumbnails.mjs`, `backfill-rig-meta.mjs` | One-shot data repair / hydration || Audit | `audit-links.mjs`, `audit-console.mjs`, `audit-deploy-artifacts.mjs`, `audit-mcp-manifests.mjs`, `audit-page-index.mjs` | Automated hygiene checks |@@ -1972,7 +1972,7 @@ Authoritative format/protocol specs that the code implements:| Solana Mobile (Seeker) | `solana-mobile/` | dApp Store submission: Trusted Web Activity + PWA wrapper, `publish/` config, `.well-known/` association || LobeHub chat plugin | `chat-plugin/` | `@three-ws/chat-plugin` — sidebar plugin rendering an embodied avatar || Standalone chat UI | `chat/` | `three.ws-chat` — fast, light, BYOK multi-provider chat (own Vite app) |-| OpenAI Apps SDK | `apps-sdk/` | `embodiment/` helpers + `studio-viewer/` for ChatGPT-app embedding |+| OpenAI Apps SDK | `apps-sdk/` (embed engine), `api/_mcp-studio/` (connector + widget) | `embodiment/` helpers for ChatGPT-app embedding; the inline widget is `api/_mcp-studio/component.js` || Browser extension | `extensions/walk-avatar/` | Walk-companion avatar as a browser extension || Blender bridge | `integrations/blender/` | `three_ws` Blender add-on || ComfyUI nodes | `integrations/comfyui/` | `three_ws_nodes` custom nodes |@@ -2451,7 +2451,7 @@ Beyond the product surfaces in [Frontend Application](#frontend-application), th| Widget / Widgets gallery | static, `/widgets` | `pages/widget.html`, `public/widget-demo.html`, `public/widgets-gallery/index.html` || Claude.ai artifact | static | `public/artifact/index.html`, `snippet.html`, `public/artifact-example.html` || Forge viewer (chat) | static | `public/chat/forge-viewer.html` |-| Apps-SDK studio viewer | static | `public/apps-sdk/studio-viewer.html` |+| ChatGPT inline 3D widget | skybridge resource | `api/_mcp-studio/component.js` (`ui://widget/three-studio-model.html`) || LobeHub / Sperax embed | `/lobehub/iframe`, `/sperax/iframe` | `public/lobehub/iframe/index.html` || Avatar artifact viewer | `/avatar-artifact` | `pages/avatar-artifact.html` |@@ -2523,7 +2523,7 @@ Three non-package surfaces that embed an agent into third-party hosts (summarize- **LobeHub Chat Plugin (`chat-plugin/`)** — `@three-ws/chat-plugin` 1.0.0 (Apache-2.0). `manifest.json` (`identifier: "3dagent"`, 320×420 right panel). `src/index.ts` exports `AgentPane` (React panel mounting the embed iframe), `AgentBridge` (host PostMessage; wire envelope `{ v:1, source, id, inReplyTo?, kind, op, payload }`; ops `ping/pong/ready/speak/gesture/emote/look/setAgent/subscribe/error`). Build `tsc` + esbuild; depends on `@lobehub/chat-plugin-sdk`.- **Walk Avatar Chrome Extension (`extensions/walk-avatar/`)** — Manifest V3. `background.js` (session/auth), `content.js` (mounts/drag-repositions avatar iframe), `content-narrator.js` (`window.__ThreewsWalkNarrator` — Readability section detection, `IntersectionObserver` ≥60%/600ms, fetches `POST /api/tts/speak`). Build `npm run build:extension:prod` → `dist/extension/`.-- **OpenAI / Claude Apps SDK (`apps-sdk/`)** — `embodiment/embodiment-stage.js` (`EmbodimentStage` — framework-agnostic Three.js engine; state machine `loading → idle ⇄ listening ⇄ thinking ⇄ speaking → error`; rides `AnimationManager` + canonicalize/retarget, never T-poses), `overlay.js` (DOM chrome), `studio-viewer/src.js` (renders Studio GLB inline from `window.openai.toolOutput.glb_url`). Build `scripts/build-apps-sdk-viewer.mjs`; inlined into `ui://widget/studio-viewer.html` by `api/_mcp3d/studio-viewer-resource.js`.+- **OpenAI / Claude Apps SDK (`apps-sdk/`)** — `embodiment/embodiment-stage.js` (`EmbodimentStage` — framework-agnostic Three.js engine; state machine `loading → idle ⇄ listening ⇄ thinking ⇄ speaking → error`; rides `AnimationManager` + canonicalize/retarget, never T-poses), `overlay.js` (DOM chrome). The ChatGPT inline 3D widget is not in `apps-sdk/`: it is the `<model-viewer>` skybridge component in `api/_mcp-studio/component.js` (resource `ui://widget/three-studio-model.html`, linked to every generation tool via `_meta["openai/outputTemplate"]`), rendering the Studio GLB from `window.openai.toolOutput`.---@@ -2923,7 +2923,7 @@ Root `package.json` (v1.5.2, Node 24.x) declares **42 npm workspaces** and ~90 s### Asset Bake (prebuild)-`prebuild` runs in parallel: `build:news`, `build-skill-metadata`, `build-local-skill-packs`, `build:club-assets` (props/venue/HDRI/audio/entrance), `build:walk-environments`, then `inject-blog-seo`, `inject-hidden-guard`, `build:page-index` + page/handler/guard audits (strict), `inject-seo-meta`, `inject-theme-boot`. Other bakers: `build:animations` (Mixamo FBX → canonical JSON), `convert:fbx`, `extract:animations`, `bake:mannequin`, `build:wasm` (`wasm-pack` for `crates/vanity-grinder` → `src/solana/vanity/wasm`), `optimize:glb`, `build:artifact-viewer`, `build:apps-sdk-viewer`.+`prebuild` runs in parallel: `build:news`, `build-skill-metadata`, `build-local-skill-packs`, `build:club-assets` (props/venue/HDRI/audio/entrance), `build:walk-environments`, then `inject-blog-seo`, `inject-hidden-guard`, `build:page-index` + page/handler/guard audits (strict), `inject-seo-meta`, `inject-theme-boot`. Other bakers: `build:animations` (Mixamo FBX → canonical JSON), `convert:fbx`, `extract:animations`, `bake:mannequin`, `build:wasm` (`wasm-pack` for `crates/vanity-grinder` → `src/solana/vanity/wasm`), `optimize:glb`, `build:artifact-viewer`.### Build & Bundle@@ -3080,7 +3080,7 @@ Two layers resolve paths: **`vercel.json`** (`routes` array, 932 entries — pro**Auth / Identity / Wallet:** `/login`, `/register`, `/forgot-password`, `/reset-password`, `/settings`, `/profile` (`/u/:handle`), `/@:handle`, `/wallet.html`, `/vanity-wallet` (+`/vanity/{verify,gallery,bounties}`), `/eth-vanity`, `/evm-wallet`, `/lookup`, `/siwx-test.html`, `/extension/{auth-callback,privacy,terms}`, `/persona/{authorize,demo}`, `.well-known/jwks.json`→`/api/auth/persona`.-**Marketplace / Widgets / Embeds:** `/marketplace` (+`/marketplace/{tools,skills,animations,onchain}` and `/:id`; `/marketplace/agents/:id`→`/agents/:id`; `/marketplace/avatars/:id`→`/avatars/:id`; `/marketplace/analytics`; `/marketplace-walk`), `/collection`, `/widgets` (`public/widgets-gallery/`), `/widget`, `/widget-demo.html`, `/embed` (+`/embed-demo`, `/embed-example.html`, `/embed/v1/preview`, `/embed/walk`), `/walk` → `pages/walk-landing.html` (+`/walk/app`,`/walk-embed`,`/walk-leaderboard`,`/walk-analytics`), `/wk/:avatar`→`/temporary`, `/temporary`, `/artifact` (+`/artifact-example.html`,`/artifact/snippet.html`), `/widget-studio`→`/studio`, `/studio` → `public/studio/index.html`, `/apps-sdk/studio-viewer.html`, `/chat/forge-viewer.html`, `/lobehub/iframe` (`/sperax/iframe`), `/demos-embed/{agents,avatar-only,forge,gallery,selfie,walk}`.+**Marketplace / Widgets / Embeds:** `/marketplace` (+`/marketplace/{tools,skills,animations,onchain}` and `/:id`; `/marketplace/agents/:id`→`/agents/:id`; `/marketplace/avatars/:id`→`/avatars/:id`; `/marketplace/analytics`; `/marketplace-walk`), `/collection`, `/widgets` (`public/widgets-gallery/`), `/widget`, `/widget-demo.html`, `/embed` (+`/embed-demo`, `/embed-example.html`, `/embed/v1/preview`, `/embed/walk`), `/walk` → `pages/walk-landing.html` (+`/walk/app`,`/walk-embed`,`/walk-leaderboard`,`/walk-analytics`), `/wk/:avatar`→`/temporary`, `/temporary`, `/artifact` (+`/artifact-example.html`,`/artifact/snippet.html`), `/widget-studio`→`/studio`, `/studio` → `public/studio/index.html`, `/chat/forge-viewer.html`, `/lobehub/iframe` (`/sperax/iframe`), `/demos-embed/{agents,avatar-only,forge,gallery,selfie,walk}`.**Dashboard (dashboard-next SPA):** `/dashboard` (+`/dashboard-next`); `/dashboard/{avatars,community-avatars,agents,library,widgets,walk,developers,three-token,holders,analytics,monetize,account,referrals,copy,irl-placements,sniper,settings,tokens,portfolio,api,brain,creator,landscape,prelaunch-radar,transactions,wallet-grinder}` → `pages/dashboard-next/:slug.html`; `/dashboard/:slug` (auto); `/dashboard/edit/:id`; `/dashboard/x402` + `/dashboard/x402-admin` → `public/dashboard/*` (classic); `/dashboard/{wallets,sessions,actions,embed-policy,memory,strategy,voice,sns,delegation,agent-pumpfun,storage,usage}` 301→dashboard-next; `/dashboard-classic/*` 301→`/dashboard/*`. Classic dashboard pages still on disk (`public/dashboard/*.html`) reachable via 301.diff --git a/apps-sdk/README.md b/apps-sdk/README.mdindex cb78dbbb3..81729cf90 100644--- a/apps-sdk/README.md+++ b/apps-sdk/README.md@@ -4,70 +4,33 @@<h1 align="center">apps-sdk</h1>-<p align="center"><strong>The two host-embeddable 3D surfaces three.ws ships into other people's apps: an inline GLB viewer component for the OpenAI Apps SDK, and the living-agent-body engine behind the embodiment embed.</strong></p>+<p align="center"><strong>The living-agent-body engine three.ws embeds into other people's apps, plus a pointer to where the ChatGPT inline 3D widget actually lives.</strong></p>----This directory is **source consumed by build scripts and page bundles** — it is not-an npm package and has no `package.json`. Nothing here is published; the two-subdirectories are built or imported directly by the platform.+This directory is **source consumed by page bundles** — it is not an npm package+and has no `package.json`. Nothing here is published; it is imported directly by the+platform.| Subdirectory | What it is | Where it ends up || --- | --- | --- |-| [`studio-viewer/`](#studio-viewer) | Self-contained Three.js GLB orbit-preview component | Bundled into the `ui://widget/studio-viewer.html` skybridge resource served to ChatGPT || [`embodiment/`](#embodiment) | The `EmbodimentStage` living-agent-body engine + its overlay chrome | Imported by [`pages/embodiment/embed.html`](../pages/embodiment/embed.html), the hosted embed |------## studio-viewer--Renders the GLB produced by the 3D Studio generation tools (`forge_free`,-`text_to_avatar`, `mesh_forge`, `rig_mesh`, `forge_avatar`, …) as an interactive,-orbitable 3D preview **inline in ChatGPT**. It uses PMREM `RoomEnvironment`-lighting, auto-framing, a contact shadow, and `AnimationMixer`-driven idle-playback for rigged models — the same rendering approach as the Claude.ai-artifact viewer and the Forge chat preview.--The entry point is a single file, [`studio-viewer/src.js`](studio-viewer/src.js).-It is bundled to one self-contained IIFE (three.js + `GLTFLoader` +-`OrbitControls` + `RoomEnvironment` + the viewer inlined) so the component needs-no external `<script>`. The only network call it makes is fetching the GLB-itself, permitted via the resource's `openai/widgetCSP` `connectDomains`.+## Where the ChatGPT inline 3D widget lives (not here)-### Host contract (OpenAI Apps SDK)+The inline 3D preview ChatGPT renders next to a generated model is **not** in this+directory. It is the `<model-viewer>` skybridge component built in+[`api/_mcp-studio/component.js`](../api/_mcp-studio/component.js): the resource+`ui://widget/three-studio-model.html` (and its persona sibling+`ui://widget/three-studio-persona.html`), registered in+[`api/_mcp-studio/dispatch.js`](../api/_mcp-studio/dispatch.js) and linked to every+generation tool through the tool's `_meta["openai/outputTemplate"]`. That is the+widget an OpenAI reviewer sees. For the full server, see+[`docs/mcp-studio.md`](../docs/mcp-studio.md).-- `window.openai.toolOutput` supplies the tool's `structuredContent`.-- The GLB URL is read from the documented `glb_url` key (camelCase `glbUrl` and a- few aliases are tolerated for forward-compat).-- The `openai:set_globals` event fires when `toolOutput`, theme, or layout change;- the viewer re-reads on it.--**Standalone fallback.** Opened directly in a browser (no `window.openai`), it-reads `?glb=<url>&viewer=<url>&name=<text>` from the query string — used for local-verification and the "open in a normal browser" path.--### Build--```bash-npm run build:apps-sdk-viewer # → node scripts/build-apps-sdk-viewer.mjs-```--Both outputs inline the same IIFE:--| Output | Consumed by |-| --- | --- |-| `public/apps-sdk/studio-viewer.bundle.js` | Read at runtime by [`api/_mcp3d/studio-viewer-resource.js`](../api/_mcp3d/studio-viewer-resource.js) and inlined into the skybridge resource |-| `public/apps-sdk/studio-viewer.html` | Standalone page that inlines the bundle and reads `?glb=<url>` |--### Runnable example--Build it, then open the standalone page against any public GLB:--```bash-npm run build:apps-sdk-viewer-npx serve public -l 4173-# → http://localhost:4173/apps-sdk/studio-viewer.html?glb=https://three.ws/models/agent.glb&name=Agent-```+The standalone "open in a normal browser" viewer that the tools' `viewerUrl`+(`https://three.ws/viewer?src=<glb>`) points at is a separate page,+[`public/viewer.html`](../public/viewer.html) — also not in this directory.---@@ -154,7 +117,8 @@ https://three.ws/embodiment/embed?persona=<persona-id>&bg=transparent## Related-- [`docs/mcp.md`](../docs/mcp.md) — the 3D Studio MCP tools whose output the viewer renders.+- [`docs/mcp-studio.md`](../docs/mcp-studio.md) — the 3D Studio MCP server, its tools, and the inline widget (`api/_mcp-studio/component.js`).+- [`docs/chatgpt-ar.md`](../docs/chatgpt-ar.md) — how each generation carries a place-in-your-room `arUrl`.- [`STRUCTURE.md`](../STRUCTURE.md) — where every product surface lives.---diff --git a/apps-sdk/studio-viewer/src.js b/apps-sdk/studio-viewer/src.jsdeleted file mode 100644index 5a74b6b49..000000000--- a/apps-sdk/studio-viewer/src.js+++ /dev/null@@ -1,618 +0,0 @@-// three.ws 3D Studio — OpenAI Apps SDK viewer component.-//-// Renders the GLB produced by the 3D Studio generation tools (forge_free,-// text_to_avatar, mesh_forge, rig_mesh, forge_avatar, …) as an interactive,-// orbitable 3D preview inline in ChatGPT. Bundled to a single self-contained-// IIFE by scripts/build-apps-sdk-viewer.mjs and inlined verbatim into the-// `ui://widget/studio-viewer.html` skybridge resource — so the component needs-// no external <script>. The ONLY network call it makes is fetching the GLB-// asset itself (allowed via the resource's openai/widgetCSP connectDomains).-//-// Reuses the same Three.js GLB-rendering approach as the Claude.ai artifact-// viewer (scripts/artifact-viewer/src.js) and the Forge chat preview-// (public/chat/forge-viewer.html): PMREM RoomEnvironment lighting, auto-framing,-// contact shadow, and AnimationMixer-driven idle playback for rigged models.-//-// Host contract (OpenAI Apps SDK):-// • window.openai.toolOutput → the tool's structuredContent.-// • the GLB URL lives under the documented `glb_url` key (camelCase `glbUrl`-// and a few other aliases are tolerated for forward-compat).-// • the `openai:set_globals` event fires when toolOutput / theme / layout-// change; we re-read on it.-// Standalone fallback: opened directly in a browser (no window.openai), it reads-// ?glb=<url>&viewer=<url>&name=<text> from the query string — used for local-// verification and the "open in a normal browser" path.--import * as THREE from 'three';-import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';-import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';-import { RoomEnvironment } from 'three/examples/jsm/environments/RoomEnvironment.js';-import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';--const REDUCED = window.matchMedia('(prefers-reduced-motion: reduce)').matches;--const THEMES = {- dark: { bg: 0x0a0c10, css: '#0a0c10', text: '#e8eaed', muted: '#9aa3ad', panel: 'rgba(13,16,21,0.72)', stroke: 'rgba(255,255,255,0.12)' },- light: { bg: 0xeef1f5, css: '#eef1f5', text: '#15181d', muted: '#5b636d', panel: 'rgba(255,255,255,0.78)', stroke: 'rgba(0,0,0,0.10)' },-};--// ── Host payload resolution ──────────────────────────────────────────────-// The structured content the generation tools return uses `glb_url`; the free-// forge_free tool returns `glbUrl`. Accept both plus a couple of generic-// aliases so any GLB-bearing tool result renders.-function pickUrl(obj, keys) {- if (!obj || typeof obj !== 'object') return '';- for (const k of keys) {- const v = obj[k];- if (typeof v === 'string' && /^https?:\/\//i.test(v)) return v;- }- return '';-}--function readPayload() {- const out = (typeof window.openai === 'object' && window.openai && window.openai.toolOutput) || null;- if (out) {- return {- glb: pickUrl(out, ['glb_url', 'glbUrl', 'model_url', 'modelUrl', 'url']),- viewer: pickUrl(out, ['viewer_url', 'viewerUrl', 'view_url', 'viewUrl', 'preview']),- name: typeof out.name === 'string' ? out.name : typeof out.prompt === 'string' ? out.prompt : '',- source: 'host',- };- }- // Standalone / local-verification fallback.- const q = new URLSearchParams(location.search);- const hashUrl = location.hash.length > 1 ? decodeURIComponent(location.hash.slice(1)) : '';- return {- glb: pickUrl({ u: q.get('glb') || hashUrl }, ['u']),- viewer: pickUrl({ u: q.get('viewer') || '' }, ['u']),- name: q.get('name') || '',- source: 'standalone',- };-}--function currentTheme() {- const t = (typeof window.openai === 'object' && window.openai && window.openai.theme) || '';- const mode = (typeof t === 'string' ? t : t?.mode) || '';- if (mode === 'light' || mode === 'dark') return mode;- return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';-}--// ── DOM scaffold (built in JS so the resource HTML stays a bare stage div) ──-const ICONS = {- download: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>',- external: '<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>',- reset: '<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>',- rotate: '<path d="M23 4v6h-6"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>',- warn: '<circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>',- cube: '<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>',-};-function svg(name) {- return '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' + (ICONS[name] || '') + '</svg>';-}--const STYLE = `-:root{color-scheme:dark light}-*{box-sizing:border-box}-html,body{margin:0;height:100%;overflow:hidden;font-family:ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;-webkit-font-smoothing:antialiased}-#studio-stage{position:fixed;inset:0}-#studio-stage canvas{display:block;width:100%;height:100%;outline:none}-.sv-hud{position:fixed;left:12px;top:12px;right:12px;display:flex;gap:8px;pointer-events:none;opacity:0;transition:opacity .5s ease}-.sv-hud.on{opacity:1}-.sv-title{max-width:70%;padding:6px 11px;font-size:12.5px;line-height:1.35;border-radius:9px;border:1px solid var(--sv-stroke);background:var(--sv-panel);color:var(--sv-text);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}-.sv-bar{position:fixed;left:50%;bottom:12px;transform:translateX(-50%) translateY(8px);display:flex;gap:5px;padding:5px;border-radius:13px;border:1px solid var(--sv-stroke);background:var(--sv-panel);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);box-shadow:0 10px 30px rgba(0,0,0,.34);opacity:0;transition:opacity .5s ease,transform .5s ease;max-width:calc(100vw - 24px);flex-wrap:wrap;justify-content:center}-.sv-bar.on{opacity:1;transform:translateX(-50%) translateY(0)}-.sv-btn{appearance:none;border:1px solid transparent;background:transparent;color:var(--sv-text);font:inherit;font-size:12.5px;font-weight:600;display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:9px;cursor:pointer;text-decoration:none;white-space:nowrap;transition:background .15s ease,border-color .15s ease}-.sv-btn:hover{background:var(--sv-hover)}-.sv-btn:active{background:var(--sv-active)}-.sv-btn:focus-visible{outline:none;border-color:#18e0c8;box-shadow:0 0 0 2px rgba(24,224,200,.4)}-.sv-btn[aria-pressed=true]{background:rgba(124,92,255,.22);border-color:rgba(124,92,255,.5)}-.sv-btn.primary{background:linear-gradient(90deg,#7c5cff,#6b8bff);color:#fff;border-color:transparent}-.sv-btn.primary:hover{filter:brightness(1.08);background:linear-gradient(90deg,#7c5cff,#6b8bff)}-.sv-btn svg{width:15px;height:15px;flex:0 0 auto}-@media (max-width:540px){.sv-btn .lbl{display:none}.sv-btn{padding:9px 10px}}-.sv-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:20px;transition:opacity .4s ease}-.sv-overlay.hidden{opacity:0;pointer-events:none}-.sv-card{width:min(420px,90%);padding:24px;border-radius:16px;border:1px solid var(--sv-stroke);background:var(--sv-panel);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);text-align:center;box-shadow:0 20px 50px rgba(0,0,0,.4)}-.sv-spinner{width:30px;height:30px;margin:0 auto 14px}-.sv-spinner circle{fill:none;stroke:#18e0c8;stroke-width:4;stroke-linecap:round;stroke-dasharray:90 150;transform-origin:center;animation:sv-spin 1s linear infinite}-@keyframes sv-spin{to{transform:rotate(360deg)}}-.sv-ic{width:44px;height:44px;margin:0 auto 14px;display:grid;place-items:center;border-radius:50%;color:#18e0c8}-.sv-ic.err{color:#ff6b6b;background:rgba(255,107,107,.13)}-.sv-ic.empty{color:var(--sv-muted);background:var(--sv-hover)}-.sv-ic svg{width:24px;height:24px}-.sv-ttl{font-size:16px;font-weight:700;color:var(--sv-text);margin-bottom:7px}-.sv-msg{font-size:13px;line-height:1.5;color:var(--sv-muted);margin-bottom:18px}-.sv-acts{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}-.sv-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}-`;--const el = (id) => document.getElementById(id);--class StudioViewer {- constructor(host) {- this.host = host;- this.theme = THEMES[currentTheme()] || THEMES.dark;- this.autoRotate = !REDUCED;- this.disposed = false;- this.frameInfo = null;- this.glbUrl = null;- this.objectUrl = null;- this._applyThemeVars();- this._buildChrome();- }-- _applyThemeVars() {- const t = this.theme;- const isLight = t === THEMES.light;- document.documentElement.style.setProperty('--sv-text', t.text);- document.documentElement.style.setProperty('--sv-muted', t.muted);- document.documentElement.style.setProperty('--sv-panel', t.panel);- document.documentElement.style.setProperty('--sv-stroke', t.stroke);- document.documentElement.style.setProperty('--sv-hover', isLight ? 'rgba(0,0,0,0.06)' : 'rgba(255,255,255,0.08)');- document.documentElement.style.setProperty('--sv-active', isLight ? 'rgba(0,0,0,0.12)' : 'rgba(255,255,255,0.14)');- document.body.style.background = t.css;- }-- _buildChrome() {- const hud = document.createElement('header');- hud.className = 'sv-hud';- hud.id = 'sv-hud';- hud.innerHTML = '<div class="sv-title" id="sv-title"></div>';-- const bar = document.createElement('nav');- bar.className = 'sv-bar';- bar.id = 'sv-bar';- bar.setAttribute('aria-label', 'Model controls');-- const overlay = document.createElement('div');- overlay.className = 'sv-overlay';- overlay.id = 'sv-overlay';- overlay.setAttribute('role', 'status');- overlay.setAttribute('aria-live', 'polite');-- this.host.append(hud, bar, overlay);- this.hud = hud;- this.bar = bar;- this.overlay = overlay;- }-- // ── Overlay states ───────────────────────────────────────────────────- showLoading(label) {- this.overlay.classList.remove('hidden');- this.overlay.innerHTML =- '<div class="sv-card">' +- '<svg class="sv-spinner" viewBox="0 0 50 50" aria-hidden="true"><circle cx="25" cy="25" r="20"/></svg>' +- '<div class="sv-ttl">' + escHtml(label || 'Loading 3D model…') + '</div>' +- '<div class="sv-msg">Rendering your generated model</div>' +- '</div>';- }-- hideOverlay() {- this.overlay.classList.add('hidden');- }-- showState({ kind, title, msg, actions }) {- this.overlay.classList.remove('hidden');- const card = document.createElement('div');- card.className = 'sv-card';- const ic = document.createElement('div');- ic.className = 'sv-ic ' + (kind === 'error' ? 'err' : 'empty');- ic.innerHTML = svg(kind === 'error' ? 'warn' : 'cube');- const h = document.createElement('div');- h.className = 'sv-ttl';- h.textContent = title;- const m = document.createElement('div');- m.className = 'sv-msg';- m.textContent = msg;- const acts = document.createElement('div');- acts.className = 'sv-acts';- for (const a of actions || []) acts.appendChild(this._mkBtn(a));- card.append(ic, h, m, acts);- this.overlay.replaceChildren(card);- }-- _mkBtn({ icon, label, onClick, href, primary, pressed, aria }) {- const node = document.createElement(href ? 'a' : 'button');- node.className = 'sv-btn' + (primary ? ' primary' : '');- node.innerHTML = (icon ? svg(icon) : '') + '<span class="lbl">' + escHtml(label) + '</span>';- node.setAttribute('aria-label', aria || label);- if (pressed !== undefined) node.setAttribute('aria-pressed', String(pressed));- if (href) {- node.href = href;- node.target = '_blank';- node.rel = 'noopener noreferrer';- } else if (onClick) {- node.type = 'button';- node.addEventListener('click', onClick);- }- return node;- }-- // ── Three.js scene ───────────────────────────────────────────────────- initThree() {- const canvas = document.createElement('canvas');- canvas.setAttribute('aria-label', '3D model viewer — drag to orbit');- canvas.tabIndex = 0;- this.host.insertBefore(canvas, this.host.firstChild);- try {- this.renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: false });- } catch {- return false;- }- const r = this.renderer;- r.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));- r.setSize(this.w(), this.h(), false);- r.outputColorSpace = THREE.SRGBColorSpace;- r.toneMapping = THREE.ACESFilmicToneMapping;- r.toneMappingExposure = 1.05;- r.shadowMap.enabled = true;- r.shadowMap.type = THREE.PCFSoftShadowMap;-- this.scene = new THREE.Scene();- this.scene.background = new THREE.Color(this.theme.bg);-- this.pmrem = new THREE.PMREMGenerator(r);- this.scene.environment = this.pmrem.fromScene(new RoomEnvironment(), 0.04).texture;-- this.camera = new THREE.PerspectiveCamera(45, this.w() / this.h(), 0.01, 2000);- this.camera.position.set(0, 1.1, 3.2);-- this.controls = new OrbitControls(this.camera, canvas);- this.controls.enableDamping = true;- this.controls.dampingFactor = 0.07;- this.controls.autoRotate = this.autoRotate;- this.controls.autoRotateSpeed = 1.3;- this.controls.listenToKeyEvents(canvas); // arrow-key orbit- this.controls.addEventListener('start', () => {- if (this.autoRotate) {- this.autoRotate = false;- this.controls.autoRotate = false;- this._syncRotate();- }- });-- const key = new THREE.DirectionalLight(0xffffff, 2.0);- key.position.set(4, 7, 5);- key.castShadow = true;- key.shadow.mapSize.set(2048, 2048);- key.shadow.bias = -0.0004;- key.shadow.normalBias = 0.02;- this.scene.add(key);- this.scene.add(new THREE.HemisphereLight(0xbfd4ff, 0x10131a, 0.35));-- this.clock = new THREE.Clock();- this._onResize = () => this.resize();- window.addEventListener('resize', this._onResize);- this._ro = new ResizeObserver(() => this.resize());- this._ro.observe(document.body);- r.setAnimationLoop(() => this.render());- return true;- }-- w() { return Math.max(1, window.innerWidth); }- h() {- const cap = Number(typeof window.openai === 'object' && window.openai && window.openai.maxHeight) || 0;- return Math.max(1, cap > 0 ? Math.min(window.innerHeight, cap) : window.innerHeight);- }-- resize() {- if (this.disposed || !this.renderer) return;- this.renderer.setSize(this.w(), this.h(), false);- this.camera.aspect = this.w() / this.h();- this.camera.updateProjectionMatrix();- }-- render() {- if (this.disposed) return;- const dt = this.clock.getDelta();- if (this.mixer) this.mixer.update(dt);- if (this.controls) this.controls.update();- this.renderer.render(this.scene, this.camera);- }-- frame(obj) {- const box = new THREE.Box3().setFromObject(obj);- const size = box.getSize(new THREE.Vector3());- const center = box.getCenter(new THREE.Vector3());- const maxDim = Math.max(size.x, size.y, size.z) || 1;- obj.position.sub(center);-- const fitDist = (maxDim / 2 / Math.tan((this.camera.fov * Math.PI) / 360)) * 1.5;- this.camera.near = maxDim / 100;- this.camera.far = maxDim * 100;- this.camera.updateProjectionMatrix();- this.controls.minDistance = maxDim * 0.4;- this.controls.maxDistance = maxDim * 6;- this.frameInfo = { dist: fitDist, height: maxDim * 0.18 };- this.resetView(true);-- const ground = new THREE.Mesh(- new THREE.PlaneGeometry(maxDim * 12, maxDim * 12),- new THREE.ShadowMaterial({ opacity: 0.26 }),- );- ground.rotation.x = -Math.PI / 2;- ground.position.y = -size.y / 2;- ground.receiveShadow = true;- this.scene.add(ground);- this.ground = ground;- }-- resetView(instant) {- if (!this.frameInfo) return;- const { dist, height } = this.frameInfo;- const target = new THREE.Vector3(0, height, dist);- this.controls.target.set(0, 0, 0);- if (instant || REDUCED) {- this.camera.position.copy(target);- return;- }- const from = this.camera.position.clone();- const t0 = performance.now();- const ease = () => {- if (this.disposed) return;- const k = Math.min(1, (performance.now() - t0) / 450);- this.camera.position.lerpVectors(from, target, 1 - Math.pow(1 - k, 3));- if (k < 1) requestAnimationFrame(ease);- };- ease();- }-- fadeIn(obj) {- const mats = [];- obj.traverse((n) => {- if (!n.isMesh) return;- n.castShadow = true;- n.receiveShadow = true;- for (const m of Array.isArray(n.material) ? n.material : [n.material]) {- if (!m) continue;- m.userData._t = m.transparent;- m.userData._o = m.opacity;- m.transparent = true;- m.opacity = 0;- mats.push(m);- }- });- if (REDUCED) {- for (const m of mats) { m.transparent = m.userData._t ?? false; m.opacity = m.userData._o ?? 1; m.needsUpdate = true; }- return;- }- const t0 = performance.now();- const step = () => {- if (this.disposed) return;- const k = Math.min(1, (performance.now() - t0) / 550);- for (const m of mats) m.opacity = (m.userData._o ?? 1) * k;- if (k < 1) requestAnimationFrame(step);- else for (const m of mats) { m.transparent = m.userData._t ?? false; m.opacity = m.userData._o ?? 1; m.needsUpdate = true; }- };- step();- }-- pickIdle(clips) {- if (!clips || !clips.length) return null;- return clips.find((c) => /idle|breath|stand|loop|rest/i.test(c.name || '')) || clips[0];- }-- // ── GLB loading ──────────────────────────────────────────────────────- async load(payload) {- this.glbUrl = payload.glb;- this.viewerUrl = payload.viewer || (payload.glb ? 'https://three.ws/viewer?src=' + encodeURIComponent(payload.glb) : 'https://three.ws/forge');- this.modelName = (payload.name || '').trim();-- if (!this.glbUrl) {- return this.showState({- kind: 'empty',- title: 'No model yet',- msg: 'Ask three.ws 3D Studio to generate a 3D model — e.g. “make a friendly robot mascot” — and it will appear here.',- actions: [{ label: 'Open three.ws Studio', href: 'https://three.ws/forge', primary: true, icon: 'external' }],- });- }-- if (!this.renderer && !this.initThree()) {- return this.showState({- kind: 'error',- title: '3D not supported here',- msg: 'This device or browser can’t render WebGL. You can still download the model or open it on three.ws.',- actions: [- { label: 'Download GLB', href: this.glbUrl, primary: true, icon: 'download' },- { label: 'Open on three.ws', href: this.viewerUrl, icon: 'external' },- ],- });- }-- this.showLoading('Loading 3D model…');-- const loader = new GLTFLoader();- if (MeshoptDecoder) {- try { loader.setMeshoptDecoder(MeshoptDecoder); } catch { /* vanilla GLBs load without it */ }- }-- let src = this.glbUrl;- try {- const res = await fetch(this.glbUrl, { mode: 'cors', credentials: 'omit' });- if (res.ok) {- const blob = await res.blob();- this.objectUrl = URL.createObjectURL(blob);- src = this.objectUrl;- }- } catch {- /* CORS/network — fall back to letting GLTFLoader fetch the URL directly */- }-- loader.load(- src,- (gltf) => {- if (this.disposed) return;- this.disposeModel();- const root = gltf.scene || gltf.scenes?.[0];- if (!root) return this.failLoad();- this.model = root;- this.scene.add(root);- this.frame(root);- this.fadeIn(root);- const clip = this.pickIdle(gltf.animations);- if (clip) {- this.mixer = new THREE.AnimationMixer(root);- this.mixer.clipAction(clip).play();- this.rigged = true;- }- this.reveal();- },- undefined,- () => { if (!this.disposed) this.failLoad(); },- );- }-- failLoad() {- this.showState({- kind: 'error',- title: 'Couldn’t load the model',- msg: 'The generated file didn’t load — it may have expired. Generate it again, or open it on three.ws.',- actions: [- { label: 'Download GLB', href: this.glbUrl, primary: true, icon: 'download' },- { label: 'Open on three.ws', href: this.viewerUrl, icon: 'external' },- ],- });- }-- reveal() {- this.hideOverlay();- this.buildHud();- this.buildBar();- requestAnimationFrame(() => {- this.hud.classList.add('on');- this.bar.classList.add('on');- });- }-- buildHud() {- const title = el('sv-title');- if (this.modelName) {- title.textContent = this.modelName;- } else {- title.style.display = 'none';- }- }-- _syncRotate() {- if (this._rotBtn) this._rotBtn.setAttribute('aria-pressed', String(this.autoRotate));- }-- buildBar() {- this.bar.replaceChildren();- this.bar.appendChild(this._mkBtn({ icon: 'download', label: 'Download', aria: 'Download GLB', onClick: () => this.download() }));-- this._rotBtn = this._mkBtn({- icon: 'rotate',- label: 'Spin',- pressed: this.autoRotate,- onClick: () => {- this.autoRotate = !this.autoRotate;- this.controls.autoRotate = this.autoRotate;- this._syncRotate();- },- });- this.bar.appendChild(this._rotBtn);-- this.bar.appendChild(this._mkBtn({ icon: 'reset', label: 'Recenter', aria: 'Recenter camera', onClick: () => this.resetView(false) }));- this.bar.appendChild(this._mkBtn({ icon: 'external', label: 'Open in three.ws', aria: 'Open in three.ws', href: this.viewerUrl, primary: true }));- }-- async download() {- const name = (this.modelName ? this.modelName.slice(0, 40).replace(/[^a-z0-9]+/gi, '-').replace(/^-+|-+$/g, '') : 'studio-model') || 'studio-model';- try {- let url = this.objectUrl;- if (!url) {- const res = await fetch(this.glbUrl, { mode: 'cors', credentials: 'omit' });- if (!res.ok) throw new Error('fetch failed');- url = URL.createObjectURL(await res.blob());- }- const a = document.createElement('a');- a.href = url;- a.download = name + '.glb';- document.body.appendChild(a);- a.click();- a.remove();- if (url !== this.objectUrl) setTimeout(() => URL.revokeObjectURL(url), 4000);- } catch {- window.open(this.glbUrl, '_blank', 'noopener,noreferrer');- }- }-- disposeModel() {- if (this.mixer) { this.mixer.stopAllAction(); this.mixer = null; }- if (this.model) {- this.scene.remove(this.model);- this.model.traverse((n) => {- if (n.isMesh) {- n.geometry?.dispose?.();- for (const m of Array.isArray(n.material) ? n.material : [n.material]) disposeMaterial(m);- }- });- this.model = null;- }- if (this.objectUrl) { URL.revokeObjectURL(this.objectUrl); this.objectUrl = null; }- }-- dispose() {- if (this.disposed) return;- this.disposed = true;- window.removeEventListener('resize', this._onResize);- this._ro?.disconnect();- this.disposeModel();- this.ground?.geometry?.dispose?.();- this.ground?.material?.dispose?.();- this.controls?.dispose?.();- this.pmrem?.dispose?.();- if (this.scene?.environment) this.scene.environment.dispose?.();- if (this.renderer) { this.renderer.setAnimationLoop(null); this.renderer.dispose(); }- }-}--function disposeMaterial(m) {- if (!m) return;- for (const k of Object.keys(m)) {- const v = m[k];- if (v && v.isTexture) v.dispose();- }- m.dispose?.();-}--function escHtml(s) {- return String(s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);-}--// ── Boot ─────────────────────────────────────────────────────────────────-function boot() {- const style = document.createElement('style');- style.textContent = STYLE;- document.head.appendChild(style);-- let host = el('studio-stage');- if (!host) {- host = document.createElement('div');- host.id = 'studio-stage';- document.body.appendChild(host);- }-- const viewer = new StudioViewer(host);- viewer.showLoading('Preparing viewer…');-- let lastGlb = null;- const sync = () => {- const payload = readPayload();- if (payload.glb === lastGlb && lastGlb !== null) return; // already showing this model- lastGlb = payload.glb;- viewer.load(payload);- };-- sync();- // Re-render when the host hands us toolOutput / theme / layout.- window.addEventListener('openai:set_globals', sync);- window.addEventListener('pagehide', () => viewer.dispose(), { once: true });-}--if (document.readyState === 'loading') {- document.addEventListener('DOMContentLoaded', boot);-} else {- boot();-}diff --git a/package.json b/package.jsonindex d130e4ad9..93940c2e5 100644--- a/package.json+++ b/package.json@@ -169,7 +169,6 @@"build:club-assets": "(npm run build:club-props & npm run build:club-venue & npm run build:club-hdri & wait)","build:walk-environments": "node scripts/build-walk-environments.mjs","build:artifact-viewer": "node scripts/build-artifact-viewer.mjs",- "build:apps-sdk-viewer": "node scripts/build-apps-sdk-viewer.mjs","build:lib": "TARGET=lib vite build","build:lib:full": "TARGET=lib LIB_FORMATS=es,umd vite build","build:artifact": "vite build --config vite.config.artifact.js",diff --git a/prompts/store-submissions/_generated/openai-actions.yaml b/prompts/store-submissions/_generated/openai-actions.yamlindex 30c8d75cb..bb2e2e73f 100644--- a/prompts/store-submissions/_generated/openai-actions.yaml+++ b/prompts/store-submissions/_generated/openai-actions.yaml@@ -11,7 +11,7 @@ info:produce the model; the finished GLB is stored on a public CDN URL so theuser can download and share it. No personal information is collected orreturned by these operations. Requests are rate-limited per IP for abuse- prevention. Full policy: https://three.ws/legal/privacy.html+ prevention. Full policy: https://three.ws/legal/privacyContract: POST /api/3d/studio either finishes inline (status "done" withglbUrl + viewerUrl + arUrl) or returns status "pending" with a "job"@@ -25,7 +25,7 @@ info:url: https://three.wslicense:name: three.ws Terms of Service- url: https://three.ws/legal/tos.html+ url: https://three.ws/legal/tosservers:- url: https://three.ws# No authentication: the free text-to-3D lane needs no API key and no account.diff --git a/prompts/store-submissions/_generated/openai-submission.md b/prompts/store-submissions/_generated/openai-submission.mdindex f52a809e7..1276fb426 100644--- a/prompts/store-submissions/_generated/openai-submission.md+++ b/prompts/store-submissions/_generated/openai-submission.md@@ -87,33 +87,17 @@ Every studio tool returns `viewerUrl: "https://three.ws/viewer?src=<glb>"` in `sin the text ("View it: …/viewer?src=…"), and the widget's primary **"Open in three.ws"** button linksto it. That path 404s.-**Root cause:** `vercel.json` has **no route** mapping `/viewer`. Neighboring viewers do not substitute:-- `/app?src=<glb>` → 200 but ignores `?src=` (renders the default agent avatar — verified by screenshot).-- `/avatar-artifact?src=<glb>` → 200 but ignores `?src=` (renders its own demo artifact — verified).-- The one standalone GLB viewer, `public/apps-sdk/studio-viewer.html`, reads `?glb=` (not `?src=`) and- is served at `/apps-sdk/studio-viewer.html`.--So `/viewer?src=` resolves nowhere. The link is emitted by 7 shipped surfaces+**Root cause:** `vercel.json` had **no route** mapping `/viewer`, so the `viewerUrl` emitted by every+studio tool resolved nowhere. The link is emitted by shipped surfaces(`api/_mcp-studio/forge-client.js`, `src/shared/forge-frames.js`, `api/v1/ai/_text-to-3d-lane.js`,-`api/_lib/tokenize-3d-metadata.js`, `api/_okx3d/identity.js`, `api/_studio/tools.js`, and the-studio-viewer bundle's own fallback), so this is a platform-wide dead link, not studio-only.--**Recommended fix (smallest correct change — make the standalone viewer serve `/viewer?src=`):**-1. In `apps-sdk/studio-viewer/src.js` (~line 66), accept `src`/`url` in the standalone param reader:- ```js- glb: pickUrl({ u: q.get('glb') || q.get('src') || q.get('url') || hashUrl }, ['u']),- ```-2. Rebuild the bundle: `npm run build:apps-sdk-viewer`.-3. Add one route to `vercel.json` (query string is forwarded automatically):- ```json- { "src": "/viewer/?", "dest": "/apps-sdk/studio-viewer.html" }- ```-4. Verify: `curl -s -o /dev/null -w '%{http_code}' "https://three.ws/viewer?src=<glb>"` → `200`, and the- page renders the model.--**Resolution (verified 2026-07-14):** `https://three.ws/viewer?src=<glb>` returns 200 and serves the-standalone studio viewer, and the `viewerUrl` returned by a live `forge_free` call uses exactly that-shape. No action left.+`api/_lib/tokenize-3d-metadata.js`, `api/_okx3d/identity.js`, `api/_studio/tools.js`), so this was a+platform-wide dead link, not studio-only.++**Resolution (verified 2026-07-14):** `vercel.json` routes `/viewer` to the standalone browser viewer+[`public/viewer.html`](../../../public/viewer.html), which reads `?src=<glb>`.+`https://three.ws/viewer?src=<glb>` returns 200 and renders the model, and the `viewerUrl` returned by+a live `forge_free` call uses exactly that shape. No action left. (Note: the ChatGPT *inline* widget is+a separate surface, `api/_mcp-studio/component.js`; `/viewer` is the "open in a normal browser" page.)---@@ -143,7 +127,7 @@ shape. No action left.### Tool list (titles as shown to users; matches live `tools/list`, re-pulled 2026-07-14)| Tool | Title | What it does ||------|-------|--------------|-| `forge_free` | Generate a 3D model from text | Text → textured GLB. Defaults to the highest quality tier (dense geometry + PBR textures), platform-funded; caller may request a faster tier. |+| `forge_free` | Generate a 3D model from text | Text → textured GLB, platform-funded. Defaults to the standard tier (fast, reliable, textured); the caller may request `draft` (fastest) or `high` (best, slower; falls back to standard under load). || `text_to_avatar` | Generate a 3D avatar | Text or reference image → avatar GLB. || `mesh_forge` | Generate a 3D mesh (art-directed) | Text/image → mesh, prompt refined by an AI art-director first. || `rig_mesh` | Rig a 3D model for animation | Static GLB URL → humanoid-rigged, animation-ready GLB. |@@ -179,6 +163,30 @@ The only matches anywhere are in **source comments** that assert the absence (e.wallet, or payment surface anywhere.`). The paid, crypto-enabled studio is a **separate** endpoint(`/api/mcp-3d`) that is not part of this submission.+### 2.1a Review surface vs the platform's general discovery manifest — **PASS**+Per OpenAI's App Directory process, the reviewer scans the app's **MCP endpoint metadata** through the+plugin submission portal, and that discovered snapshot is what review evaluates (sources:+[App submission guidelines](https://developers.openai.com/apps-sdk/app-submission-guidelines),+[Prepare and maintain an app for submission](https://developers.openai.com/apps-sdk/deploy/submission)).+The app's review surface is therefore the keyless MCP connector at+`https://three.ws/api/mcp-studio`, which §2.1 shows is free of any coin/token/wallet/payment string, and+which `tests/mcp-studio.test.js` pins with a regex assertion in CI.++three.ws separately serves a **general-platform** discovery manifest at `/.well-known/ai-plugin.json`+(the legacy ChatGPT-plugins format, generated by `scripts/build-discovery-cards.mjs` and consumed by+third-party agents and crawlers). That manifest describes the broader three.ws platform, not this app,+and is **not** part of the Apps SDK review flow. To keep the app's own discovery story unambiguous, the+3D Studio app additionally ships a dedicated, served OpenAPI at+`https://three.ws/.well-known/3d-studio-openapi.yaml`, scoped to the two free endpoints+(`/api/3d/studio`, `/api/ar`) with `auth: none` and no payment fields, verified crypto/payment-free by+`tests/api/3d-studio-openapi.test.js`.++> Owner note: the general `ai-plugin.json` and `openapi.yaml` under `/.well-known/` describe the paid+> platform and are out of scope for this app's review. Two optional quality improvements to that+> platform manifest (branded `logo_url` instead of the favicon; an explicit free-vs-paid split in the+> descriptions) are staged as a recommendation only — they touch platform-positioning copy and are left+> for owner sign-off, not changed as part of this submission.+### 2.2 No payments / no embedded checkout — **PASS**`api/mcp-studio.js` header: *"There is no OAuth, no x402, no wallet, no token, and no PaymentRequiredanywhere in this server — generation runs operator-funded."* No tool returns a price, invoice, or@@ -302,12 +310,15 @@ control bar (Download · Spin · Recenter · Open in three.ws).| `three-ws-3d-studio-widget-1600x1000.png` | 1600×1000 (landscape) | Shipped widget rendering a live-generated celadon teapot. || `three-ws-3d-studio-widget-1280x800.png` | 1280×800 (landscape) | Same, standard 16:10 landscape. |-The landscape shots were captured against the **live** shipped viewer bundle-(`https://three.ws/apps-sdk/studio-viewer.html?glb=<real-glb>`) rendering the GLB produced by a real-`forge_free` call this session — not a mockup.+The landscape shots must show the **shipped ChatGPT inline widget** (`api/_mcp-studio/component.js`,+resource `ui://widget/three-studio-model.html`) rendering the GLB produced by a real `forge_free` call+— not a standalone page and not a mockup.-`[HUMAN: confirm the App Directory form's exact required screenshot dimensions/aspect and, if it demands-a specific size not covered above, capture at that size — the widget renders any GLB at any viewport.]`+`[HUMAN: re-capture the landscape widget shots against the shipped inline widget (render a real+forge_free GLB in the ChatGPT-app sandbox, or the widget resource loaded standalone), and confirm the+App Directory form's exact required screenshot dimensions/aspect. Earlier captures were taken against a+now-removed standalone viewer bundle and must not be reused. The widget renders any GLB at any+viewport.]`---diff --git a/public/.well-known/3d-studio-openapi.yaml b/public/.well-known/3d-studio-openapi.yamlnew file mode 100644index 000000000..bb2e2e73f--- /dev/null+++ b/public/.well-known/3d-studio-openapi.yaml@@ -0,0 +1,233 @@+openapi: 3.1.0+info:+ title: three.ws 3D Studio+ version: 1.0.0+ description: |+ Free text-to-3D generation for the "three.ws 3D Studio" custom GPT.+ Turn a short text prompt into a real, textured, downloadable 3D model (GLB)+ plus a browser viewer link. No account, no API key, no payment.++ Data handling: the prompt is forwarded to the generation provider solely to+ produce the model; the finished GLB is stored on a public CDN URL so the+ user can download and share it. No personal information is collected or+ returned by these operations. Requests are rate-limited per IP for abuse+ prevention. Full policy: https://three.ws/legal/privacy++ Contract: POST /api/3d/studio either finishes inline (status "done" with+ glbUrl + viewerUrl + arUrl) or returns status "pending" with a "job"+ handle. Poll GET /api/3d/studio?job=... every few seconds until status is+ "done" or "error". Generation typically takes 20-60 seconds. arUrl is the+ augmented-reality launch link: opened on a phone it places the model in+ the user's real room (Quick Look on iPhone, Scene Viewer on Android);+ always offer it alongside the viewer link.+ contact:+ name: three.ws+ url: https://three.ws+ license:+ name: three.ws Terms of Service+ url: https://three.ws/legal/tos+servers:+ - url: https://three.ws+# No authentication: the free text-to-3D lane needs no API key and no account.+# An explicit empty root security requirement declares that plainly.+security: []+paths:+ /api/3d/studio:+ post:+ operationId: generate3DModel+ x-openai-isConsequential: false+ summary: Generate a 3D model (GLB) from a text prompt+ description: >-+ Start a free text-to-3D generation. Describe ONE subject concretely+ (shape, colors, style). Returns status "done" with glbUrl (download),+ viewerUrl (preview), and arUrl (see it in your room in AR), or+ "pending" with a "job" handle for checkModelJob. Unsafe prompts return+ error "prompt_rejected".+ requestBody:+ required: true+ content:+ application/json:+ schema:+ type: object+ required: [prompt]+ additionalProperties: false+ properties:+ prompt:+ type: string+ minLength: 3+ maxLength: 1000+ description: >-+ A concrete description of one subject to model, e.g.+ "a small ceramic robot figurine with round eyes".+ examples:+ fox:+ summary: Low-poly animal+ value:+ prompt: a low-poly orange fox sitting down+ responses:+ "200":+ description: Generation finished inline, or queued with a poll handle.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/GenerationState"+ examples:+ done:+ summary: Finished inline+ value:+ status: done+ glbUrl: https://pub-2534e921bf9c4314addcd4d8a6e98b7b.r2.dev/forge/anon/04818491-d43e-4576-b245-22743bf125a6.glb+ viewerUrl: https://three.ws/viewer?src=https%3A%2F%2Fpub-2534e921bf9c4314addcd4d8a6e98b7b.r2.dev%2Fforge%2Fanon%2F04818491-d43e-4576-b245-22743bf125a6.glb+ arUrl: https://three.ws/api/ar?src=https%3A%2F%2Fpub-2534e921bf9c4314addcd4d8a6e98b7b.r2.dev%2Fforge%2Fanon%2F04818491-d43e-4576-b245-22743bf125a6.glb&title=a%20low-poly%20orange%20fox+ format: glb+ pending:+ summary: Queued - poll with the job handle+ value:+ status: pending+ job: f1.eyJwIjoibnZpZGlhIn0.c2ln+ poll: /api/3d/studio?job=f1.eyJwIjoibnZpZGlhIn0.c2ln&title=a%20low-poly%20orange%20fox+ format: glb+ "400":+ description: >-+ Invalid prompt (too short/long) or refused by the content-safety+ gate (error "prompt_rejected"). Relay the message to the user.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/ErrorResponse"+ "429":+ description: Free generation limit reached - ask the user to try again later.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/ErrorResponse"+ "502":+ description: The generator could not start the job - safe to retry once.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/ErrorResponse"+ "503":+ description: Generation temporarily unavailable - try again later.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/ErrorResponse"+ get:+ operationId: checkModelJob+ x-openai-isConsequential: false+ summary: Check a pending 3D generation job+ description: >-+ Poll a generation started by generate3DModel. Use the "poll" path from+ the pending response verbatim (it carries the job handle and title).+ Keep polling every few seconds while "pending"; stop on "done"+ (present glbUrl + viewerUrl + arUrl) or "error" (offer to retry -+ generation is free).+ parameters:+ - name: job+ in: query+ required: true+ schema:+ type: string+ minLength: 8+ maxLength: 1024+ pattern: "^[A-Za-z0-9._-]+$"+ description: The job handle returned by generate3DModel.+ - name: title+ in: query+ required: false+ schema:+ type: string+ maxLength: 120+ description: >-+ Short label for the finished model (usually the prompt) - it names+ the AR and viewer pages. Already embedded in the "poll" path of a+ pending response, so it never needs to be added by hand.+ responses:+ "200":+ description: Current job state.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/GenerationState"+ examples:+ done:+ summary: Model ready+ value:+ status: done+ job: f1.eyJwIjoibnZpZGlhIn0.c2ln+ glbUrl: https://pub-2534e921bf9c4314addcd4d8a6e98b7b.r2.dev/forge/anon/done.glb+ viewerUrl: https://three.ws/viewer?src=https%3A%2F%2Fpub-2534e921bf9c4314addcd4d8a6e98b7b.r2.dev%2Fforge%2Fanon%2Fdone.glb+ arUrl: https://three.ws/api/ar?src=https%3A%2F%2Fpub-2534e921bf9c4314addcd4d8a6e98b7b.r2.dev%2Fforge%2Fanon%2Fdone.glb+ format: glb+ failed:+ summary: Upstream failure - retrying is free+ value:+ status: error+ job: f1.eyJwIjoibnZpZGlhIn0.c2ln+ error: 3D generation hit a snag upstream - it costs nothing to try again.+ "400":+ description: Missing or malformed job handle.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/ErrorResponse"+ "429":+ description: Polling too fast - wait for retry_after seconds.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/ErrorResponse"+components:+ schemas:+ GenerationState:+ type: object+ required: [status]+ properties:+ status:+ type: string+ enum: [done, pending, error]+ description: done = model ready; pending = keep polling; error = generation failed.+ glbUrl:+ type: string+ format: uri+ description: Public download URL of the generated GLB model (present when done).+ viewerUrl:+ type: string+ format: uri+ description: Interactive three.ws browser viewer for the model (present when done).+ arUrl:+ type: string+ format: uri+ description: >-+ Augmented-reality launch link (present when done). Opened on a+ phone it places the model in the user's real room: Quick Look on+ iPhone, Scene Viewer on Android; on desktop it falls back to the+ interactive viewer. Always present it to the user alongside the+ viewer link.+ format:+ type: string+ const: glb+ description: Output format - always GLB (binary glTF).+ job:+ type: string+ description: Job handle to pass to checkModelJob (present when pending).+ poll:+ type: string+ description: Relative poll path for the pending job.+ error:+ type: string+ description: Human-readable failure message (present when status is error).+ ErrorResponse:+ type: object+ required: [error, message]+ properties:+ error:+ type: string+ description: Machine-readable error code (e.g. invalid_prompt, prompt_rejected, rate_limited).+ message:+ type: string+ description: Human-readable explanation to relay to the user.+ retry_after:+ type: integer+ description: Seconds to wait before retrying (rate-limit responses).diff --git a/public/apps-sdk/studio-viewer.bundle.js b/public/apps-sdk/studio-viewer.bundle.jsdeleted file mode 100644index 4208c9a7f..000000000--- a/public/apps-sdk/studio-viewer.bundle.js+++ /dev/null@@ -1,4141 +0,0 @@-/* three.ws 3D Studio — Apps SDK viewer bundle (three.js + GLTFLoader + viewer).- * Built from apps-sdk/studio-viewer/src.js. Do not edit by hand.- * Regenerate with: npm run build:apps-sdk-viewer */-"use strict";(()=>{var mi={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},gi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Xh=0,Ic=1,jh=2;var vr=1,Va=2,ws=3,_n=0,Lt=1,ln=2,Nn=0,Pi=1,Dc=2,Lc=3,Fc=4,Kh=5;var hi=100,Yh=101,Jh=102,Zh=103,$h=104,Qh=200,eu=201,tu=202,nu=203,ua=204,da=205,iu=206,su=207,ru=208,au=209,ou=210,cu=211,lu=212,hu=213,uu=214,fa=0,pa=1,ma=2,Ii=3,ga=4,ba=5,_a=6,xa=7,Ha=0,du=1,fu=2,vn=0,Nc=1,Uc=2,Oc=3,yr=4,Bc=5,kc=6,zc=7,yc="attached",pu="detached",Gc=300,bi=301,Hi=302,Wa=303,qa=304,Mr=306,ui=1e3,on=1001,us=1002,xt=1003,Xa=1004;var Wi=1005;var vt=1006,Es=1007;var yn=1008;var jt=1009,Vc=1010,Hc=1011,Rs=1012,ja=1013,Mn=1014,tn=1015,Un=1016,Ka=1017,Ya=1018,Cs=1020,Wc=35902,qc=35899,Xc=1021,jc=1022,nn=1023,En=1026,_i=1027,Ja=1028,Za=1029,xi=1030,$a=1031;var Qa=1033,Sr=33776,Tr=33777,Ar=33778,wr=33779,eo=35840,to=35841,no=35842,io=35843,so=36196,ro=37492,ao=37496,oo=37488,co=37489,Er=37490,lo=37491,ho=37808,uo=37809,fo=37810,po=37811,mo=37812,go=37813,bo=37814,_o=37815,xo=37816,vo=37817,yo=37818,Mo=37819,So=37820,To=37821,Ao=36492,wo=36494,Eo=36495,Ro=36283,Co=36284,Rr=36285,Po=36286,mu=2200,gu=2201,bu=2202,Di=2300,Li=2301,ha=2302,Mc=2303,Ri=2400,Ci=2401,js=2402,Io=2500,_u=2501,Kc=0,Cr=1,Ps=2,xu=3200;var Pr=0,vu=1,Qn="",_t="srgb",Gt="srgb-linear",Ks="linear",Ye="srgb";var Ei=7680;var Sc=519,yu=512,Mu=513,Su=514,Do=515,Tu=516,Au=517,Lo=518,wu=519,va=35044;var Yc="300 es",mn=2e3,ds=2001;function Dd(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}function Ld(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function fs(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function Eu(){let s=fs("canvas");return s.style.display="block",s}var hh={},ps=null;function Ys(...s){let e="THREE."+s.shift();ps?ps("log",e,...s):console.log(e,...s)}function Ru(s){let e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function _e(...s){s=Ru(s);let e="THREE."+s.shift();if(ps)ps("warn",e,...s);else{let t=s[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...s)}}function we(...s){s=Ru(s);let e="THREE."+s.shift();if(ps)ps("error",e,...s);else{let t=s[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...s)}}function ya(...s){let e=s.join(" ");e in hh||(hh[e]=!0,_e(...s))}function Cu(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}var Pu={[fa]:pa,[ma]:_a,[ga]:xa,[Ii]:ba,[pa]:fa,[_a]:ma,[xa]:ga,[ba]:Ii},cn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}},Nt=["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"],uh=1234567,qs=Math.PI/180,Fi=180/Math.PI;function bn(){let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Nt[s&255]+Nt[s>>8&255]+Nt[s>>16&255]+Nt[s>>24&255]+"-"+Nt[e&255]+Nt[e>>8&255]+"-"+Nt[e>>16&15|64]+Nt[e>>24&255]+"-"+Nt[t&63|128]+Nt[t>>8&255]+"-"+Nt[t>>16&255]+Nt[t>>24&255]+Nt[n&255]+Nt[n>>8&255]+Nt[n>>16&255]+Nt[n>>24&255]).toLowerCase()}function Ge(s,e,t){return Math.max(e,Math.min(t,s))}function Jc(s,e){return(s%e+e)%e}function Fd(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function Nd(s,e,t){return s!==e?(t-s)/(e-s):0}function Xs(s,e,t){return(1-t)*s+t*e}function Ud(s,e,t,n){return Xs(s,e,1-Math.exp(-t*n))}function Od(s,e=1){return e-Math.abs(Jc(s,e*2)-e)}function Bd(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function kd(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function zd(s,e){return s+Math.floor(Math.random()*(e-s+1))}function Gd(s,e){return s+Math.random()*(e-s)}function Vd(s){return s*(.5-Math.random())}function Hd(s){s!==void 0&&(uh=s);let e=uh+=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 Wd(s){return s*qs}function qd(s){return s*Fi}function Xd(s){return(s&s-1)===0&&s!==0}function jd(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Kd(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Yd(s,e,t,n,i){let r=Math.cos,a=Math.sin,o=r(t/2),c=a(t/2),l=r((e+n)/2),h=a((e+n)/2),u=r((e-n)/2),d=a((e-n)/2),f=r((n-e)/2),g=a((n-e)/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*g,c*f,o*l);break;case"YXY":s.set(c*f,o*h,c*g,o*l);break;case"ZYZ":s.set(c*g,c*f,o*h,o*l);break;default:_e("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function pn(s,e){switch(e.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 Je(s,e){switch(e.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 Ir={DEG2RAD:qs,RAD2DEG:Fi,generateUUID:bn,clamp:Ge,euclideanModulo:Jc,mapLinear:Fd,inverseLerp:Nd,lerp:Xs,damp:Ud,pingpong:Od,smoothstep:Bd,smootherstep:kd,randInt:zd,randFloat:Gd,randFloatSpread:Vd,seededRandom:Hd,degToRad:Wd,radToDeg:qd,isPowerOfTwo:Xd,ceilPowerOfTwo:jd,floorPowerOfTwo:Kd,setQuaternionFromProperEuler:Yd,normalize:Je,denormalize:pn},tl=class tl{constructor(e=0,t=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,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ge(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,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 n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};tl.prototype.isVector2=!0;var Re=tl,Et=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,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],g=r[a+2],y=r[a+3];if(u!==y||c!==d||l!==f||h!==g){let m=c*d+l*f+h*g+u*y;m<0&&(d=-d,f=-f,g=-g,y=-y,m=-m);let p=1-o;if(m<.9995){let x=Math.acos(m),S=Math.sin(x);p=Math.sin(p*x)/S,o=Math.sin(o*x)/S,c=c*p+d*o,l=l*p+f*o,h=h*p+g*o,u=u*p+y*o}else{c=c*p+d*o,l=l*p+f*o,h=h*p+g*o,u=u*p+y*o;let x=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=x,l*=x,h*=x,u*=x}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,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],g=r[a+3];return e[t]=o*g+h*u+c*f-l*d,e[t+1]=c*g+h*d+l*u-o*f,e[t+2]=l*g+h*f+o*d-c*u,e[t+3]=h*g-o*u-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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 n=e._x,i=e._y,r=e._z,a=e._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),g=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u-d*f*g;break;case"YXZ":this._x=d*h*u+l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u+d*f*g;break;case"ZXY":this._x=d*h*u-l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u-d*f*g;break;case"ZYX":this._x=d*h*u-l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u+d*f*g;break;case"YZX":this._x=d*h*u+l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u-d*f*g;break;case"XZY":this._x=d*h*u-l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u+d*f*g;break;default:_e("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],c=t[9],l=t[2],h=t[6],u=t[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(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ge(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,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(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 n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,c=t._y,l=t._z,h=t._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(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,r=-r,a=-a,o=-o);let c=1-t;if(o<.9995){let l=Math.acos(o),h=Math.sin(l);c=Math.sin(c*l)/h,t=Math.sin(t*l)/h,this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+r*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+r*t,this._w=this._w*c+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*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}},nl=class nl{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw 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(dh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(dh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*i-o*n),h=2*(o*t-r*i),u=2*(r*n-a*t);return this.x=t+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(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,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=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,c=t.z;return this.x=i*c-r*o,this.y=r*a-n*c,this.z=n*o-i*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Yo.copy(this).projectOnVector(e),this.sub(Yo)}reflect(e){return this.sub(Yo.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 n=this.dot(e)/t;return Math.acos(Ge(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};nl.prototype.isVector3=!0;var D=nl,Yo=new D,dh=new Et,il=class il{constructor(e,t,n,i,r,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l)}set(e,t,n,i,r,a,o,c,l){let h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,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(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.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],g=n[8],y=i[0],m=i[3],p=i[6],x=i[1],S=i[4],M=i[7],E=i[2],A=i[5],C=i[8];return r[0]=a*y+o*x+c*E,r[3]=a*m+o*S+c*A,r[6]=a*p+o*M+c*C,r[1]=l*y+h*x+u*E,r[4]=l*m+h*S+u*A,r[7]=l*p+h*M+u*C,r[2]=d*y+f*x+g*E,r[5]=d*m+f*S+g*A,r[8]=d*p+f*M+g*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],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*a*h-t*o*l-n*r*h+n*o*c+i*r*l-i*a*c}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*a-o*l,d=o*c-h*r,f=l*r-a*c,g=t*u+n*d+i*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/g;return e[0]=u*y,e[1]=(i*l-h*n)*y,e[2]=(o*n-i*a)*y,e[3]=d*y,e[4]=(h*t-i*c)*y,e[5]=(i*r-o*t)*y,e[6]=f*y,e[7]=(n*c-l*t)*y,e[8]=(a*t-n*r)*y,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,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+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Jo.makeScale(e,t)),this}rotate(e){return this.premultiply(Jo.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jo.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};il.prototype.isMatrix3=!0;var Ie=il,Jo=new Ie,fh=new Ie().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ph=new Ie().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Jd(){let s={enabled:!0,workingColorSpace:Gt,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===Ye&&(i.r=jn(i.r),i.g=jn(i.g),i.b=jn(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ye&&(i.r=hs(i.r),i.g=hs(i.g),i.b=hs(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Qn?Ks:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return ya("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return ya("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Gt]:{primaries:e,whitePoint:n,transfer:Ks,toXYZ:fh,fromXYZ:ph,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:_t},outputColorSpaceConfig:{drawingBufferColorSpace:_t}},[_t]:{primaries:e,whitePoint:n,transfer:Ye,toXYZ:fh,fromXYZ:ph,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:_t}}}),s}var ze=Jd();function jn(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function hs(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var Ji,Ma=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ji===void 0&&(Ji=fs("canvas")),Ji.width=e.width,Ji.height=e.height;let i=Ji.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ji}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=fs("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=jn(r[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(jn(t[n]/255)*255):t[n]=jn(t[n]);return{data:t,width:e.width,height:e.height}}else return _e("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Zd=0,ms=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Zd++}),this.uuid=bn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}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 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(Zo(i[a].image)):r.push(Zo(i[a]))}else r=Zo(i);n.url=r}return t||(e.images[this.uuid]=n),n}};function Zo(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?Ma.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(_e("Texture: Unable to serialize Texture."),{})}var $d=0,$o=new D,Dt=class s extends cn{constructor(e=s.DEFAULT_IMAGE,t=s.DEFAULT_MAPPING,n=on,i=on,r=vt,a=yn,o=nn,c=jt,l=s.DEFAULT_ANISOTROPY,h=Qn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$d++}),this.uuid=bn(),this.name="",this.source=new ms(e),this.mipmaps=[],this.mapping=t,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 Re(0,0),this.repeat=new Re(1,1),this.center=new Re(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ie,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize($o).x}get height(){return this.source.getSize($o).y}get depth(){return this.source.getSize($o).z}get image(){return this.source.data}set image(e){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)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.normalized=e.normalized,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.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){_e(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){_e(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,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,normalized:this.normalized,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),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Gc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ui:e.x=e.x-Math.floor(e.x);break;case on:e.x=e.x<0?0:1;break;case us: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 ui:e.y=e.y-Math.floor(e.y);break;case on:e.y=e.y<0?0:1;break;case us: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++}};Dt.DEFAULT_IMAGE=null;Dt.DEFAULT_MAPPING=Gc;Dt.DEFAULT_ANISOTROPY=1;var sl=class sl{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+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,n,i,r,c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],g=c[9],y=c[2],m=c[6],p=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-y)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+y)<.1&&Math.abs(g+m)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let S=(l+1)/2,M=(f+1)/2,E=(p+1)/2,A=(h+d)/4,C=(u+y)/4,_=(g+m)/4;return S>M&&S>E?S<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(S),i=A/n,r=C/n):M>E?M<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(M),n=A/i,r=_/i):E<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(E),n=C/r,i=_/r),this.set(n,i,r,t),this}let x=Math.sqrt((m-g)*(m-g)+(u-y)*(u-y)+(d-h)*(d-h));return Math.abs(x)<.001&&(x=1),this.x=(m-g)/x,this.y=(u-y)/x,this.z=(d-h)/x,this.w=Math.acos((l+f+p-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=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this.w=Ge(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this.w=Ge(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,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}};sl.prototype.isVector4=!0;var nt=sl,Sa=class extends cn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new nt(0,0,e,t),this.scissorTest=!1,this.viewport=new nt(0,0,e,t),this.textures=[];let i={width:e,height:t,depth:n.depth},r=new Dt(i),a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:vt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new ms(i)}return 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.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}},Qt=class extends Sa{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Js=class extends Dt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=on,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var Ta=class extends Dt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=on,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ga=class Ga{constructor(e,t,n,i,r,a,o,c,l,h,u,d,f,g,y,m){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,n,i,r,a,o,c,l,h,u,d,f,g,y,m)}set(e,t,n,i,r,a,o,c,l,h,u,d,f,g,y,m){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=a,p[9]=o,p[13]=c,p[2]=l,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=g,p[11]=y,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ga().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Zi.setFromMatrixColumn(e,0).length(),r=1/Zi.setFromMatrixColumn(e,1).length(),a=1/Zi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let d=a*h,f=a*u,g=o*h,y=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+g*l,t[5]=d-y*l,t[9]=-o*c,t[2]=y-d*l,t[6]=g+f*l,t[10]=a*c}else if(e.order==="YXZ"){let d=c*h,f=c*u,g=l*h,y=l*u;t[0]=d+y*o,t[4]=g*o-f,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-g,t[6]=y+d*o,t[10]=a*c}else if(e.order==="ZXY"){let d=c*h,f=c*u,g=l*h,y=l*u;t[0]=d-y*o,t[4]=-a*u,t[8]=g+f*o,t[1]=f+g*o,t[5]=a*h,t[9]=y-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){let d=a*h,f=a*u,g=o*h,y=o*u;t[0]=c*h,t[4]=g*l-f,t[8]=d*l+y,t[1]=c*u,t[5]=y*l+d,t[9]=f*l-g,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){let d=a*c,f=a*l,g=o*c,y=o*l;t[0]=c*h,t[4]=y-d*u,t[8]=g*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=f*u+g,t[10]=d-y*u}else if(e.order==="XZY"){let d=a*c,f=a*l,g=o*c,y=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+y,t[5]=a*h,t[9]=f*u-g,t[2]=g*u-f,t[6]=o*h,t[10]=y*u+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(Qd,e,ef)}lookAt(e,t,n){let i=this.elements;return Zt.subVectors(e,t),Zt.lengthSq()===0&&(Zt.z=1),Zt.normalize(),ii.crossVectors(n,Zt),ii.lengthSq()===0&&(Math.abs(n.z)===1?Zt.x+=1e-4:Zt.z+=1e-4,Zt.normalize(),ii.crossVectors(n,Zt)),ii.normalize(),Br.crossVectors(Zt,ii),i[0]=ii.x,i[4]=Br.x,i[8]=Zt.x,i[1]=ii.y,i[5]=Br.y,i[9]=Zt.y,i[2]=ii.z,i[6]=Br.z,i[10]=Zt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],f=n[13],g=n[2],y=n[6],m=n[10],p=n[14],x=n[3],S=n[7],M=n[11],E=n[15],A=i[0],C=i[4],_=i[8],w=i[12],L=i[1],R=i[5],O=i[9],H=i[13],q=i[2],N=i[6],z=i[10],V=i[14],$=i[3],Q=i[7],le=i[11],xe=i[15];return r[0]=a*A+o*L+c*q+l*$,r[4]=a*C+o*R+c*N+l*Q,r[8]=a*_+o*O+c*z+l*le,r[12]=a*w+o*H+c*V+l*xe,r[1]=h*A+u*L+d*q+f*$,r[5]=h*C+u*R+d*N+f*Q,r[9]=h*_+u*O+d*z+f*le,r[13]=h*w+u*H+d*V+f*xe,r[2]=g*A+y*L+m*q+p*$,r[6]=g*C+y*R+m*N+p*Q,r[10]=g*_+y*O+m*z+p*le,r[14]=g*w+y*H+m*V+p*xe,r[3]=x*A+S*L+M*q+E*$,r[7]=x*C+S*R+M*N+E*Q,r[11]=x*_+S*O+M*z+E*le,r[15]=x*w+S*H+M*V+E*xe,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],f=e[14],g=e[3],y=e[7],m=e[11],p=e[15],x=c*f-l*d,S=o*f-l*u,M=o*d-c*u,E=a*f-l*h,A=a*d-c*h,C=a*u-o*h;return t*(y*x-m*S+p*M)-n*(g*x-m*E+p*A)+i*(g*S-y*E+p*C)-r*(g*M-y*A+m*C)}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,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],f=e[11],g=e[12],y=e[13],m=e[14],p=e[15],x=t*o-n*a,S=t*c-i*a,M=t*l-r*a,E=n*c-i*o,A=n*l-r*o,C=i*l-r*c,_=h*y-u*g,w=h*m-d*g,L=h*p-f*g,R=u*m-d*y,O=u*p-f*y,H=d*p-f*m,q=x*H-S*O+M*R+E*L-A*w+C*_;if(q===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let N=1/q;return e[0]=(o*H-c*O+l*R)*N,e[1]=(i*O-n*H-r*R)*N,e[2]=(y*C-m*A+p*E)*N,e[3]=(d*A-u*C-f*E)*N,e[4]=(c*L-a*H-l*w)*N,e[5]=(t*H-i*L+r*w)*N,e[6]=(m*M-g*C-p*S)*N,e[7]=(h*C-d*M+f*S)*N,e[8]=(a*O-o*L+l*_)*N,e[9]=(n*L-t*O-r*_)*N,e[10]=(g*A-y*M+p*x)*N,e[11]=(u*M-h*A-f*x)*N,e[12]=(o*w-a*R-c*_)*N,e[13]=(t*R-n*w+i*_)*N,e[14]=(y*S-g*E-m*x)*N,e[15]=(h*E-u*S+d*x)*N,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,c=e.z,l=r*a,h=r*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,h*o+n,h*c-i*a,0,l*c-i*o,h*c+i*a,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,a=t._y,o=t._z,c=t._w,l=r+r,h=a+a,u=o+o,d=r*l,f=r*h,g=r*u,y=a*h,m=a*u,p=o*u,x=c*l,S=c*h,M=c*u,E=n.x,A=n.y,C=n.z;return i[0]=(1-(y+p))*E,i[1]=(f+M)*E,i[2]=(g-S)*E,i[3]=0,i[4]=(f-M)*A,i[5]=(1-(d+p))*A,i[6]=(m+x)*A,i[7]=0,i[8]=(g+S)*C,i[9]=(m-x)*C,i[10]=(1-(d+y))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinant();if(r===0)return n.set(1,1,1),t.identity(),this;let a=Zi.set(i[0],i[1],i[2]).length(),o=Zi.set(i[4],i[5],i[6]).length(),c=Zi.set(i[8],i[9],i[10]).length();r<0&&(a=-a),un.copy(this);let l=1/a,h=1/o,u=1/c;return un.elements[0]*=l,un.elements[1]*=l,un.elements[2]*=l,un.elements[4]*=h,un.elements[5]*=h,un.elements[6]*=h,un.elements[8]*=u,un.elements[9]*=u,un.elements[10]*=u,t.setFromRotationMatrix(un),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,i,r,a,o=mn,c=!1){let l=this.elements,h=2*r/(t-e),u=2*r/(n-i),d=(t+e)/(t-e),f=(n+i)/(n-i),g,y;if(c)g=r/(a-r),y=a*r/(a-r);else if(o===mn)g=-(a+r)/(a-r),y=-2*a*r/(a-r);else if(o===ds)g=-a/(a-r),y=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=mn,c=!1){let l=this.elements,h=2/(t-e),u=2/(n-i),d=-(t+e)/(t-e),f=-(n+i)/(n-i),g,y;if(c)g=1/(a-r),y=a/(a-r);else if(o===mn)g=-2/(a-r),y=-(a+r)/(a-r);else if(o===ds)g=-1/(a-r),y=-r/(a-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=u,l[9]=0,l[13]=f,l[2]=0,l[6]=0,l[10]=g,l[14]=y,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};Ga.prototype.isMatrix4=!0;var Oe=Ga,Zi=new D,un=new Oe,Qd=new D(0,0,0),ef=new D(1,1,1),ii=new D,Br=new D,Zt=new D,mh=new Oe,gh=new Et,Rn=class s{constructor(e=0,t=0,n=0,i=s.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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,n=!0){let i=e.elements,r=i[0],a=i[4],o=i[8],c=i[1],l=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(Ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Ge(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ge(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Ge(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Ge(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-Ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,f),this._y=0);break;default:_e("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return mh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gh.setFromEuler(this),this.setFromQuaternion(gh,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}};Rn.DEFAULT_ORDER="XYZ";var Zs=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}},tf=0,bh=new D,$i=new Et,Gn=new Oe,kr=new D,Os=new D,nf=new D,sf=new Et,_h=new D(1,0,0),xh=new D(0,1,0),vh=new D(0,0,1),yh={type:"added"},rf={type:"removed"},Qi={type:"childadded",child:null},Qo={type:"childremoved",child:null},lt=class s extends cn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:tf++}),this.uuid=bn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=s.DEFAULT_UP.clone();let e=new D,t=new Rn,n=new Et,i=new D(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._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:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Oe},normalMatrix:{value:new Ie}}),this.matrix=new Oe,this.matrixWorld=new Oe,this.matrixAutoUpdate=s.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=s.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Zs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}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 $i.setFromAxisAngle(e,t),this.quaternion.multiply($i),this}rotateOnWorldAxis(e,t){return $i.setFromAxisAngle(e,t),this.quaternion.premultiply($i),this}rotateX(e){return this.rotateOnAxis(_h,e)}rotateY(e){return this.rotateOnAxis(xh,e)}rotateZ(e){return this.rotateOnAxis(vh,e)}translateOnAxis(e,t){return bh.copy(e).applyQuaternion(this.quaternion),this.position.add(bh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(_h,e)}translateY(e){return this.translateOnAxis(xh,e)}translateZ(e){return this.translateOnAxis(vh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Gn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?kr.copy(e):kr.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),Os.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Gn.lookAt(Os,kr,this.up):Gn.lookAt(kr,Os,this.up),this.quaternion.setFromRotationMatrix(Gn),i&&(Gn.extractRotation(i.matrixWorld),$i.setFromRotationMatrix(Gn),this.quaternion.premultiply($i.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(we("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(yh),Qi.child=e,this.dispatchEvent(Qi),Qi.child=null):we("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rf),Qo.child=e,this.dispatchEvent(Qo),Qo.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),Gn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Gn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Gn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(yh),Qi.child=e,this.dispatchEvent(Qi),Qi.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 n=0,i=this.children.length;n<i;n++){let a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Os,e,nf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Os,sf,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 n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].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);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}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 n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.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 i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let c=this.animations[o];i.animations.push(r(e.animations,c))}}if(t){let o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),f=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),g.length>0&&(n.nodes=g)}return n.object=i,n;function a(o){let c=[];for(let l in o){let h=o[l];delete h.metadata,c.push(h)}return c}}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.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};lt.DEFAULT_UP=new D(0,1,0);lt.DEFAULT_MATRIX_AUTO_UPDATE=!0;lt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var gn=class extends lt{constructor(){super(),this.isGroup=!0,this.type="Group"}},af={type:"move"},gs=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new gn,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 gn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new gn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D,this._grip.eventsEnabled=!1),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 n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),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,n){let i=null,r=null,a=null,o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(let y of e.hand.values()){let m=t.getJointPose(y,n),p=this._getHandJoint(l,y);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}let h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,g=.005;l.inputState.pinching&&d>f+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(af)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new gn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Iu={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},si={h:0,s:0,l:0},zr={h:0,s:0,l:0};function ec(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}var Ae=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_t){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ze.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=ze.workingColorSpace){return this.r=e,this.g=t,this.b=n,ze.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=ze.workingColorSpace){if(e=Jc(e,1),t=Ge(t,0,1),n=Ge(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=ec(a,r,e+1/3),this.g=ec(a,r,e),this.b=ec(a,r,e-1/3)}return ze.colorSpaceToWorking(this,i),this}setStyle(e,t=_t){function n(r){r!==void 0&&parseFloat(r)<1&&_e("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=i[1],o=i[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 n(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 n(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 n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:_e("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[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);_e("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_t){let n=Iu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):_e("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=jn(e.r),this.g=jn(e.g),this.b=jn(e.b),this}copyLinearToSRGB(e){return this.r=hs(e.r),this.g=hs(e.g),this.b=hs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_t){return ze.workingToColorSpace(Ut.copy(this),e),Math.round(Ge(Ut.r*255,0,255))*65536+Math.round(Ge(Ut.g*255,0,255))*256+Math.round(Ge(Ut.b*255,0,255))}getHexString(e=_t){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ze.workingColorSpace){ze.workingToColorSpace(Ut.copy(this),t);let n=Ut.r,i=Ut.g,r=Ut.b,a=Math.max(n,i,r),o=Math.min(n,i,r),c,l,h=(o+a)/2;if(o===a)c=0,l=0;else{let u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(i-r)/u+(i<r?6:0);break;case i:c=(r-n)/u+2;break;case r:c=(n-i)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=ze.workingColorSpace){return ze.workingToColorSpace(Ut.copy(this),t),e.r=Ut.r,e.g=Ut.g,e.b=Ut.b,e}getStyle(e=_t){ze.workingToColorSpace(Ut.copy(this),e);let t=Ut.r,n=Ut.g,i=Ut.b;return e!==_t?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(si),this.setHSL(si.h+e,si.s+t,si.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(si),e.getHSL(zr);let n=Xs(si.h,zr.h,t),i=Xs(si.s,zr.s,t),r=Xs(si.l,zr.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,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}},Ut=new Ae;Ae.NAMES=Iu;var Ni=class extends lt{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 Rn,this.environmentIntensity=1,this.environmentRotation=new Rn,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}},dn=new D,Vn=new D,tc=new D,Hn=new D,es=new D,ts=new D,Mh=new D,nc=new D,ic=new D,sc=new D,rc=new nt,ac=new nt,oc=new nt,li=class s{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),dn.subVectors(e,t),i.cross(dn);let r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){dn.subVectors(i,t),Vn.subVectors(n,t),tc.subVectors(e,t);let a=dn.dot(dn),o=dn.dot(Vn),c=dn.dot(tc),l=Vn.dot(Vn),h=Vn.dot(tc),u=a*l-o*o;if(u===0)return r.set(0,0,0),null;let d=1/u,f=(l*c-o*h)*d,g=(a*h-o*c)*d;return r.set(1-f-g,g,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Hn)===null?!1:Hn.x>=0&&Hn.y>=0&&Hn.x+Hn.y<=1}static getInterpolation(e,t,n,i,r,a,o,c){return this.getBarycoord(e,t,n,i,Hn)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,Hn.x),c.addScaledVector(a,Hn.y),c.addScaledVector(o,Hn.z),c)}static getInterpolatedAttribute(e,t,n,i,r,a){return rc.setScalar(0),ac.setScalar(0),oc.setScalar(0),rc.fromBufferAttribute(e,t),ac.fromBufferAttribute(e,n),oc.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(rc,r.x),a.addScaledVector(ac,r.y),a.addScaledVector(oc,r.z),a}static isFrontFacing(e,t,n,i){return dn.subVectors(n,t),Vn.subVectors(e,t),dn.cross(Vn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 dn.subVectors(this.c,this.b),Vn.subVectors(this.a,this.b),dn.cross(Vn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return s.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return s.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return s.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return s.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return s.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,r=this.c,a,o;es.subVectors(i,n),ts.subVectors(r,n),nc.subVectors(e,n);let c=es.dot(nc),l=ts.dot(nc);if(c<=0&&l<=0)return t.copy(n);ic.subVectors(e,i);let h=es.dot(ic),u=ts.dot(ic);if(h>=0&&u<=h)return t.copy(i);let d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(es,a);sc.subVectors(e,r);let f=es.dot(sc),g=ts.dot(sc);if(g>=0&&f<=g)return t.copy(r);let y=f*l-c*g;if(y<=0&&l>=0&&g<=0)return o=l/(l-g),t.copy(n).addScaledVector(ts,o);let m=h*g-f*u;if(m<=0&&u-h>=0&&f-g>=0)return Mh.subVectors(r,i),o=(u-h)/(u-h+(f-g)),t.copy(i).addScaledVector(Mh,o);let p=1/(m+y+d);return a=y*p,o=d*p,t.copy(n).addScaledVector(es,a).addScaledVector(ts,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Vt=class{constructor(e=new D(1/0,1/0,1/0),t=new D(-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,n=e.length;t<n;t+=3)this.expandByPoint(fn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(fn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=fn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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 n=e.geometry;if(n!==void 0){let r=n.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,fn):fn.fromBufferAttribute(r,a),fn.applyMatrix4(e.matrixWorld),this.expandByPoint(fn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Gr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Gr.copy(n.boundingBox)),Gr.applyMatrix4(e.matrixWorld),this.union(Gr)}let i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[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,fn),fn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bs),Vr.subVectors(this.max,Bs),ns.subVectors(e.a,Bs),is.subVectors(e.b,Bs),ss.subVectors(e.c,Bs),ri.subVectors(is,ns),ai.subVectors(ss,is),Si.subVectors(ns,ss);let t=[0,-ri.z,ri.y,0,-ai.z,ai.y,0,-Si.z,Si.y,ri.z,0,-ri.x,ai.z,0,-ai.x,Si.z,0,-Si.x,-ri.y,ri.x,0,-ai.y,ai.x,0,-Si.y,Si.x,0];return!cc(t,ns,is,ss,Vr)||(t=[1,0,0,0,1,0,0,0,1],!cc(t,ns,is,ss,Vr))?!1:(Hr.crossVectors(ri,ai),t=[Hr.x,Hr.y,Hr.z],cc(t,ns,is,ss,Vr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,fn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(fn).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:(Wn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Wn=[new D,new D,new D,new D,new D,new D,new D,new D],fn=new D,Gr=new Vt,ns=new D,is=new D,ss=new D,ri=new D,ai=new D,Si=new D,Bs=new D,Vr=new D,Hr=new D,Ti=new D;function cc(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Ti.fromArray(s,r);let o=i.x*Math.abs(Ti.x)+i.y*Math.abs(Ti.y)+i.z*Math.abs(Ti.z),c=e.dot(Ti),l=t.dot(Ti),h=n.dot(Ti);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}var Mt=new D,Wr=new Re,of=0,Tt=class extends cn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:of++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=va,this.updateRanges=[],this.gpuType=tn,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,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Wr.fromBufferAttribute(this,t),Wr.applyMatrix3(e),this.setXY(t,Wr.x,Wr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyMatrix3(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyMatrix4(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyNormalMatrix(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.transformDirection(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=pn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=pn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=pn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Je(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=pn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Je(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=pn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),r=Je(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,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!==va&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var $s=class extends Tt{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var Qs=class extends Tt{constructor(e,t,n){super(new Uint32Array(e),t,n)}};var zt=class extends Tt{constructor(e,t,n){super(new Float32Array(e),t,n)}},cf=new Vt,ks=new D,lc=new D,Wt=class{constructor(e=new D,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 n=this.center;t!==void 0?n.copy(t):cf.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),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 n=this.center.distanceToSquared(e);return t.copy(e),n>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;ks.subVectors(e,this.center);let t=ks.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ks,i/n),this.radius+=i}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):(lc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ks.copy(e.center).add(lc)),this.expandByPoint(ks.copy(e.center).sub(lc))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},lf=0,rn=new Oe,hc=new lt,rs=new D,$t=new Vt,zs=new Vt,It=new D,Ht=class s extends cn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:lf++}),this.uuid=bn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,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(Dd(e)?Qs:$s)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,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,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Ie().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return rn.makeRotationFromQuaternion(e),this.applyMatrix4(rn),this}rotateX(e){return rn.makeRotationX(e),this.applyMatrix4(rn),this}rotateY(e){return rn.makeRotationY(e),this.applyMatrix4(rn),this}rotateZ(e){return rn.makeRotationZ(e),this.applyMatrix4(rn),this}translate(e,t,n){return rn.makeTranslation(e,t,n),this.applyMatrix4(rn),this}scale(e,t,n){return rn.makeScale(e,t,n),this.applyMatrix4(rn),this}lookAt(e){return hc.lookAt(e),hc.updateMatrix(),this.applyMatrix4(hc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rs).negate(),this.translate(rs.x,rs.y,rs.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,r=e.length;i<r;i++){let a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new zt(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&_e("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 Vt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){we("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let r=t[n];$t.setFromBufferAttribute(r),this.morphTargetsRelative?(It.addVectors(this.boundingBox.min,$t.min),this.boundingBox.expandByPoint(It),It.addVectors(this.boundingBox.max,$t.max),this.boundingBox.expandByPoint(It)):(this.boundingBox.expandByPoint($t.min),this.boundingBox.expandByPoint($t.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&we('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 Wt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){we("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){let n=this.boundingSphere.center;if($t.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){let o=t[r];zs.setFromBufferAttribute(o),this.morphTargetsRelative?(It.addVectors($t.min,zs.min),$t.expandByPoint(It),It.addVectors($t.max,zs.max),$t.expandByPoint(It)):($t.expandByPoint(zs.min),$t.expandByPoint(zs.max))}$t.getCenter(n);let i=0;for(let r=0,a=e.count;r<a;r++)It.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(It));if(t)for(let r=0,a=t.length;r<a;r++){let o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)It.fromBufferAttribute(o,l),c&&(rs.fromBufferAttribute(e,l),It.add(rs)),i=Math.max(i,n.distanceToSquared(It))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&we('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){we("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Tt(new Float32Array(4*n.count),4));let a=this.getAttribute("tangent"),o=[],c=[];for(let _=0;_<n.count;_++)o[_]=new D,c[_]=new D;let l=new D,h=new D,u=new D,d=new Re,f=new Re,g=new Re,y=new D,m=new D;function p(_,w,L){l.fromBufferAttribute(n,_),h.fromBufferAttribute(n,w),u.fromBufferAttribute(n,L),d.fromBufferAttribute(r,_),f.fromBufferAttribute(r,w),g.fromBufferAttribute(r,L),h.sub(l),u.sub(l),f.sub(d),g.sub(d);let R=1/(f.x*g.y-g.x*f.y);isFinite(R)&&(y.copy(h).multiplyScalar(g.y).addScaledVector(u,-f.y).multiplyScalar(R),m.copy(u).multiplyScalar(f.x).addScaledVector(h,-g.x).multiplyScalar(R),o[_].add(y),o[w].add(y),o[L].add(y),c[_].add(m),c[w].add(m),c[L].add(m))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let _=0,w=x.length;_<w;++_){let L=x[_],R=L.start,O=L.count;for(let H=R,q=R+O;H<q;H+=3)p(e.getX(H+0),e.getX(H+1),e.getX(H+2))}let S=new D,M=new D,E=new D,A=new D;function C(_){E.fromBufferAttribute(i,_),A.copy(E);let w=o[_];S.copy(w),S.sub(E.multiplyScalar(E.dot(w))).normalize(),M.crossVectors(A,w);let R=M.dot(c[_])<0?-1:1;a.setXYZW(_,S.x,S.y,S.z,R)}for(let _=0,w=x.length;_<w;++_){let L=x[_],R=L.start,O=L.count;for(let H=R,q=R+O;H<q;H+=3)C(e.getX(H+0)),C(e.getX(H+1)),C(e.getX(H+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Tt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);let i=new D,r=new D,a=new D,o=new D,c=new D,l=new D,h=new D,u=new D;if(e)for(let d=0,f=e.count;d<f;d+=3){let g=e.getX(d+0),y=e.getX(d+1),m=e.getX(d+2);i.fromBufferAttribute(t,g),r.fromBufferAttribute(t,y),a.fromBufferAttribute(t,m),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),o.fromBufferAttribute(n,g),c.fromBufferAttribute(n,y),l.fromBufferAttribute(n,m),o.add(h),c.add(h),l.add(h),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)It.fromBufferAttribute(e,t),It.normalize(),e.setXYZ(t,It.x,It.y,It.z)}toNonIndexed(){function e(o,c){let l=o.array,h=o.itemSize,u=o.normalized,d=new l.constructor(c.length*h),f=0,g=0;for(let y=0,m=c.length;y<m;y++){o.isInterleavedBufferAttribute?f=c[y]*o.data.stride+o.offset:f=c[y]*h;for(let p=0;p<h;p++)d[g++]=l[f++]}return new Tt(d,h,u)}if(this.index===null)return _e("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new s,n=this.index.array,i=this.attributes;for(let o in i){let c=i[o],l=e(c,n);t.setAttribute(o,l)}let r=this.morphAttributes;for(let o in r){let c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){let d=l[h],f=e(d,n);c.push(f)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,c=a.length;o<c;o++){let l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,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 c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);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 n=this.attributes;for(let c in n){let l=n[c];e.data.attributes[c]=l.toJSON(e.data)}let i={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){let f=l[u];h.push(f.toJSON(e.data))}h.length>0&&(i[c]=h,r=!0)}r&&(e.data.morphAttributes=i,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=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let i=e.attributes;for(let l in i){let h=i[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],u=r[l];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let l=0,h=a.length;l<h;l++){let u=a[l];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},bs=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=va,this.updateRanges=[],this.version=0,this.uuid=bn()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},kt=new D,_s=class s{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)kt.fromBufferAttribute(this,t),kt.applyMatrix4(e),this.setXYZ(t,kt.x,kt.y,kt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)kt.fromBufferAttribute(this,t),kt.applyNormalMatrix(e),this.setXYZ(t,kt.x,kt.y,kt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)kt.fromBufferAttribute(this,t),kt.transformDirection(e),this.setXYZ(t,kt.x,kt.y,kt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=pn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=pn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=pn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=pn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=pn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),r=Je(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){Ys("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new Tt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new s(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Ys("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},hf=0,Ot=class extends cn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:hf++}),this.uuid=bn(),this.name="",this.type="Material",this.blending=Pi,this.side=_n,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ua,this.blendDst=da,this.blendEquation=hi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ae(0,0,0),this.blendAlpha=0,this.depthFunc=Ii,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Sc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ei,this.stencilZFail=Ei,this.stencilZPass=Ei,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}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 n=e[t];if(n===void 0){_e(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){_e(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Pi&&(n.blending=this.blending),this.side!==_n&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ua&&(n.blendSrc=this.blendSrc),this.blendDst!==da&&(n.blendDst=this.blendDst),this.blendEquation!==hi&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ii&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Sc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ei&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ei&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ei&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){let a=[];for(let o in r){let c=r[o];delete c.metadata,a.push(c)}return a}if(t){let r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,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++}};var qn=new D,uc=new D,qr=new D,oi=new D,dc=new D,Xr=new D,fc=new D,Kn=class{constructor(e=new D,t=new D(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,qn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=qn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qn.copy(this.origin).addScaledVector(this.direction,t),qn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){uc.copy(e).add(t).multiplyScalar(.5),qr.copy(t).sub(e).normalize(),oi.copy(this.origin).sub(uc);let r=e.distanceTo(t)*.5,a=-this.direction.dot(qr),o=oi.dot(this.direction),c=-oi.dot(qr),l=oi.lengthSq(),h=Math.abs(1-a*a),u,d,f,g;if(h>0)if(u=a*c-o,d=a*o-c,g=r*h,u>=0)if(d>=-g)if(d<=g){let y=1/h;u*=y,d*=y,f=u*(u+a*d+2*o)+d*(a*u+d+2*c)+l}else d=r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d=-r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d<=-g?(u=Math.max(0,-(-a*r+o)),d=u>0?-r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l):d<=g?(u=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(u=Math.max(0,-(a*r+o)),d=u>0?r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l);else d=a>0?-r:r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(uc).addScaledVector(qr,d),f}intersectSphere(e,t){qn.subVectors(e.center,this.origin);let n=qn.dot(this.direction),i=qn.dot(qn)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1: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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,c,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),h>=0?(r=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(r=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||o>i)||((o>n||n!==n)&&(n=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,qn)!==null}intersectTriangle(e,t,n,i,r){dc.subVectors(t,e),Xr.subVectors(n,e),fc.crossVectors(dc,Xr);let a=this.direction.dot(fc),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;oi.subVectors(this.origin,e);let c=o*this.direction.dot(Xr.crossVectors(oi,Xr));if(c<0)return null;let l=o*this.direction.dot(dc.cross(oi));if(l<0||c+l>a)return null;let h=-o*oi.dot(fc);return h<0?null:this.at(h/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)}},xn=class extends Ot{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ae(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 Rn,this.combine=Ha,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}},Sh=new Oe,Ai=new Kn,jr=new Wt,Th=new D,Kr=new D,Yr=new D,Jr=new D,pc=new D,Zr=new D,Ah=new D,$r=new D,at=class extends lt{constructor(e=new Ht,t=new xn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,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,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(r&&o){Zr.set(0,0,0);for(let c=0,l=r.length;c<l;c++){let h=o[c],u=r[c];h!==0&&(pc.fromBufferAttribute(u,e),a?Zr.addScaledVector(pc,h):Zr.addScaledVector(pc.sub(t),h))}t.add(Zr)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),jr.copy(n.boundingSphere),jr.applyMatrix4(r),Ai.copy(e.ray).recast(e.near),!(jr.containsPoint(Ai.origin)===!1&&(Ai.intersectSphere(jr,Th)===null||Ai.origin.distanceToSquared(Th)>(e.far-e.near)**2))&&(Sh.copy(r).invert(),Ai.copy(e.ray).applyMatrix4(Sh),!(n.boundingBox!==null&&Ai.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ai)))}_computeIntersections(e,t,n){let i,r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,d=r.groups,f=r.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,y=d.length;g<y;g++){let m=d[g],p=a[m.materialIndex],x=Math.max(m.start,f.start),S=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let M=x,E=S;M<E;M+=3){let A=o.getX(M),C=o.getX(M+1),_=o.getX(M+2);i=Qr(this,p,e,n,l,h,u,A,C,_),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let g=Math.max(0,f.start),y=Math.min(o.count,f.start+f.count);for(let m=g,p=y;m<p;m+=3){let x=o.getX(m),S=o.getX(m+1),M=o.getX(m+2);i=Qr(this,a,e,n,l,h,u,x,S,M),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(a))for(let g=0,y=d.length;g<y;g++){let m=d[g],p=a[m.materialIndex],x=Math.max(m.start,f.start),S=Math.min(c.count,Math.min(m.start+m.count,f.start+f.count));for(let M=x,E=S;M<E;M+=3){let A=M,C=M+1,_=M+2;i=Qr(this,p,e,n,l,h,u,A,C,_),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let g=Math.max(0,f.start),y=Math.min(c.count,f.start+f.count);for(let m=g,p=y;m<p;m+=3){let x=m,S=m+1,M=m+2;i=Qr(this,a,e,n,l,h,u,x,S,M),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}};function uf(s,e,t,n,i,r,a,o){let c;if(e.side===Lt?c=n.intersectTriangle(a,r,i,!0,o):c=n.intersectTriangle(i,r,a,e.side===_n,o),c===null)return null;$r.copy(o),$r.applyMatrix4(s.matrixWorld);let l=t.ray.origin.distanceTo($r);return l<t.near||l>t.far?null:{distance:l,point:$r.clone(),object:s}}function Qr(s,e,t,n,i,r,a,o,c,l){s.getVertexPosition(o,Kr),s.getVertexPosition(c,Yr),s.getVertexPosition(l,Jr);let h=uf(s,e,t,n,Kr,Yr,Jr,Ah);if(h){let u=new D;li.getBarycoord(Ah,Kr,Yr,Jr,u),i&&(h.uv=li.getInterpolatedAttribute(i,o,c,l,u,new Re)),r&&(h.uv1=li.getInterpolatedAttribute(r,o,c,l,u,new Re)),a&&(h.normal=li.getInterpolatedAttribute(a,o,c,l,u,new D),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let d={a:o,b:c,c:l,normal:new D,materialIndex:0};li.getNormal(Kr,Yr,Jr,d.normal),h.face=d,h.barycoord=u}return h}var Gs=new nt,wh=new nt,Eh=new nt,df=new nt,Rh=new Oe,ea=new D,mc=new Wt,Ch=new Oe,gc=new Kn,er=class extends at{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=yc,this.bindMatrix=new Oe,this.bindMatrixInverse=new Oe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Vt),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ea),this.boundingBox.expandByPoint(ea)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Wt),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ea),this.boundingSphere.expandByPoint(ea)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),mc.copy(this.boundingSphere),mc.applyMatrix4(i),e.ray.intersectsSphere(mc)!==!1&&(Ch.copy(i).invert(),gc.copy(e.ray).applyMatrix4(Ch),!(this.boundingBox!==null&&gc.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,gc)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new nt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===yc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===pu?this.bindMatrixInverse.copy(this.bindMatrix).invert():_e("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;wh.fromBufferAttribute(i.attributes.skinIndex,e),Eh.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4?(Gs.copy(t),t.set(0,0,0,0)):(Gs.set(...t,1),t.set(0,0,0)),Gs.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let a=Eh.getComponent(r);if(a!==0){let o=wh.getComponent(r);Rh.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(df.copy(Gs).applyMatrix4(Rh),a)}}return t.isVector4&&(t.w=Gs.w),t.applyMatrix4(this.bindMatrixInverse)}},xs=class extends lt{constructor(){super(),this.isBone=!0,this.type="Bone"}},vs=class extends Dt{constructor(e=null,t=1,n=1,i,r,a,o,c,l=xt,h=xt,u,d){super(null,a,o,c,l,h,i,r,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Ph=new Oe,ff=new Oe,tr=class s{constructor(e=[],t=[]){this.uuid=bn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){_e("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Oe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Oe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=e.length;r<a;r++){let o=e[r]?e[r].matrixWorld:ff;Ph.multiplyMatrices(o,t[r]),Ph.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new s(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new vs(t,e,e,nn,tn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let r=e.bones[n],a=t[r];a===void 0&&(_e("Skeleton: No bone found with UUID:",r),a=new xs),this.bones.push(a),this.boneInverses.push(new Oe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){let a=t[i];e.bones.push(a.uuid);let o=n[i];e.boneInverses.push(o.toArray())}return e}},di=class extends Tt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}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}},as=new Oe,Ih=new Oe,ta=[],Dh=new Vt,pf=new Oe,Vs=new at,Hs=new Wt,Ui=class extends at{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new di(new Float32Array(n*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,pf)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Vt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,as),Dh.copy(e.boundingBox).applyMatrix4(as),this.boundingBox.union(Dh)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Wt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,as),Hs.copy(e.boundingSphere).applyMatrix4(as),this.boundingSphere.union(Hs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),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){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,a=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(Vs.geometry=this.geometry,Vs.material=this.material,Vs.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Hs.copy(this.boundingSphere),Hs.applyMatrix4(n),e.ray.intersectsSphere(Hs)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,as),Ih.multiplyMatrices(n,as),Vs.matrixWorld=Ih,Vs.raycast(e,ta);for(let a=0,o=ta.length;a<o;a++){let c=ta[a];c.instanceId=r,c.object=this,t.push(c)}ta.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new di(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new vs(new Float32Array(i*this.count),i,this.count,Ja,tn));let r=this.morphTexture.source.data.data,a=0;for(let l=0;l<n.length;l++)a+=n[l];let o=this.geometry.morphTargetsRelative?1:1-a,c=i*e;return r[c]=o,r.set(n,c+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},bc=new D,mf=new D,gf=new Ie,an=class{constructor(e=new D(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=bc.subVectors(n,t).cross(mf.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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,n=!0){let i=e.delta(bc),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/r;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||gf.getNormalMatrix(e),i=this.coplanarPoint(bc).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.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)}},wi=new Wt,bf=new Re(.5,.5),na=new D,ys=class{constructor(e=new an,t=new an,n=new an,i=new an,r=new an,a=new an){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=mn,n=!1){let i=this.planes,r=e.elements,a=r[0],o=r[1],c=r[2],l=r[3],h=r[4],u=r[5],d=r[6],f=r[7],g=r[8],y=r[9],m=r[10],p=r[11],x=r[12],S=r[13],M=r[14],E=r[15];if(i[0].setComponents(l-a,f-h,p-g,E-x).normalize(),i[1].setComponents(l+a,f+h,p+g,E+x).normalize(),i[2].setComponents(l+o,f+u,p+y,E+S).normalize(),i[3].setComponents(l-o,f-u,p-y,E-S).normalize(),n)i[4].setComponents(c,d,m,M).normalize(),i[5].setComponents(l-c,f-d,p-m,E-M).normalize();else if(i[4].setComponents(l-c,f-d,p-m,E-M).normalize(),t===mn)i[5].setComponents(l+c,f+d,p+m,E+M).normalize();else if(t===ds)i[5].setComponents(c,d,m,M).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(),wi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),wi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(wi)}intersectsSprite(e){wi.center.set(0,0,0);let t=bf.distanceTo(e.center);return wi.radius=.7071067811865476+t,wi.applyMatrix4(e.matrixWorld),this.intersectsSphere(wi)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(na.x=i.normal.x>0?e.max.x:e.min.x,na.y=i.normal.y>0?e.max.y:e.min.y,na.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(na)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var Ms=class extends Ot{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ae(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Aa=new D,wa=new D,Lh=new Oe,Ws=new Kn,ia=new Wt,_c=new D,Fh=new D,Oi=class extends lt{constructor(e=new Ht,t=new Ms){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Aa.fromBufferAttribute(t,i-1),wa.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Aa.distanceTo(wa);e.setAttribute("lineDistance",new zt(n,1))}else _e("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ia.copy(n.boundingSphere),ia.applyMatrix4(i),ia.radius+=r,e.ray.intersectsSphere(ia)===!1)return;Lh.copy(i).invert(),Ws.copy(e.ray).applyMatrix4(Lh);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){let f=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let y=f,m=g-1;y<m;y+=l){let p=h.getX(y),x=h.getX(y+1),S=sa(this,e,Ws,c,p,x,y);S&&t.push(S)}if(this.isLineLoop){let y=h.getX(g-1),m=h.getX(f),p=sa(this,e,Ws,c,y,m,g-1);p&&t.push(p)}}else{let f=Math.max(0,a.start),g=Math.min(d.count,a.start+a.count);for(let y=f,m=g-1;y<m;y+=l){let p=sa(this,e,Ws,c,y,y+1,y);p&&t.push(p)}if(this.isLineLoop){let y=sa(this,e,Ws,c,g-1,f,g-1);y&&t.push(y)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}};function sa(s,e,t,n,i,r,a){let o=s.geometry.attributes.position;if(Aa.fromBufferAttribute(o,i),wa.fromBufferAttribute(o,r),t.distanceSqToSegment(Aa,wa,_c,Fh)>n)return;_c.applyMatrix4(s.matrixWorld);let l=e.ray.origin.distanceTo(_c);if(!(l<e.near||l>e.far))return{distance:l,point:Fh.clone().applyMatrix4(s.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:s}}var Nh=new D,Uh=new D,nr=class extends Oi{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)Nh.fromBufferAttribute(t,i),Uh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Nh.distanceTo(Uh);e.setAttribute("lineDistance",new zt(n,1))}else _e("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},ir=class extends Oi{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}},Ss=class extends Ot{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ae(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}},Oh=new Oe,Tc=new Kn,ra=new Wt,aa=new D,sr=class extends lt{constructor(e=new Ht,t=new Ss){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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 n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ra.copy(n.boundingSphere),ra.applyMatrix4(i),ra.radius+=r,e.ray.intersectsSphere(ra)===!1)return;Oh.copy(i).invert(),Tc.copy(e.ray).applyMatrix4(Oh);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,u=n.attributes.position;if(l!==null){let d=Math.max(0,a.start),f=Math.min(l.count,a.start+a.count);for(let g=d,y=f;g<y;g++){let m=l.getX(g);aa.fromBufferAttribute(u,m),Bh(aa,m,c,i,e,t,this)}}else{let d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let g=d,y=f;g<y;g++)aa.fromBufferAttribute(u,g),Bh(aa,g,c,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}};function Bh(s,e,t,n,i,r,a){let o=Tc.distanceSqToPoint(s);if(o<t){let c=new D;Tc.closestPointToPoint(s,c),c.applyMatrix4(n);let l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}var rr=class extends Dt{constructor(e=[],t=bi,n,i,r,a,o,c,l,h){super(e,t,n,i,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Yn=class extends Dt{constructor(e,t,n=Mn,i,r,a,o=xt,c=xt,l,h=En,u=1){if(h!==En&&h!==_i)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:u};super(d,i,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ms(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Ea=class extends Yn{constructor(e,t=Mn,n=bi,i,r,a=xt,o=xt,c,l=En){let h={width:e,height:e,depth:1},u=[h,h,h,h,h,h];super(e,e,t,n,i,r,a,o,c,l),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},ar=class extends Dt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},fi=class s extends Ht{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};let o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);let c=[],l=[],h=[],u=[],d=0,f=0;g("z","y","x",-1,-1,n,t,e,a,r,0),g("z","y","x",1,-1,n,t,-e,a,r,1),g("x","z","y",1,1,e,n,t,i,a,2),g("x","z","y",1,-1,e,n,-t,i,a,3),g("x","y","z",1,-1,e,t,n,i,r,4),g("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new zt(l,3)),this.setAttribute("normal",new zt(h,3)),this.setAttribute("uv",new zt(u,2));function g(y,m,p,x,S,M,E,A,C,_,w){let L=M/C,R=E/_,O=M/2,H=E/2,q=A/2,N=C+1,z=_+1,V=0,$=0,Q=new D;for(let le=0;le<z;le++){let xe=le*R-H;for(let Se=0;Se<N;Se++){let Xe=Se*L-O;Q[y]=Xe*x,Q[m]=xe*S,Q[p]=q,l.push(Q.x,Q.y,Q.z),Q[y]=0,Q[m]=0,Q[p]=A>0?1:-1,h.push(Q.x,Q.y,Q.z),u.push(Se/C),u.push(1-le/_),V+=1}}for(let le=0;le<_;le++)for(let xe=0;xe<C;xe++){let Se=d+xe+N*le,Xe=d+xe+N*(le+1),Ze=d+(xe+1)+N*(le+1),Ne=d+(xe+1)+N*le;c.push(Se,Xe,Ne),c.push(Xe,Ze,Ne),$+=6}o.addGroup(f,$,w),f+=$,d+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var Bi=class s extends Ht{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let r=e/2,a=t/2,o=Math.floor(n),c=Math.floor(i),l=o+1,h=c+1,u=e/o,d=t/c,f=[],g=[],y=[],m=[];for(let p=0;p<h;p++){let x=p*d-a;for(let S=0;S<l;S++){let M=S*u-r;g.push(M,-x,0),y.push(0,0,1),m.push(S/o),m.push(1-p/c)}}for(let p=0;p<c;p++)for(let x=0;x<o;x++){let S=x+l*p,M=x+l*(p+1),E=x+1+l*(p+1),A=x+1+l*p;f.push(S,M,A),f.push(M,E,A)}this.setIndex(f),this.setAttribute("position",new zt(g,3)),this.setAttribute("normal",new zt(y,3)),this.setAttribute("uv",new zt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s(e.width,e.height,e.widthSegments,e.heightSegments)}};var or=class extends Ot{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ae(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function qi(s){let e={};for(let t in s){e[t]={};for(let n in s[t]){let i=s[t][n];if(kh(i))i.isRenderTargetTexture?(_e("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(kh(i[0])){let r=[];for(let a=0,o=i.length;a<o;a++)r[a]=i[a].clone();e[t][n]=r}else e[t][n]=i.slice();else e[t][n]=i}}return e}function Bt(s){let e={};for(let t=0;t<s.length;t++){let n=qi(s[t]);for(let i in n)e[i]=n[i]}return e}function kh(s){return s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)}function _f(s){let e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Zc(s){let e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ze.workingColorSpace}var Du={clone:qi,merge:Bt},xf=`void main() {- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );-}`,vf=`void main() {- gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );-}`,en=class extends Ot{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=xf,this.fragmentShader=vf,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=qi(e.uniforms),this.uniformsGroups=_f(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.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={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 n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},Ra=class extends en{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},Cn=class extends Ot{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ae(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 Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pr,this.normalScale=new Re(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 Rn,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}},qt=class extends Cn{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Re(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ge(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 Ae(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 Ae(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ae(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}};var cr=class extends Ot{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ae(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pr,this.normalScale=new Re(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rn,this.combine=Ha,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Ca=class extends Ot{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xu,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}},Pa=class extends Ot{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}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}};function oa(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function yf(s){function e(i,r){return s[i]-s[r]}let t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function zh(s,e,t){let n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){let o=t[r]*e;for(let c=0;c!==e;++c)i[a++]=s[o+c]}return i}function Lu(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push(...a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}var Pn=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=r)){let o=t[1];e<o&&(n=2,r=o);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){let o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ia=class extends Pn{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ri,endingEnd:Ri}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,a=e+1,o=i[r],c=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ci:r=e,o=2*t-n;break;case js:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Ci:a=e,c=2*n-t;break;case js:a=1,c=n+i[1]-i[0];break;default:a=e-1,c=t}let l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(c-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,g=(n-t)/(i-t),y=g*g,m=y*g,p=-d*m+2*d*y-d*g,x=(1+d)*m+(-1.5-2*d)*y+(-.5+d)*g+1,S=(-1-f)*m+(1.5+f)*y+.5*g,M=f*m-f*y;for(let E=0;E!==o;++E)r[E]=p*a[h+E]+x*a[l+E]+S*a[c+E]+M*a[u+E];return r}},lr=class extends Pn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)r[d]=a[l+d]*u+a[c+d]*h;return r}},Da=class extends Pn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},La=class extends Pn{interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this.settings||this.DefaultSettings_,u=h.inTangents,d=h.outTangents;if(!u||!d){let y=(n-t)/(i-t),m=1-y;for(let p=0;p!==o;++p)r[p]=a[l+p]*m+a[c+p]*y;return r}let f=o*2,g=e-1;for(let y=0;y!==o;++y){let m=a[l+y],p=a[c+y],x=g*f+y*2,S=d[x],M=d[x+1],E=e*f+y*2,A=u[E],C=u[E+1],_=(n-t)/(i-t),w,L,R,O,H;for(let q=0;q<8;q++){w=_*_,L=w*_,R=1-_,O=R*R,H=O*R;let z=H*t+3*O*_*S+3*R*w*A+L*i-n;if(Math.abs(z)<1e-10)break;let V=3*O*(S-t)+6*R*_*(A-S)+3*w*(i-A);if(Math.abs(V)<1e-10)break;_=_-z/V,_=Math.max(0,Math.min(1,_))}r[y]=H*m+3*O*_*M+3*R*w*C+L*p}return r}},Xt=class{constructor(e,t,n,i){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=oa(t,this.TimeBufferType),this.values=oa(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:oa(e.times,Array),values:oa(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Da(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new lr(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ia(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new La(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case Di:t=this.InterpolantFactoryMethodDiscrete;break;case Li:t=this.InterpolantFactoryMethodLinear;break;case ha:t=this.InterpolantFactoryMethodSmooth;break;case Mc:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="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(n);return _e("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Di;case this.InterpolantFactoryMethodLinear:return Li;case this.InterpolantFactoryMethodSmooth:return ha;case this.InterpolantFactoryMethodBezier:return Mc}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=n.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&&(we("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;r===0&&(we("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){let c=n[o];if(typeof c=="number"&&isNaN(c)){we("KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){we("KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&Ld(i))for(let o=0,c=i.length;o!==c;++o){let l=i[o];if(isNaN(l)){we("KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===ha,r=e.length-1,a=1;for(let o=1;o<r;++o){let c=!1,l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(i)c=!0;else{let u=o*n,d=u-n,f=u+n;for(let g=0;g!==n;++g){let y=t[u+g];if(y!==t[d+g]||y!==t[f+g]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];let u=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++a}}if(r>0){e[a]=e[r];for(let o=r*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Xt.prototype.ValueTypeName="";Xt.prototype.TimeBufferType=Float32Array;Xt.prototype.ValueBufferType=Float32Array;Xt.prototype.DefaultInterpolation=Li;var Jn=class extends Xt{constructor(e,t,n){super(e,t,n)}};Jn.prototype.ValueTypeName="bool";Jn.prototype.ValueBufferType=Array;Jn.prototype.DefaultInterpolation=Di;Jn.prototype.InterpolantFactoryMethodLinear=void 0;Jn.prototype.InterpolantFactoryMethodSmooth=void 0;var hr=class extends Xt{constructor(e,t,n,i){super(e,t,n,i)}};hr.prototype.ValueTypeName="color";var In=class extends Xt{constructor(e,t,n,i){super(e,t,n,i)}};In.prototype.ValueTypeName="number";var Fa=class extends Pn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t),l=e*o;for(let h=l+o;l!==h;l+=4)Et.slerpFlat(r,0,a,l-o,a,l,c);return r}},Dn=class extends Xt{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Fa(this.times,this.values,this.getValueSize(),e)}};Dn.prototype.ValueTypeName="quaternion";Dn.prototype.InterpolantFactoryMethodSmooth=void 0;var Zn=class extends Xt{constructor(e,t,n){super(e,t,n)}};Zn.prototype.ValueTypeName="string";Zn.prototype.ValueBufferType=Array;Zn.prototype.DefaultInterpolation=Di;Zn.prototype.InterpolantFactoryMethodLinear=void 0;Zn.prototype.InterpolantFactoryMethodSmooth=void 0;var Ln=class extends Xt{constructor(e,t,n,i){super(e,t,n,i)}};Ln.prototype.ValueTypeName="vector";var ki=class{constructor(e="",t=-1,n=[],i=Io){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Sf(n[a]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,a=n.length;r!==a;++r)t.push(Xt.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,a=[];for(let o=0;o<r;o++){let c=[],l=[];c.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);let h=yf(c);c=zh(c,1,h),l=zh(l,1,h),!i&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new In(".morphTargetInfluences["+t[o].name+"]",c,l).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){let l=e[o],h=l.name.match(r);if(h&&h.length>1){let u=h[1],d=i[u];d||(i[u]=d=[]),d.push(l)}}let a=[];for(let o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(_e("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return we("AnimationClip: No animation in JSONLoader data."),null;let n=function(u,d,f,g,y){if(f.length!==0){let m=[],p=[];Lu(f,m,p,g),m.length!==0&&y.push(new u(d,m,p))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let u=0;u<l.length;u++){let d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){let f={},g;for(g=0;g<d.length;g++)if(d[g].morphTargets)for(let y=0;y<d[g].morphTargets.length;y++)f[d[g].morphTargets[y]]=-1;for(let y in f){let m=[],p=[];for(let x=0;x!==d[g].morphTargets.length;++x){let S=d[g];m.push(S.time),p.push(S.morphTarget===y?1:0)}i.push(new In(".morphTargetInfluence["+y+"]",m,p))}c=f.length*a}else{let f=".bones["+t[u].name+"]";n(Ln,f+".position",d,"pos",i),n(Dn,f+".quaternion",d,"rot",i),n(Ln,f+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,o)}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}};function Mf(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return In;case"vector":case"vector2":case"vector3":case"vector4":return Ln;case"color":return hr;case"quaternion":return Dn;case"bool":case"boolean":return Jn;case"string":return Zn}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function Sf(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=Mf(s.type);if(s.times===void 0){let t=[],n=[];Lu(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}var wn={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(Gh(s)||(this.files[s]=e))},get:function(s){if(this.enabled!==!1&&!Gh(s))return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};function Gh(s){try{let e=s.slice(s.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var Na=class{constructor(e,t,n){let i=this,r=!1,a=0,o=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){o++,r===!1&&i.onStart!==void 0&&i.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){let u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=l.length;u<d;u+=2){let f=l[u],g=l[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Fu=new Na,Fn=class{constructor(e){this.manager=e!==void 0?e:Fu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,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}abort(){return this}};Fn.DEFAULT_MATERIAL_NAME="__DEFAULT";var Xn={},Ac=class extends Error{constructor(e,t){super(e),this.response=t}},Ts=class extends Fn{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=wn.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0);return}if(Xn[e]!==void 0){Xn[e].push({onLoad:t,onProgress:n,onError:i});return}Xn[e]=[],Xn[e].push({onLoad:t,onProgress:n,onError:i});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&_e("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let h=Xn[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,g=f!==0,y=0,m=new ReadableStream({start(p){x();function x(){u.read().then(({done:S,value:M})=>{if(S)p.close();else{y+=M.byteLength;let E=new ProgressEvent("progress",{lengthComputable:g,loaded:y,total:f});for(let A=0,C=h.length;A<C;A++){let _=h[A];_.onProgress&&_.onProgress(E)}p.enqueue(M),x()}},S=>{p.error(S)})}}});return new Response(m)}else throw new Ac(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return l.json();default:if(o==="")return l.text();{let u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(g=>f.decode(g))}}}).then(l=>{wn.add(`file:${e}`,l);let h=Xn[e];delete Xn[e];for(let u=0,d=h.length;u<d;u++){let f=h[u];f.onLoad&&f.onLoad(l)}}).catch(l=>{let h=Xn[e];if(h===void 0)throw this.manager.itemError(e),l;delete Xn[e];for(let u=0,d=h.length;u<d;u++){let f=h[u];f.onError&&f.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var os=new WeakMap,Ua=class extends Fn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=wn.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);else{let u=os.get(a);u===void 0&&(u=[],os.set(a,u)),u.push({onLoad:t,onError:i})}return a}let o=fs("img");function c(){h(),t&&t(this);let u=os.get(this)||[];for(let d=0;d<u.length;d++){let f=u[d];f.onLoad&&f.onLoad(this)}os.delete(this),r.manager.itemEnd(e)}function l(u){h(),i&&i(u),wn.remove(`image:${e}`);let d=os.get(this)||[];for(let f=0;f<d.length;f++){let g=d[f];g.onError&&g.onError(u)}os.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),wn.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}};var ur=class extends Fn{constructor(e){super(e)}load(e,t,n,i){let r=new Dt,a=new Ua(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){r.image=o,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}},zi=class extends lt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ae(e),this.intensity=t}dispose(){this.dispatchEvent({type:"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,t}},dr=class extends zi{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ae(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},xc=new Oe,Vh=new D,Hh=new D,fr=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Re(512,512),this.mapType=jt,this.map=null,this.mapPass=null,this.matrix=new Oe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ys,this._frameExtents=new Re(1,1),this._viewportCount=1,this._viewports=[new nt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;Vh.setFromMatrixPosition(e.matrixWorld),t.position.copy(Vh),Hh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Hh),t.updateMatrixWorld(),xc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===ds||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(xc)}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.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,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}},ca=new D,la=new Et,An=new D,pr=class extends lt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Oe,this.projectionMatrix=new Oe,this.projectionMatrixInverse=new Oe,this.coordinateSystem=mn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(ca,la,An),An.x===1&&An.y===1&&An.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ca,la,An.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(ca,la,An),An.x===1&&An.y===1&&An.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ca,la,An.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ci=new D,Wh=new Re,qh=new Re,St=class extends pr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=Fi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(qs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Fi*2*Math.atan(Math.tan(qs*.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,n){ci.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ci.x,ci.y).multiplyScalar(-e/ci.z),ci.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ci.x,ci.y).multiplyScalar(-e/ci.z)}getViewSize(e,t){return this.getViewBounds(e,Wh,qh),t.subVectors(qh,Wh)}setViewOffset(e,t,n,i,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=n,this.view.offsetY=i,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(qs*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(this.view!==null&&this.view.enabled){let c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}let o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},wc=class extends fr{constructor(){super(new St(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Fi*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},mr=class extends zi{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.target=new lt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new wc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},Ec=class extends fr{constructor(){super(new St(90,1,.5,500)),this.isPointLightShadow=!0}},Gi=class extends zi{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Ec}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.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}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},pi=class extends pr{constructor(e=-1,t=1,n=1,i=-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=n,this.bottom=i,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,n,i,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=n,this.view.offsetY=i,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Rc=class extends fr{constructor(){super(new pi(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},Vi=class extends zi{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.target=new lt,this.shadow=new Rc}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}};var $n=class{static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}};var vc=new WeakMap,gr=class extends Fn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&_e("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&_e("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=wn.get(`image-bitmap:${e}`);if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(l=>{vc.has(a)===!0?(i&&i(vc.get(a)),r.manager.itemError(e),r.manager.itemEnd(e)):(t&&t(l),r.manager.itemEnd(e))});return}setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let c=fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){wn.add(`image-bitmap:${e}`,l),t&&t(l),r.manager.itemEnd(e)}).catch(function(l){i&&i(l),vc.set(c,l),wn.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});wn.add(`image-bitmap:${e}`,c),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var cs=-90,ls=1,Oa=class extends lt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new St(cs,ls,e,t);i.layers=this.layers,this.add(i);let r=new St(cs,ls,e,t);r.layers=this.layers,this.add(r);let a=new St(cs,ls,e,t);a.layers=this.layers,this.add(a);let o=new St(cs,ls,e,t);o.layers=this.layers,this.add(o);let c=new St(cs,ls,e,t);c.layers=this.layers,this.add(c);let l=new St(cs,ls,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,c]=t;for(let l of t)this.remove(l);if(e===mn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===ds)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;let y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(n,1,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=y,e.setRenderTarget(n,5,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}},Ba=class extends St{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}};var ka=class{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,a;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[r+o]=n[o];a=t}else{a+=t;let o=t/a;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){Et.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let a=this._workIndex*r;Et.multiplyQuaternionsFlat(e,a,e,t,e,n),Et.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){let a=1-i;for(let o=0;o!==r;++o){let c=t+o;e[c]=e[c]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){let o=t+a;e[o]=e[o]+e[n+a]*i}}},$c="\\[\\]\\.:\\/",Tf=new RegExp("["+$c+"]","g"),Qc="[^"+$c+"]",Af="[^"+$c.replace("\\.","")+"]",wf=/((?:WC+[\/:])*)/.source.replace("WC",Qc),Ef=/(WCOD+)?/.source.replace("WCOD",Af),Rf=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qc),Cf=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qc),Pf=new RegExp("^"+wf+Ef+Rf+Cf+"$"),If=["material","materials","bones","map"],Cc=class{constructor(e,t,n){let i=n||tt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},tt=class s{constructor(e,t,n){this.path=t,this.parsedPath=n||s.parseTrackName(t),this.node=s.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new s.Composite(e,t,n):new s(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Tf,"")}static parseTrackName(e){let t=Pf.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);If.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let a=0;a<r.length;a++){let o=r[a];if(o.name===t||o.uuid===t)return o;let c=n(o.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_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 n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=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,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=s.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){_e("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){we("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){we("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){we("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){we("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){we("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[n]===void 0){we("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){we("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let a=e[i];if(a===void 0){let l=t.nodeName;we("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){we("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){we("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])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};tt.Composite=Cc;tt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};tt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};tt.prototype.GetterByBindingType=[tt.prototype._getValue_direct,tt.prototype._getValue_array,tt.prototype._getValue_arrayElement,tt.prototype._getValue_toArray];tt.prototype.SetterByBindingTypeAndVersioning=[[tt.prototype._setValue_direct,tt.prototype._setValue_direct_setNeedsUpdate,tt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_array,tt.prototype._setValue_array_setNeedsUpdate,tt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_arrayElement,tt.prototype._setValue_arrayElement_setNeedsUpdate,tt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_fromArray,tt.prototype._setValue_fromArray_setNeedsUpdate,tt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var za=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,a=r.length,o=new Array(a),c={endingStart:Ri,endingEnd:Ri};for(let l=0;l!==a;++l){let h=r[l].createInterpolant(null);o[l]=h,h.settings&&Object.assign(c,h.settings),h.settings=c}this._interpolantSettings=c,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=gu,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,a=this.timeScale,o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);let c=o.parameterPositions,l=o.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let r=this._startTime;if(r!==null){let c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);let a=this._updateTime(t),o=this._updateWeight(e);if(o>0){let c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case _u:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case Io:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,a=n===bu;if(e===0)return r===-1?i:a&&(r&1)===1?t-i:i;if(n===mu){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){let o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);let c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){let l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(a&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=Ci,i.endingEnd=Ci):(e?i.endingStart=this.zeroSlopeAtStart?Ci:Ri:i.endingStart=js,t?i.endingEnd=this.zeroSlopeAtEnd?Ci:Ri:i.endingEnd=js)}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let o=a.parameterPositions,c=a.sampleValues;return o[0]=r,c[0]=t,o[1]=r+e,c[1]=n,this}},Df=new Float32Array(1),br=class extends cn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName,h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){let d=i[u],f=d.name,g=h[f];if(g!==void 0)++g.referenceCount,a[u]=g;else{if(g=a[u],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,c,f));continue}let y=t&&t._propertyBindings[u].binding.parsedPath;g=new ka(tt.create(n,f,y),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,c,f),a[u]=g}o[u].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,r=this._actionsByClip,a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{let o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,a=this._actionsByClip,o=a[r],c=o.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],c.length===0&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,r=this._bindings,a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete o[r],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new lr(new Float32Array(2),new Float32Array(2),1,Df),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){let i=t||this._root,r=i.uuid,a=typeof e=="string"?ki.findByName(i,e):e,o=a!==null?a.uuid:e,c=this._actionsByClip[o],l=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Io),c!==void 0){let u=c.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;l=c.knownActions[0],a===null&&(a=l._clip)}if(a===null)return null;let h=new za(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h}existingAction(e,t){let n=t||this._root,i=n.uuid,r=typeof e=="string"?ki.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,a);let o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){let a=r.knownActions;for(let o=0,c=a.length;o!==c;++o){let l=a[o];this._deactivateAction(l);let h=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let a in n){let o=n[a].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}let i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(let a in r){let o=r[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){let n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}};var _r=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,_e("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},As=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ge(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ge(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var rl=class rl{constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}};rl.prototype.isMatrix2=!0;var Pc=rl;var xr=class extends cn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){_e("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function el(s,e,t,n){let i=Lf(n);switch(t){case Xc:return s*e;case Ja:return s*e/i.components*i.byteLength;case Za:return s*e/i.components*i.byteLength;case xi:return s*e*2/i.components*i.byteLength;case $a:return s*e*2/i.components*i.byteLength;case jc:return s*e*3/i.components*i.byteLength;case nn:return s*e*4/i.components*i.byteLength;case Qa:return s*e*4/i.components*i.byteLength;case Sr:case Tr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Ar:case wr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case to:case io:return Math.max(s,16)*Math.max(e,8)/4;case eo:case no:return Math.max(s,8)*Math.max(e,8)/2;case so:case ro:case oo:case co:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case ao:case Er:case lo:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case ho:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case uo:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case fo:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case po:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case mo:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case go:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case bo:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case _o:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case xo:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case vo:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case yo:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case Mo:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case So:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case To:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case Ao:case wo:case Eo:return Math.ceil(s/4)*Math.ceil(e/4)*16;case Ro:case Co:return Math.ceil(s/4)*Math.ceil(e/4)*8;case Rr:case Po:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Lf(s){switch(s){case jt:case Vc:return{byteLength:1,components:1};case Rs:case Hc:case Un:return{byteLength:2,components:1};case Ka:case Ya:return{byteLength:2,components:4};case Mn:case ja:case tn:return{byteLength:4,components:1};case Wc:case qc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?_e("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");function id(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&s!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s!==null&&s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function Nf(s){let e=new WeakMap;function t(o,c){let l=o.array,h=o.usage,u=l.byteLength,d=s.createBuffer();s.bindBuffer(c,d),s.bufferData(c,l,h),o.onUploadCallback();let f;if(l instanceof Float32Array)f=s.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)f=s.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?f=s.HALF_FLOAT:f=s.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=s.SHORT;else if(l instanceof Uint32Array)f=s.UNSIGNED_INT;else if(l instanceof Int32Array)f=s.INT;else if(l instanceof Int8Array)f=s.BYTE;else if(l instanceof Uint8Array)f=s.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:f,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,c,l){let h=c.array,u=c.updateRanges;if(s.bindBuffer(l,o),u.length===0)s.bufferSubData(l,0,h);else{u.sort((f,g)=>f.start-g.start);let d=0;for(let f=1;f<u.length;f++){let g=u[d],y=u[f];y.start<=g.start+g.count+1?g.count=Math.max(g.count,y.start+y.count-g.start):(++d,u[d]=y)}u.length=d+1;for(let f=0,g=u.length;f<g;f++){let y=u[f];s.bufferSubData(l,y.start*h.BYTES_PER_ELEMENT,h,y.start,y.count)}c.clearUpdateRanges()}c.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);let c=e.get(o);c&&(s.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){let h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.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.");n(l.buffer,o,c),l.version=o.version}}return{get:i,remove:r,update:a}}var Uf=`#ifdef USE_ALPHAHASH- if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;-#endif`,Of=`#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`,Bf=`#ifdef USE_ALPHAMAP- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;-#endif`,kf=`#ifdef USE_ALPHAMAP- uniform sampler2D alphaMap;-#endif`,zf=`#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`,Gf=`#ifdef USE_ALPHATEST- uniform float alphaTest;-#endif`,Vf=`#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`,Hf=`#ifdef USE_AOMAP- uniform sampler2D aoMap;- uniform float aoMapIntensity;-#endif`,Wf=`#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;- vec4 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 );- }-#endif`,qf=`#ifdef USE_BATCHING- mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );-#endif`,Xf=`vec3 transformed = vec3( position );-#ifdef USE_ALPHAHASH- vPosition = vec3( position );-#endif`,jf=`vec3 objectNormal = vec3( normal );-#ifdef USE_TANGENT- vec3 objectTangent = vec3( tangent.xyz );-#endif`,Kf=`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`,Yf=`#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`,Jf=`#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`,Zf=`#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`,$f=`#if NUM_CLIPPING_PLANES > 0- varying vec3 vClipPosition;- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];-#endif`,Qf=`#if NUM_CLIPPING_PLANES > 0- varying vec3 vClipPosition;-#endif`,ep=`#if NUM_CLIPPING_PLANES > 0- vClipPosition = - mvPosition.xyz;-#endif`,tp=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )- diffuseColor *= vColor;-#endif`,np=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )- varying vec4 vColor;-#endif`,ip=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )- varying vec4 vColor;-#endif`,sp=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )- vColor = vec4( 1.0 );-#endif-#ifdef USE_COLOR_ALPHA- vColor *= color;-#elif defined( USE_COLOR )- vColor.rgb *= color;-#endif-#ifdef USE_INSTANCING_COLOR- vColor.rgb *= instanceColor.rgb;-#endif-#ifdef USE_BATCHING_COLOR- vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );-#endif`,rp=`#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 );-}-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`,ap=`#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`,op=`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`,cp=`#ifdef USE_DISPLACEMENTMAP- uniform sampler2D displacementMap;- uniform float displacementScale;- uniform float displacementBias;-#endif`,lp=`#ifdef USE_DISPLACEMENTMAP- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );-#endif`,hp=`#ifdef USE_EMISSIVEMAP- vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );- #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE- emissiveColor = sRGBTransferEOTF( emissiveColor );- #endif- totalEmissiveRadiance *= emissiveColor.rgb;-#endif`,up=`#ifdef USE_EMISSIVEMAP- uniform sampler2D emissiveMap;-#endif`,dp="gl_FragColor = linearToOutputTexel( gl_FragColor );",fp=`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 );-}`,pp=`#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 * reflectVec );- #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-#endif`,mp=`#ifdef USE_ENVMAP- uniform float envMapIntensity;- uniform mat3 envMapRotation;- #ifdef ENVMAP_TYPE_CUBE- uniform samplerCube envMap;- #else- uniform sampler2D envMap;- #endif-#endif`,gp=`#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`,bp=`#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`,_p=`#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`,xp=`#ifdef USE_FOG- vFogDepth = - mvPosition.z;-#endif`,vp=`#ifdef USE_FOG- varying float vFogDepth;-#endif`,yp=`#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`,Mp=`#ifdef USE_FOG- uniform vec3 fogColor;- varying float vFogDepth;- #ifdef FOG_EXP2- uniform float fogDensity;- #else- uniform float fogNear;- uniform float fogFar;- #endif-#endif`,Sp=`#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-}`,Tp=`#ifdef USE_LIGHTMAP- uniform sampler2D lightMap;- uniform float lightMapIntensity;-#endif`,Ap=`LambertMaterial material;-material.diffuseColor = diffuseColor.rgb;-material.specularStrength = specularStrength;`,wp=`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`,Ep=`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-#include <lightprobes_pars_fragment>`,Rp=`#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, pow4( 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`,Cp=`ToonMaterial material;-material.diffuseColor = diffuseColor.rgb;`,Pp=`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`,Ip=`BlinnPhongMaterial material;-material.diffuseColor = diffuseColor.rgb;-material.specularColor = specular;-material.specularShininess = shininess;-material.specularStrength = specularStrength;`,Dp=`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`,Lp=`PhysicalMaterial material;-material.diffuseColor = diffuseColor.rgb;-material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );-material.metalness = 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 = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;- material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );-#else- material.specularColor = vec3( 0.04 );- material.specularColorBlended = mix( material.specularColor, 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.0001, 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`,Fp=`uniform sampler2D dfgLUT;-struct PhysicalMaterial {- vec3 diffuseColor;- vec3 diffuseContribution;- vec3 specularColor;- vec3 specularColorBlended;- float roughness;- float metalness;- 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;- vec3 iridescenceFresnelDielectric;- vec3 iridescenceFresnelMetallic;- #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 ) );- return 0.5 / max( gv + gl, EPSILON );- }- 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.specularColorBlended;- 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 * transpose( 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 rInv = 1.0 / ( roughness + 0.1 );- float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;- float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;- float DG = exp( a * dotNV + b );- return saturate( DG );-}-vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {- float dotNV = saturate( dot( normal, viewDir ) );- vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;- 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- float dotNV = saturate( dot( normal, viewDir ) );- vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;- #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;-}-vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {- vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );- float dotNL = saturate( dot( normal, lightDir ) );- float dotNV = saturate( dot( normal, viewDir ) );- vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;- vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;- vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;- vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;- float Ess_V = dfgV.x + dfgV.y;- float Ess_L = dfgL.x + dfgL.y;- float Ems_V = 1.0 - Ess_V;- float Ems_L = 1.0 - Ess_L;- vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;- vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );- float compensationFactor = Ems_V * Ems_L;- vec3 multiScatter = Fms * compensationFactor;- return singleScatter + multiScatter;-}-#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.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );- reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );- #ifdef USE_CLEARCOAT- vec3 Ncc = geometryClearcoatNormal;- vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );- vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );- vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );- mat3 mInvClearcoat = mat3(- vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),- vec3( 0, 1, 0 ),- vec3( t1Clearcoat.z, 0, t1Clearcoat.w )- );- vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;- clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );- #endif- }-#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 );-- float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );- float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );-- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );-- irradiance *= sheenEnergyComp;-- #endif- reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );-}-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 ) {- vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );- #ifdef USE_SHEEN- float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;- diffuse *= sheenEnergyComp;- #endif- reflectedLight.indirectDiffuse += diffuse;-}-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 ) * RECIPROCAL_PI;- #endif- vec3 singleScatteringDielectric = vec3( 0.0 );- vec3 multiScatteringDielectric = vec3( 0.0 );- vec3 singleScatteringMetallic = vec3( 0.0 );- vec3 multiScatteringMetallic = vec3( 0.0 );- #ifdef USE_IRIDESCENCE- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );- #else- computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );- computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );- #endif- vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );- vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );- vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;- vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;- vec3 indirectSpecular = radiance * singleScattering;- indirectSpecular += multiScattering * cosineWeightedIrradiance;- vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;- #ifdef USE_SHEEN- float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;- indirectSpecular *= sheenEnergyComp;- indirectDiffuse *= sheenEnergyComp;- #endif- reflectedLight.indirectSpecular += indirectSpecular;- reflectedLight.indirectDiffuse += indirectDiffuse;-}-#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 );-}`,Np=`-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.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );- material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );- material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );- 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 ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )- 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- #ifdef USE_LIGHT_PROBES_GRID- vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;- vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );- irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );- #endif-#endif-#if defined( RE_IndirectSpecular )- vec3 radiance = vec3( 0.0 );- vec3 clearcoatRadiance = vec3( 0.0 );-#endif`,Up=`#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( ENVMAP_TYPE_CUBE_UV )- #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )- iblIrradiance += getIBLIrradiance( geometryNormal );- #endif- #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`,Op=`#if defined( RE_IndirectDiffuse )- #if defined( LAMBERT ) || defined( PHONG )- irradiance += iblIrradiance;- #endif- 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`,Bp=`#ifdef USE_LIGHT_PROBES_GRID-uniform highp sampler3D probesSH;-uniform vec3 probesMin;-uniform vec3 probesMax;-uniform vec3 probesResolution;-vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {- vec3 res = probesResolution;- vec3 gridRange = probesMax - probesMin;- vec3 resMinusOne = res - 1.0;- vec3 probeSpacing = gridRange / resMinusOne;- vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;- vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );- uvw = uvw * resMinusOne / res + 0.5 / res;- float nz = res.z;- float paddedSlices = nz + 2.0;- float atlasDepth = 7.0 * paddedSlices;- float uvZBase = uvw.z * nz + 1.0;- vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );- vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );- vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );- vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );- vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );- vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );- vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );- vec3 c0 = s0.xyz;- vec3 c1 = vec3( s0.w, s1.xy );- vec3 c2 = vec3( s1.zw, s2.x );- vec3 c3 = s2.yzw;- vec3 c4 = s3.xyz;- vec3 c5 = vec3( s3.w, s4.xy );- vec3 c6 = vec3( s4.zw, s5.x );- vec3 c7 = s5.yzw;- vec3 c8 = s6.xyz;- float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;- vec3 result = c0 * 0.886227;- result += c1 * 2.0 * 0.511664 * y;- result += c2 * 2.0 * 0.511664 * z;- result += c3 * 2.0 * 0.511664 * x;- result += c4 * 2.0 * 0.429043 * x * y;- result += c5 * 2.0 * 0.429043 * y * z;- result += c6 * ( 0.743125 * z * z - 0.247708 );- result += c7 * 2.0 * 0.429043 * x * z;- result += c8 * 0.429043 * ( x * x - y * y );- return max( result, vec3( 0.0 ) );-}-#endif`,kp=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;-#endif`,zp=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )- uniform float logDepthBufFC;- varying float vFragDepth;- varying float vIsPerspective;-#endif`,Gp=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER- varying float vFragDepth;- varying float vIsPerspective;-#endif`,Vp=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER- vFragDepth = 1.0 + gl_Position.w;- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );-#endif`,Hp=`#ifdef USE_MAP- vec4 sampledDiffuseColor = texture2D( map, vMapUv );- #ifdef DECODE_VIDEO_TEXTURE- sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );- #endif- diffuseColor *= sampledDiffuseColor;-#endif`,Wp=`#ifdef USE_MAP- uniform sampler2D map;-#endif`,qp=`#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`,Xp=`#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`,jp=`float metalnessFactor = metalness;-#ifdef USE_METALNESSMAP- vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );- metalnessFactor *= texelMetalness.b;-#endif`,Kp=`#ifdef USE_METALNESSMAP- uniform sampler2D metalnessMap;-#endif`,Yp=`#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`,Jp=`#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`,Zp=`#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`,$p=`#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`,Qp=`#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`,em=`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;`,tm=`#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;- #if defined( USE_PACKED_NORMALMAP )- mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );- #endif- mapN.xy *= normalScale;- normal = normalize( tbn * mapN );-#elif defined( USE_BUMPMAP )- normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );-#endif`,nm=`#ifndef FLAT_SHADED- varying vec3 vNormal;- #ifdef USE_TANGENT- varying vec3 vTangent;- varying vec3 vBitangent;- #endif-#endif`,im=`#ifndef FLAT_SHADED- varying vec3 vNormal;- #ifdef USE_TANGENT- varying vec3 vTangent;- varying vec3 vBitangent;- #endif-#endif`,sm=`#ifndef FLAT_SHADED- vNormal = normalize( transformedNormal );- #ifdef USE_TANGENT- vTangent = normalize( transformedTangent );- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );- #endif-#endif`,rm=`#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`,am=`#ifdef USE_CLEARCOAT- vec3 clearcoatNormal = nonPerturbedNormal;-#endif`,om=`#ifdef USE_CLEARCOAT_NORMALMAP- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;- clearcoatMapN.xy *= clearcoatNormalScale;- clearcoatNormal = normalize( tbn2 * clearcoatMapN );-#endif`,cm=`#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`,lm=`#ifdef USE_IRIDESCENCEMAP- uniform sampler2D iridescenceMap;-#endif-#ifdef USE_IRIDESCENCE_THICKNESSMAP- uniform sampler2D iridescenceThicknessMap;-#endif`,hm=`#ifdef OPAQUE-diffuseColor.a = 1.0;-#endif-#ifdef USE_TRANSMISSION-diffuseColor.a *= material.transmissionAlpha;-#endif-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,um=`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 ) {- #ifdef USE_REVERSED_DEPTH_BUFFER-- return depth * ( far - near ) - far;- #else- return depth * ( near - far ) - near;- #endif-}-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 ) {-- #ifdef USE_REVERSED_DEPTH_BUFFER- return ( near * far ) / ( ( near - far ) * depth - near );- #else- return ( near * far ) / ( ( far - near ) * depth - far );- #endif-}`,dm=`#ifdef PREMULTIPLIED_ALPHA- gl_FragColor.rgb *= gl_FragColor.a;-#endif`,fm=`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;`,pm=`#ifdef DITHERING- gl_FragColor.rgb = dithering( gl_FragColor.rgb );-#endif`,mm=`#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`,gm=`float roughnessFactor = roughness;-#ifdef USE_ROUGHNESSMAP- vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );- roughnessFactor *= texelRoughness.g;-#endif`,bm=`#ifdef USE_ROUGHNESSMAP- uniform sampler2D roughnessMap;-#endif`,_m=`#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- #if defined( SHADOWMAP_TYPE_PCF )- uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];- #else- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];- #endif- 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- #if defined( SHADOWMAP_TYPE_PCF )- uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];- #else- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];- #endif- 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- #if defined( SHADOWMAP_TYPE_PCF )- uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];- #elif defined( SHADOWMAP_TYPE_BASIC )- uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];- #endif- 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- #if defined( SHADOWMAP_TYPE_PCF )- float interleavedGradientNoise( vec2 position ) {- return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );- }- vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {- const float goldenAngle = 2.399963229728653;- float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );- float theta = float( sampleIndex ) * goldenAngle + phi;- return vec2( cos( theta ), sin( theta ) ) * r;- }- #endif- #if defined( SHADOWMAP_TYPE_PCF )- float getShadow( sampler2DShadow 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 ) {- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;- float radius = shadowRadius * texelSize.x;- float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;- shadow = (- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )- ) * 0.2;- }- return mix( 1.0, shadow, shadowIntensity );- }- #elif defined( SHADOWMAP_TYPE_VSM )- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {- float shadow = 1.0;- shadowCoord.xyz /= shadowCoord.w;- #ifdef USE_REVERSED_DEPTH_BUFFER- shadowCoord.z -= shadowBias;- #else- shadowCoord.z += shadowBias;- #endif- 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 ) {- vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;- float mean = distribution.x;- float variance = distribution.y * distribution.y;- #ifdef USE_REVERSED_DEPTH_BUFFER- float hard_shadow = step( mean, shadowCoord.z );- #else- float hard_shadow = step( shadowCoord.z, mean );- #endif-- if ( hard_shadow == 1.0 ) {- shadow = 1.0;- } else {- variance = max( variance, 0.0000001 );- float d = shadowCoord.z - mean;- float p_max = variance / ( variance + d * d );- p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );- shadow = max( hard_shadow, p_max );- }- }- return mix( 1.0, shadow, shadowIntensity );- }- #else- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {- float shadow = 1.0;- shadowCoord.xyz /= shadowCoord.w;- #ifdef USE_REVERSED_DEPTH_BUFFER- shadowCoord.z -= shadowBias;- #else- shadowCoord.z += shadowBias;- #endif- 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 ) {- float depth = texture2D( shadowMap, shadowCoord.xy ).r;- #ifdef USE_REVERSED_DEPTH_BUFFER- shadow = step( depth, shadowCoord.z );- #else- shadow = step( shadowCoord.z, depth );- #endif- }- return mix( 1.0, shadow, shadowIntensity );- }- #endif- #if NUM_POINT_LIGHT_SHADOWS > 0- #if defined( SHADOWMAP_TYPE_PCF )- float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {- float shadow = 1.0;- vec3 lightToPosition = shadowCoord.xyz;- vec3 bd3D = normalize( lightToPosition );- vec3 absVec = abs( lightToPosition );- float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );- if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {- #ifdef USE_REVERSED_DEPTH_BUFFER- float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );- dp -= shadowBias;- #else- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );- dp += shadowBias;- #endif- float texelSize = shadowRadius / shadowMapSize.x;- vec3 absDir = abs( bd3D );- vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );- tangent = normalize( cross( bd3D, tangent ) );- vec3 bitangent = cross( bd3D, tangent );- float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;- vec2 sample0 = vogelDiskSample( 0, 5, phi );- vec2 sample1 = vogelDiskSample( 1, 5, phi );- vec2 sample2 = vogelDiskSample( 2, 5, phi );- vec2 sample3 = vogelDiskSample( 3, 5, phi );- vec2 sample4 = vogelDiskSample( 4, 5, phi );- shadow = (- texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +- texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +- texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +- texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +- texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )- ) * 0.2;- }- return mix( 1.0, shadow, shadowIntensity );- }- #elif defined( SHADOWMAP_TYPE_BASIC )- float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {- float shadow = 1.0;- vec3 lightToPosition = shadowCoord.xyz;- vec3 absVec = abs( lightToPosition );- float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );- if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );- dp += shadowBias;- vec3 bd3D = normalize( lightToPosition );- float depth = textureCube( shadowMap, bd3D ).r;- #ifdef USE_REVERSED_DEPTH_BUFFER- depth = 1.0 - depth;- #endif- shadow = step( dp, depth );- }- return mix( 1.0, shadow, shadowIntensity );- }- #endif- #endif-#endif`,xm=`#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`,vm=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )- #ifdef HAS_NORMAL- vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );- #else- vec3 shadowWorldNormal = vec3( 0.0 );- #endif- 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`,ym=`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 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )- 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;-}`,Mm=`#ifdef USE_SKINNING- mat4 boneMatX = getBoneMatrix( skinIndex.x );- mat4 boneMatY = getBoneMatrix( skinIndex.y );- mat4 boneMatZ = getBoneMatrix( skinIndex.z );- mat4 boneMatW = getBoneMatrix( skinIndex.w );-#endif`,Sm=`#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`,Tm=`#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`,Am=`#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`,wm=`float specularStrength;-#ifdef USE_SPECULARMAP- vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );- specularStrength = texelSpecular.r;-#else- specularStrength = 1.0;-#endif`,Em=`#ifdef USE_SPECULARMAP- uniform sampler2D specularMap;-#endif`,Rm=`#if defined( TONE_MAPPING )- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );-#endif`,Cm=`#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; }`,Pm=`#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.diffuseContribution, material.specularColorBlended, 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`,Im=`#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`,Dm=`#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`,Lm=`#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`,Fm=`#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`,Nm=`#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`,Um=`varying vec2 vUv;-uniform mat3 uvTransform;-void main() {- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;- gl_Position = vec4( position.xy, 1.0, 1.0 );-}`,Om=`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>-}`,Bm=`varying vec3 vWorldDirection;-#include <common>-void main() {- vWorldDirection = transformDirection( position, modelMatrix );- #include <begin_vertex>- #include <project_vertex>- gl_Position.z = gl_Position.w;-}`,km=`#ifdef ENVMAP_TYPE_CUBE- uniform samplerCube envMap;-#elif defined( ENVMAP_TYPE_CUBE_UV )- uniform sampler2D envMap;-#endif-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 * vWorldDirection );- #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>-}`,zm=`varying vec3 vWorldDirection;-#include <common>-void main() {- vWorldDirection = transformDirection( position, modelMatrix );- #include <begin_vertex>- #include <project_vertex>- gl_Position.z = gl_Position.w;-}`,Gm=`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>-}`,Vm=`#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;-}`,Hm=`#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>- #ifdef USE_REVERSED_DEPTH_BUFFER- float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];- #else- float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;- #endif- #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-}`,Wm=`#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;-}`,qm=`#define DISTANCE-uniform vec3 referencePosition;-uniform float nearDistance;-uniform float farDistance;-varying vec3 vWorldPosition;-#include <common>-#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 = vec4( dist, 0.0, 0.0, 1.0 );-}`,Xm=`varying vec3 vWorldDirection;-#include <common>-void main() {- vWorldDirection = transformDirection( position, modelMatrix );- #include <begin_vertex>- #include <project_vertex>-}`,jm=`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>-}`,Km=`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>-}`,Ym=`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>-}`,Jm=`#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>-}`,Zm=`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>-}`,$m=`#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>-}`,Qm=`#define LAMBERT-uniform vec3 diffuse;-uniform vec3 emissive;-uniform float opacity;-#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 <emissivemap_pars_fragment>-#include <cube_uv_reflection_fragment>-#include <envmap_common_pars_fragment>-#include <envmap_pars_fragment>-#include <envmap_physical_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>-}`,eg=`#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;-}`,tg=`#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>-}`,ng=`#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-}`,ig=`#define NORMAL-uniform float opacity;-#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )- varying vec3 vViewPosition;-#endif-#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( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );- #ifdef OPAQUE- gl_FragColor.a = 1.0;- #endif-}`,sg=`#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>-}`,rg=`#define PHONG-uniform vec3 diffuse;-uniform vec3 emissive;-uniform vec3 specular;-uniform float shininess;-uniform float opacity;-#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 <emissivemap_pars_fragment>-#include <cube_uv_reflection_fragment>-#include <envmap_common_pars_fragment>-#include <envmap_pars_fragment>-#include <envmap_physical_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>-}`,ag=`#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-}`,og=`#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 <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-- outgoingLight = outgoingLight + 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>-}`,cg=`#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>-}`,lg=`#define TOON-uniform vec3 diffuse;-uniform vec3 emissive;-uniform float opacity;-#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 <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>-}`,hg=`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>-}`,ug=`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>-}`,dg=`#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>-}`,fg=`uniform vec3 color;-uniform float opacity;-#include <common>-#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>- #include <premultiplied_alpha_fragment>-}`,pg=`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>-}`,mg=`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>-}`,Be={alphahash_fragment:Uf,alphahash_pars_fragment:Of,alphamap_fragment:Bf,alphamap_pars_fragment:kf,alphatest_fragment:zf,alphatest_pars_fragment:Gf,aomap_fragment:Vf,aomap_pars_fragment:Hf,batching_pars_vertex:Wf,batching_vertex:qf,begin_vertex:Xf,beginnormal_vertex:jf,bsdfs:Kf,iridescence_fragment:Yf,bumpmap_pars_fragment:Jf,clipping_planes_fragment:Zf,clipping_planes_pars_fragment:$f,clipping_planes_pars_vertex:Qf,clipping_planes_vertex:ep,color_fragment:tp,color_pars_fragment:np,color_pars_vertex:ip,color_vertex:sp,common:rp,cube_uv_reflection_fragment:ap,defaultnormal_vertex:op,displacementmap_pars_vertex:cp,displacementmap_vertex:lp,emissivemap_fragment:hp,emissivemap_pars_fragment:up,colorspace_fragment:dp,colorspace_pars_fragment:fp,envmap_fragment:pp,envmap_common_pars_fragment:mp,envmap_pars_fragment:gp,envmap_pars_vertex:bp,envmap_physical_pars_fragment:Rp,envmap_vertex:_p,fog_vertex:xp,fog_pars_vertex:vp,fog_fragment:yp,fog_pars_fragment:Mp,gradientmap_pars_fragment:Sp,lightmap_pars_fragment:Tp,lights_lambert_fragment:Ap,lights_lambert_pars_fragment:wp,lights_pars_begin:Ep,lights_toon_fragment:Cp,lights_toon_pars_fragment:Pp,lights_phong_fragment:Ip,lights_phong_pars_fragment:Dp,lights_physical_fragment:Lp,lights_physical_pars_fragment:Fp,lights_fragment_begin:Np,lights_fragment_maps:Up,lights_fragment_end:Op,lightprobes_pars_fragment:Bp,logdepthbuf_fragment:kp,logdepthbuf_pars_fragment:zp,logdepthbuf_pars_vertex:Gp,logdepthbuf_vertex:Vp,map_fragment:Hp,map_pars_fragment:Wp,map_particle_fragment:qp,map_particle_pars_fragment:Xp,metalnessmap_fragment:jp,metalnessmap_pars_fragment:Kp,morphinstance_vertex:Yp,morphcolor_vertex:Jp,morphnormal_vertex:Zp,morphtarget_pars_vertex:$p,morphtarget_vertex:Qp,normal_fragment_begin:em,normal_fragment_maps:tm,normal_pars_fragment:nm,normal_pars_vertex:im,normal_vertex:sm,normalmap_pars_fragment:rm,clearcoat_normal_fragment_begin:am,clearcoat_normal_fragment_maps:om,clearcoat_pars_fragment:cm,iridescence_pars_fragment:lm,opaque_fragment:hm,packing:um,premultiplied_alpha_fragment:dm,project_vertex:fm,dithering_fragment:pm,dithering_pars_fragment:mm,roughnessmap_fragment:gm,roughnessmap_pars_fragment:bm,shadowmap_pars_fragment:_m,shadowmap_pars_vertex:xm,shadowmap_vertex:vm,shadowmask_pars_fragment:ym,skinbase_vertex:Mm,skinning_pars_vertex:Sm,skinning_vertex:Tm,skinnormal_vertex:Am,specularmap_fragment:wm,specularmap_pars_fragment:Em,tonemapping_fragment:Rm,tonemapping_pars_fragment:Cm,transmission_fragment:Pm,transmission_pars_fragment:Im,uv_pars_fragment:Dm,uv_pars_vertex:Lm,uv_vertex:Fm,worldpos_vertex:Nm,background_vert:Um,background_frag:Om,backgroundCube_vert:Bm,backgroundCube_frag:km,cube_vert:zm,cube_frag:Gm,depth_vert:Vm,depth_frag:Hm,distance_vert:Wm,distance_frag:qm,equirect_vert:Xm,equirect_frag:jm,linedashed_vert:Km,linedashed_frag:Ym,meshbasic_vert:Jm,meshbasic_frag:Zm,meshlambert_vert:$m,meshlambert_frag:Qm,meshmatcap_vert:eg,meshmatcap_frag:tg,meshnormal_vert:ng,meshnormal_frag:ig,meshphong_vert:sg,meshphong_frag:rg,meshphysical_vert:ag,meshphysical_frag:og,meshtoon_vert:cg,meshtoon_frag:lg,points_vert:hg,points_frag:ug,shadow_vert:dg,shadow_frag:fg,sprite_vert:pg,sprite_frag:mg},ce={common:{diffuse:{value:new Ae(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ie},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ie}},envmap:{envMap:{value:null},envMapRotation:{value:new Ie},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ie}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ie}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ie},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ie},normalScale:{value:new Re(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ie},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ie}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ie}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ie}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ae(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new D},probesMax:{value:new D},probesResolution:{value:new D}},points:{diffuse:{value:new Ae(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0},uvTransform:{value:new Ie}},sprite:{diffuse:{value:new Ae(16777215)},opacity:{value:1},center:{value:new Re(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ie},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0}}},Bn={basic:{uniforms:Bt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.fog]),vertexShader:Be.meshbasic_vert,fragmentShader:Be.meshbasic_frag},lambert:{uniforms:Bt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Ae(0)},envMapIntensity:{value:1}}]),vertexShader:Be.meshlambert_vert,fragmentShader:Be.meshlambert_frag},phong:{uniforms:Bt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Ae(0)},specular:{value:new Ae(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Be.meshphong_vert,fragmentShader:Be.meshphong_frag},standard:{uniforms:Bt([ce.common,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.roughnessmap,ce.metalnessmap,ce.fog,ce.lights,{emissive:{value:new Ae(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag},toon:{uniforms:Bt([ce.common,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.gradientmap,ce.fog,ce.lights,{emissive:{value:new Ae(0)}}]),vertexShader:Be.meshtoon_vert,fragmentShader:Be.meshtoon_frag},matcap:{uniforms:Bt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,{matcap:{value:null}}]),vertexShader:Be.meshmatcap_vert,fragmentShader:Be.meshmatcap_frag},points:{uniforms:Bt([ce.points,ce.fog]),vertexShader:Be.points_vert,fragmentShader:Be.points_frag},dashed:{uniforms:Bt([ce.common,ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Be.linedashed_vert,fragmentShader:Be.linedashed_frag},depth:{uniforms:Bt([ce.common,ce.displacementmap]),vertexShader:Be.depth_vert,fragmentShader:Be.depth_frag},normal:{uniforms:Bt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,{opacity:{value:1}}]),vertexShader:Be.meshnormal_vert,fragmentShader:Be.meshnormal_frag},sprite:{uniforms:Bt([ce.sprite,ce.fog]),vertexShader:Be.sprite_vert,fragmentShader:Be.sprite_frag},background:{uniforms:{uvTransform:{value:new Ie},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Be.background_vert,fragmentShader:Be.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ie}},vertexShader:Be.backgroundCube_vert,fragmentShader:Be.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Be.cube_vert,fragmentShader:Be.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Be.equirect_vert,fragmentShader:Be.equirect_frag},distance:{uniforms:Bt([ce.common,ce.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Be.distance_vert,fragmentShader:Be.distance_frag},shadow:{uniforms:Bt([ce.lights,ce.fog,{color:{value:new Ae(0)},opacity:{value:1}}]),vertexShader:Be.shadow_vert,fragmentShader:Be.shadow_frag}};Bn.physical={uniforms:Bt([Bn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ie},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ie},clearcoatNormalScale:{value:new Re(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ie},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ie},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ie},sheen:{value:0},sheenColor:{value:new Ae(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ie},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ie},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ie},transmissionSamplerSize:{value:new Re},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ie},attenuationDistance:{value:0},attenuationColor:{value:new Ae(0)},specularColor:{value:new Ae(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ie},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ie},anisotropyVector:{value:new Re},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ie}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag};var Fo={r:0,b:0,g:0},gg=new Oe,sd=new Ie;sd.set(-1,0,0,0,1,0,0,0,1);function bg(s,e,t,n,i,r){let a=new Ae(0),o=i===!0?0:1,c,l,h=null,u=0,d=null;function f(x){let S=x.isScene===!0?x.background:null;if(S&&S.isTexture){let M=x.backgroundBlurriness>0;S=e.get(S,M)}return S}function g(x){let S=!1,M=f(x);M===null?m(a,o):M&&M.isColor&&(m(M,1),S=!0);let E=s.xr.getEnvironmentBlendMode();E==="additive"?t.buffers.color.setClear(0,0,0,1,r):E==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(s.autoClear||S)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function y(x,S){let M=f(S);M&&(M.isCubeTexture||M.mapping===Mr)?(l===void 0&&(l=new at(new fi(1,1,1),new en({name:"BackgroundCubeMaterial",uniforms:qi(Bn.backgroundCube.uniforms),vertexShader:Bn.backgroundCube.vertexShader,fragmentShader:Bn.backgroundCube.fragmentShader,side:Lt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(E,A,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(gg.makeRotationFromEuler(S.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(sd),l.material.toneMapped=ze.getTransfer(M.colorSpace)!==Ye,(h!==M||u!==M.version||d!==s.toneMapping)&&(l.material.needsUpdate=!0,h=M,u=M.version,d=s.toneMapping),l.layers.enableAll(),x.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new at(new Bi(2,2),new en({name:"BackgroundMaterial",uniforms:qi(Bn.background.uniforms),vertexShader:Bn.background.vertexShader,fragmentShader:Bn.background.fragmentShader,side:_n,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.toneMapped=ze.getTransfer(M.colorSpace)!==Ye,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||u!==M.version||d!==s.toneMapping)&&(c.material.needsUpdate=!0,h=M,u=M.version,d=s.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function m(x,S){x.getRGB(Fo,Zc(s)),t.buffers.color.setClear(Fo.r,Fo.g,Fo.b,S,r)}function p(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(x,S=1){a.set(x),o=S,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(x){o=x,m(a,o)},render:g,addToRenderList:y,dispose:p}}function _g(s,e){let t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=d(null),r=i,a=!1;function o(R,O,H,q,N){let z=!1,V=u(R,q,H,O);r!==V&&(r=V,l(r.object)),z=f(R,q,H,N),z&&g(R,q,H,N),N!==null&&e.update(N,s.ELEMENT_ARRAY_BUFFER),(z||a)&&(a=!1,M(R,O,H,q),N!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function c(){return s.createVertexArray()}function l(R){return s.bindVertexArray(R)}function h(R){return s.deleteVertexArray(R)}function u(R,O,H,q){let N=q.wireframe===!0,z=n[O.id];z===void 0&&(z={},n[O.id]=z);let V=R.isInstancedMesh===!0?R.id:0,$=z[V];$===void 0&&($={},z[V]=$);let Q=$[H.id];Q===void 0&&(Q={},$[H.id]=Q);let le=Q[N];return le===void 0&&(le=d(c()),Q[N]=le),le}function d(R){let O=[],H=[],q=[];for(let N=0;N<t;N++)O[N]=0,H[N]=0,q[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:H,attributeDivisors:q,object:R,attributes:{},index:null}}function f(R,O,H,q){let N=r.attributes,z=O.attributes,V=0,$=H.getAttributes();for(let Q in $)if($[Q].location>=0){let xe=N[Q],Se=z[Q];if(Se===void 0&&(Q==="instanceMatrix"&&R.instanceMatrix&&(Se=R.instanceMatrix),Q==="instanceColor"&&R.instanceColor&&(Se=R.instanceColor)),xe===void 0||xe.attribute!==Se||Se&&xe.data!==Se.data)return!0;V++}return r.attributesNum!==V||r.index!==q}function g(R,O,H,q){let N={},z=O.attributes,V=0,$=H.getAttributes();for(let Q in $)if($[Q].location>=0){let xe=z[Q];xe===void 0&&(Q==="instanceMatrix"&&R.instanceMatrix&&(xe=R.instanceMatrix),Q==="instanceColor"&&R.instanceColor&&(xe=R.instanceColor));let Se={};Se.attribute=xe,xe&&xe.data&&(Se.data=xe.data),N[Q]=Se,V++}r.attributes=N,r.attributesNum=V,r.index=q}function y(){let R=r.newAttributes;for(let O=0,H=R.length;O<H;O++)R[O]=0}function m(R){p(R,0)}function p(R,O){let H=r.newAttributes,q=r.enabledAttributes,N=r.attributeDivisors;H[R]=1,q[R]===0&&(s.enableVertexAttribArray(R),q[R]=1),N[R]!==O&&(s.vertexAttribDivisor(R,O),N[R]=O)}function x(){let R=r.newAttributes,O=r.enabledAttributes;for(let H=0,q=O.length;H<q;H++)O[H]!==R[H]&&(s.disableVertexAttribArray(H),O[H]=0)}function S(R,O,H,q,N,z,V){V===!0?s.vertexAttribIPointer(R,O,H,N,z):s.vertexAttribPointer(R,O,H,q,N,z)}function M(R,O,H,q){y();let N=q.attributes,z=H.getAttributes(),V=O.defaultAttributeValues;for(let $ in z){let Q=z[$];if(Q.location>=0){let le=N[$];if(le===void 0&&($==="instanceMatrix"&&R.instanceMatrix&&(le=R.instanceMatrix),$==="instanceColor"&&R.instanceColor&&(le=R.instanceColor)),le!==void 0){let xe=le.normalized,Se=le.itemSize,Xe=e.get(le);if(Xe===void 0)continue;let Ze=Xe.buffer,Ne=Xe.type,Y=Xe.bytesPerElement,de=Ne===s.INT||Ne===s.UNSIGNED_INT||le.gpuType===ja;if(le.isInterleavedBufferAttribute){let ie=le.data,Ee=ie.stride,De=le.offset;if(ie.isInstancedInterleavedBuffer){for(let Ce=0;Ce<Q.locationSize;Ce++)p(Q.location+Ce,ie.meshPerAttribute);R.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let Ce=0;Ce<Q.locationSize;Ce++)m(Q.location+Ce);s.bindBuffer(s.ARRAY_BUFFER,Ze);for(let Ce=0;Ce<Q.locationSize;Ce++)S(Q.location+Ce,Se/Q.locationSize,Ne,xe,Ee*Y,(De+Se/Q.locationSize*Ce)*Y,de)}else{if(le.isInstancedBufferAttribute){for(let ie=0;ie<Q.locationSize;ie++)p(Q.location+ie,le.meshPerAttribute);R.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let ie=0;ie<Q.locationSize;ie++)m(Q.location+ie);s.bindBuffer(s.ARRAY_BUFFER,Ze);for(let ie=0;ie<Q.locationSize;ie++)S(Q.location+ie,Se/Q.locationSize,Ne,xe,Se*Y,Se/Q.locationSize*ie*Y,de)}}else if(V!==void 0){let xe=V[$];if(xe!==void 0)switch(xe.length){case 2:s.vertexAttrib2fv(Q.location,xe);break;case 3:s.vertexAttrib3fv(Q.location,xe);break;case 4:s.vertexAttrib4fv(Q.location,xe);break;default:s.vertexAttrib1fv(Q.location,xe)}}}}x()}function E(){w();for(let R in n){let O=n[R];for(let H in O){let q=O[H];for(let N in q){let z=q[N];for(let V in z)h(z[V].object),delete z[V];delete q[N]}}delete n[R]}}function A(R){if(n[R.id]===void 0)return;let O=n[R.id];for(let H in O){let q=O[H];for(let N in q){let z=q[N];for(let V in z)h(z[V].object),delete z[V];delete q[N]}}delete n[R.id]}function C(R){for(let O in n){let H=n[O];for(let q in H){let N=H[q];if(N[R.id]===void 0)continue;let z=N[R.id];for(let V in z)h(z[V].object),delete z[V];delete N[R.id]}}}function _(R){for(let O in n){let H=n[O],q=R.isInstancedMesh===!0?R.id:0,N=H[q];if(N!==void 0){for(let z in N){let V=N[z];for(let $ in V)h(V[$].object),delete V[$];delete N[z]}delete H[q],Object.keys(H).length===0&&delete n[O]}}}function w(){L(),a=!0,r!==i&&(r=i,l(r.object))}function L(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:w,resetDefaultState:L,dispose:E,releaseStatesOfGeometry:A,releaseStatesOfObject:_,releaseStatesOfProgram:C,initAttributes:y,enableAttribute:m,disableUnusedAttributes:x}}function xg(s,e,t){let n;function i(c){n=c}function r(c,l){s.drawArrays(n,c,l),t.update(l,n,1)}function a(c,l,h){h!==0&&(s.drawArraysInstanced(n,c,l,h),t.update(l,n,h))}function o(c,l,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,l,0,h);let d=0;for(let f=0;f<h;f++)d+=l[f];t.update(d,n,1)}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function vg(s,e,t,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){let C=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(C){return!(C!==nn&&n.convert(C)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){let _=C===Un&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==jt&&n.convert(C)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==tn&&!_)}function c(C){if(C==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp",h=c(l);h!==l&&(_e("WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);let u=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&_e("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let f=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),g=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=s.getParameter(s.MAX_TEXTURE_SIZE),m=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),p=s.getParameter(s.MAX_VERTEX_ATTRIBS),x=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),S=s.getParameter(s.MAX_VARYING_VECTORS),M=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),E=s.getParameter(s.MAX_SAMPLES),A=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:u,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:g,maxTextureSize:y,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:x,maxVaryings:S,maxFragmentUniforms:M,maxSamples:E,samples:A}}function yg(s){let e=this,t=null,n=0,i=!1,r=!1,a=new an,o=new Ie,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){let f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){let g=u.clippingPlanes,y=u.clipIntersection,m=u.clipShadows,p=s.get(u);if(!i||g===null||g.length===0||r&&!m)r?h(null):l();else{let x=r?0:n,S=x*4,M=p.clippingState||null;c.value=M,M=h(g,d,S,f);for(let E=0;E!==S;++E)M[E]=t[E];p.clippingState=M,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=x}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,g){let y=u!==null?u.length:0,m=null;if(y!==0){if(m=c.value,g!==!0||m===null){let p=f+y*4,x=d.matrixWorldInverse;o.getNormalMatrix(x),(m===null||m.length<p)&&(m=new Float32Array(p));for(let S=0,M=f;S!==y;++S,M+=4)a.copy(u[S]).applyMatrix4(x,o),a.normal.toArray(m,M),m[M+3]=a.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,m}}var vi=4,Nu=[.125,.215,.35,.446,.526,.582],Xi=20,Mg=256,Dr=new pi,Uu=new Ae,al=null,ol=0,cl=0,ll=!1,Sg=new D,Ls=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,r={}){let{size:a=256,position:o=Sg}=r;al=this._renderer.getRenderTarget(),ol=this._renderer.getActiveCubeFace(),cl=this._renderer.getActiveMipmapLevel(),ll=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ku(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Bu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(al,ol,cl),this._renderer.xr.enabled=ll,e.scissorTest=!1,Is(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===bi||e.mapping===Hi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),al=this._renderer.getRenderTarget(),ol=this._renderer.getActiveCubeFace(),cl=this._renderer.getActiveMipmapLevel(),ll=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:vt,minFilter:vt,generateMipmaps:!1,type:Un,format:nn,colorSpace:Gt,depthBuffer:!1},i=Ou(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ou(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Tg(r)),this._blurMaterial=wg(r,e,t),this._ggxMaterial=Ag(r,e,t)}return i}_compileMaterial(e){let t=new at(new Ht,e);this._renderer.compile(t,Dr)}_sceneToCubeUV(e,t,n,i,r){let c=new St(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(Uu),u.toneMapping=vn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new at(new fi,new xn({name:"PMREM.Background",side:Lt,depthWrite:!1,depthTest:!1})));let y=this._backgroundBox,m=y.material,p=!1,x=e.background;x?x.isColor&&(m.color.copy(x),e.background=null,p=!0):(m.color.copy(Uu),p=!0);for(let S=0;S<6;S++){let M=S%3;M===0?(c.up.set(0,l[S],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+h[S],r.y,r.z)):M===1?(c.up.set(0,0,l[S]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+h[S],r.z)):(c.up.set(0,l[S],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+h[S]));let E=this._cubeSize;Is(i,M*E,S>2?E:0,E,E),u.setRenderTarget(i),p&&u.render(y,c),u.render(e,c)}u.toneMapping=f,u.autoClear=d,e.background=x}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===bi||e.mapping===Hi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=ku()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Bu());let r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;let o=r.uniforms;o.envMap.value=e;let c=this._cubeSize;Is(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Dr)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let c=a.uniforms,l=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),u=Math.sqrt(l*l-h*h),d=0+l*1.25,f=u*d,{_lodMax:g}=this,y=this._sizeLods[n],m=3*y*(n>g-vi?n-g+vi:0),p=4*(this._cubeSize-y);c.envMap.value=e.texture,c.roughness.value=f,c.mipInt.value=g-t,Is(r,m,p,3*y,2*y),i.setRenderTarget(r),i.render(o,Dr),c.envMap.value=r.texture,c.roughness.value=0,c.mipInt.value=g-n,Is(e,m,p,3*y,2*y),i.setRenderTarget(e),i.render(o,Dr)}_blur(e,t,n,i,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){let c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&we("blur direction must be either latitudinal or longitudinal!");let h=3,u=this._lodMeshes[i];u.material=l;let d=l.uniforms,f=this._sizeLods[n]-1,g=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*Xi-1),y=r/g,m=isFinite(r)?1+Math.floor(h*y):Xi;m>Xi&&_e(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Xi}`);let p=[],x=0;for(let C=0;C<Xi;++C){let _=C/y,w=Math.exp(-_*_/2);p.push(w),C===0?x+=w:C<m&&(x+=2*w)}for(let C=0;C<p.length;C++)p[C]=p[C]/x;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);let{_lodMax:S}=this;d.dTheta.value=g,d.mipInt.value=S-n;let M=this._sizeLods[i],E=3*M*(i>S-vi?i-S+vi:0),A=4*(this._cubeSize-M);Is(t,E,A,3*M,2*M),c.setRenderTarget(t),c.render(u,Dr)}};function Tg(s){let e=[],t=[],n=[],i=s,r=s-vi+1+Nu.length;for(let a=0;a<r;a++){let o=Math.pow(2,i);e.push(o);let c=1/o;a>s-vi?c=Nu[a-s+vi-1]:a===0&&(c=0),t.push(c);let l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,g=6,y=3,m=2,p=1,x=new Float32Array(y*g*f),S=new Float32Array(m*g*f),M=new Float32Array(p*g*f);for(let A=0;A<f;A++){let C=A%3*2/3-1,_=A>2?0:-1,w=[C,_,0,C+2/3,_,0,C+2/3,_+1,0,C,_,0,C+2/3,_+1,0,C,_+1,0];x.set(w,y*g*A),S.set(d,m*g*A);let L=[A,A,A,A,A,A];M.set(L,p*g*A)}let E=new Ht;E.setAttribute("position",new Tt(x,y)),E.setAttribute("uv",new Tt(S,m)),E.setAttribute("faceIndex",new Tt(M,p)),n.push(new at(E,null)),i>vi&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Ou(s,e,t){let n=new Qt(s,e,t);return n.texture.mapping=Mr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Is(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function Ag(s,e,t){return new en({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Mg,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Bo(),fragmentShader:`-- precision highp float;- precision highp int;-- varying vec3 vOutputDirection;-- uniform sampler2D envMap;- uniform float roughness;- uniform float mipInt;-- #define ENVMAP_TYPE_CUBE_UV- #include <cube_uv_reflection_fragment>-- #define PI 3.14159265359-- // Van der Corput radical inverse- float radicalInverse_VdC(uint bits) {- bits = (bits << 16u) | (bits >> 16u);- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);- return float(bits) * 2.3283064365386963e-10; // / 0x100000000- }-- // Hammersley sequence- vec2 hammersley(uint i, uint N) {- return vec2(float(i) / float(N), radicalInverse_VdC(i));- }-- // GGX VNDF importance sampling (Eric Heitz 2018)- // "Sampling the GGX Distribution of Visible Normals"- // https://jcgt.org/published/0007/04/01/- vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {- float alpha = roughness * roughness;-- // Section 4.1: Orthonormal basis- vec3 T1 = vec3(1.0, 0.0, 0.0);- vec3 T2 = cross(V, T1);-- // Section 4.2: Parameterization of projected area- float r = sqrt(Xi.x);- float phi = 2.0 * PI * Xi.y;- float t1 = r * cos(phi);- float t2 = r * sin(phi);- float s = 0.5 * (1.0 + V.z);- t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;-- // Section 4.3: Reprojection onto hemisphere- vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;-- // Section 3.4: Transform back to ellipsoid configuration- return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));- }-- void main() {- vec3 N = normalize(vOutputDirection);- vec3 V = N; // Assume view direction equals normal for pre-filtering-- vec3 prefilteredColor = vec3(0.0);- float totalWeight = 0.0;-- // For very low roughness, just sample the environment directly- if (roughness < 0.001) {- gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);- return;- }-- // Tangent space basis for VNDF sampling- vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);- vec3 tangent = normalize(cross(up, N));- vec3 bitangent = cross(N, tangent);-- for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {- vec2 Xi = hammersley(i, uint(GGX_SAMPLES));-- // For PMREM, V = N, so in tangent space V is always (0, 0, 1)- vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);-- // Transform H back to world space- vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);- vec3 L = normalize(2.0 * dot(V, H) * H - V);-- float NdotL = max(dot(N, L), 0.0);-- if(NdotL > 0.0) {- // Sample environment at fixed mip level- // VNDF importance sampling handles the distribution filtering- vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);-- // Weight by NdotL for the split-sum approximation- // VNDF PDF naturally accounts for the visible microfacet distribution- prefilteredColor += sampleColor * NdotL;- totalWeight += NdotL;- }- }-- if (totalWeight > 0.0) {- prefilteredColor = prefilteredColor / totalWeight;- }-- gl_FragColor = vec4(prefilteredColor, 1.0);- }- `,blending:Nn,depthTest:!1,depthWrite:!1})}function wg(s,e,t){let n=new Float32Array(Xi),i=new D(0,1,0);return new en({name:"SphericalGaussianBlur",defines:{n:Xi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Bo(),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:Nn,depthTest:!1,depthWrite:!1})}function Bu(){return new en({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Bo(),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:Nn,depthTest:!1,depthWrite:!1})}function ku(){return new en({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Bo(),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:Nn,depthTest:!1,depthWrite:!1})}function Bo(){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 );-- }- `}var Uo=class extends Qt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new rr(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={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 );-- }- `},i=new fi(5,5,5),r=new en({name:"CubemapFromEquirect",uniforms:qi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Lt,blending:Nn});r.uniforms.tEquirect.value=t;let a=new at(i,r),o=t.minFilter;return t.minFilter===yn&&(t.minFilter=vt),new Oa(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}};function Eg(s){let e=new WeakMap,t=new WeakMap,n=null;function i(d,f=!1){return d==null?null:f?a(d):r(d)}function r(d){if(d&&d.isTexture){let f=d.mapping;if(f===Wa||f===qa)if(e.has(d)){let g=e.get(d).texture;return o(g,d.mapping)}else{let g=d.image;if(g&&g.height>0){let y=new Uo(g.height);return y.fromEquirectangularTexture(s,d),e.set(d,y),d.addEventListener("dispose",l),o(y.texture,d.mapping)}else return null}}return d}function a(d){if(d&&d.isTexture){let f=d.mapping,g=f===Wa||f===qa,y=f===bi||f===Hi;if(g||y){let m=t.get(d),p=m!==void 0?m.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==p)return n===null&&(n=new Ls(s)),m=g?n.fromEquirectangular(d,m):n.fromCubemap(d,m),m.texture.pmremVersion=d.pmremVersion,t.set(d,m),m.texture;if(m!==void 0)return m.texture;{let x=d.image;return g&&x&&x.height>0||y&&x&&c(x)?(n===null&&(n=new Ls(s)),m=g?n.fromEquirectangular(d):n.fromCubemap(d),m.texture.pmremVersion=d.pmremVersion,t.set(d,m),d.addEventListener("dispose",h),m.texture):null}}}return d}function o(d,f){return f===Wa?d.mapping=bi:f===qa&&(d.mapping=Hi),d}function c(d){let f=0,g=6;for(let y=0;y<g;y++)d[y]!==void 0&&f++;return f===g}function l(d){let f=d.target;f.removeEventListener("dispose",l);let g=e.get(f);g!==void 0&&(e.delete(f),g.dispose())}function h(d){let f=d.target;f.removeEventListener("dispose",h);let g=t.get(f);g!==void 0&&(t.delete(f),g.dispose())}function u(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:u}}function Rg(s){let e={};function t(n){if(e[n]!==void 0)return e[n];let i=s.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==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(n){let i=t(n);return i===null&&ya("WebGLRenderer: "+n+" extension not supported."),i}}}function Cg(s,e,t,n){let i={},r=new WeakMap;function a(u){let d=u.target;d.index!==null&&e.remove(d.index);for(let g in d.attributes)e.remove(d.attributes[g]);d.removeEventListener("dispose",a),delete i[d.id];let f=r.get(d);f&&(e.remove(f),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function c(u){let d=u.attributes;for(let f in d)e.update(d[f],s.ARRAY_BUFFER)}function l(u){let d=[],f=u.index,g=u.attributes.position,y=0;if(g===void 0)return;if(f!==null){let x=f.array;y=f.version;for(let S=0,M=x.length;S<M;S+=3){let E=x[S+0],A=x[S+1],C=x[S+2];d.push(E,A,A,C,C,E)}}else{let x=g.array;y=g.version;for(let S=0,M=x.length/3-1;S<M;S+=3){let E=S+0,A=S+1,C=S+2;d.push(E,A,A,C,C,E)}}let m=new(g.count>=65535?Qs:$s)(d,1);m.version=y;let p=r.get(u);p&&e.remove(p),r.set(u,m)}function h(u){let d=r.get(u);if(d){let f=u.index;f!==null&&d.version<f.version&&l(u)}else l(u);return r.get(u)}return{get:o,update:c,getWireframeAttribute:h}}function Pg(s,e,t){let n;function i(u){n=u}let r,a;function o(u){r=u.type,a=u.bytesPerElement}function c(u,d){s.drawElements(n,d,r,u*a),t.update(d,n,1)}function l(u,d,f){f!==0&&(s.drawElementsInstanced(n,d,r,u*a,f),t.update(d,n,f))}function h(u,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,r,u,0,f);let y=0;for(let m=0;m<f;m++)y+=d[m];t.update(y,n,1)}this.setMode=i,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h}function Ig(s){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(t.calls++,a){case s.TRIANGLES:t.triangles+=o*(r/3);break;case s.LINES:t.lines+=o*(r/2);break;case s.LINE_STRIP:t.lines+=o*(r-1);break;case s.LINE_LOOP:t.lines+=o*r;break;case s.POINTS:t.points+=o*r;break;default:we("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function Dg(s,e,t){let n=new WeakMap,i=new nt;function r(a,o,c){let l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0,d=n.get(o);if(d===void 0||d.count!==u){let w=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",w)};d!==void 0&&d.texture.dispose();let f=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,y=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],x=o.morphAttributes.color||[],S=0;f===!0&&(S=1),g===!0&&(S=2),y===!0&&(S=3);let M=o.attributes.position.count*S,E=1;M>e.maxTextureSize&&(E=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);let A=new Float32Array(M*E*4*u),C=new Js(A,M,E,u);C.type=tn,C.needsUpdate=!0;let _=S*4;for(let L=0;L<u;L++){let R=m[L],O=p[L],H=x[L],q=M*E*4*L;for(let N=0;N<R.count;N++){let z=N*_;f===!0&&(i.fromBufferAttribute(R,N),A[q+z+0]=i.x,A[q+z+1]=i.y,A[q+z+2]=i.z,A[q+z+3]=0),g===!0&&(i.fromBufferAttribute(O,N),A[q+z+4]=i.x,A[q+z+5]=i.y,A[q+z+6]=i.z,A[q+z+7]=0),y===!0&&(i.fromBufferAttribute(H,N),A[q+z+8]=i.x,A[q+z+9]=i.y,A[q+z+10]=i.z,A[q+z+11]=H.itemSize===4?i.w:1)}}d={count:u,texture:C,size:new Re(M,E)},n.set(o,d),o.addEventListener("dispose",w)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(s,"morphTexture",a.morphTexture,t);else{let f=0;for(let y=0;y<l.length;y++)f+=l[y];let g=o.morphTargetsRelative?1:1-f;c.getUniforms().setValue(s,"morphTargetBaseInfluence",g),c.getUniforms().setValue(s,"morphTargetInfluences",l)}c.getUniforms().setValue(s,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(s,"morphTargetsTextureSize",d.size)}return{update:r}}function Lg(s,e,t,n,i){let r=new WeakMap;function a(l){let h=i.render.frame,u=l.geometry,d=e.get(l,u);if(r.get(d)!==h&&(e.update(d),r.set(d,h)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),r.get(l)!==h&&(t.update(l.instanceMatrix,s.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,s.ARRAY_BUFFER),r.set(l,h))),l.isSkinnedMesh){let f=l.skeleton;r.get(f)!==h&&(f.update(),r.set(f,h))}return d}function o(){r=new WeakMap}function c(l){let h=l.target;h.removeEventListener("dispose",c),n.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:a,dispose:o}}var Fg={[Nc]:"LINEAR_TONE_MAPPING",[Uc]:"REINHARD_TONE_MAPPING",[Oc]:"CINEON_TONE_MAPPING",[yr]:"ACES_FILMIC_TONE_MAPPING",[kc]:"AGX_TONE_MAPPING",[zc]:"NEUTRAL_TONE_MAPPING",[Bc]:"CUSTOM_TONE_MAPPING"};function Ng(s,e,t,n,i){let r=new Qt(e,t,{type:s,depthBuffer:n,stencilBuffer:i,depthTexture:n?new Yn(e,t):void 0}),a=new Qt(e,t,{type:Un,depthBuffer:!1,stencilBuffer:!1}),o=new Ht;o.setAttribute("position",new zt([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new zt([0,2,0,0,2,0],2));let c=new Ra({uniforms:{tDiffuse:{value:null}},vertexShader:`- precision highp float;-- uniform mat4 modelViewMatrix;- uniform mat4 projectionMatrix;-- attribute vec3 position;- attribute vec2 uv;-- varying vec2 vUv;-- void main() {- vUv = uv;- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );- }`,fragmentShader:`- precision highp float;-- uniform sampler2D tDiffuse;-- varying vec2 vUv;-- #include <tonemapping_pars_fragment>- #include <colorspace_pars_fragment>-- void main() {- gl_FragColor = texture2D( tDiffuse, vUv );-- #ifdef LINEAR_TONE_MAPPING- gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );- #elif defined( REINHARD_TONE_MAPPING )- gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );- #elif defined( CINEON_TONE_MAPPING )- gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );- #elif defined( ACES_FILMIC_TONE_MAPPING )- gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );- #elif defined( AGX_TONE_MAPPING )- gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );- #elif defined( NEUTRAL_TONE_MAPPING )- gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );- #elif defined( CUSTOM_TONE_MAPPING )- gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );- #endif-- #ifdef SRGB_TRANSFER- gl_FragColor = sRGBTransferOETF( gl_FragColor );- #endif- }`,depthTest:!1,depthWrite:!1}),l=new at(o,c),h=new pi(-1,1,1,-1,0,1),u=null,d=null,f=!1,g,y=null,m=[],p=!1;this.setSize=function(x,S){r.setSize(x,S),a.setSize(x,S);for(let M=0;M<m.length;M++){let E=m[M];E.setSize&&E.setSize(x,S)}},this.setEffects=function(x){m=x,p=m.length>0&&m[0].isRenderPass===!0;let S=r.width,M=r.height;for(let E=0;E<m.length;E++){let A=m[E];A.setSize&&A.setSize(S,M)}},this.begin=function(x,S){if(f||x.toneMapping===vn&&m.length===0)return!1;if(y=S,S!==null){let M=S.width,E=S.height;(r.width!==M||r.height!==E)&&this.setSize(M,E)}return p===!1&&x.setRenderTarget(r),g=x.toneMapping,x.toneMapping=vn,!0},this.hasRenderPass=function(){return p},this.end=function(x,S){x.toneMapping=g,f=!0;let M=r,E=a;for(let A=0;A<m.length;A++){let C=m[A];if(C.enabled!==!1&&(C.render(x,E,M,S),C.needsSwap!==!1)){let _=M;M=E,E=_}}if(u!==x.outputColorSpace||d!==x.toneMapping){u=x.outputColorSpace,d=x.toneMapping,c.defines={},ze.getTransfer(u)===Ye&&(c.defines.SRGB_TRANSFER="");let A=Fg[d];A&&(c.defines[A]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=M.texture,x.setRenderTarget(y),x.render(l,h),y=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){r.depthTexture&&r.depthTexture.dispose(),r.dispose(),a.dispose(),o.dispose(),c.dispose()}}var rd=new Dt,dl=new Yn(1,1),ad=new Js,od=new Ta,cd=new rr,zu=[],Gu=[],Vu=new Float32Array(16),Hu=new Float32Array(9),Wu=new Float32Array(4);function Fs(s,e,t){let n=s[0];if(n<=0||n>0)return s;let i=e*t,r=zu[i];if(r===void 0&&(r=new Float32Array(i),zu[i]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(r,o)}return r}function Rt(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function Ct(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function ko(s,e){let t=Gu[e];t===void 0&&(t=new Int32Array(e),Gu[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function Ug(s,e){let t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function Og(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2fv(this.addr,e),Ct(t,e)}}function Bg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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)&&(s.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;s.uniform3fv(this.addr,e),Ct(t,e)}}function kg(s,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)&&(s.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;s.uniform4fv(this.addr,e),Ct(t,e)}}function zg(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),Ct(t,e)}else{if(Rt(t,n))return;Wu.set(n),s.uniformMatrix2fv(this.addr,!1,Wu),Ct(t,n)}}function Gg(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),Ct(t,e)}else{if(Rt(t,n))return;Hu.set(n),s.uniformMatrix3fv(this.addr,!1,Hu),Ct(t,n)}}function Vg(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),Ct(t,e)}else{if(Rt(t,n))return;Vu.set(n),s.uniformMatrix4fv(this.addr,!1,Vu),Ct(t,n)}}function Hg(s,e){let t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function Wg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2iv(this.addr,e),Ct(t,e)}}function qg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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;s.uniform3iv(this.addr,e),Ct(t,e)}}function Xg(s,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)&&(s.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;s.uniform4iv(this.addr,e),Ct(t,e)}}function jg(s,e){let t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function Kg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2uiv(this.addr,e),Ct(t,e)}}function Yg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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;s.uniform3uiv(this.addr,e),Ct(t,e)}}function Jg(s,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)&&(s.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;s.uniform4uiv(this.addr,e),Ct(t,e)}}function Zg(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(dl.compareFunction=t.isReversedDepthBuffer()?Lo:Do,r=dl):r=rd,t.setTexture2D(e||r,i)}function $g(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||od,i)}function Qg(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||cd,i)}function eb(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||ad,i)}function tb(s){switch(s){case 5126:return Ug;case 35664:return Og;case 35665:return Bg;case 35666:return kg;case 35674:return zg;case 35675:return Gg;case 35676:return Vg;case 5124:case 35670:return Hg;case 35667:case 35671:return Wg;case 35668:case 35672:return qg;case 35669:case 35673:return Xg;case 5125:return jg;case 36294:return Kg;case 36295:return Yg;case 36296:return Jg;case 35678:case 36198:case 36298:case 36306:case 35682:return Zg;case 35679:case 36299:case 36307:return $g;case 35680:case 36300:case 36308:case 36293:return Qg;case 36289:case 36303:case 36311:case 36292:return eb}}function nb(s,e){s.uniform1fv(this.addr,e)}function ib(s,e){let t=Fs(e,this.size,2);s.uniform2fv(this.addr,t)}function sb(s,e){let t=Fs(e,this.size,3);s.uniform3fv(this.addr,t)}function rb(s,e){let t=Fs(e,this.size,4);s.uniform4fv(this.addr,t)}function ab(s,e){let t=Fs(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function ob(s,e){let t=Fs(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function cb(s,e){let t=Fs(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function lb(s,e){s.uniform1iv(this.addr,e)}function hb(s,e){s.uniform2iv(this.addr,e)}function ub(s,e){s.uniform3iv(this.addr,e)}function db(s,e){s.uniform4iv(this.addr,e)}function fb(s,e){s.uniform1uiv(this.addr,e)}function pb(s,e){s.uniform2uiv(this.addr,e)}function mb(s,e){s.uniform3uiv(this.addr,e)}function gb(s,e){s.uniform4uiv(this.addr,e)}function bb(s,e,t){let n=this.cache,i=e.length,r=ko(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),Ct(n,r));let a;this.type===s.SAMPLER_2D_SHADOW?a=dl:a=rd;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,r[o])}function _b(s,e,t){let n=this.cache,i=e.length,r=ko(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),Ct(n,r));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||od,r[a])}function xb(s,e,t){let n=this.cache,i=e.length,r=ko(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),Ct(n,r));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||cd,r[a])}function vb(s,e,t){let n=this.cache,i=e.length,r=ko(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),Ct(n,r));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||ad,r[a])}function yb(s){switch(s){case 5126:return nb;case 35664:return ib;case 35665:return sb;case 35666:return rb;case 35674:return ab;case 35675:return ob;case 35676:return cb;case 5124:case 35670:return lb;case 35667:case 35671:return hb;case 35668:case 35672:return ub;case 35669:case 35673:return db;case 5125:return fb;case 36294:return pb;case 36295:return mb;case 36296:return gb;case 35678:case 36198:case 36298:case 36306:case 35682:return bb;case 35679:case 36299:case 36307:return _b;case 35680:case 36300:case 36308:case 36293:return xb;case 36289:case 36303:case 36311:case 36292:return vb}}var fl=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=tb(t.type)}},pl=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=yb(t.type)}},ml=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let r=0,a=i.length;r!==a;++r){let o=i[r];o.setValue(e,t[o.id],n)}}},hl=/(\w+)(\])?(\[|\.)?/g;function qu(s,e){s.seq.push(e),s.map[e.id]=e}function Mb(s,e,t){let n=s.name,i=n.length;for(hl.lastIndex=0;;){let r=hl.exec(n),a=hl.lastIndex,o=r[1],c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===i){qu(t,l===void 0?new fl(o,s,e):new pl(o,s,e));break}else{let u=t.map[o];u===void 0&&(u=new ml(o),qu(t,u)),t=u}}}var Ds=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){let o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);Mb(o,c,this)}let i=[],r=[];for(let a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):r.push(a);i.length>0&&(this.seq=i.concat(r))}setValue(e,t,n,i){let r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){let o=t[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let a=e[i];a.id in t&&n.push(a)}return n}};function Xu(s,e,t){let n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}var Sb=37297,Tb=0;function Ab(s,e){let t=s.split(`-`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=i;a<r;a++){let o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`-`)}var ju=new Ie;function wb(s){ze._getMatrix(ju,ze.workingColorSpace,s);let e=`mat3( ${ju.elements.map(t=>t.toFixed(4))} )`;switch(ze.getTransfer(s)){case Ks:return[e,"LinearTransferOETF"];case Ye:return[e,"sRGBTransferOETF"];default:return _e("WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function Ku(s,e,t){let n=s.getShaderParameter(e,s.COMPILE_STATUS),r=(s.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";let a=/ERROR: 0:(\d+)/.exec(r);if(a){let o=parseInt(a[1]);return t.toUpperCase()+`--`+r+`--`+Ab(s.getShaderSource(e),o)}else return r}function Eb(s,e){let t=wb(e);return[`vec4 ${s}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`-`)}var Rb={[Nc]:"Linear",[Uc]:"Reinhard",[Oc]:"Cineon",[yr]:"ACESFilmic",[kc]:"AgX",[zc]:"Neutral",[Bc]:"Custom"};function Cb(s,e){let t=Rb[e];return t===void 0?(_e("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+s+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var No=new D;function Pb(){ze.getLuminanceCoefficients(No);let s=No.x.toFixed(4),e=No.y.toFixed(4),t=No.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${s}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`-`)}function Ib(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fr).join(`-`)}function Db(s){let e=[];for(let t in s){let n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`-`)}function Lb(s,e){let t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){let r=s.getActiveAttrib(e,i),a=r.name,o=1;r.type===s.FLOAT_MAT2&&(o=2),r.type===s.FLOAT_MAT3&&(o=3),r.type===s.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:s.getAttribLocation(e,a),locationSize:o}}return t}function Fr(s){return s!==""}function Yu(s,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.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 Ju(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Fb=/^[ \t]*#include +<([\w\d./]+)>/gm;function gl(s){return s.replace(Fb,Ub)}var Nb=new Map;function Ub(s,e){let t=Be[e];if(t===void 0){let n=Nb.get(e);if(n!==void 0)t=Be[n],_e('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return gl(t)}var Ob=/#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 Zu(s){return s.replace(Ob,Bb)}function Bb(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function $u(s){let e=`precision ${s.precision} float;- precision ${s.precision} int;- precision ${s.precision} sampler2D;- precision ${s.precision} samplerCube;- precision ${s.precision} sampler3D;- precision ${s.precision} sampler2DArray;- precision ${s.precision} sampler2DShadow;- precision ${s.precision} samplerCubeShadow;- precision ${s.precision} sampler2DArrayShadow;- precision ${s.precision} isampler2D;- precision ${s.precision} isampler3D;- precision ${s.precision} isamplerCube;- precision ${s.precision} isampler2DArray;- precision ${s.precision} usampler2D;- precision ${s.precision} usampler3D;- precision ${s.precision} usamplerCube;- precision ${s.precision} usampler2DArray;- `;return s.precision==="highp"?e+=`-#define HIGH_PRECISION`:s.precision==="mediump"?e+=`-#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`-#define LOW_PRECISION`),e}var kb={[vr]:"SHADOWMAP_TYPE_PCF",[ws]:"SHADOWMAP_TYPE_VSM"};function zb(s){return kb[s.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Gb={[bi]:"ENVMAP_TYPE_CUBE",[Hi]:"ENVMAP_TYPE_CUBE",[Mr]:"ENVMAP_TYPE_CUBE_UV"};function Vb(s){return s.envMap===!1?"ENVMAP_TYPE_CUBE":Gb[s.envMapMode]||"ENVMAP_TYPE_CUBE"}var Hb={[Hi]:"ENVMAP_MODE_REFRACTION"};function Wb(s){return s.envMap===!1?"ENVMAP_MODE_REFLECTION":Hb[s.envMapMode]||"ENVMAP_MODE_REFLECTION"}var qb={[Ha]:"ENVMAP_BLENDING_MULTIPLY",[du]:"ENVMAP_BLENDING_MIX",[fu]:"ENVMAP_BLENDING_ADD"};function Xb(s){return s.envMap===!1?"ENVMAP_BLENDING_NONE":qb[s.combine]||"ENVMAP_BLENDING_NONE"}function jb(s){let e=s.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function Kb(s,e,t,n){let i=s.getContext(),r=t.defines,a=t.vertexShader,o=t.fragmentShader,c=zb(t),l=Vb(t),h=Wb(t),u=Xb(t),d=jb(t),f=Ib(t),g=Db(r),y=i.createProgram(),m,p,x=t.glslVersion?"#version "+t.glslVersion+`-`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Fr).join(`-`),m.length>0&&(m+=`-`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Fr).join(`-`),p.length>0&&(p+=`-`)):(m=[$u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+h:"",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.vertexNormals?"#define HAS_NORMAL":"",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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`-`].filter(Fr).join(`-`),p=[$u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==vn?"#define TONE_MAPPING":"",t.toneMapping!==vn?Be.tonemapping_pars_fragment:"",t.toneMapping!==vn?Cb("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Be.colorspace_pars_fragment,Eb("linearToOutputTexel",t.outputColorSpace),Pb(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`-`].filter(Fr).join(`-`)),a=gl(a),a=Yu(a,t),a=Ju(a,t),o=gl(o),o=Yu(o,t),o=Ju(o,t),a=Zu(a),o=Zu(o),t.isRawShaderMaterial!==!0&&(x=`#version 300 es-`,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`-`)+`-`+m,p=["#define varying in",t.glslVersion===Yc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Yc?"":"#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(`-`)+`-`+p);let S=x+m+a,M=x+p+o,E=Xu(i,i.VERTEX_SHADER,S),A=Xu(i,i.FRAGMENT_SHADER,M);i.attachShader(y,E),i.attachShader(y,A),t.index0AttributeName!==void 0?i.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);function C(R){if(s.debug.checkShaderErrors){let O=i.getProgramInfoLog(y)||"",H=i.getShaderInfoLog(E)||"",q=i.getShaderInfoLog(A)||"",N=O.trim(),z=H.trim(),V=q.trim(),$=!0,Q=!0;if(i.getProgramParameter(y,i.LINK_STATUS)===!1)if($=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,y,E,A);else{let le=Ku(i,E,"vertex"),xe=Ku(i,A,"fragment");we("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(y,i.VALIDATE_STATUS)+`--Material Name: `+R.name+`-Material Type: `+R.type+`--Program Info Log: `+N+`-`+le+`-`+xe)}else N!==""?_e("WebGLProgram: Program Info Log:",N):(z===""||V==="")&&(Q=!1);Q&&(R.diagnostics={runnable:$,programLog:N,vertexShader:{log:z,prefix:m},fragmentShader:{log:V,prefix:p}})}i.deleteShader(E),i.deleteShader(A),_=new Ds(i,y),w=Lb(i,y)}let _;this.getUniforms=function(){return _===void 0&&C(this),_};let w;this.getAttributes=function(){return w===void 0&&C(this),w};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=i.getProgramParameter(y,Sb)),L},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Tb++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=E,this.fragmentShader=A,this}var Yb=0,bl=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new _l(e),t.set(e,n)),n}},_l=class{constructor(e){this.id=Yb++,this.code=e,this.usedTimes=0}};function Jb(s){return s===xi||s===Er||s===Rr}function Zb(s,e,t,n,i,r){let a=new Zs,o=new bl,c=new Set,l=[],h=new Map,u=n.logarithmicDepthBuffer,d=n.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 g(_){return c.add(_),_===0?"uv":`uv${_}`}function y(_,w,L,R,O,H){let q=R.fog,N=O.geometry,z=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?R.environment:null,V=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,$=e.get(_.envMap||z,V),Q=$&&$.mapping===Mr?$.image.height:null,le=f[_.type];_.precision!==null&&(d=n.getMaxPrecision(_.precision),d!==_.precision&&_e("WebGLProgram.getParameters:",_.precision,"not supported, using",d,"instead."));let xe=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,Se=xe!==void 0?xe.length:0,Xe=0;N.morphAttributes.position!==void 0&&(Xe=1),N.morphAttributes.normal!==void 0&&(Xe=2),N.morphAttributes.color!==void 0&&(Xe=3);let Ze,Ne,Y,de;if(le){let Le=Bn[le];Ze=Le.vertexShader,Ne=Le.fragmentShader}else Ze=_.vertexShader,Ne=_.fragmentShader,o.update(_),Y=o.getVertexShaderID(_),de=o.getFragmentShaderID(_);let ie=s.getRenderTarget(),Ee=s.state.buffers.depth.getReversed(),De=O.isInstancedMesh===!0,Ce=O.isBatchedMesh===!0,ut=!!_.map,We=!!_.matcap,$e=!!$,ht=!!_.aoMap,He=!!_.lightMap,At=!!_.bumpMap,dt=!!_.normalMap,Yt=!!_.displacementMap,I=!!_.emissiveMap,wt=!!_.metalnessMap,qe=!!_.roughnessMap,ot=_.anisotropy>0,oe=_.clearcoat>0,ft=_.dispersion>0,T=_.iridescence>0,b=_.sheen>0,U=_.transmission>0,j=ot&&!!_.anisotropyMap,Z=oe&&!!_.clearcoatMap,ee=oe&&!!_.clearcoatNormalMap,ae=oe&&!!_.clearcoatRoughnessMap,W=T&&!!_.iridescenceMap,K=T&&!!_.iridescenceThicknessMap,fe=b&&!!_.sheenColorMap,ge=b&&!!_.sheenRoughnessMap,se=!!_.specularMap,te=!!_.specularColorMap,Pe=!!_.specularIntensityMap,Ue=U&&!!_.transmissionMap,Ke=U&&!!_.thicknessMap,P=!!_.gradientMap,ne=!!_.alphaMap,X=_.alphaTest>0,pe=!!_.alphaHash,re=!!_.extensions,J=vn;_.toneMapped&&(ie===null||ie.isXRRenderTarget===!0)&&(J=s.toneMapping);let ye={shaderID:le,shaderType:_.type,shaderName:_.name,vertexShader:Ze,fragmentShader:Ne,defines:_.defines,customVertexShaderID:Y,customFragmentShaderID:de,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:d,batching:Ce,batchingColor:Ce&&O._colorsTexture!==null,instancing:De,instancingColor:De&&O.instanceColor!==null,instancingMorph:De&&O.morphTexture!==null,outputColorSpace:ie===null?s.outputColorSpace:ie.isXRRenderTarget===!0?ie.texture.colorSpace:ze.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ut,matcap:We,envMap:$e,envMapMode:$e&&$.mapping,envMapCubeUVHeight:Q,aoMap:ht,lightMap:He,bumpMap:At,normalMap:dt,displacementMap:Yt,emissiveMap:I,normalMapObjectSpace:dt&&_.normalMapType===vu,normalMapTangentSpace:dt&&_.normalMapType===Pr,packedNormalMap:dt&&_.normalMapType===Pr&&Jb(_.normalMap.format),metalnessMap:wt,roughnessMap:qe,anisotropy:ot,anisotropyMap:j,clearcoat:oe,clearcoatMap:Z,clearcoatNormalMap:ee,clearcoatRoughnessMap:ae,dispersion:ft,iridescence:T,iridescenceMap:W,iridescenceThicknessMap:K,sheen:b,sheenColorMap:fe,sheenRoughnessMap:ge,specularMap:se,specularColorMap:te,specularIntensityMap:Pe,transmission:U,transmissionMap:Ue,thicknessMap:Ke,gradientMap:P,opaque:_.transparent===!1&&_.blending===Pi&&_.alphaToCoverage===!1,alphaMap:ne,alphaTest:X,alphaHash:pe,combine:_.combine,mapUv:ut&&g(_.map.channel),aoMapUv:ht&&g(_.aoMap.channel),lightMapUv:He&&g(_.lightMap.channel),bumpMapUv:At&&g(_.bumpMap.channel),normalMapUv:dt&&g(_.normalMap.channel),displacementMapUv:Yt&&g(_.displacementMap.channel),emissiveMapUv:I&&g(_.emissiveMap.channel),metalnessMapUv:wt&&g(_.metalnessMap.channel),roughnessMapUv:qe&&g(_.roughnessMap.channel),anisotropyMapUv:j&&g(_.anisotropyMap.channel),clearcoatMapUv:Z&&g(_.clearcoatMap.channel),clearcoatNormalMapUv:ee&&g(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ae&&g(_.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&g(_.iridescenceMap.channel),iridescenceThicknessMapUv:K&&g(_.iridescenceThicknessMap.channel),sheenColorMapUv:fe&&g(_.sheenColorMap.channel),sheenRoughnessMapUv:ge&&g(_.sheenRoughnessMap.channel),specularMapUv:se&&g(_.specularMap.channel),specularColorMapUv:te&&g(_.specularColorMap.channel),specularIntensityMapUv:Pe&&g(_.specularIntensityMap.channel),transmissionMapUv:Ue&&g(_.transmissionMap.channel),thicknessMapUv:Ke&&g(_.thicknessMap.channel),alphaMapUv:ne&&g(_.alphaMap.channel),vertexTangents:!!N.attributes.tangent&&(dt||ot),vertexNormals:!!N.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!N.attributes.uv&&(ut||ne),fog:!!q,useFog:_.fog===!0,fogExp2:!!q&&q.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||N.attributes.normal===void 0&&dt===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:Ee,skinning:O.isSkinnedMesh===!0,morphTargets:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.morphAttributes.color!==void 0,morphTargetsCount:Se,morphTextureStride:Xe,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numLightProbeGrids:H.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:_.dithering,shadowMapEnabled:s.shadowMap.enabled&&L.length>0,shadowMapType:s.shadowMap.type,toneMapping:J,decodeVideoTexture:ut&&_.map.isVideoTexture===!0&&ze.getTransfer(_.map.colorSpace)===Ye,decodeVideoTextureEmissive:I&&_.emissiveMap.isVideoTexture===!0&&ze.getTransfer(_.emissiveMap.colorSpace)===Ye,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===ln,flipSided:_.side===Lt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:re&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(re&&_.extensions.multiDraw===!0||Ce)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return ye.vertexUv1s=c.has(1),ye.vertexUv2s=c.has(2),ye.vertexUv3s=c.has(3),c.clear(),ye}function m(_){let w=[];if(_.shaderID?w.push(_.shaderID):(w.push(_.customVertexShaderID),w.push(_.customFragmentShaderID)),_.defines!==void 0)for(let L in _.defines)w.push(L),w.push(_.defines[L]);return _.isRawShaderMaterial===!1&&(p(w,_),x(w,_),w.push(s.outputColorSpace)),w.push(_.customProgramCacheKey),w.join()}function p(_,w){_.push(w.precision),_.push(w.outputColorSpace),_.push(w.envMapMode),_.push(w.envMapCubeUVHeight),_.push(w.mapUv),_.push(w.alphaMapUv),_.push(w.lightMapUv),_.push(w.aoMapUv),_.push(w.bumpMapUv),_.push(w.normalMapUv),_.push(w.displacementMapUv),_.push(w.emissiveMapUv),_.push(w.metalnessMapUv),_.push(w.roughnessMapUv),_.push(w.anisotropyMapUv),_.push(w.clearcoatMapUv),_.push(w.clearcoatNormalMapUv),_.push(w.clearcoatRoughnessMapUv),_.push(w.iridescenceMapUv),_.push(w.iridescenceThicknessMapUv),_.push(w.sheenColorMapUv),_.push(w.sheenRoughnessMapUv),_.push(w.specularMapUv),_.push(w.specularColorMapUv),_.push(w.specularIntensityMapUv),_.push(w.transmissionMapUv),_.push(w.thicknessMapUv),_.push(w.combine),_.push(w.fogExp2),_.push(w.sizeAttenuation),_.push(w.morphTargetsCount),_.push(w.morphAttributeCount),_.push(w.numDirLights),_.push(w.numPointLights),_.push(w.numSpotLights),_.push(w.numSpotLightMaps),_.push(w.numHemiLights),_.push(w.numRectAreaLights),_.push(w.numDirLightShadows),_.push(w.numPointLightShadows),_.push(w.numSpotLightShadows),_.push(w.numSpotLightShadowsWithMaps),_.push(w.numLightProbes),_.push(w.shadowMapType),_.push(w.toneMapping),_.push(w.numClippingPlanes),_.push(w.numClipIntersection),_.push(w.depthPacking)}function x(_,w){a.disableAll(),w.instancing&&a.enable(0),w.instancingColor&&a.enable(1),w.instancingMorph&&a.enable(2),w.matcap&&a.enable(3),w.envMap&&a.enable(4),w.normalMapObjectSpace&&a.enable(5),w.normalMapTangentSpace&&a.enable(6),w.clearcoat&&a.enable(7),w.iridescence&&a.enable(8),w.alphaTest&&a.enable(9),w.vertexColors&&a.enable(10),w.vertexAlphas&&a.enable(11),w.vertexUv1s&&a.enable(12),w.vertexUv2s&&a.enable(13),w.vertexUv3s&&a.enable(14),w.vertexTangents&&a.enable(15),w.anisotropy&&a.enable(16),w.alphaHash&&a.enable(17),w.batching&&a.enable(18),w.dispersion&&a.enable(19),w.batchingColor&&a.enable(20),w.gradientMap&&a.enable(21),w.packedNormalMap&&a.enable(22),w.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),w.fog&&a.enable(0),w.useFog&&a.enable(1),w.flatShading&&a.enable(2),w.logarithmicDepthBuffer&&a.enable(3),w.reversedDepthBuffer&&a.enable(4),w.skinning&&a.enable(5),w.morphTargets&&a.enable(6),w.morphNormals&&a.enable(7),w.morphColors&&a.enable(8),w.premultipliedAlpha&&a.enable(9),w.shadowMapEnabled&&a.enable(10),w.doubleSided&&a.enable(11),w.flipSided&&a.enable(12),w.useDepthPacking&&a.enable(13),w.dithering&&a.enable(14),w.transmission&&a.enable(15),w.sheen&&a.enable(16),w.opaque&&a.enable(17),w.pointsUvs&&a.enable(18),w.decodeVideoTexture&&a.enable(19),w.decodeVideoTextureEmissive&&a.enable(20),w.alphaToCoverage&&a.enable(21),w.numLightProbeGrids>0&&a.enable(22),_.push(a.mask)}function S(_){let w=f[_.type],L;if(w){let R=Bn[w];L=Du.clone(R.uniforms)}else L=_.uniforms;return L}function M(_,w){let L=h.get(w);return L!==void 0?++L.usedTimes:(L=new Kb(s,w,_,i),l.push(L),h.set(w,L)),L}function E(_){if(--_.usedTimes===0){let w=l.indexOf(_);l[w]=l[l.length-1],l.pop(),h.delete(_.cacheKey),_.destroy()}}function A(_){o.remove(_)}function C(){o.dispose()}return{getParameters:y,getProgramCacheKey:m,getUniforms:S,acquireProgram:M,releaseProgram:E,releaseShaderCache:A,programs:l,dispose:C}}function $b(){let s=new WeakMap;function e(a){return s.has(a)}function t(a){let o=s.get(a);return o===void 0&&(o={},s.set(a,o)),o}function n(a){s.delete(a)}function i(a,o,c){s.get(a)[o]=c}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function Qb(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.materialVariant!==e.materialVariant?s.materialVariant-e.materialVariant:s.z!==e.z?s.z-e.z:s.id-e.id}function Qu(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function ed(){let s=[],e=0,t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function a(d){let f=0;return d.isInstancedMesh&&(f+=2),d.isSkinnedMesh&&(f+=1),f}function o(d,f,g,y,m,p){let x=s[e];return x===void 0?(x={id:d.id,object:d,geometry:f,material:g,materialVariant:a(d),groupOrder:y,renderOrder:d.renderOrder,z:m,group:p},s[e]=x):(x.id=d.id,x.object=d,x.geometry=f,x.material=g,x.materialVariant=a(d),x.groupOrder=y,x.renderOrder=d.renderOrder,x.z=m,x.group=p),e++,x}function c(d,f,g,y,m,p){let x=o(d,f,g,y,m,p);g.transmission>0?n.push(x):g.transparent===!0?i.push(x):t.push(x)}function l(d,f,g,y,m,p){let x=o(d,f,g,y,m,p);g.transmission>0?n.unshift(x):g.transparent===!0?i.unshift(x):t.unshift(x)}function h(d,f){t.length>1&&t.sort(d||Qb),n.length>1&&n.sort(f||Qu),i.length>1&&i.sort(f||Qu)}function u(){for(let d=e,f=s.length;d<f;d++){let g=s[d];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:c,unshift:l,finish:u,sort:h}}function e0(){let s=new WeakMap;function e(n,i){let r=s.get(n),a;return r===void 0?(a=new ed,s.set(n,[a])):i>=r.length?(a=new ed,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function t0(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new D,color:new Ae};break;case"SpotLight":t={position:new D,direction:new D,color:new Ae,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Ae,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Ae,groundColor:new Ae};break;case"RectAreaLight":t={color:new Ae,position:new D,halfWidth:new D,halfHeight:new D};break}return s[e.id]=t,t}}}function n0(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}var i0=0;function s0(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function r0(s){let e=new t0,t=n0(),n={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 l=0;l<9;l++)n.probe.push(new D);let i=new D,r=new Oe,a=new Oe;function o(l){let h=0,u=0,d=0;for(let w=0;w<9;w++)n.probe[w].set(0,0,0);let f=0,g=0,y=0,m=0,p=0,x=0,S=0,M=0,E=0,A=0,C=0;l.sort(s0);for(let w=0,L=l.length;w<L;w++){let R=l[w],O=R.color,H=R.intensity,q=R.distance,N=null;if(R.shadow&&R.shadow.map&&(R.shadow.map.texture.format===xi?N=R.shadow.map.texture:N=R.shadow.map.depthTexture||R.shadow.map.texture),R.isAmbientLight)h+=O.r*H,u+=O.g*H,d+=O.b*H;else if(R.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(R.sh.coefficients[z],H);C++}else if(R.isDirectionalLight){let z=e.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){let V=R.shadow,$=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,n.directionalShadow[f]=$,n.directionalShadowMap[f]=N,n.directionalShadowMatrix[f]=R.shadow.matrix,x++}n.directional[f]=z,f++}else if(R.isSpotLight){let z=e.get(R);z.position.setFromMatrixPosition(R.matrixWorld),z.color.copy(O).multiplyScalar(H),z.distance=q,z.coneCos=Math.cos(R.angle),z.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),z.decay=R.decay,n.spot[y]=z;let V=R.shadow;if(R.map&&(n.spotLightMap[E]=R.map,E++,V.updateMatrices(R),R.castShadow&&A++),n.spotLightMatrix[y]=V.matrix,R.castShadow){let $=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,n.spotShadow[y]=$,n.spotShadowMap[y]=N,M++}y++}else if(R.isRectAreaLight){let z=e.get(R);z.color.copy(O).multiplyScalar(H),z.halfWidth.set(R.width*.5,0,0),z.halfHeight.set(0,R.height*.5,0),n.rectArea[m]=z,m++}else if(R.isPointLight){let z=e.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),z.distance=R.distance,z.decay=R.decay,R.castShadow){let V=R.shadow,$=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,$.shadowCameraNear=V.camera.near,$.shadowCameraFar=V.camera.far,n.pointShadow[g]=$,n.pointShadowMap[g]=N,n.pointShadowMatrix[g]=R.shadow.matrix,S++}n.point[g]=z,g++}else if(R.isHemisphereLight){let z=e.get(R);z.skyColor.copy(R.color).multiplyScalar(H),z.groundColor.copy(R.groundColor).multiplyScalar(H),n.hemi[p]=z,p++}}m>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ce.LTC_FLOAT_1,n.rectAreaLTC2=ce.LTC_FLOAT_2):(n.rectAreaLTC1=ce.LTC_HALF_1,n.rectAreaLTC2=ce.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;let _=n.hash;(_.directionalLength!==f||_.pointLength!==g||_.spotLength!==y||_.rectAreaLength!==m||_.hemiLength!==p||_.numDirectionalShadows!==x||_.numPointShadows!==S||_.numSpotShadows!==M||_.numSpotMaps!==E||_.numLightProbes!==C)&&(n.directional.length=f,n.spot.length=y,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=S,n.pointShadowMap.length=S,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=S,n.spotLightMatrix.length=M+E-A,n.spotLightMap.length=E,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=C,_.directionalLength=f,_.pointLength=g,_.spotLength=y,_.rectAreaLength=m,_.hemiLength=p,_.numDirectionalShadows=x,_.numPointShadows=S,_.numSpotShadows=M,_.numSpotMaps=E,_.numLightProbes=C,n.version=i0++)}function c(l,h){let u=0,d=0,f=0,g=0,y=0,m=h.matrixWorldInverse;for(let p=0,x=l.length;p<x;p++){let S=l[p];if(S.isDirectionalLight){let M=n.directional[u];M.direction.setFromMatrixPosition(S.matrixWorld),i.setFromMatrixPosition(S.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(m),u++}else if(S.isSpotLight){let M=n.spot[f];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),M.direction.setFromMatrixPosition(S.matrixWorld),i.setFromMatrixPosition(S.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(m),f++}else if(S.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),a.identity(),r.copy(S.matrixWorld),r.premultiply(m),a.extractRotation(r),M.halfWidth.set(S.width*.5,0,0),M.halfHeight.set(0,S.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),g++}else if(S.isPointLight){let M=n.point[d];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),d++}else if(S.isHemisphereLight){let M=n.hemi[y];M.direction.setFromMatrixPosition(S.matrixWorld),M.direction.transformDirection(m),y++}}}return{setup:o,setupView:c,state:n}}function td(s){let e=new r0(s),t=[],n=[],i=[];function r(d){u.camera=d,t.length=0,n.length=0,i.length=0}function a(d){t.push(d)}function o(d){n.push(d)}function c(d){i.push(d)}function l(){e.setup(t)}function h(d){e.setupView(t,d)}let u={lightsArray:t,shadowsArray:n,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:u,setupLights:l,setupLightsView:h,pushLight:a,pushShadow:o,pushLightProbeGrid:c}}function a0(s){let e=new WeakMap;function t(i,r=0){let a=e.get(i),o;return a===void 0?(o=new td(s),e.set(i,[o])):r>=a.length?(o=new td(s),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}var o0=`void main() {- gl_Position = vec4( position, 1.0 );-}`,c0=`uniform sampler2D shadow_pass;-uniform vec2 resolution;-uniform float radius;-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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;- mean += distribution.x;- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;- #else- float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;- mean += depth;- squared_mean += depth * depth;- #endif- }- mean = mean / samples;- squared_mean = squared_mean / samples;- float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );- gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );-}`,l0=[new D(1,0,0),new D(-1,0,0),new D(0,1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1)],h0=[new D(0,-1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1),new D(0,-1,0),new D(0,-1,0)],nd=new Oe,Lr=new D,ul=new D;function u0(s,e,t){let n=new ys,i=new Re,r=new Re,a=new nt,o=new Ca,c=new Pa,l={},h=t.maxTextureSize,u={[_n]:Lt,[Lt]:_n,[ln]:ln},d=new en({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Re},radius:{value:4}},vertexShader:o0,fragmentShader:c0}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let g=new Ht;g.setAttribute("position",new Tt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let y=new at(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=vr;let p=this.type;this.render=function(A,C,_){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;this.type===Va&&(_e("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=vr);let w=s.getRenderTarget(),L=s.getActiveCubeFace(),R=s.getActiveMipmapLevel(),O=s.state;O.setBlending(Nn),O.buffers.depth.getReversed()===!0?O.buffers.color.setClear(0,0,0,0):O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);let H=p!==this.type;H&&C.traverse(function(q){q.material&&(Array.isArray(q.material)?q.material.forEach(N=>N.needsUpdate=!0):q.material.needsUpdate=!0)});for(let q=0,N=A.length;q<N;q++){let z=A[q],V=z.shadow;if(V===void 0){_e("WebGLShadowMap:",z,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;i.copy(V.mapSize);let $=V.getFrameExtents();i.multiply($),r.copy(V.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/$.x),i.x=r.x*$.x,V.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/$.y),i.y=r.y*$.y,V.mapSize.y=r.y));let Q=s.state.buffers.depth.getReversed();if(V.camera._reversedDepth=Q,V.map===null||H===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===ws){if(z.isPointLight){_e("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}V.map=new Qt(i.x,i.y,{format:xi,type:Un,minFilter:vt,magFilter:vt,generateMipmaps:!1}),V.map.texture.name=z.name+".shadowMap",V.map.depthTexture=new Yn(i.x,i.y,tn),V.map.depthTexture.name=z.name+".shadowMapDepth",V.map.depthTexture.format=En,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=xt,V.map.depthTexture.magFilter=xt}else z.isPointLight?(V.map=new Uo(i.x),V.map.depthTexture=new Ea(i.x,Mn)):(V.map=new Qt(i.x,i.y),V.map.depthTexture=new Yn(i.x,i.y,Mn)),V.map.depthTexture.name=z.name+".shadowMap",V.map.depthTexture.format=En,this.type===vr?(V.map.depthTexture.compareFunction=Q?Lo:Do,V.map.depthTexture.minFilter=vt,V.map.depthTexture.magFilter=vt):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=xt,V.map.depthTexture.magFilter=xt);V.camera.updateProjectionMatrix()}let le=V.map.isWebGLCubeRenderTarget?6:1;for(let xe=0;xe<le;xe++){if(V.map.isWebGLCubeRenderTarget)s.setRenderTarget(V.map,xe),s.clear();else{xe===0&&(s.setRenderTarget(V.map),s.clear());let Se=V.getViewport(xe);a.set(r.x*Se.x,r.y*Se.y,r.x*Se.z,r.y*Se.w),O.viewport(a)}if(z.isPointLight){let Se=V.camera,Xe=V.matrix,Ze=z.distance||Se.far;Ze!==Se.far&&(Se.far=Ze,Se.updateProjectionMatrix()),Lr.setFromMatrixPosition(z.matrixWorld),Se.position.copy(Lr),ul.copy(Se.position),ul.add(l0[xe]),Se.up.copy(h0[xe]),Se.lookAt(ul),Se.updateMatrixWorld(),Xe.makeTranslation(-Lr.x,-Lr.y,-Lr.z),nd.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),V._frustum.setFromProjectionMatrix(nd,Se.coordinateSystem,Se.reversedDepth)}else V.updateMatrices(z);n=V.getFrustum(),M(C,_,V.camera,z,this.type)}V.isPointLightShadow!==!0&&this.type===ws&&x(V,_),V.needsUpdate=!1}p=this.type,m.needsUpdate=!1,s.setRenderTarget(w,L,R)};function x(A,C){let _=e.update(y);d.defines.VSM_SAMPLES!==A.blurSamples&&(d.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new Qt(i.x,i.y,{format:xi,type:Un})),d.uniforms.shadow_pass.value=A.map.depthTexture,d.uniforms.resolution.value=A.mapSize,d.uniforms.radius.value=A.radius,s.setRenderTarget(A.mapPass),s.clear(),s.renderBufferDirect(C,null,_,d,y,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radius,s.setRenderTarget(A.map),s.clear(),s.renderBufferDirect(C,null,_,f,y,null)}function S(A,C,_,w){let L=null,R=_.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(R!==void 0)L=R;else if(L=_.isPointLight===!0?c:o,s.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||C.alphaToCoverage===!0){let O=L.uuid,H=C.uuid,q=l[O];q===void 0&&(q={},l[O]=q);let N=q[H];N===void 0&&(N=L.clone(),q[H]=N,C.addEventListener("dispose",E)),L=N}if(L.visible=C.visible,L.wireframe=C.wireframe,w===ws?L.side=C.shadowSide!==null?C.shadowSide:C.side:L.side=C.shadowSide!==null?C.shadowSide:u[C.side],L.alphaMap=C.alphaMap,L.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,L.map=C.map,L.clipShadows=C.clipShadows,L.clippingPlanes=C.clippingPlanes,L.clipIntersection=C.clipIntersection,L.displacementMap=C.displacementMap,L.displacementScale=C.displacementScale,L.displacementBias=C.displacementBias,L.wireframeLinewidth=C.wireframeLinewidth,L.linewidth=C.linewidth,_.isPointLight===!0&&L.isMeshDistanceMaterial===!0){let O=s.properties.get(L);O.light=_}return L}function M(A,C,_,w,L){if(A.visible===!1)return;if(A.layers.test(C.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&L===ws)&&(!A.frustumCulled||n.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,A.matrixWorld);let H=e.update(A),q=A.material;if(Array.isArray(q)){let N=H.groups;for(let z=0,V=N.length;z<V;z++){let $=N[z],Q=q[$.materialIndex];if(Q&&Q.visible){let le=S(A,Q,w,L);A.onBeforeShadow(s,A,C,_,H,le,$),s.renderBufferDirect(_,null,H,le,A,$),A.onAfterShadow(s,A,C,_,H,le,$)}}}else if(q.visible){let N=S(A,q,w,L);A.onBeforeShadow(s,A,C,_,H,N,null),s.renderBufferDirect(_,null,H,N,A,null),A.onAfterShadow(s,A,C,_,H,N,null)}}let O=A.children;for(let H=0,q=O.length;H<q;H++)M(O[H],C,_,w,L)}function E(A){A.target.removeEventListener("dispose",E);for(let _ in l){let w=l[_],L=A.target.uuid;L in w&&(w[L].dispose(),delete w[L])}}}function d0(s,e){function t(){let P=!1,ne=new nt,X=null,pe=new nt(0,0,0,0);return{setMask:function(re){X!==re&&!P&&(s.colorMask(re,re,re,re),X=re)},setLocked:function(re){P=re},setClear:function(re,J,ye,Le,mt){mt===!0&&(re*=Le,J*=Le,ye*=Le),ne.set(re,J,ye,Le),pe.equals(ne)===!1&&(s.clearColor(re,J,ye,Le),pe.copy(ne))},reset:function(){P=!1,X=null,pe.set(-1,0,0,0)}}}function n(){let P=!1,ne=!1,X=null,pe=null,re=null;return{setReversed:function(J){if(ne!==J){let ye=e.get("EXT_clip_control");J?ye.clipControlEXT(ye.LOWER_LEFT_EXT,ye.ZERO_TO_ONE_EXT):ye.clipControlEXT(ye.LOWER_LEFT_EXT,ye.NEGATIVE_ONE_TO_ONE_EXT),ne=J;let Le=re;re=null,this.setClear(Le)}},getReversed:function(){return ne},setTest:function(J){J?ie(s.DEPTH_TEST):Ee(s.DEPTH_TEST)},setMask:function(J){X!==J&&!P&&(s.depthMask(J),X=J)},setFunc:function(J){if(ne&&(J=Pu[J]),pe!==J){switch(J){case fa:s.depthFunc(s.NEVER);break;case pa:s.depthFunc(s.ALWAYS);break;case ma:s.depthFunc(s.LESS);break;case Ii:s.depthFunc(s.LEQUAL);break;case ga:s.depthFunc(s.EQUAL);break;case ba:s.depthFunc(s.GEQUAL);break;case _a:s.depthFunc(s.GREATER);break;case xa:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}pe=J}},setLocked:function(J){P=J},setClear:function(J){re!==J&&(re=J,ne&&(J=1-J),s.clearDepth(J))},reset:function(){P=!1,X=null,pe=null,re=null,ne=!1}}}function i(){let P=!1,ne=null,X=null,pe=null,re=null,J=null,ye=null,Le=null,mt=null;return{setTest:function(Qe){P||(Qe?ie(s.STENCIL_TEST):Ee(s.STENCIL_TEST))},setMask:function(Qe){ne!==Qe&&!P&&(s.stencilMask(Qe),ne=Qe)},setFunc:function(Qe,zn,Sn){(X!==Qe||pe!==zn||re!==Sn)&&(s.stencilFunc(Qe,zn,Sn),X=Qe,pe=zn,re=Sn)},setOp:function(Qe,zn,Sn){(J!==Qe||ye!==zn||Le!==Sn)&&(s.stencilOp(Qe,zn,Sn),J=Qe,ye=zn,Le=Sn)},setLocked:function(Qe){P=Qe},setClear:function(Qe){mt!==Qe&&(s.clearStencil(Qe),mt=Qe)},reset:function(){P=!1,ne=null,X=null,pe=null,re=null,J=null,ye=null,Le=null,mt=null}}}let r=new t,a=new n,o=new i,c=new WeakMap,l=new WeakMap,h={},u={},d={},f=new WeakMap,g=[],y=null,m=!1,p=null,x=null,S=null,M=null,E=null,A=null,C=null,_=new Ae(0,0,0),w=0,L=!1,R=null,O=null,H=null,q=null,N=null,z=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS),V=!1,$=0,Q=s.getParameter(s.VERSION);Q.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(Q)[1]),V=$>=1):Q.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),V=$>=2);let le=null,xe={},Se=s.getParameter(s.SCISSOR_BOX),Xe=s.getParameter(s.VIEWPORT),Ze=new nt().fromArray(Se),Ne=new nt().fromArray(Xe);function Y(P,ne,X,pe){let re=new Uint8Array(4),J=s.createTexture();s.bindTexture(P,J),s.texParameteri(P,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(P,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let ye=0;ye<X;ye++)P===s.TEXTURE_3D||P===s.TEXTURE_2D_ARRAY?s.texImage3D(ne,0,s.RGBA,1,1,pe,0,s.RGBA,s.UNSIGNED_BYTE,re):s.texImage2D(ne+ye,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,re);return J}let de={};de[s.TEXTURE_2D]=Y(s.TEXTURE_2D,s.TEXTURE_2D,1),de[s.TEXTURE_CUBE_MAP]=Y(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),de[s.TEXTURE_2D_ARRAY]=Y(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),de[s.TEXTURE_3D]=Y(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ie(s.DEPTH_TEST),a.setFunc(Ii),At(!1),dt(Ic),ie(s.CULL_FACE),ht(Nn);function ie(P){h[P]!==!0&&(s.enable(P),h[P]=!0)}function Ee(P){h[P]!==!1&&(s.disable(P),h[P]=!1)}function De(P,ne){return d[P]!==ne?(s.bindFramebuffer(P,ne),d[P]=ne,P===s.DRAW_FRAMEBUFFER&&(d[s.FRAMEBUFFER]=ne),P===s.FRAMEBUFFER&&(d[s.DRAW_FRAMEBUFFER]=ne),!0):!1}function Ce(P,ne){let X=g,pe=!1;if(P){X=f.get(ne),X===void 0&&(X=[],f.set(ne,X));let re=P.textures;if(X.length!==re.length||X[0]!==s.COLOR_ATTACHMENT0){for(let J=0,ye=re.length;J<ye;J++)X[J]=s.COLOR_ATTACHMENT0+J;X.length=re.length,pe=!0}}else X[0]!==s.BACK&&(X[0]=s.BACK,pe=!0);pe&&s.drawBuffers(X)}function ut(P){return y!==P?(s.useProgram(P),y=P,!0):!1}let We={[hi]:s.FUNC_ADD,[Yh]:s.FUNC_SUBTRACT,[Jh]:s.FUNC_REVERSE_SUBTRACT};We[Zh]=s.MIN,We[$h]=s.MAX;let $e={[Qh]:s.ZERO,[eu]:s.ONE,[tu]:s.SRC_COLOR,[ua]:s.SRC_ALPHA,[ou]:s.SRC_ALPHA_SATURATE,[ru]:s.DST_COLOR,[iu]:s.DST_ALPHA,[nu]:s.ONE_MINUS_SRC_COLOR,[da]:s.ONE_MINUS_SRC_ALPHA,[au]:s.ONE_MINUS_DST_COLOR,[su]:s.ONE_MINUS_DST_ALPHA,[cu]:s.CONSTANT_COLOR,[lu]:s.ONE_MINUS_CONSTANT_COLOR,[hu]:s.CONSTANT_ALPHA,[uu]:s.ONE_MINUS_CONSTANT_ALPHA};function ht(P,ne,X,pe,re,J,ye,Le,mt,Qe){if(P===Nn){m===!0&&(Ee(s.BLEND),m=!1);return}if(m===!1&&(ie(s.BLEND),m=!0),P!==Kh){if(P!==p||Qe!==L){if((x!==hi||E!==hi)&&(s.blendEquation(s.FUNC_ADD),x=hi,E=hi),Qe)switch(P){case Pi:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Dc:s.blendFunc(s.ONE,s.ONE);break;case Lc:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case Fc:s.blendFuncSeparate(s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:we("WebGLState: Invalid blending: ",P);break}else switch(P){case Pi:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Dc:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case Lc:we("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fc:we("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:we("WebGLState: Invalid blending: ",P);break}S=null,M=null,A=null,C=null,_.set(0,0,0),w=0,p=P,L=Qe}return}re=re||ne,J=J||X,ye=ye||pe,(ne!==x||re!==E)&&(s.blendEquationSeparate(We[ne],We[re]),x=ne,E=re),(X!==S||pe!==M||J!==A||ye!==C)&&(s.blendFuncSeparate($e[X],$e[pe],$e[J],$e[ye]),S=X,M=pe,A=J,C=ye),(Le.equals(_)===!1||mt!==w)&&(s.blendColor(Le.r,Le.g,Le.b,mt),_.copy(Le),w=mt),p=P,L=!1}function He(P,ne){P.side===ln?Ee(s.CULL_FACE):ie(s.CULL_FACE);let X=P.side===Lt;ne&&(X=!X),At(X),P.blending===Pi&&P.transparent===!1?ht(Nn):ht(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),a.setFunc(P.depthFunc),a.setTest(P.depthTest),a.setMask(P.depthWrite),r.setMask(P.colorWrite);let pe=P.stencilWrite;o.setTest(pe),pe&&(o.setMask(P.stencilWriteMask),o.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),o.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),I(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?ie(s.SAMPLE_ALPHA_TO_COVERAGE):Ee(s.SAMPLE_ALPHA_TO_COVERAGE)}function At(P){R!==P&&(P?s.frontFace(s.CW):s.frontFace(s.CCW),R=P)}function dt(P){P!==Xh?(ie(s.CULL_FACE),P!==O&&(P===Ic?s.cullFace(s.BACK):P===jh?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):Ee(s.CULL_FACE),O=P}function Yt(P){P!==H&&(V&&s.lineWidth(P),H=P)}function I(P,ne,X){P?(ie(s.POLYGON_OFFSET_FILL),(q!==ne||N!==X)&&(q=ne,N=X,a.getReversed()&&(ne=-ne),s.polygonOffset(ne,X))):Ee(s.POLYGON_OFFSET_FILL)}function wt(P){P?ie(s.SCISSOR_TEST):Ee(s.SCISSOR_TEST)}function qe(P){P===void 0&&(P=s.TEXTURE0+z-1),le!==P&&(s.activeTexture(P),le=P)}function ot(P,ne,X){X===void 0&&(le===null?X=s.TEXTURE0+z-1:X=le);let pe=xe[X];pe===void 0&&(pe={type:void 0,texture:void 0},xe[X]=pe),(pe.type!==P||pe.texture!==ne)&&(le!==X&&(s.activeTexture(X),le=X),s.bindTexture(P,ne||de[P]),pe.type=P,pe.texture=ne)}function oe(){let P=xe[le];P!==void 0&&P.type!==void 0&&(s.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function ft(){try{s.compressedTexImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function T(){try{s.compressedTexImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function b(){try{s.texSubImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function U(){try{s.texSubImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function j(){try{s.compressedTexSubImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function Z(){try{s.compressedTexSubImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function ee(){try{s.texStorage2D(...arguments)}catch(P){we("WebGLState:",P)}}function ae(){try{s.texStorage3D(...arguments)}catch(P){we("WebGLState:",P)}}function W(){try{s.texImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function K(){try{s.texImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function fe(P){return u[P]!==void 0?u[P]:s.getParameter(P)}function ge(P,ne){u[P]!==ne&&(s.pixelStorei(P,ne),u[P]=ne)}function se(P){Ze.equals(P)===!1&&(s.scissor(P.x,P.y,P.z,P.w),Ze.copy(P))}function te(P){Ne.equals(P)===!1&&(s.viewport(P.x,P.y,P.z,P.w),Ne.copy(P))}function Pe(P,ne){let X=l.get(ne);X===void 0&&(X=new WeakMap,l.set(ne,X));let pe=X.get(P);pe===void 0&&(pe=s.getUniformBlockIndex(ne,P.name),X.set(P,pe))}function Ue(P,ne){let pe=l.get(ne).get(P);c.get(ne)!==pe&&(s.uniformBlockBinding(ne,pe,P.__bindingPointIndex),c.set(ne,pe))}function Ke(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),a.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),s.pixelStorei(s.PACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.BROWSER_DEFAULT_WEBGL),s.pixelStorei(s.PACK_ROW_LENGTH,0),s.pixelStorei(s.PACK_SKIP_PIXELS,0),s.pixelStorei(s.PACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_ROW_LENGTH,0),s.pixelStorei(s.UNPACK_IMAGE_HEIGHT,0),s.pixelStorei(s.UNPACK_SKIP_PIXELS,0),s.pixelStorei(s.UNPACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_SKIP_IMAGES,0),h={},u={},le=null,xe={},d={},f=new WeakMap,g=[],y=null,m=!1,p=null,x=null,S=null,M=null,E=null,A=null,C=null,_=new Ae(0,0,0),w=0,L=!1,R=null,O=null,H=null,q=null,N=null,Ze.set(0,0,s.canvas.width,s.canvas.height),Ne.set(0,0,s.canvas.width,s.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:ie,disable:Ee,bindFramebuffer:De,drawBuffers:Ce,useProgram:ut,setBlending:ht,setMaterial:He,setFlipSided:At,setCullFace:dt,setLineWidth:Yt,setPolygonOffset:I,setScissorTest:wt,activeTexture:qe,bindTexture:ot,unbindTexture:oe,compressedTexImage2D:ft,compressedTexImage3D:T,texImage2D:W,texImage3D:K,pixelStorei:ge,getParameter:fe,updateUBOMapping:Pe,uniformBlockBinding:Ue,texStorage2D:ee,texStorage3D:ae,texSubImage2D:b,texSubImage3D:U,compressedTexSubImage2D:j,compressedTexSubImage3D:Z,scissor:se,viewport:te,reset:Ke}}function f0(s,e,t,n,i,r,a){let o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Re,h=new WeakMap,u=new Set,d,f=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(T,b){return g?new OffscreenCanvas(T,b):fs("canvas")}function m(T,b,U){let j=1,Z=ft(T);if((Z.width>U||Z.height>U)&&(j=U/Math.max(Z.width,Z.height)),j<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){let ee=Math.floor(j*Z.width),ae=Math.floor(j*Z.height);d===void 0&&(d=y(ee,ae));let W=b?y(ee,ae):d;return W.width=ee,W.height=ae,W.getContext("2d").drawImage(T,0,0,ee,ae),_e("WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+ee+"x"+ae+")."),W}else return"data"in T&&_e("WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),T;return T}function p(T){return T.generateMipmaps}function x(T){s.generateMipmap(T)}function S(T){return T.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?s.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function M(T,b,U,j,Z,ee=!1){if(T!==null){if(s[T]!==void 0)return s[T];_e("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let ae;j&&(ae=e.get("EXT_texture_norm16"),ae||_e("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let W=b;if(b===s.RED&&(U===s.FLOAT&&(W=s.R32F),U===s.HALF_FLOAT&&(W=s.R16F),U===s.UNSIGNED_BYTE&&(W=s.R8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.R16_EXT),U===s.SHORT&&ae&&(W=ae.R16_SNORM_EXT)),b===s.RED_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.R8UI),U===s.UNSIGNED_SHORT&&(W=s.R16UI),U===s.UNSIGNED_INT&&(W=s.R32UI),U===s.BYTE&&(W=s.R8I),U===s.SHORT&&(W=s.R16I),U===s.INT&&(W=s.R32I)),b===s.RG&&(U===s.FLOAT&&(W=s.RG32F),U===s.HALF_FLOAT&&(W=s.RG16F),U===s.UNSIGNED_BYTE&&(W=s.RG8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.RG16_EXT),U===s.SHORT&&ae&&(W=ae.RG16_SNORM_EXT)),b===s.RG_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RG8UI),U===s.UNSIGNED_SHORT&&(W=s.RG16UI),U===s.UNSIGNED_INT&&(W=s.RG32UI),U===s.BYTE&&(W=s.RG8I),U===s.SHORT&&(W=s.RG16I),U===s.INT&&(W=s.RG32I)),b===s.RGB_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RGB8UI),U===s.UNSIGNED_SHORT&&(W=s.RGB16UI),U===s.UNSIGNED_INT&&(W=s.RGB32UI),U===s.BYTE&&(W=s.RGB8I),U===s.SHORT&&(W=s.RGB16I),U===s.INT&&(W=s.RGB32I)),b===s.RGBA_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RGBA8UI),U===s.UNSIGNED_SHORT&&(W=s.RGBA16UI),U===s.UNSIGNED_INT&&(W=s.RGBA32UI),U===s.BYTE&&(W=s.RGBA8I),U===s.SHORT&&(W=s.RGBA16I),U===s.INT&&(W=s.RGBA32I)),b===s.RGB&&(U===s.UNSIGNED_SHORT&&ae&&(W=ae.RGB16_EXT),U===s.SHORT&&ae&&(W=ae.RGB16_SNORM_EXT),U===s.UNSIGNED_INT_5_9_9_9_REV&&(W=s.RGB9_E5),U===s.UNSIGNED_INT_10F_11F_11F_REV&&(W=s.R11F_G11F_B10F)),b===s.RGBA){let K=ee?Ks:ze.getTransfer(Z);U===s.FLOAT&&(W=s.RGBA32F),U===s.HALF_FLOAT&&(W=s.RGBA16F),U===s.UNSIGNED_BYTE&&(W=K===Ye?s.SRGB8_ALPHA8:s.RGBA8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.RGBA16_EXT),U===s.SHORT&&ae&&(W=ae.RGBA16_SNORM_EXT),U===s.UNSIGNED_SHORT_4_4_4_4&&(W=s.RGBA4),U===s.UNSIGNED_SHORT_5_5_5_1&&(W=s.RGB5_A1)}return(W===s.R16F||W===s.R32F||W===s.RG16F||W===s.RG32F||W===s.RGBA16F||W===s.RGBA32F)&&e.get("EXT_color_buffer_float"),W}function E(T,b){let U;return T?b===null||b===Mn||b===Cs?U=s.DEPTH24_STENCIL8:b===tn?U=s.DEPTH32F_STENCIL8:b===Rs&&(U=s.DEPTH24_STENCIL8,_e("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===Mn||b===Cs?U=s.DEPTH_COMPONENT24:b===tn?U=s.DEPTH_COMPONENT32F:b===Rs&&(U=s.DEPTH_COMPONENT16),U}function A(T,b){return p(T)===!0||T.isFramebufferTexture&&T.minFilter!==xt&&T.minFilter!==vt?Math.log2(Math.max(b.width,b.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?b.mipmaps.length:1}function C(T){let b=T.target;b.removeEventListener("dispose",C),w(b),b.isVideoTexture&&h.delete(b),b.isHTMLTexture&&u.delete(b)}function _(T){let b=T.target;b.removeEventListener("dispose",_),R(b)}function w(T){let b=n.get(T);if(b.__webglInit===void 0)return;let U=T.source,j=f.get(U);if(j){let Z=j[b.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&L(T),Object.keys(j).length===0&&f.delete(U)}n.remove(T)}function L(T){let b=n.get(T);s.deleteTexture(b.__webglTexture);let U=T.source,j=f.get(U);delete j[b.__cacheKey],a.memory.textures--}function R(T){let b=n.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),n.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let j=0;j<6;j++){if(Array.isArray(b.__webglFramebuffer[j]))for(let Z=0;Z<b.__webglFramebuffer[j].length;Z++)s.deleteFramebuffer(b.__webglFramebuffer[j][Z]);else s.deleteFramebuffer(b.__webglFramebuffer[j]);b.__webglDepthbuffer&&s.deleteRenderbuffer(b.__webglDepthbuffer[j])}else{if(Array.isArray(b.__webglFramebuffer))for(let j=0;j<b.__webglFramebuffer.length;j++)s.deleteFramebuffer(b.__webglFramebuffer[j]);else s.deleteFramebuffer(b.__webglFramebuffer);if(b.__webglDepthbuffer&&s.deleteRenderbuffer(b.__webglDepthbuffer),b.__webglMultisampledFramebuffer&&s.deleteFramebuffer(b.__webglMultisampledFramebuffer),b.__webglColorRenderbuffer)for(let j=0;j<b.__webglColorRenderbuffer.length;j++)b.__webglColorRenderbuffer[j]&&s.deleteRenderbuffer(b.__webglColorRenderbuffer[j]);b.__webglDepthRenderbuffer&&s.deleteRenderbuffer(b.__webglDepthRenderbuffer)}let U=T.textures;for(let j=0,Z=U.length;j<Z;j++){let ee=n.get(U[j]);ee.__webglTexture&&(s.deleteTexture(ee.__webglTexture),a.memory.textures--),n.remove(U[j])}n.remove(T)}let O=0;function H(){O=0}function q(){return O}function N(T){O=T}function z(){let T=O;return T>=i.maxTextures&&_e("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+i.maxTextures),O+=1,T}function V(T){let b=[];return b.push(T.wrapS),b.push(T.wrapT),b.push(T.wrapR||0),b.push(T.magFilter),b.push(T.minFilter),b.push(T.anisotropy),b.push(T.internalFormat),b.push(T.format),b.push(T.type),b.push(T.generateMipmaps),b.push(T.premultiplyAlpha),b.push(T.flipY),b.push(T.unpackAlignment),b.push(T.colorSpace),b.join()}function $(T,b){let U=n.get(T);if(T.isVideoTexture&&ot(T),T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&U.__version!==T.version){let j=T.image;if(j===null)_e("WebGLRenderer: Texture marked for update but no image data found.");else if(j.complete===!1)_e("WebGLRenderer: Texture marked for update but image is incomplete");else{Ee(U,T,b);return}}else T.isExternalTexture&&(U.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,U.__webglTexture,s.TEXTURE0+b)}function Q(T,b){let U=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&U.__version!==T.version){Ee(U,T,b);return}else T.isExternalTexture&&(U.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(s.TEXTURE_2D_ARRAY,U.__webglTexture,s.TEXTURE0+b)}function le(T,b){let U=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&U.__version!==T.version){Ee(U,T,b);return}t.bindTexture(s.TEXTURE_3D,U.__webglTexture,s.TEXTURE0+b)}function xe(T,b){let U=n.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&U.__version!==T.version){De(U,T,b);return}t.bindTexture(s.TEXTURE_CUBE_MAP,U.__webglTexture,s.TEXTURE0+b)}let Se={[ui]:s.REPEAT,[on]:s.CLAMP_TO_EDGE,[us]:s.MIRRORED_REPEAT},Xe={[xt]:s.NEAREST,[Xa]:s.NEAREST_MIPMAP_NEAREST,[Wi]:s.NEAREST_MIPMAP_LINEAR,[vt]:s.LINEAR,[Es]:s.LINEAR_MIPMAP_NEAREST,[yn]:s.LINEAR_MIPMAP_LINEAR},Ze={[yu]:s.NEVER,[wu]:s.ALWAYS,[Mu]:s.LESS,[Do]:s.LEQUAL,[Su]:s.EQUAL,[Lo]:s.GEQUAL,[Tu]:s.GREATER,[Au]:s.NOTEQUAL};function Ne(T,b){if(b.type===tn&&e.has("OES_texture_float_linear")===!1&&(b.magFilter===vt||b.magFilter===Es||b.magFilter===Wi||b.magFilter===yn||b.minFilter===vt||b.minFilter===Es||b.minFilter===Wi||b.minFilter===yn)&&_e("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(T,s.TEXTURE_WRAP_S,Se[b.wrapS]),s.texParameteri(T,s.TEXTURE_WRAP_T,Se[b.wrapT]),(T===s.TEXTURE_3D||T===s.TEXTURE_2D_ARRAY)&&s.texParameteri(T,s.TEXTURE_WRAP_R,Se[b.wrapR]),s.texParameteri(T,s.TEXTURE_MAG_FILTER,Xe[b.magFilter]),s.texParameteri(T,s.TEXTURE_MIN_FILTER,Xe[b.minFilter]),b.compareFunction&&(s.texParameteri(T,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(T,s.TEXTURE_COMPARE_FUNC,Ze[b.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===xt||b.minFilter!==Wi&&b.minFilter!==yn||b.type===tn&&e.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||n.get(b).__currentAnisotropy){let U=e.get("EXT_texture_filter_anisotropic");s.texParameterf(T,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,i.getMaxAnisotropy())),n.get(b).__currentAnisotropy=b.anisotropy}}}function Y(T,b){let U=!1;T.__webglInit===void 0&&(T.__webglInit=!0,b.addEventListener("dispose",C));let j=b.source,Z=f.get(j);Z===void 0&&(Z={},f.set(j,Z));let ee=V(b);if(ee!==T.__cacheKey){Z[ee]===void 0&&(Z[ee]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,U=!0),Z[ee].usedTimes++;let ae=Z[T.__cacheKey];ae!==void 0&&(Z[T.__cacheKey].usedTimes--,ae.usedTimes===0&&L(b)),T.__cacheKey=ee,T.__webglTexture=Z[ee].texture}return U}function de(T,b,U){return Math.floor(Math.floor(T/U)/b)}function ie(T,b,U,j){let ee=T.updateRanges;if(ee.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,b.width,b.height,U,j,b.data);else{ee.sort((ge,se)=>ge.start-se.start);let ae=0;for(let ge=1;ge<ee.length;ge++){let se=ee[ae],te=ee[ge],Pe=se.start+se.count,Ue=de(te.start,b.width,4),Ke=de(se.start,b.width,4);te.start<=Pe+1&&Ue===Ke&&de(te.start+te.count-1,b.width,4)===Ue?se.count=Math.max(se.count,te.start+te.count-se.start):(++ae,ee[ae]=te)}ee.length=ae+1;let W=t.getParameter(s.UNPACK_ROW_LENGTH),K=t.getParameter(s.UNPACK_SKIP_PIXELS),fe=t.getParameter(s.UNPACK_SKIP_ROWS);t.pixelStorei(s.UNPACK_ROW_LENGTH,b.width);for(let ge=0,se=ee.length;ge<se;ge++){let te=ee[ge],Pe=Math.floor(te.start/4),Ue=Math.ceil(te.count/4),Ke=Pe%b.width,P=Math.floor(Pe/b.width),ne=Ue,X=1;t.pixelStorei(s.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(s.UNPACK_SKIP_ROWS,P),t.texSubImage2D(s.TEXTURE_2D,0,Ke,P,ne,X,U,j,b.data)}T.clearUpdateRanges(),t.pixelStorei(s.UNPACK_ROW_LENGTH,W),t.pixelStorei(s.UNPACK_SKIP_PIXELS,K),t.pixelStorei(s.UNPACK_SKIP_ROWS,fe)}}function Ee(T,b,U){let j=s.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&(j=s.TEXTURE_2D_ARRAY),b.isData3DTexture&&(j=s.TEXTURE_3D);let Z=Y(T,b),ee=b.source;t.bindTexture(j,T.__webglTexture,s.TEXTURE0+U);let ae=n.get(ee);if(ee.version!==ae.__version||Z===!0){if(t.activeTexture(s.TEXTURE0+U),(typeof ImageBitmap<"u"&&b.image instanceof ImageBitmap)===!1){let X=ze.getPrimaries(ze.workingColorSpace),pe=b.colorSpace===Qn?null:ze.getPrimaries(b.colorSpace),re=b.colorSpace===Qn||X===pe?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,re)}t.pixelStorei(s.UNPACK_ALIGNMENT,b.unpackAlignment);let K=m(b.image,!1,i.maxTextureSize);K=oe(b,K);let fe=r.convert(b.format,b.colorSpace),ge=r.convert(b.type),se=M(b.internalFormat,fe,ge,b.normalized,b.colorSpace,b.isVideoTexture);Ne(j,b);let te,Pe=b.mipmaps,Ue=b.isVideoTexture!==!0,Ke=ae.__version===void 0||Z===!0,P=ee.dataReady,ne=A(b,K);if(b.isDepthTexture)se=E(b.format===_i,b.type),Ke&&(Ue?t.texStorage2D(s.TEXTURE_2D,1,se,K.width,K.height):t.texImage2D(s.TEXTURE_2D,0,se,K.width,K.height,0,fe,ge,null));else if(b.isDataTexture)if(Pe.length>0){Ue&&Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,Pe[0].width,Pe[0].height);for(let X=0,pe=Pe.length;X<pe;X++)te=Pe[X],Ue?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,ge,te.data):t.texImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,fe,ge,te.data);b.generateMipmaps=!1}else Ue?(Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,K.width,K.height),P&&ie(b,K,fe,ge)):t.texImage2D(s.TEXTURE_2D,0,se,K.width,K.height,0,fe,ge,K.data);else if(b.isCompressedTexture)if(b.isCompressedArrayTexture){Ue&&Ke&&t.texStorage3D(s.TEXTURE_2D_ARRAY,ne,se,Pe[0].width,Pe[0].height,K.depth);for(let X=0,pe=Pe.length;X<pe;X++)if(te=Pe[X],b.format!==nn)if(fe!==null)if(Ue){if(P)if(b.layerUpdates.size>0){let re=el(te.width,te.height,b.format,b.type);for(let J of b.layerUpdates){let ye=te.data.subarray(J*re/te.data.BYTES_PER_ELEMENT,(J+1)*re/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,J,te.width,te.height,1,fe,ye)}b.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,0,te.width,te.height,K.depth,fe,te.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,X,se,te.width,te.height,K.depth,0,te.data,0,0);else _e("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ue?P&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,0,te.width,te.height,K.depth,fe,ge,te.data):t.texImage3D(s.TEXTURE_2D_ARRAY,X,se,te.width,te.height,K.depth,0,fe,ge,te.data)}else{Ue&&Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,Pe[0].width,Pe[0].height);for(let X=0,pe=Pe.length;X<pe;X++)te=Pe[X],b.format!==nn?fe!==null?Ue?P&&t.compressedTexSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,te.data):t.compressedTexImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,te.data):_e("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ue?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,ge,te.data):t.texImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,fe,ge,te.data)}else if(b.isDataArrayTexture)if(Ue){if(Ke&&t.texStorage3D(s.TEXTURE_2D_ARRAY,ne,se,K.width,K.height,K.depth),P)if(b.layerUpdates.size>0){let X=el(K.width,K.height,b.format,b.type);for(let pe of b.layerUpdates){let re=K.data.subarray(pe*X/K.data.BYTES_PER_ELEMENT,(pe+1)*X/K.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,pe,K.width,K.height,1,fe,ge,re)}b.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,K.width,K.height,K.depth,fe,ge,K.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,se,K.width,K.height,K.depth,0,fe,ge,K.data);else if(b.isData3DTexture)Ue?(Ke&&t.texStorage3D(s.TEXTURE_3D,ne,se,K.width,K.height,K.depth),P&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,K.width,K.height,K.depth,fe,ge,K.data)):t.texImage3D(s.TEXTURE_3D,0,se,K.width,K.height,K.depth,0,fe,ge,K.data);else if(b.isFramebufferTexture){if(Ke)if(Ue)t.texStorage2D(s.TEXTURE_2D,ne,se,K.width,K.height);else{let X=K.width,pe=K.height;for(let re=0;re<ne;re++)t.texImage2D(s.TEXTURE_2D,re,se,X,pe,0,fe,ge,null),X>>=1,pe>>=1}}else if(b.isHTMLTexture){if("texElementImage2D"in s){let X=s.canvas;if(X.hasAttribute("layoutsubtree")||X.setAttribute("layoutsubtree","true"),K.parentNode!==X){X.appendChild(K),u.add(b),X.onpaint=Le=>{let mt=Le.changedElements;for(let Qe of u)mt.includes(Qe.image)&&(Qe.needsUpdate=!0)},X.requestPaint();return}let pe=0,re=s.RGBA,J=s.RGBA,ye=s.UNSIGNED_BYTE;s.texElementImage2D(s.TEXTURE_2D,pe,re,J,ye,K),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE)}}else if(Pe.length>0){if(Ue&&Ke){let X=ft(Pe[0]);t.texStorage2D(s.TEXTURE_2D,ne,se,X.width,X.height)}for(let X=0,pe=Pe.length;X<pe;X++)te=Pe[X],Ue?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,fe,ge,te):t.texImage2D(s.TEXTURE_2D,X,se,fe,ge,te);b.generateMipmaps=!1}else if(Ue){if(Ke){let X=ft(K);t.texStorage2D(s.TEXTURE_2D,ne,se,X.width,X.height)}P&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,fe,ge,K)}else t.texImage2D(s.TEXTURE_2D,0,se,fe,ge,K);p(b)&&x(j),ae.__version=ee.version,b.onUpdate&&b.onUpdate(b)}T.__version=b.version}function De(T,b,U){if(b.image.length!==6)return;let j=Y(T,b),Z=b.source;t.bindTexture(s.TEXTURE_CUBE_MAP,T.__webglTexture,s.TEXTURE0+U);let ee=n.get(Z);if(Z.version!==ee.__version||j===!0){t.activeTexture(s.TEXTURE0+U);let ae=ze.getPrimaries(ze.workingColorSpace),W=b.colorSpace===Qn?null:ze.getPrimaries(b.colorSpace),K=b.colorSpace===Qn||ae===W?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(s.UNPACK_ALIGNMENT,b.unpackAlignment),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,K);let fe=b.isCompressedTexture||b.image[0].isCompressedTexture,ge=b.image[0]&&b.image[0].isDataTexture,se=[];for(let J=0;J<6;J++)!fe&&!ge?se[J]=m(b.image[J],!0,i.maxCubemapSize):se[J]=ge?b.image[J].image:b.image[J],se[J]=oe(b,se[J]);let te=se[0],Pe=r.convert(b.format,b.colorSpace),Ue=r.convert(b.type),Ke=M(b.internalFormat,Pe,Ue,b.normalized,b.colorSpace),P=b.isVideoTexture!==!0,ne=ee.__version===void 0||j===!0,X=Z.dataReady,pe=A(b,te);Ne(s.TEXTURE_CUBE_MAP,b);let re;if(fe){P&&ne&&t.texStorage2D(s.TEXTURE_CUBE_MAP,pe,Ke,te.width,te.height);for(let J=0;J<6;J++){re=se[J].mipmaps;for(let ye=0;ye<re.length;ye++){let Le=re[ye];b.format!==nn?Pe!==null?P?X&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye,0,0,Le.width,Le.height,Pe,Le.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye,Ke,Le.width,Le.height,0,Le.data):_e("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye,0,0,Le.width,Le.height,Pe,Ue,Le.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye,Ke,Le.width,Le.height,0,Pe,Ue,Le.data)}}}else{if(re=b.mipmaps,P&&ne){re.length>0&&pe++;let J=ft(se[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,pe,Ke,J.width,J.height)}for(let J=0;J<6;J++)if(ge){P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,se[J].width,se[J].height,Pe,Ue,se[J].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Ke,se[J].width,se[J].height,0,Pe,Ue,se[J].data);for(let ye=0;ye<re.length;ye++){let mt=re[ye].image[J].image;P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye+1,0,0,mt.width,mt.height,Pe,Ue,mt.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye+1,Ke,mt.width,mt.height,0,Pe,Ue,mt.data)}}else{P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,Pe,Ue,se[J]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Ke,Pe,Ue,se[J]);for(let ye=0;ye<re.length;ye++){let Le=re[ye];P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye+1,0,0,Pe,Ue,Le.image[J]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye+1,Ke,Pe,Ue,Le.image[J])}}}p(b)&&x(s.TEXTURE_CUBE_MAP),ee.__version=Z.version,b.onUpdate&&b.onUpdate(b)}T.__version=b.version}function Ce(T,b,U,j,Z,ee){let ae=r.convert(U.format,U.colorSpace),W=r.convert(U.type),K=M(U.internalFormat,ae,W,U.normalized,U.colorSpace),fe=n.get(b),ge=n.get(U);if(ge.__renderTarget=b,!fe.__hasExternalTextures){let se=Math.max(1,b.width>>ee),te=Math.max(1,b.height>>ee);Z===s.TEXTURE_3D||Z===s.TEXTURE_2D_ARRAY?t.texImage3D(Z,ee,K,se,te,b.depth,0,ae,W,null):t.texImage2D(Z,ee,K,se,te,0,ae,W,null)}t.bindFramebuffer(s.FRAMEBUFFER,T),qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,j,Z,ge.__webglTexture,0,wt(b)):(Z===s.TEXTURE_2D||Z>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,j,Z,ge.__webglTexture,ee),t.bindFramebuffer(s.FRAMEBUFFER,null)}function ut(T,b,U){if(s.bindRenderbuffer(s.RENDERBUFFER,T),b.depthBuffer){let j=b.depthTexture,Z=j&&j.isDepthTexture?j.type:null,ee=E(b.stencilBuffer,Z),ae=b.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;qe(b)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,wt(b),ee,b.width,b.height):U?s.renderbufferStorageMultisample(s.RENDERBUFFER,wt(b),ee,b.width,b.height):s.renderbufferStorage(s.RENDERBUFFER,ee,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,ae,s.RENDERBUFFER,T)}else{let j=b.textures;for(let Z=0;Z<j.length;Z++){let ee=j[Z],ae=r.convert(ee.format,ee.colorSpace),W=r.convert(ee.type),K=M(ee.internalFormat,ae,W,ee.normalized,ee.colorSpace);qe(b)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,wt(b),K,b.width,b.height):U?s.renderbufferStorageMultisample(s.RENDERBUFFER,wt(b),K,b.width,b.height):s.renderbufferStorage(s.RENDERBUFFER,K,b.width,b.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function We(T,b,U){let j=b.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(s.FRAMEBUFFER,T),!(b.depthTexture&&b.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let Z=n.get(b.depthTexture);if(Z.__renderTarget=b,(!Z.__webglTexture||b.depthTexture.image.width!==b.width||b.depthTexture.image.height!==b.height)&&(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),j){if(Z.__webglInit===void 0&&(Z.__webglInit=!0,b.depthTexture.addEventListener("dispose",C)),Z.__webglTexture===void 0){Z.__webglTexture=s.createTexture(),t.bindTexture(s.TEXTURE_CUBE_MAP,Z.__webglTexture),Ne(s.TEXTURE_CUBE_MAP,b.depthTexture);let fe=r.convert(b.depthTexture.format),ge=r.convert(b.depthTexture.type),se;b.depthTexture.format===En?se=s.DEPTH_COMPONENT24:b.depthTexture.format===_i&&(se=s.DEPTH24_STENCIL8);for(let te=0;te<6;te++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,se,b.width,b.height,0,fe,ge,null)}}else $(b.depthTexture,0);let ee=Z.__webglTexture,ae=wt(b),W=j?s.TEXTURE_CUBE_MAP_POSITIVE_X+U:s.TEXTURE_2D,K=b.depthTexture.format===_i?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;if(b.depthTexture.format===En)qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,K,W,ee,0,ae):s.framebufferTexture2D(s.FRAMEBUFFER,K,W,ee,0);else if(b.depthTexture.format===_i)qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,K,W,ee,0,ae):s.framebufferTexture2D(s.FRAMEBUFFER,K,W,ee,0);else throw new Error("Unknown depthTexture format")}function $e(T){let b=n.get(T),U=T.isWebGLCubeRenderTarget===!0;if(b.__boundDepthTexture!==T.depthTexture){let j=T.depthTexture;if(b.__depthDisposeCallback&&b.__depthDisposeCallback(),j){let Z=()=>{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,j.removeEventListener("dispose",Z)};j.addEventListener("dispose",Z),b.__depthDisposeCallback=Z}b.__boundDepthTexture=j}if(T.depthTexture&&!b.__autoAllocateDepthBuffer)if(U)for(let j=0;j<6;j++)We(b.__webglFramebuffer[j],T,j);else{let j=T.texture.mipmaps;j&&j.length>0?We(b.__webglFramebuffer[0],T,0):We(b.__webglFramebuffer,T,0)}else if(U){b.__webglDepthbuffer=[];for(let j=0;j<6;j++)if(t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer[j]),b.__webglDepthbuffer[j]===void 0)b.__webglDepthbuffer[j]=s.createRenderbuffer(),ut(b.__webglDepthbuffer[j],T,!1);else{let Z=T.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ee=b.__webglDepthbuffer[j];s.bindRenderbuffer(s.RENDERBUFFER,ee),s.framebufferRenderbuffer(s.FRAMEBUFFER,Z,s.RENDERBUFFER,ee)}}else{let j=T.texture.mipmaps;if(j&&j.length>0?t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=s.createRenderbuffer(),ut(b.__webglDepthbuffer,T,!1);else{let Z=T.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ee=b.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,ee),s.framebufferRenderbuffer(s.FRAMEBUFFER,Z,s.RENDERBUFFER,ee)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function ht(T,b,U){let j=n.get(T);b!==void 0&&Ce(j.__webglFramebuffer,T,T.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),U!==void 0&&$e(T)}function He(T){let b=T.texture,U=n.get(T),j=n.get(b);T.addEventListener("dispose",_);let Z=T.textures,ee=T.isWebGLCubeRenderTarget===!0,ae=Z.length>1;if(ae||(j.__webglTexture===void 0&&(j.__webglTexture=s.createTexture()),j.__version=b.version,a.memory.textures++),ee){U.__webglFramebuffer=[];for(let W=0;W<6;W++)if(b.mipmaps&&b.mipmaps.length>0){U.__webglFramebuffer[W]=[];for(let K=0;K<b.mipmaps.length;K++)U.__webglFramebuffer[W][K]=s.createFramebuffer()}else U.__webglFramebuffer[W]=s.createFramebuffer()}else{if(b.mipmaps&&b.mipmaps.length>0){U.__webglFramebuffer=[];for(let W=0;W<b.mipmaps.length;W++)U.__webglFramebuffer[W]=s.createFramebuffer()}else U.__webglFramebuffer=s.createFramebuffer();if(ae)for(let W=0,K=Z.length;W<K;W++){let fe=n.get(Z[W]);fe.__webglTexture===void 0&&(fe.__webglTexture=s.createTexture(),a.memory.textures++)}if(T.samples>0&&qe(T)===!1){U.__webglMultisampledFramebuffer=s.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let W=0;W<Z.length;W++){let K=Z[W];U.__webglColorRenderbuffer[W]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,U.__webglColorRenderbuffer[W]);let fe=r.convert(K.format,K.colorSpace),ge=r.convert(K.type),se=M(K.internalFormat,fe,ge,K.normalized,K.colorSpace,T.isXRRenderTarget===!0),te=wt(T);s.renderbufferStorageMultisample(s.RENDERBUFFER,te,se,T.width,T.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+W,s.RENDERBUFFER,U.__webglColorRenderbuffer[W])}s.bindRenderbuffer(s.RENDERBUFFER,null),T.depthBuffer&&(U.__webglDepthRenderbuffer=s.createRenderbuffer(),ut(U.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(ee){t.bindTexture(s.TEXTURE_CUBE_MAP,j.__webglTexture),Ne(s.TEXTURE_CUBE_MAP,b);for(let W=0;W<6;W++)if(b.mipmaps&&b.mipmaps.length>0)for(let K=0;K<b.mipmaps.length;K++)Ce(U.__webglFramebuffer[W][K],T,b,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+W,K);else Ce(U.__webglFramebuffer[W],T,b,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+W,0);p(b)&&x(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ae){for(let W=0,K=Z.length;W<K;W++){let fe=Z[W],ge=n.get(fe),se=s.TEXTURE_2D;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(se=T.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(se,ge.__webglTexture),Ne(se,fe),Ce(U.__webglFramebuffer,T,fe,s.COLOR_ATTACHMENT0+W,se,0),p(fe)&&x(se)}t.unbindTexture()}else{let W=s.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(W=T.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(W,j.__webglTexture),Ne(W,b),b.mipmaps&&b.mipmaps.length>0)for(let K=0;K<b.mipmaps.length;K++)Ce(U.__webglFramebuffer[K],T,b,s.COLOR_ATTACHMENT0,W,K);else Ce(U.__webglFramebuffer,T,b,s.COLOR_ATTACHMENT0,W,0);p(b)&&x(W),t.unbindTexture()}T.depthBuffer&&$e(T)}function At(T){let b=T.textures;for(let U=0,j=b.length;U<j;U++){let Z=b[U];if(p(Z)){let ee=S(T),ae=n.get(Z).__webglTexture;t.bindTexture(ee,ae),x(ee),t.unbindTexture()}}}let dt=[],Yt=[];function I(T){if(T.samples>0){if(qe(T)===!1){let b=T.textures,U=T.width,j=T.height,Z=s.COLOR_BUFFER_BIT,ee=T.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ae=n.get(T),W=b.length>1;if(W)for(let fe=0;fe<b.length;fe++)t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,ae.__webglMultisampledFramebuffer);let K=T.texture.mipmaps;K&&K.length>0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglFramebuffer);for(let fe=0;fe<b.length;fe++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(Z|=s.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(Z|=s.STENCIL_BUFFER_BIT)),W){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,ae.__webglColorRenderbuffer[fe]);let ge=n.get(b[fe]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,ge,0)}s.blitFramebuffer(0,0,U,j,0,0,U,j,Z,s.NEAREST),c===!0&&(dt.length=0,Yt.length=0,dt.push(s.COLOR_ATTACHMENT0+fe),T.depthBuffer&&T.resolveDepthBuffer===!1&&(dt.push(ee),Yt.push(ee),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,Yt)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,dt))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),W)for(let fe=0;fe<b.length;fe++){t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.RENDERBUFFER,ae.__webglColorRenderbuffer[fe]);let ge=n.get(b[fe]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.TEXTURE_2D,ge,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&c){let b=T.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[b])}}}function wt(T){return Math.min(i.maxSamples,T.samples)}function qe(T){let b=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function ot(T){let b=a.render.frame;h.get(T)!==b&&(h.set(T,b),T.update())}function oe(T,b){let U=T.colorSpace,j=T.format,Z=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||U!==Gt&&U!==Qn&&(ze.getTransfer(U)===Ye?(j!==nn||Z!==jt)&&_e("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):we("WebGLTextures: Unsupported texture color space:",U)),b}function ft(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(l.width=T.naturalWidth||T.width,l.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(l.width=T.displayWidth,l.height=T.displayHeight):(l.width=T.width,l.height=T.height),l}this.allocateTextureUnit=z,this.resetTextureUnits=H,this.getTextureUnits=q,this.setTextureUnits=N,this.setTexture2D=$,this.setTexture2DArray=Q,this.setTexture3D=le,this.setTextureCube=xe,this.rebindTextures=ht,this.setupRenderTarget=He,this.updateRenderTargetMipmap=At,this.updateMultisampleRenderTarget=I,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function p0(s,e){function t(n,i=Qn){let r,a=ze.getTransfer(i);if(n===jt)return s.UNSIGNED_BYTE;if(n===Ka)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Ya)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Wc)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===qc)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vc)return s.BYTE;if(n===Hc)return s.SHORT;if(n===Rs)return s.UNSIGNED_SHORT;if(n===ja)return s.INT;if(n===Mn)return s.UNSIGNED_INT;if(n===tn)return s.FLOAT;if(n===Un)return s.HALF_FLOAT;if(n===Xc)return s.ALPHA;if(n===jc)return s.RGB;if(n===nn)return s.RGBA;if(n===En)return s.DEPTH_COMPONENT;if(n===_i)return s.DEPTH_STENCIL;if(n===Ja)return s.RED;if(n===Za)return s.RED_INTEGER;if(n===xi)return s.RG;if(n===$a)return s.RG_INTEGER;if(n===Qa)return s.RGBA_INTEGER;if(n===Sr||n===Tr||n===Ar||n===wr)if(a===Ye)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Sr)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Tr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ar)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===wr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Sr)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Tr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ar)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===wr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===eo||n===to||n===no||n===io)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===eo)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===to)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===no)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===io)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===so||n===ro||n===ao||n===oo||n===co||n===Er||n===lo)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===so||n===ro)return a===Ye?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ao)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===oo)return r.COMPRESSED_R11_EAC;if(n===co)return r.COMPRESSED_SIGNED_R11_EAC;if(n===Er)return r.COMPRESSED_RG11_EAC;if(n===lo)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ho||n===uo||n===fo||n===po||n===mo||n===go||n===bo||n===_o||n===xo||n===vo||n===yo||n===Mo||n===So||n===To)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===ho)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===uo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===fo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===po)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===mo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===go)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===bo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===_o)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===xo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===vo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===yo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Mo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===So)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===To)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ao||n===wo||n===Eo)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Ao)return a===Ye?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===wo)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Eo)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ro||n===Co||n===Rr||n===Po)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===Ro)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Co)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Rr)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Po)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Cs?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}var m0=`-void main() {-- gl_Position = vec4( position, 1.0 );--}`,g0=`-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;-- }--}`,xl=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new ar(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new en({vertexShader:m0,fragmentShader:g0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new at(new Bi(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},vl=class extends cn{constructor(e,t){super();let n=this,i=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,f=null,g=null,y=typeof XRWebGLBinding<"u",m=new xl,p={},x=t.getContextAttributes(),S=null,M=null,E=[],A=[],C=new Re,_=null,w=new St;w.viewport=new nt;let L=new St;L.viewport=new nt;let R=[w,L],O=new Ba,H=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let de=E[Y];return de===void 0&&(de=new gs,E[Y]=de),de.getTargetRaySpace()},this.getControllerGrip=function(Y){let de=E[Y];return de===void 0&&(de=new gs,E[Y]=de),de.getGripSpace()},this.getHand=function(Y){let de=E[Y];return de===void 0&&(de=new gs,E[Y]=de),de.getHandSpace()};function N(Y){let de=A.indexOf(Y.inputSource);if(de===-1)return;let ie=E[de];ie!==void 0&&(ie.update(Y.inputSource,Y.frame,l||a),ie.dispatchEvent({type:Y.type,data:Y.inputSource}))}function z(){i.removeEventListener("select",N),i.removeEventListener("selectstart",N),i.removeEventListener("selectend",N),i.removeEventListener("squeeze",N),i.removeEventListener("squeezestart",N),i.removeEventListener("squeezeend",N),i.removeEventListener("end",z),i.removeEventListener("inputsourceschange",V);for(let Y=0;Y<E.length;Y++){let de=A[Y];de!==null&&(A[Y]=null,E[Y].disconnect(de))}H=null,q=null,m.reset();for(let Y in p)delete p[Y];e.setRenderTarget(S),f=null,d=null,u=null,i=null,M=null,Ne.stop(),n.isPresenting=!1,e.setPixelRatio(_),e.setSize(C.width,C.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){r=Y,n.isPresenting===!0&&_e("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&_e("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(Y){l=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&y&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(S=e.getRenderTarget(),i.addEventListener("select",N),i.addEventListener("selectstart",N),i.addEventListener("selectend",N),i.addEventListener("squeeze",N),i.addEventListener("squeezestart",N),i.addEventListener("squeezeend",N),i.addEventListener("end",z),i.addEventListener("inputsourceschange",V),x.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(C),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let ie=null,Ee=null,De=null;x.depth&&(De=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ie=x.stencil?_i:En,Ee=x.stencil?Cs:Mn);let Ce={colorFormat:t.RGBA8,depthFormat:De,scaleFactor:r};u=this.getBinding(),d=u.createProjectionLayer(Ce),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),M=new Qt(d.textureWidth,d.textureHeight,{format:nn,type:jt,depthTexture:new Yn(d.textureWidth,d.textureHeight,Ee,void 0,void 0,void 0,void 0,void 0,void 0,ie),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let ie={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,t,ie),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new Qt(f.framebufferWidth,f.framebufferHeight,{format:nn,type:jt,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await i.requestReferenceSpace(o),Ne.setContext(i),Ne.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function V(Y){for(let de=0;de<Y.removed.length;de++){let ie=Y.removed[de],Ee=A.indexOf(ie);Ee>=0&&(A[Ee]=null,E[Ee].disconnect(ie))}for(let de=0;de<Y.added.length;de++){let ie=Y.added[de],Ee=A.indexOf(ie);if(Ee===-1){for(let Ce=0;Ce<E.length;Ce++)if(Ce>=A.length){A.push(ie),Ee=Ce;break}else if(A[Ce]===null){A[Ce]=ie,Ee=Ce;break}if(Ee===-1)break}let De=E[Ee];De&&De.connect(ie)}}let $=new D,Q=new D;function le(Y,de,ie){$.setFromMatrixPosition(de.matrixWorld),Q.setFromMatrixPosition(ie.matrixWorld);let Ee=$.distanceTo(Q),De=de.projectionMatrix.elements,Ce=ie.projectionMatrix.elements,ut=De[14]/(De[10]-1),We=De[14]/(De[10]+1),$e=(De[9]+1)/De[5],ht=(De[9]-1)/De[5],He=(De[8]-1)/De[0],At=(Ce[8]+1)/Ce[0],dt=ut*He,Yt=ut*At,I=Ee/(-He+At),wt=I*-He;if(de.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(wt),Y.translateZ(I),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),De[10]===-1)Y.projectionMatrix.copy(de.projectionMatrix),Y.projectionMatrixInverse.copy(de.projectionMatrixInverse);else{let qe=ut+I,ot=We+I,oe=dt-wt,ft=Yt+(Ee-wt),T=$e*We/ot*qe,b=ht*We/ot*qe;Y.projectionMatrix.makePerspective(oe,ft,T,b,qe,ot),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function xe(Y,de){de===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(de.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let de=Y.near,ie=Y.far;m.texture!==null&&(m.depthNear>0&&(de=m.depthNear),m.depthFar>0&&(ie=m.depthFar)),O.near=L.near=w.near=de,O.far=L.far=w.far=ie,(H!==O.near||q!==O.far)&&(i.updateRenderState({depthNear:O.near,depthFar:O.far}),H=O.near,q=O.far),O.layers.mask=Y.layers.mask|6,w.layers.mask=O.layers.mask&-5,L.layers.mask=O.layers.mask&-3;let Ee=Y.parent,De=O.cameras;xe(O,Ee);for(let Ce=0;Ce<De.length;Ce++)xe(De[Ce],Ee);De.length===2?le(O,w,L):O.projectionMatrix.copy(w.projectionMatrix),Se(Y,O,Ee)};function Se(Y,de,ie){ie===null?Y.matrix.copy(de.matrixWorld):(Y.matrix.copy(ie.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(de.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(de.projectionMatrix),Y.projectionMatrixInverse.copy(de.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=Fi*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(Y){c=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(O)},this.getCameraTexture=function(Y){return p[Y]};let Xe=null;function Ze(Y,de){if(h=de.getViewerPose(l||a),g=de,h!==null){let ie=h.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let Ee=!1;ie.length!==O.cameras.length&&(O.cameras.length=0,Ee=!0);for(let We=0;We<ie.length;We++){let $e=ie[We],ht=null;if(f!==null)ht=f.getViewport($e);else{let At=u.getViewSubImage(d,$e);ht=At.viewport,We===0&&(e.setRenderTargetTextures(M,At.colorTexture,At.depthStencilTexture),e.setRenderTarget(M))}let He=R[We];He===void 0&&(He=new St,He.layers.enable(We),He.viewport=new nt,R[We]=He),He.matrix.fromArray($e.transform.matrix),He.matrix.decompose(He.position,He.quaternion,He.scale),He.projectionMatrix.fromArray($e.projectionMatrix),He.projectionMatrixInverse.copy(He.projectionMatrix).invert(),He.viewport.set(ht.x,ht.y,ht.width,ht.height),We===0&&(O.matrix.copy(He.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),Ee===!0&&O.cameras.push(He)}let De=i.enabledFeatures;if(De&&De.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&y){u=n.getBinding();let We=u.getDepthInformation(ie[0]);We&&We.isValid&&We.texture&&m.init(We,i.renderState)}if(De&&De.includes("camera-access")&&y){e.state.unbindTexture(),u=n.getBinding();for(let We=0;We<ie.length;We++){let $e=ie[We].camera;if($e){let ht=p[$e];ht||(ht=new ar,p[$e]=ht);let He=u.getCameraImage($e);ht.sourceTexture=He}}}}for(let ie=0;ie<E.length;ie++){let Ee=A[ie],De=E[ie];Ee!==null&&De!==void 0&&De.update(Ee,de,l||a)}Xe&&Xe(Y,de),de.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:de}),g=null}let Ne=new id;Ne.setAnimationLoop(Ze),this.setAnimationLoop=function(Y){Xe=Y},this.dispose=function(){}}},b0=new Oe,ld=new Ie;ld.set(-1,0,0,0,1,0,0,0,1);function _0(s,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,Zc(s)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function i(m,p,x,S,M){p.isNodeMaterial?p.uniformsNeedUpdate=!1:p.isMeshBasicMaterial?r(m,p):p.isMeshLambertMaterial?(r(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(r(m,p),u(m,p)):p.isMeshPhongMaterial?(r(m,p),h(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(r(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,M)):p.isMeshMatcapMaterial?(r(m,p),g(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),y(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?c(m,p,x,S):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Lt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Lt&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);let x=e.get(p),S=x.envMap,M=x.envMapRotation;S&&(m.envMap.value=S,m.envMapRotation.value.setFromMatrix4(b0.makeRotationFromEuler(M)).transpose(),S.isCubeTexture&&S.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(ld),m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,x,S){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*x,m.scale.value=S*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,x){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Lt&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=x.texture,m.transmissionSamplerSize.value.set(x.width,x.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function y(m,p){let x=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(x.matrixWorld),m.nearDistance.value=x.shadow.camera.near,m.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function x0(s,e,t,n){let i={},r={},a=[],o=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(x,S){let M=S.program;n.uniformBlockBinding(x,M)}function l(x,S){let M=i[x.id];M===void 0&&(g(x),M=h(x),i[x.id]=M,x.addEventListener("dispose",m));let E=S.program;n.updateUBOMapping(x,E);let A=e.render.frame;r[x.id]!==A&&(d(x),r[x.id]=A)}function h(x){let S=u();x.__bindingPointIndex=S;let M=s.createBuffer(),E=x.__size,A=x.usage;return s.bindBuffer(s.UNIFORM_BUFFER,M),s.bufferData(s.UNIFORM_BUFFER,E,A),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,S,M),M}function u(){for(let x=0;x<o;x++)if(a.indexOf(x)===-1)return a.push(x),x;return we("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(x){let S=i[x.id],M=x.uniforms,E=x.__cache;s.bindBuffer(s.UNIFORM_BUFFER,S);for(let A=0,C=M.length;A<C;A++){let _=Array.isArray(M[A])?M[A]:[M[A]];for(let w=0,L=_.length;w<L;w++){let R=_[w];if(f(R,A,w,E)===!0){let O=R.__offset,H=Array.isArray(R.value)?R.value:[R.value],q=0;for(let N=0;N<H.length;N++){let z=H[N],V=y(z);typeof z=="number"||typeof z=="boolean"?(R.__data[0]=z,s.bufferSubData(s.UNIFORM_BUFFER,O+q,R.__data)):z.isMatrix3?(R.__data[0]=z.elements[0],R.__data[1]=z.elements[1],R.__data[2]=z.elements[2],R.__data[3]=0,R.__data[4]=z.elements[3],R.__data[5]=z.elements[4],R.__data[6]=z.elements[5],R.__data[7]=0,R.__data[8]=z.elements[6],R.__data[9]=z.elements[7],R.__data[10]=z.elements[8],R.__data[11]=0):ArrayBuffer.isView(z)?R.__data.set(new z.constructor(z.buffer,z.byteOffset,R.__data.length)):(z.toArray(R.__data,q),q+=V.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,O,R.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function f(x,S,M,E){let A=x.value,C=S+"_"+M;if(E[C]===void 0)return typeof A=="number"||typeof A=="boolean"?E[C]=A:ArrayBuffer.isView(A)?E[C]=A.slice():E[C]=A.clone(),!0;{let _=E[C];if(typeof A=="number"||typeof A=="boolean"){if(_!==A)return E[C]=A,!0}else{if(ArrayBuffer.isView(A))return!0;if(_.equals(A)===!1)return _.copy(A),!0}}return!1}function g(x){let S=x.uniforms,M=0,E=16;for(let C=0,_=S.length;C<_;C++){let w=Array.isArray(S[C])?S[C]:[S[C]];for(let L=0,R=w.length;L<R;L++){let O=w[L],H=Array.isArray(O.value)?O.value:[O.value];for(let q=0,N=H.length;q<N;q++){let z=H[q],V=y(z),$=M%E,Q=$%V.boundary,le=$+Q;M+=Q,le!==0&&E-le<V.storage&&(M+=E-le),O.__data=new Float32Array(V.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=M,M+=V.storage}}}let A=M%E;return A>0&&(M+=E-A),x.__size=M,x.__cache={},this}function y(x){let S={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(S.boundary=4,S.storage=4):x.isVector2?(S.boundary=8,S.storage=8):x.isVector3||x.isColor?(S.boundary=16,S.storage=12):x.isVector4?(S.boundary=16,S.storage=16):x.isMatrix3?(S.boundary=48,S.storage=48):x.isMatrix4?(S.boundary=64,S.storage=64):x.isTexture?_e("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(x)?(S.boundary=16,S.storage=x.byteLength):_e("WebGLRenderer: Unsupported uniform value type.",x),S}function m(x){let S=x.target;S.removeEventListener("dispose",m);let M=a.indexOf(S.__bindingPointIndex);a.splice(M,1),s.deleteBuffer(i[S.id]),delete i[S.id],delete r[S.id]}function p(){for(let x in i)s.deleteBuffer(i[x]);a=[],i={},r={}}return{bind:c,update:l,dispose:p}}var v0=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),On=null;function y0(){return On===null&&(On=new vs(v0,16,16,xi,Un),On.name="DFG_LUT",On.minFilter=vt,On.magFilter=vt,On.wrapS=on,On.wrapT=on,On.generateMipmaps=!1,On.needsUpdate=!0),On}var Oo=class{constructor(e={}){let{canvas:t=Eu(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=jt}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;let y=f,m=new Set([Qa,$a,Za]),p=new Set([jt,Mn,Rs,Cs,Ka,Ya]),x=new Uint32Array(4),S=new Int32Array(4),M=new D,E=null,A=null,C=[],_=[],w=null;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.toneMapping=vn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let L=this,R=!1,O=null;this._outputColorSpace=_t;let H=0,q=0,N=null,z=-1,V=null,$=new nt,Q=new nt,le=null,xe=new Ae(0),Se=0,Xe=t.width,Ze=t.height,Ne=1,Y=null,de=null,ie=new nt(0,0,Xe,Ze),Ee=new nt(0,0,Xe,Ze),De=!1,Ce=new ys,ut=!1,We=!1,$e=new Oe,ht=new D,He=new nt,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},dt=!1;function Yt(){return N===null?Ne:1}let I=n;function wt(v,F){return t.getContext(v,F)}try{let v={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"184"}`),t.addEventListener("webglcontextlost",J,!1),t.addEventListener("webglcontextrestored",ye,!1),t.addEventListener("webglcontextcreationerror",Le,!1),I===null){let F="webgl2";if(I=wt(F,v),I===null)throw wt(F)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(v){throw we("WebGLRenderer: "+v.message),v}let qe,ot,oe,ft,T,b,U,j,Z,ee,ae,W,K,fe,ge,se,te,Pe,Ue,Ke,P,ne,X;function pe(){qe=new Rg(I),qe.init(),P=new p0(I,qe),ot=new vg(I,qe,e,P),oe=new d0(I,qe),ot.reversedDepthBuffer&&d&&oe.buffers.depth.setReversed(!0),ft=new Ig(I),T=new $b,b=new f0(I,qe,oe,T,ot,P,ft),U=new Eg(L),j=new Nf(I),ne=new _g(I,j),Z=new Cg(I,j,ft,ne),ee=new Lg(I,Z,j,ne,ft),Pe=new Dg(I,ot,b),ge=new yg(T),ae=new Zb(L,U,qe,ot,ne,ge),W=new _0(L,T),K=new e0,fe=new a0(qe),te=new bg(L,U,oe,ee,g,c),se=new u0(L,ee,ot),X=new x0(I,ft,ot,oe),Ue=new xg(I,qe,ft),Ke=new Pg(I,qe,ft),ft.programs=ae.programs,L.capabilities=ot,L.extensions=qe,L.properties=T,L.renderLists=K,L.shadowMap=se,L.state=oe,L.info=ft}pe(),y!==jt&&(w=new Ng(y,t.width,t.height,i,r));let re=new vl(L,I);this.xr=re,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let v=qe.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){let v=qe.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return Ne},this.setPixelRatio=function(v){v!==void 0&&(Ne=v,this.setSize(Xe,Ze,!1))},this.getSize=function(v){return v.set(Xe,Ze)},this.setSize=function(v,F,G=!0){if(re.isPresenting){_e("WebGLRenderer: Can't change size while VR device is presenting.");return}Xe=v,Ze=F,t.width=Math.floor(v*Ne),t.height=Math.floor(F*Ne),G===!0&&(t.style.width=v+"px",t.style.height=F+"px"),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,v,F)},this.getDrawingBufferSize=function(v){return v.set(Xe*Ne,Ze*Ne).floor()},this.setDrawingBufferSize=function(v,F,G){Xe=v,Ze=F,Ne=G,t.width=Math.floor(v*G),t.height=Math.floor(F*G),this.setViewport(0,0,v,F)},this.setEffects=function(v){if(y===jt){we("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let F=0;F<v.length;F++)if(v[F].isOutputPass===!0){_e("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}w.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy($)},this.getViewport=function(v){return v.copy(ie)},this.setViewport=function(v,F,G,B){v.isVector4?ie.set(v.x,v.y,v.z,v.w):ie.set(v,F,G,B),oe.viewport($.copy(ie).multiplyScalar(Ne).round())},this.getScissor=function(v){return v.copy(Ee)},this.setScissor=function(v,F,G,B){v.isVector4?Ee.set(v.x,v.y,v.z,v.w):Ee.set(v,F,G,B),oe.scissor(Q.copy(Ee).multiplyScalar(Ne).round())},this.getScissorTest=function(){return De},this.setScissorTest=function(v){oe.setScissorTest(De=v)},this.setOpaqueSort=function(v){Y=v},this.setTransparentSort=function(v){de=v},this.getClearColor=function(v){return v.copy(te.getClearColor())},this.setClearColor=function(){te.setClearColor(...arguments)},this.getClearAlpha=function(){return te.getClearAlpha()},this.setClearAlpha=function(){te.setClearAlpha(...arguments)},this.clear=function(v=!0,F=!0,G=!0){let B=0;if(v){let k=!1;if(N!==null){let ue=N.texture.format;k=m.has(ue)}if(k){let ue=N.texture.type,be=p.has(ue),he=te.getClearColor(),ve=te.getClearAlpha(),Me=he.r,Fe=he.g,ke=he.b;be?(x[0]=Me,x[1]=Fe,x[2]=ke,x[3]=ve,I.clearBufferuiv(I.COLOR,0,x)):(S[0]=Me,S[1]=Fe,S[2]=ke,S[3]=ve,I.clearBufferiv(I.COLOR,0,S))}else B|=I.COLOR_BUFFER_BIT}F&&(B|=I.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),G&&(B|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B!==0&&I.clear(B)},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.setNodesHandler=function(v){v.setRenderer(this),O=v},this.dispose=function(){t.removeEventListener("webglcontextlost",J,!1),t.removeEventListener("webglcontextrestored",ye,!1),t.removeEventListener("webglcontextcreationerror",Le,!1),te.dispose(),K.dispose(),fe.dispose(),T.dispose(),U.dispose(),ee.dispose(),ne.dispose(),X.dispose(),ae.dispose(),re.dispose(),re.removeEventListener("sessionstart",nh),re.removeEventListener("sessionend",ih),Mi.stop()};function J(v){v.preventDefault(),Ys("WebGLRenderer: Context Lost."),R=!0}function ye(){Ys("WebGLRenderer: Context Restored."),R=!1;let v=ft.autoReset,F=se.enabled,G=se.autoUpdate,B=se.needsUpdate,k=se.type;pe(),ft.autoReset=v,se.enabled=F,se.autoUpdate=G,se.needsUpdate=B,se.type=k}function Le(v){we("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function mt(v){let F=v.target;F.removeEventListener("dispose",mt),Qe(F)}function Qe(v){zn(v),T.remove(v)}function zn(v){let F=T.get(v).programs;F!==void 0&&(F.forEach(function(G){ae.releaseProgram(G)}),v.isShaderMaterial&&ae.releaseShaderCache(v))}this.renderBufferDirect=function(v,F,G,B,k,ue){F===null&&(F=At);let be=k.isMesh&&k.matrixWorld.determinant()<0,he=wd(v,F,G,B,k);oe.setMaterial(B,be);let ve=G.index,Me=1;if(B.wireframe===!0){if(ve=Z.getWireframeAttribute(G),ve===void 0)return;Me=2}let Fe=G.drawRange,ke=G.attributes.position,Te=Fe.start*Me,et=(Fe.start+Fe.count)*Me;ue!==null&&(Te=Math.max(Te,ue.start*Me),et=Math.min(et,(ue.start+ue.count)*Me)),ve!==null?(Te=Math.max(Te,0),et=Math.min(et,ve.count)):ke!=null&&(Te=Math.max(Te,0),et=Math.min(et,ke.count));let gt=et-Te;if(gt<0||gt===1/0)return;ne.setup(k,B,he,G,ve);let pt,st=Ue;if(ve!==null&&(pt=j.get(ve),st=Ke,st.setIndex(pt)),k.isMesh)B.wireframe===!0?(oe.setLineWidth(B.wireframeLinewidth*Yt()),st.setMode(I.LINES)):st.setMode(I.TRIANGLES);else if(k.isLine){let Ft=B.linewidth;Ft===void 0&&(Ft=1),oe.setLineWidth(Ft*Yt()),k.isLineSegments?st.setMode(I.LINES):k.isLineLoop?st.setMode(I.LINE_LOOP):st.setMode(I.LINE_STRIP)}else k.isPoints?st.setMode(I.POINTS):k.isSprite&&st.setMode(I.TRIANGLES);if(k.isBatchedMesh)if(qe.get("WEBGL_multi_draw"))st.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{let Ft=k._multiDrawStarts,me=k._multiDrawCounts,Jt=k._multiDrawCount,je=ve?j.get(ve).bytesPerElement:1,sn=T.get(B).currentProgram.getUniforms();for(let Tn=0;Tn<Jt;Tn++)sn.setValue(I,"_gl_DrawID",Tn),st.render(Ft[Tn]/je,me[Tn])}else if(k.isInstancedMesh)st.renderInstances(Te,gt,k.count);else if(G.isInstancedBufferGeometry){let Ft=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,me=Math.min(G.instanceCount,Ft);st.renderInstances(Te,gt,me)}else st.render(Te,gt)};function Sn(v,F,G){v.transparent===!0&&v.side===ln&&v.forceSinglePass===!1?(v.side=Lt,v.needsUpdate=!0,Or(v,F,G),v.side=_n,v.needsUpdate=!0,Or(v,F,G),v.side=ln):Or(v,F,G)}this.compile=function(v,F,G=null){G===null&&(G=v),A=fe.get(G),A.init(F),_.push(A),G.traverseVisible(function(k){k.isLight&&k.layers.test(F.layers)&&(A.pushLight(k),k.castShadow&&A.pushShadow(k))}),v!==G&&v.traverseVisible(function(k){k.isLight&&k.layers.test(F.layers)&&(A.pushLight(k),k.castShadow&&A.pushShadow(k))}),A.setupLights();let B=new Set;return v.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;let ue=k.material;if(ue)if(Array.isArray(ue))for(let be=0;be<ue.length;be++){let he=ue[be];Sn(he,G,k),B.add(he)}else Sn(ue,G,k),B.add(ue)}),A=_.pop(),B},this.compileAsync=function(v,F,G=null){let B=this.compile(v,F,G);return new Promise(k=>{function ue(){if(B.forEach(function(be){T.get(be).currentProgram.isReady()&&B.delete(be)}),B.size===0){k(v);return}setTimeout(ue,10)}qe.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let jo=null;function Td(v){jo&&jo(v)}function nh(){Mi.stop()}function ih(){Mi.start()}let Mi=new id;Mi.setAnimationLoop(Td),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(v){jo=v,re.setAnimationLoop(v),v===null?Mi.stop():Mi.start()},re.addEventListener("sessionstart",nh),re.addEventListener("sessionend",ih),this.render=function(v,F){if(F!==void 0&&F.isCamera!==!0){we("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;O!==null&&O.renderStart(v,F);let G=re.enabled===!0&&re.isPresenting===!0,B=w!==null&&(N===null||G)&&w.begin(L,N);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),re.enabled===!0&&re.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(re.cameraAutoUpdate===!0&&re.updateCamera(F),F=re.getCamera()),v.isScene===!0&&v.onBeforeRender(L,v,F,N),A=fe.get(v,_.length),A.init(F),A.state.textureUnits=b.getTextureUnits(),_.push(A),$e.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),Ce.setFromProjectionMatrix($e,mn,F.reversedDepth),We=this.localClippingEnabled,ut=ge.init(this.clippingPlanes,We),E=K.get(v,C.length),E.init(),C.push(E),re.enabled===!0&&re.isPresenting===!0){let be=L.xr.getDepthSensingMesh();be!==null&&Ko(be,F,-1/0,L.sortObjects)}Ko(v,F,0,L.sortObjects),E.finish(),L.sortObjects===!0&&E.sort(Y,de),dt=re.enabled===!1||re.isPresenting===!1||re.hasDepthSensing()===!1,dt&&te.addToRenderList(E,v),this.info.render.frame++,ut===!0&&ge.beginShadows();let k=A.state.shadowsArray;if(se.render(k,v,F),ut===!0&&ge.endShadows(),this.info.autoReset===!0&&this.info.reset(),(B&&w.hasRenderPass())===!1){let be=E.opaque,he=E.transmissive;if(A.setupLights(),F.isArrayCamera){let ve=F.cameras;if(he.length>0)for(let Me=0,Fe=ve.length;Me<Fe;Me++){let ke=ve[Me];rh(be,he,v,ke)}dt&&te.render(v);for(let Me=0,Fe=ve.length;Me<Fe;Me++){let ke=ve[Me];sh(E,v,ke,ke.viewport)}}else he.length>0&&rh(be,he,v,F),dt&&te.render(v),sh(E,v,F)}N!==null&&q===0&&(b.updateMultisampleRenderTarget(N),b.updateRenderTargetMipmap(N)),B&&w.end(L),v.isScene===!0&&v.onAfterRender(L,v,F),ne.resetDefaultState(),z=-1,V=null,_.pop(),_.length>0?(A=_[_.length-1],b.setTextureUnits(A.state.textureUnits),ut===!0&&ge.setGlobalState(L.clippingPlanes,A.state.camera)):A=null,C.pop(),C.length>0?E=C[C.length-1]:E=null,O!==null&&O.renderEnd()};function Ko(v,F,G,B){if(v.visible===!1)return;if(v.layers.test(F.layers)){if(v.isGroup)G=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(F);else if(v.isLightProbeGrid)A.pushLightProbeGrid(v);else if(v.isLight)A.pushLight(v),v.castShadow&&A.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||Ce.intersectsSprite(v)){B&&He.setFromMatrixPosition(v.matrixWorld).applyMatrix4($e);let be=ee.update(v),he=v.material;he.visible&&E.push(v,be,he,G,He.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||Ce.intersectsObject(v))){let be=ee.update(v),he=v.material;if(B&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),He.copy(v.boundingSphere.center)):(be.boundingSphere===null&&be.computeBoundingSphere(),He.copy(be.boundingSphere.center)),He.applyMatrix4(v.matrixWorld).applyMatrix4($e)),Array.isArray(he)){let ve=be.groups;for(let Me=0,Fe=ve.length;Me<Fe;Me++){let ke=ve[Me],Te=he[ke.materialIndex];Te&&Te.visible&&E.push(v,be,Te,G,He.z,ke)}}else he.visible&&E.push(v,be,he,G,He.z,null)}}let ue=v.children;for(let be=0,he=ue.length;be<he;be++)Ko(ue[be],F,G,B)}function sh(v,F,G,B){let{opaque:k,transmissive:ue,transparent:be}=v;A.setupLightsView(G),ut===!0&&ge.setGlobalState(L.clippingPlanes,G),B&&oe.viewport($.copy(B)),k.length>0&&Ur(k,F,G),ue.length>0&&Ur(ue,F,G),be.length>0&&Ur(be,F,G),oe.buffers.depth.setTest(!0),oe.buffers.depth.setMask(!0),oe.buffers.color.setMask(!0),oe.setPolygonOffset(!1)}function rh(v,F,G,B){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(A.state.transmissionRenderTarget[B.id]===void 0){let Te=qe.has("EXT_color_buffer_half_float")||qe.has("EXT_color_buffer_float");A.state.transmissionRenderTarget[B.id]=new Qt(1,1,{generateMipmaps:!0,type:Te?Un:jt,minFilter:yn,samples:Math.max(4,ot.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ze.workingColorSpace})}let ue=A.state.transmissionRenderTarget[B.id],be=B.viewport||$;ue.setSize(be.z*L.transmissionResolutionScale,be.w*L.transmissionResolutionScale);let he=L.getRenderTarget(),ve=L.getActiveCubeFace(),Me=L.getActiveMipmapLevel();L.setRenderTarget(ue),L.getClearColor(xe),Se=L.getClearAlpha(),Se<1&&L.setClearColor(16777215,.5),L.clear(),dt&&te.render(G);let Fe=L.toneMapping;L.toneMapping=vn;let ke=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),A.setupLightsView(B),ut===!0&&ge.setGlobalState(L.clippingPlanes,B),Ur(v,G,B),b.updateMultisampleRenderTarget(ue),b.updateRenderTargetMipmap(ue),qe.has("WEBGL_multisampled_render_to_texture")===!1){let Te=!1;for(let et=0,gt=F.length;et<gt;et++){let pt=F[et],{object:st,geometry:Ft,material:me,group:Jt}=pt;if(me.side===ln&&st.layers.test(B.layers)){let je=me.side;me.side=Lt,me.needsUpdate=!0,ah(st,G,B,Ft,me,Jt),me.side=je,me.needsUpdate=!0,Te=!0}}Te===!0&&(b.updateMultisampleRenderTarget(ue),b.updateRenderTargetMipmap(ue))}L.setRenderTarget(he,ve,Me),L.setClearColor(xe,Se),ke!==void 0&&(B.viewport=ke),L.toneMapping=Fe}function Ur(v,F,G){let B=F.isScene===!0?F.overrideMaterial:null;for(let k=0,ue=v.length;k<ue;k++){let be=v[k],{object:he,geometry:ve,group:Me}=be,Fe=be.material;Fe.allowOverride===!0&&B!==null&&(Fe=B),he.layers.test(G.layers)&&ah(he,F,G,ve,Fe,Me)}}function ah(v,F,G,B,k,ue){v.onBeforeRender(L,F,G,B,k,ue),v.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),k.onBeforeRender(L,F,G,B,v,ue),k.transparent===!0&&k.side===ln&&k.forceSinglePass===!1?(k.side=Lt,k.needsUpdate=!0,L.renderBufferDirect(G,F,B,k,v,ue),k.side=_n,k.needsUpdate=!0,L.renderBufferDirect(G,F,B,k,v,ue),k.side=ln):L.renderBufferDirect(G,F,B,k,v,ue),v.onAfterRender(L,F,G,B,k,ue)}function Or(v,F,G){F.isScene!==!0&&(F=At);let B=T.get(v),k=A.state.lights,ue=A.state.shadowsArray,be=k.state.version,he=ae.getParameters(v,k.state,ue,F,G,A.state.lightProbeGridArray),ve=ae.getProgramCacheKey(he),Me=B.programs;B.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?F.environment:null,B.fog=F.fog;let Fe=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;B.envMap=U.get(v.envMap||B.environment,Fe),B.envMapRotation=B.environment!==null&&v.envMap===null?F.environmentRotation:v.envMapRotation,Me===void 0&&(v.addEventListener("dispose",mt),Me=new Map,B.programs=Me);let ke=Me.get(ve);if(ke!==void 0){if(B.currentProgram===ke&&B.lightsStateVersion===be)return ch(v,he),ke}else he.uniforms=ae.getUniforms(v),O!==null&&v.isNodeMaterial&&O.build(v,G,he),v.onBeforeCompile(he,L),ke=ae.acquireProgram(he,ve),Me.set(ve,ke),B.uniforms=he.uniforms;let Te=B.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Te.clippingPlanes=ge.uniform),ch(v,he),B.needsLights=Rd(v),B.lightsStateVersion=be,B.needsLights&&(Te.ambientLightColor.value=k.state.ambient,Te.lightProbe.value=k.state.probe,Te.directionalLights.value=k.state.directional,Te.directionalLightShadows.value=k.state.directionalShadow,Te.spotLights.value=k.state.spot,Te.spotLightShadows.value=k.state.spotShadow,Te.rectAreaLights.value=k.state.rectArea,Te.ltc_1.value=k.state.rectAreaLTC1,Te.ltc_2.value=k.state.rectAreaLTC2,Te.pointLights.value=k.state.point,Te.pointLightShadows.value=k.state.pointShadow,Te.hemisphereLights.value=k.state.hemi,Te.directionalShadowMatrix.value=k.state.directionalShadowMatrix,Te.spotLightMatrix.value=k.state.spotLightMatrix,Te.spotLightMap.value=k.state.spotLightMap,Te.pointShadowMatrix.value=k.state.pointShadowMatrix),B.lightProbeGrid=A.state.lightProbeGridArray.length>0,B.currentProgram=ke,B.uniformsList=null,ke}function oh(v){if(v.uniformsList===null){let F=v.currentProgram.getUniforms();v.uniformsList=Ds.seqWithValue(F.seq,v.uniforms)}return v.uniformsList}function ch(v,F){let G=T.get(v);G.outputColorSpace=F.outputColorSpace,G.batching=F.batching,G.batchingColor=F.batchingColor,G.instancing=F.instancing,G.instancingColor=F.instancingColor,G.instancingMorph=F.instancingMorph,G.skinning=F.skinning,G.morphTargets=F.morphTargets,G.morphNormals=F.morphNormals,G.morphColors=F.morphColors,G.morphTargetsCount=F.morphTargetsCount,G.numClippingPlanes=F.numClippingPlanes,G.numIntersection=F.numClipIntersection,G.vertexAlphas=F.vertexAlphas,G.vertexTangents=F.vertexTangents,G.toneMapping=F.toneMapping}function Ad(v,F){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(F.matrixWorld);for(let G=0,B=v.length;G<B;G++){let k=v[G];if(k.texture!==null&&k.boundingBox.containsPoint(M))return k}return null}function wd(v,F,G,B,k){F.isScene!==!0&&(F=At),b.resetTextureUnits();let ue=F.fog,be=B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial?F.environment:null,he=N===null?L.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:ze.workingColorSpace,ve=B.isMeshStandardMaterial||B.isMeshLambertMaterial&&!B.envMap||B.isMeshPhongMaterial&&!B.envMap,Me=U.get(B.envMap||be,ve),Fe=B.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,ke=!!G.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),Te=!!G.morphAttributes.position,et=!!G.morphAttributes.normal,gt=!!G.morphAttributes.color,pt=vn;B.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(pt=L.toneMapping);let st=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,Ft=st!==void 0?st.length:0,me=T.get(B),Jt=A.state.lights;if(ut===!0&&(We===!0||v!==V)){let ct=v===V&&B.id===z;ge.setState(B,v,ct)}let je=!1;B.version===me.__version?(me.needsLights&&me.lightsStateVersion!==Jt.state.version||me.outputColorSpace!==he||k.isBatchedMesh&&me.batching===!1||!k.isBatchedMesh&&me.batching===!0||k.isBatchedMesh&&me.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&me.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&me.instancing===!1||!k.isInstancedMesh&&me.instancing===!0||k.isSkinnedMesh&&me.skinning===!1||!k.isSkinnedMesh&&me.skinning===!0||k.isInstancedMesh&&me.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&me.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&me.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&me.instancingMorph===!1&&k.morphTexture!==null||me.envMap!==Me||B.fog===!0&&me.fog!==ue||me.numClippingPlanes!==void 0&&(me.numClippingPlanes!==ge.numPlanes||me.numIntersection!==ge.numIntersection)||me.vertexAlphas!==Fe||me.vertexTangents!==ke||me.morphTargets!==Te||me.morphNormals!==et||me.morphColors!==gt||me.toneMapping!==pt||me.morphTargetsCount!==Ft||!!me.lightProbeGrid!=A.state.lightProbeGridArray.length>0)&&(je=!0):(je=!0,me.__version=B.version);let sn=me.currentProgram;je===!0&&(sn=Or(B,F,k),O&&B.isNodeMaterial&&O.onUpdateProgram(B,sn,me));let Tn=!1,ei=!1,Ki=!1,rt=sn.getUniforms(),bt=me.uniforms;if(oe.useProgram(sn.program)&&(Tn=!0,ei=!0,Ki=!0),B.id!==z&&(z=B.id,ei=!0),me.needsLights){let ct=Ad(A.state.lightProbeGridArray,k);me.lightProbeGrid!==ct&&(me.lightProbeGrid=ct,ei=!0)}if(Tn||V!==v){oe.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),rt.setValue(I,"projectionMatrix",v.projectionMatrix),rt.setValue(I,"viewMatrix",v.matrixWorldInverse);let ni=rt.map.cameraPosition;ni!==void 0&&ni.setValue(I,ht.setFromMatrixPosition(v.matrixWorld)),ot.logarithmicDepthBuffer&&rt.setValue(I,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&rt.setValue(I,"isOrthographic",v.isOrthographicCamera===!0),V!==v&&(V=v,ei=!0,Ki=!0)}if(me.needsLights&&(Jt.state.directionalShadowMap.length>0&&rt.setValue(I,"directionalShadowMap",Jt.state.directionalShadowMap,b),Jt.state.spotShadowMap.length>0&&rt.setValue(I,"spotShadowMap",Jt.state.spotShadowMap,b),Jt.state.pointShadowMap.length>0&&rt.setValue(I,"pointShadowMap",Jt.state.pointShadowMap,b)),k.isSkinnedMesh){rt.setOptional(I,k,"bindMatrix"),rt.setOptional(I,k,"bindMatrixInverse");let ct=k.skeleton;ct&&(ct.boneTexture===null&&ct.computeBoneTexture(),rt.setValue(I,"boneTexture",ct.boneTexture,b))}k.isBatchedMesh&&(rt.setOptional(I,k,"batchingTexture"),rt.setValue(I,"batchingTexture",k._matricesTexture,b),rt.setOptional(I,k,"batchingIdTexture"),rt.setValue(I,"batchingIdTexture",k._indirectTexture,b),rt.setOptional(I,k,"batchingColorTexture"),k._colorsTexture!==null&&rt.setValue(I,"batchingColorTexture",k._colorsTexture,b));let ti=G.morphAttributes;if((ti.position!==void 0||ti.normal!==void 0||ti.color!==void 0)&&Pe.update(k,G,sn),(ei||me.receiveShadow!==k.receiveShadow)&&(me.receiveShadow=k.receiveShadow,rt.setValue(I,"receiveShadow",k.receiveShadow)),(B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial)&&B.envMap===null&&F.environment!==null&&(bt.envMapIntensity.value=F.environmentIntensity),bt.dfgLUT!==void 0&&(bt.dfgLUT.value=y0()),ei){if(rt.setValue(I,"toneMappingExposure",L.toneMappingExposure),me.needsLights&&Ed(bt,Ki),ue&&B.fog===!0&&W.refreshFogUniforms(bt,ue),W.refreshMaterialUniforms(bt,B,Ne,Ze,A.state.transmissionRenderTarget[v.id]),me.needsLights&&me.lightProbeGrid){let ct=me.lightProbeGrid;bt.probesSH.value=ct.texture,bt.probesMin.value.copy(ct.boundingBox.min),bt.probesMax.value.copy(ct.boundingBox.max),bt.probesResolution.value.copy(ct.resolution)}Ds.upload(I,oh(me),bt,b)}if(B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(Ds.upload(I,oh(me),bt,b),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&rt.setValue(I,"center",k.center),rt.setValue(I,"modelViewMatrix",k.modelViewMatrix),rt.setValue(I,"normalMatrix",k.normalMatrix),rt.setValue(I,"modelMatrix",k.matrixWorld),B.uniformsGroups!==void 0){let ct=B.uniformsGroups;for(let ni=0,Yi=ct.length;ni<Yi;ni++){let lh=ct[ni];X.update(lh,sn),X.bind(lh,sn)}}return sn}function Ed(v,F){v.ambientLightColor.needsUpdate=F,v.lightProbe.needsUpdate=F,v.directionalLights.needsUpdate=F,v.directionalLightShadows.needsUpdate=F,v.pointLights.needsUpdate=F,v.pointLightShadows.needsUpdate=F,v.spotLights.needsUpdate=F,v.spotLightShadows.needsUpdate=F,v.rectAreaLights.needsUpdate=F,v.hemisphereLights.needsUpdate=F}function Rd(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return q},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(v,F,G){let B=T.get(v);B.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,B.__autoAllocateDepthBuffer===!1&&(B.__useRenderToTexture=!1),T.get(v.texture).__webglTexture=F,T.get(v.depthTexture).__webglTexture=B.__autoAllocateDepthBuffer?void 0:G,B.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,F){let G=T.get(v);G.__webglFramebuffer=F,G.__useDefaultFramebuffer=F===void 0};let Cd=I.createFramebuffer();this.setRenderTarget=function(v,F=0,G=0){N=v,H=F,q=G;let B=null,k=!1,ue=!1;if(v){let he=T.get(v);if(he.__useDefaultFramebuffer!==void 0){oe.bindFramebuffer(I.FRAMEBUFFER,he.__webglFramebuffer),$.copy(v.viewport),Q.copy(v.scissor),le=v.scissorTest,oe.viewport($),oe.scissor(Q),oe.setScissorTest(le),z=-1;return}else if(he.__webglFramebuffer===void 0)b.setupRenderTarget(v);else if(he.__hasExternalTextures)b.rebindTextures(v,T.get(v.texture).__webglTexture,T.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){let Fe=v.depthTexture;if(he.__boundDepthTexture!==Fe){if(Fe!==null&&T.has(Fe)&&(v.width!==Fe.image.width||v.height!==Fe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");b.setupDepthRenderbuffer(v)}}let ve=v.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(ue=!0);let Me=T.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Me[F])?B=Me[F][G]:B=Me[F],k=!0):v.samples>0&&b.useMultisampledRTT(v)===!1?B=T.get(v).__webglMultisampledFramebuffer:Array.isArray(Me)?B=Me[G]:B=Me,$.copy(v.viewport),Q.copy(v.scissor),le=v.scissorTest}else $.copy(ie).multiplyScalar(Ne).floor(),Q.copy(Ee).multiplyScalar(Ne).floor(),le=De;if(G!==0&&(B=Cd),oe.bindFramebuffer(I.FRAMEBUFFER,B)&&oe.drawBuffers(v,B),oe.viewport($),oe.scissor(Q),oe.setScissorTest(le),k){let he=T.get(v.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+F,he.__webglTexture,G)}else if(ue){let he=F;for(let ve=0;ve<v.textures.length;ve++){let Me=T.get(v.textures[ve]);I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0+ve,Me.__webglTexture,G,he)}}else if(v!==null&&G!==0){let he=T.get(v.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,he.__webglTexture,G)}z=-1},this.readRenderTargetPixels=function(v,F,G,B,k,ue,be,he=0){if(!(v&&v.isWebGLRenderTarget)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ve=T.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&be!==void 0&&(ve=ve[be]),ve){oe.bindFramebuffer(I.FRAMEBUFFER,ve);try{let Me=v.textures[he],Fe=Me.format,ke=Me.type;if(v.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+he),!ot.textureFormatReadable(Fe)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ot.textureTypeReadable(ke)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=v.width-B&&G>=0&&G<=v.height-k&&I.readPixels(F,G,B,k,P.convert(Fe),P.convert(ke),ue)}finally{let Me=N!==null?T.get(N).__webglFramebuffer:null;oe.bindFramebuffer(I.FRAMEBUFFER,Me)}}},this.readRenderTargetPixelsAsync=async function(v,F,G,B,k,ue,be,he=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ve=T.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&be!==void 0&&(ve=ve[be]),ve)if(F>=0&&F<=v.width-B&&G>=0&&G<=v.height-k){oe.bindFramebuffer(I.FRAMEBUFFER,ve);let Me=v.textures[he],Fe=Me.format,ke=Me.type;if(v.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+he),!ot.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ot.textureTypeReadable(ke))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Te=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,Te),I.bufferData(I.PIXEL_PACK_BUFFER,ue.byteLength,I.STREAM_READ),I.readPixels(F,G,B,k,P.convert(Fe),P.convert(ke),0);let et=N!==null?T.get(N).__webglFramebuffer:null;oe.bindFramebuffer(I.FRAMEBUFFER,et);let gt=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await Cu(I,gt,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,Te),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,ue),I.deleteBuffer(Te),I.deleteSync(gt),ue}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,F=null,G=0){let B=Math.pow(2,-G),k=Math.floor(v.image.width*B),ue=Math.floor(v.image.height*B),be=F!==null?F.x:0,he=F!==null?F.y:0;b.setTexture2D(v,0),I.copyTexSubImage2D(I.TEXTURE_2D,G,0,0,be,he,k,ue),oe.unbindTexture()};let Pd=I.createFramebuffer(),Id=I.createFramebuffer();this.copyTextureToTexture=function(v,F,G=null,B=null,k=0,ue=0){let be,he,ve,Me,Fe,ke,Te,et,gt,pt=v.isCompressedTexture?v.mipmaps[ue]:v.image;if(G!==null)be=G.max.x-G.min.x,he=G.max.y-G.min.y,ve=G.isBox3?G.max.z-G.min.z:1,Me=G.min.x,Fe=G.min.y,ke=G.isBox3?G.min.z:0;else{let bt=Math.pow(2,-k);be=Math.floor(pt.width*bt),he=Math.floor(pt.height*bt),v.isDataArrayTexture?ve=pt.depth:v.isData3DTexture?ve=Math.floor(pt.depth*bt):ve=1,Me=0,Fe=0,ke=0}B!==null?(Te=B.x,et=B.y,gt=B.z):(Te=0,et=0,gt=0);let st=P.convert(F.format),Ft=P.convert(F.type),me;F.isData3DTexture?(b.setTexture3D(F,0),me=I.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?(b.setTexture2DArray(F,0),me=I.TEXTURE_2D_ARRAY):(b.setTexture2D(F,0),me=I.TEXTURE_2D),oe.activeTexture(I.TEXTURE0),oe.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,F.flipY),oe.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),oe.pixelStorei(I.UNPACK_ALIGNMENT,F.unpackAlignment);let Jt=oe.getParameter(I.UNPACK_ROW_LENGTH),je=oe.getParameter(I.UNPACK_IMAGE_HEIGHT),sn=oe.getParameter(I.UNPACK_SKIP_PIXELS),Tn=oe.getParameter(I.UNPACK_SKIP_ROWS),ei=oe.getParameter(I.UNPACK_SKIP_IMAGES);oe.pixelStorei(I.UNPACK_ROW_LENGTH,pt.width),oe.pixelStorei(I.UNPACK_IMAGE_HEIGHT,pt.height),oe.pixelStorei(I.UNPACK_SKIP_PIXELS,Me),oe.pixelStorei(I.UNPACK_SKIP_ROWS,Fe),oe.pixelStorei(I.UNPACK_SKIP_IMAGES,ke);let Ki=v.isDataArrayTexture||v.isData3DTexture,rt=F.isDataArrayTexture||F.isData3DTexture;if(v.isDepthTexture){let bt=T.get(v),ti=T.get(F),ct=T.get(bt.__renderTarget),ni=T.get(ti.__renderTarget);oe.bindFramebuffer(I.READ_FRAMEBUFFER,ct.__webglFramebuffer),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,ni.__webglFramebuffer);for(let Yi=0;Yi<ve;Yi++)Ki&&(I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,T.get(v).__webglTexture,k,ke+Yi),I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,T.get(F).__webglTexture,ue,gt+Yi)),I.blitFramebuffer(Me,Fe,be,he,Te,et,be,he,I.DEPTH_BUFFER_BIT,I.NEAREST);oe.bindFramebuffer(I.READ_FRAMEBUFFER,null),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else if(k!==0||v.isRenderTargetTexture||T.has(v)){let bt=T.get(v),ti=T.get(F);oe.bindFramebuffer(I.READ_FRAMEBUFFER,Pd),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,Id);for(let ct=0;ct<ve;ct++)Ki?I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,bt.__webglTexture,k,ke+ct):I.framebufferTexture2D(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,bt.__webglTexture,k),rt?I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,ti.__webglTexture,ue,gt+ct):I.framebufferTexture2D(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,ti.__webglTexture,ue),k!==0?I.blitFramebuffer(Me,Fe,be,he,Te,et,be,he,I.COLOR_BUFFER_BIT,I.NEAREST):rt?I.copyTexSubImage3D(me,ue,Te,et,gt+ct,Me,Fe,be,he):I.copyTexSubImage2D(me,ue,Te,et,Me,Fe,be,he);oe.bindFramebuffer(I.READ_FRAMEBUFFER,null),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else rt?v.isDataTexture||v.isData3DTexture?I.texSubImage3D(me,ue,Te,et,gt,be,he,ve,st,Ft,pt.data):F.isCompressedArrayTexture?I.compressedTexSubImage3D(me,ue,Te,et,gt,be,he,ve,st,pt.data):I.texSubImage3D(me,ue,Te,et,gt,be,he,ve,st,Ft,pt):v.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,ue,Te,et,be,he,st,Ft,pt.data):v.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,ue,Te,et,pt.width,pt.height,st,pt.data):I.texSubImage2D(I.TEXTURE_2D,ue,Te,et,be,he,st,Ft,pt);oe.pixelStorei(I.UNPACK_ROW_LENGTH,Jt),oe.pixelStorei(I.UNPACK_IMAGE_HEIGHT,je),oe.pixelStorei(I.UNPACK_SKIP_PIXELS,sn),oe.pixelStorei(I.UNPACK_SKIP_ROWS,Tn),oe.pixelStorei(I.UNPACK_SKIP_IMAGES,ei),ue===0&&F.generateMipmaps&&I.generateMipmap(me),oe.unbindTexture()},this.initRenderTarget=function(v){T.get(v).__webglFramebuffer===void 0&&b.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?b.setTextureCube(v,0):v.isData3DTexture?b.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?b.setTexture2DArray(v,0):b.setTexture2D(v,0),oe.unbindTexture()},this.resetState=function(){H=0,q=0,N=null,oe.reset(),ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return mn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ze._getDrawingBufferColorSpace(e),t.unpackColorSpace=ze._getUnpackColorSpace()}};var hd={type:"change"},Ml={type:"start"},dd={type:"end"},zo=new Kn,ud=new an,S0=Math.cos(70*Ir.DEG2RAD),Pt=new D,Kt=2*Math.PI,it={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},yl=1e-6,Go=class extends xr{constructor(e,t=null){super(e,t),this.state=it.NONE,this.target=new D,this.cursor=new D,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:mi.ROTATE,MIDDLE:mi.DOLLY,RIGHT:mi.PAN},this.touches={ONE:gi.ROTATE,TWO:gi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new D,this._lastQuaternion=new Et,this._lastTargetPosition=new D,this._quat=new Et().setFromUnitVectors(e.up,new D(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new As,this._sphericalDelta=new As,this._scale=1,this._panOffset=new D,this._rotateStart=new Re,this._rotateEnd=new Re,this._rotateDelta=new Re,this._panStart=new Re,this._panEnd=new Re,this._panDelta=new Re,this._dollyStart=new Re,this._dollyEnd=new Re,this._dollyDelta=new Re,this._dollyDirection=new D,this._mouse=new Re,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=A0.bind(this),this._onPointerDown=T0.bind(this),this._onPointerUp=w0.bind(this),this._onContextMenu=L0.bind(this),this._onMouseWheel=C0.bind(this),this._onKeyDown=P0.bind(this),this._onTouchStart=I0.bind(this),this._onTouchMove=D0.bind(this),this._onMouseDown=E0.bind(this),this._onMouseMove=R0.bind(this),this._interceptControlDown=F0.bind(this),this._interceptControlUp=N0.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(hd),this.update(),this.state=it.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;Pt.copy(t).sub(this.target),Pt.applyQuaternion(this._quat),this._spherical.setFromVector3(Pt),this.autoRotate&&this.state===it.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=Kt:n>Math.PI&&(n-=Kt),i<-Math.PI?i+=Kt:i>Math.PI&&(i-=Kt),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(Pt.setFromSpherical(this._spherical),Pt.applyQuaternion(this._quatInverse),t.copy(this.target).add(Pt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){let o=Pt.length();a=this._clampDistance(o*this._scale);let c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){let o=new D(this._mouse.x,this._mouse.y,0);o.unproject(this.object);let c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;let l=new D(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=Pt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(zo.origin.copy(this.object.position),zo.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(zo.direction))<S0?this.object.lookAt(this.target):(ud.setFromNormalAndCoplanarPoint(this.object.up,this.target),zo.intersectPlane(ud,this.target))))}else if(this.object.isOrthographicCamera){let a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>yl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>yl||this._lastTargetPosition.distanceToSquared(this.target)>yl?(this.dispatchEvent(hd),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Kt/60*this.autoRotateSpeed*e:Kt/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Pt.setFromMatrixColumn(t,0),Pt.multiplyScalar(-e),this._panOffset.add(Pt)}_panUp(e,t){this.screenSpacePanning===!0?Pt.setFromMatrixColumn(t,1):(Pt.setFromMatrixColumn(t,0),Pt.crossVectors(this.object.up,Pt)),Pt.multiplyScalar(e),this._panOffset.add(Pt)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let i=this.object.position;Pt.copy(i).sub(this.target);let r=Pt.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,a=n.width,o=n.height;this._mouse.x=i/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Kt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Kt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Kt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Kt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Kt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Kt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Kt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Kt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Re,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function T0(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(s)&&(this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function A0(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function w0(s){switch(this._removePointer(s),this._pointers.length){case 0:this.domElement.releasePointerCapture(s.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(dd),this.state=it.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function E0(s){let e;switch(s.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case mi.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(s),this.state=it.DOLLY;break;case mi.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=it.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=it.ROTATE}break;case mi.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=it.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=it.PAN}break;default:this.state=it.NONE}this.state!==it.NONE&&this.dispatchEvent(Ml)}function R0(s){switch(this.state){case it.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(s);break;case it.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(s);break;case it.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(s);break}}function C0(s){this.enabled===!1||this.enableZoom===!1||this.state!==it.NONE||(s.preventDefault(),this.dispatchEvent(Ml),this._handleMouseWheel(this._customWheelEvent(s)),this.dispatchEvent(dd))}function P0(s){this.enabled!==!1&&this._handleKeyDown(s)}function I0(s){switch(this._trackPointer(s),this._pointers.length){case 1:switch(this.touches.ONE){case gi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(s),this.state=it.TOUCH_ROTATE;break;case gi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(s),this.state=it.TOUCH_PAN;break;default:this.state=it.NONE}break;case 2:switch(this.touches.TWO){case gi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(s),this.state=it.TOUCH_DOLLY_PAN;break;case gi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(s),this.state=it.TOUCH_DOLLY_ROTATE;break;default:this.state=it.NONE}break;default:this.state=it.NONE}this.state!==it.NONE&&this.dispatchEvent(Ml)}function D0(s){switch(this._trackPointer(s),this.state){case it.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(s),this.update();break;case it.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(s),this.update();break;case it.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(s),this.update();break;case it.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(s),this.update();break;default:this.state=it.NONE}}function L0(s){this.enabled!==!1&&s.preventDefault()}function F0(s){s.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function N0(s){s.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Sl(s,e){if(e===Kc)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===Ps||e===Cr){let t=s.getIndex();if(t===null){let a=[],o=s.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);s.setIndex(a),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}let n=t.count-2,i=[];if(e===Ps)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let r=s.clone();return r.setIndex(i),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}function fd(s){let e=new Map,t=new Map,n=s.clone();return pd(s,n,function(i,r){e.set(r,i),t.set(i,r)}),n.traverse(function(i){if(!i.isSkinnedMesh)return;let r=i,a=e.get(i),o=a.skeleton.bones;r.skeleton=a.skeleton.clone(),r.bindMatrix.copy(a.bindMatrix),r.skeleton.bones=o.map(function(c){return t.get(c)}),r.bind(r.skeleton,r.bindMatrix)}),n}function pd(s,e,t){t(s,e);for(let n=0;n<s.children.length;n++)pd(s.children[n],e.children[n],t)}var Vo=class extends Fn{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Pl(t)}),this.register(function(t){return new Il(t)}),this.register(function(t){return new zl(t)}),this.register(function(t){return new Gl(t)}),this.register(function(t){return new Vl(t)}),this.register(function(t){return new Ll(t)}),this.register(function(t){return new Fl(t)}),this.register(function(t){return new Nl(t)}),this.register(function(t){return new Ul(t)}),this.register(function(t){return new Cl(t)}),this.register(function(t){return new Ol(t)}),this.register(function(t){return new Dl(t)}),this.register(function(t){return new kl(t)}),this.register(function(t){return new Bl(t)}),this.register(function(t){return new El(t)}),this.register(function(t){return new Ho(t,Ve.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new Ho(t,Ve.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Hl(t)})}load(e,t,n,i){let r=this,a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){let l=$n.extractUrlBase(e);a=$n.resolveURL(l,this.path)}else a=$n.extractUrlBase(e);this.manager.itemStart(e);let o=function(l){i?i(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new Ts(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{r.parse(l,a,function(h){t(h),r.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r,a={},o={},c=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===xd){try{a[Ve.KHR_BINARY_GLTF]=new Wl(e)}catch(u){i&&i(u);return}r=JSON.parse(a[Ve.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new Zl(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){let u=this.pluginCallbacks[h](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){let u=r.extensionsUsed[h],d=r.extensionsRequired||[];switch(u){case Ve.KHR_MATERIALS_UNLIT:a[u]=new Rl;break;case Ve.KHR_DRACO_MESH_COMPRESSION:a[u]=new ql(r,this.dracoLoader);break;case Ve.KHR_TEXTURE_TRANSFORM:a[u]=new Xl;break;case Ve.KHR_MESH_QUANTIZATION:a[u]=new jl;break;default:d.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}};function U0(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}function yt(s,e,t){let n=s.json.materials[e];return n.extensions&&n.extensions[t]?n.extensions[t]:null}var Ve={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},El=class{constructor(e){this.parser=e,this.name=Ve.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],l,h=new Ae(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],Gt);let u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new Vi(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new Gi(h),l.distance=u;break;case"spot":l=new mr(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),kn(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(c){return n._getNodeRef(t.cache,o,c)})}},Rl=class{constructor(){this.name=Ve.KHR_MATERIALS_UNLIT}getMaterialType(){return xn}extendParams(e,t,n){let i=[];e.color=new Ae(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let a=r.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Gt),e.opacity=a[3]}r.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",r.baseColorTexture,_t))}return Promise.all(i)}},Cl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},Pl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Re(r,r)}return Promise.all(i)}},Il=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_DISPERSION}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}},Dl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(i)}},Ll=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_SHEEN}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Ae(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],Gt)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,_t)),n.sheenRoughnessTexture!==void 0&&i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(i)}},Fl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture)),Promise.all(i)}},Nl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_VOLUME}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new Ae().setRGB(r[0],r[1],r[2],Gt),Promise.all(i)}},Ul=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_IOR}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);return n===null||(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}},Ol=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_SPECULAR}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];return t.specularColor=new Ae().setRGB(r[0],r[1],r[2],Gt),n.specularColorTexture!==void 0&&i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,_t)),Promise.all(i)}},Bl=class{constructor(e){this.parser=e,this.name=Ve.EXT_MATERIALS_BUMP}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture)),Promise.all(i)}},kl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture)),Promise.all(i)}},zl=class{constructor(e){this.parser=e,this.name=Ve.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}},Gl=class{constructor(e){this.parser=e,this.name=Ve.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],o=i.images[a.source],c=n.textureLoader;if(o.uri){let l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}},Vl=class{constructor(e){this.parser=e,this.name=Ve.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],o=i.images[a.source],c=n.textureLoader;if(o.uri){let l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}},Ho=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(o){let c=i.byteOffset||0,l=i.byteLength||0,h=i.count,u=i.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,d,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){let f=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(f),h,u,d,i.mode,i.filter),f})})}else return null}},Hl=class{constructor(e){this.name=Ve.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let l of i.primitives)if(l.mode!==hn.TRIANGLES&&l.mode!==hn.TRIANGLE_STRIP&&l.mode!==hn.TRIANGLE_FAN&&l.mode!==void 0)return null;let a=n.extensions[this.name].attributes,o=[],c={};for(let l in a)o.push(this.parser.getDependency("accessor",a[l]).then(h=>(c[l]=h,c[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{let h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,f=[];for(let g of u){let y=new Oe,m=new D,p=new Et,x=new D(1,1,1),S=new Ui(g.geometry,g.material,d);for(let M=0;M<d;M++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,M),c.ROTATION&&p.fromBufferAttribute(c.ROTATION,M),c.SCALE&&x.fromBufferAttribute(c.SCALE,M),S.setMatrixAt(M,y.compose(m,p,x));for(let M in c)if(M==="_COLOR_0"){let E=c[M];S.instanceColor=new di(E.array,E.itemSize,E.normalized)}else M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE"&&g.geometry.setAttribute(M,c[M]);lt.prototype.copy.call(S,g),this.parser.assignFinalMaterial(S),f.push(S)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}},xd="glTF",Nr=12,md={JSON:1313821514,BIN:5130562},Wl=class{constructor(e){this.name=Ve.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,Nr),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==xd)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-Nr,r=new DataView(e,Nr),a=0;for(;a<i;){let o=r.getUint32(a,!0);a+=4;let c=r.getUint32(a,!0);if(a+=4,c===md.JSON){let l=new Uint8Array(e,Nr+a,o);this.content=n.decode(l)}else if(c===md.BIN){let l=Nr+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},ql=class{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ve.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(let h in a){let u=Yl[h]||h.toLowerCase();o[u]=a[h]}for(let h in e.attributes){let u=Yl[h]||h.toLowerCase();if(a[h]!==void 0){let d=n.accessors[e.attributes[h]],f=Ns[d.componentType];l[u]=f.name,c[u]=d.normalized===!0}}return t.getDependency("bufferView",r).then(function(h){return new Promise(function(u,d){i.decodeDracoFile(h,function(f){for(let g in f.attributes){let y=f.attributes[g],m=c[g];m!==void 0&&(y.normalized=m)}u(f)},o,l,Gt,d)})})}},Xl=class{constructor(){this.name=Ve.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}},jl=class{constructor(){this.name=Ve.KHR_MESH_QUANTIZATION}},Wo=class extends Pn{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[r+a];return t}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,h=i-t,u=(n-t)/h,d=u*u,f=d*u,g=e*l,y=g-l,m=-2*f+3*d,p=f-d,x=1-m,S=p-d+u;for(let M=0;M!==o;M++){let E=a[y+M+o],A=a[y+M+c]*h,C=a[g+M+o],_=a[g+M]*h;r[M]=x*E+S*A+m*C+p*_}return r}},O0=new Et,Kl=class extends Wo{interpolate_(e,t,n,i){let r=super.interpolate_(e,t,n,i);return O0.fromArray(r).normalize().toArray(r),r}},hn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ns={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},gd={9728:xt,9729:vt,9984:Xa,9985:Es,9986:Wi,9987:yn},bd={33071:on,33648:us,10497:ui},Tl={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Yl={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},yi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},B0={CUBICSPLINE:void 0,LINEAR:Li,STEP:Di},Al={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function k0(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new Cn({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:_n})),s.DefaultMaterial}function ji(s,e,t){for(let n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function kn(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function z0(s,e,t){let n=!1,i=!1,r=!1;for(let l=0,h=e.length;l<h;l++){let u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(s);let a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){let u=e[l];if(n){let d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):s.attributes.position;a.push(d)}if(i){let d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):s.attributes.normal;o.push(d)}if(r){let d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):s.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){let h=l[0],u=l[1],d=l[2];return n&&(s.morphAttributes.position=h),i&&(s.morphAttributes.normal=u),r&&(s.morphAttributes.color=d),s.morphTargetsRelative=!0,s})}function G0(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function V0(s){let e,t=s.extensions&&s.extensions[Ve.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+wl(t.attributes):e=s.indices+":"+wl(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+wl(s.targets[n]);return e}function wl(s){let e="",t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function Jl(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function H0(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":s.search(/\.ktx2($|\?)/i)>0||s.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var W0=new Oe,Zl=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new U0,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,a=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;let c=o.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,r=o.indexOf("Firefox")>-1,a=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||r&&a<98?this.textureLoader=new ur(this.options.manager):this.textureLoader=new gr(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ts(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){let o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return ji(r,o,i),kn(o,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){for(let c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let a=t[i].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){let a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),r=(a,o)=>{let c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(let[l,h]of a.children.entries())r(h,o.children[l])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Ve.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(r,a){n.load($n.resolveURL(t.uri,i.path),r,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let a=Tl[i.type],o=Ns[i.componentType],c=i.normalized===!0,l=new o(i.count*a);return Promise.resolve(new Tt(l,a,c))}let r=[];return i.bufferView!==void 0?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),i.sparse!==void 0&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(a){let o=a[0],c=Tl[i.type],l=Ns[i.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,g=i.normalized===!0,y,m;if(f&&f!==u){let p=Math.floor(d/f),x="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,S=t.cache.get(x);S||(y=new l(o,p*f,i.count*f/h),S=new bs(y,f/h),t.cache.add(x,S)),m=new _s(S,c,d%f/h,g)}else o===null?y=new l(i.count*c):y=new l(o,d,i.count*c),m=new Tt(y,c,g);if(i.sparse!==void 0){let p=Tl.SCALAR,x=Ns[i.sparse.indices.componentType],S=i.sparse.indices.byteOffset||0,M=i.sparse.values.byteOffset||0,E=new x(a[1],S,i.sparse.count*p),A=new l(a[2],M,i.sparse.count*c);o!==null&&(m=new Tt(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let C=0,_=E.length;C<_;C++){let w=E[C];if(m.setX(w,A[C*c]),c>=2&&m.setY(w,A[C*c+1]),c>=3&&m.setZ(w,A[C*c+2]),c>=4&&m.setW(w,A[C*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,a=t.images[r],o=this.textureLoader;if(a.uri){let c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){let i=this,r=this.json,a=r.textures[e],o=r.images[t],c=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[c])return this.textureCache[c];let l=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);let d=(r.samplers||{})[a.sampler]||{};return h.magFilter=gd[d.magFilter]||vt,h.minFilter=gd[d.minFilter]||yn,h.wrapS=bd[d.wrapS]||ui,h.wrapT=bd[d.wrapT]||ui,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==xt&&h.minFilter!==vt,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){let n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());let a=i.images[e],o=self.URL||self.webkitURL,c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(u){l=!0;let d=new Blob([u],{type:a.mimeType});return c=o.createObjectURL(d),c});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let h=Promise.resolve(c).then(function(u){return new Promise(function(d,f){let g=d;t.isImageBitmapLoader===!0&&(g=function(y){let m=new Dt(y);m.needsUpdate=!0,d(m)}),t.load($n.resolveURL(u,r.path),g,void 0,f)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),kn(u,a),u.userData.mimeType=a.mimeType||H0(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){let r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),r.extensions[Ve.KHR_TEXTURE_TRANSFORM]){let o=n.extensions!==void 0?n.extensions[Ve.KHR_TEXTURE_TRANSFORM]:void 0;if(o){let c=r.associations.get(a);a=r.extensions[Ve.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,c)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let o="PointsMaterial:"+n.uuid,c=this.cache.get(o);c||(c=new Ss,Ot.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(o,c)),n=c}else if(e.isLine){let o="LineBasicMaterial:"+n.uuid,c=this.cache.get(o);c||(c=new Ms,Ot.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(i||r||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),r&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let c=this.cache.get(o);c||(c=n.clone(),r&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(o,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return Cn}loadMaterial(e){let t=this,n=this.json,i=this.extensions,r=n.materials[e],a,o={},c=r.extensions||{},l=[];if(c[Ve.KHR_MATERIALS_UNLIT]){let u=i[Ve.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,r,t))}else{let u=r.pbrMetallicRoughness||{};if(o.color=new Ae(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){let d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],Gt),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,_t)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}r.doubleSided===!0&&(o.side=ln);let h=r.alphaMode||Al.OPAQUE;if(h===Al.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Al.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==xn&&(l.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Re(1,1),r.normalTexture.scale!==void 0)){let u=r.normalTexture.scale;o.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&a!==xn&&(l.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==xn){let u=r.emissiveFactor;o.emissive=new Ae().setRGB(u[0],u[1],u[2],Gt)}return r.emissiveTexture!==void 0&&a!==xn&&l.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,_t)),Promise.all(l).then(function(){let u=new a(o);return r.name&&(u.name=r.name),kn(u,r),t.associations.set(u,{materials:e}),r.extensions&&ji(i,u,r),u})}createUniqueName(e){let t=tt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[Ve.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return _d(c,o,t)})}let a=[];for(let o=0,c=e.length;o<c;o++){let l=e[o],h=V0(l),u=i[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[Ve.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=_d(new Ht,l,t),i[h]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let c=0,l=a.length;c<l;c++){let h=a[c].material===void 0?k0(this.cache):this.getDependency("material",a[c].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){let l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let f=0,g=h.length;f<g;f++){let y=h[f],m=a[f],p,x=l[f];if(m.mode===hn.TRIANGLES||m.mode===hn.TRIANGLE_STRIP||m.mode===hn.TRIANGLE_FAN||m.mode===void 0)p=r.isSkinnedMesh===!0?new er(y,x):new at(y,x),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),m.mode===hn.TRIANGLE_STRIP?p.geometry=Sl(p.geometry,Cr):m.mode===hn.TRIANGLE_FAN&&(p.geometry=Sl(p.geometry,Ps));else if(m.mode===hn.LINES)p=new nr(y,x);else if(m.mode===hn.LINE_STRIP)p=new Oi(y,x);else if(m.mode===hn.LINE_LOOP)p=new ir(y,x);else if(m.mode===hn.POINTS)p=new sr(y,x);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(p.geometry.morphAttributes).length>0&&G0(p,r),p.name=t.createUniqueName(r.name||"mesh_"+e),kn(p,r),m.extensions&&ji(i,p,m),t.assignFinalMaterial(p),u.push(p)}for(let f=0,g=u.length;f<g;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return r.extensions&&ji(i,u[0],r),u[0];let d=new gn;r.extensions&&ji(i,d,r),t.associations.set(d,{meshes:e});for(let f=0,g=u.length;f<g;f++)d.add(u[f]);return d})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new St(Ir.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new pi(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),kn(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){let r=i.pop(),a=i,o=[],c=[];for(let l=0,h=a.length;l<h;l++){let u=a[l];if(u){o.push(u);let d=new Oe;r!==null&&d.fromArray(r.array,l*16),c.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new tr(o,c)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],c=[],l=[],h=[];for(let u=0,d=i.channels.length;u<d;u++){let f=i.channels[u],g=i.samplers[f.sampler],y=f.target,m=y.node,p=i.parameters!==void 0?i.parameters[g.input]:g.input,x=i.parameters!==void 0?i.parameters[g.output]:g.output;y.node!==void 0&&(a.push(this.getDependency("node",m)),o.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",x)),l.push(g),h.push(y))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){let d=u[0],f=u[1],g=u[2],y=u[3],m=u[4],p=[];for(let S=0,M=d.length;S<M;S++){let E=d[S],A=f[S],C=g[S],_=y[S],w=m[S];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();let L=n._createAnimationTracks(E,A,C,_,w);if(L)for(let R=0;R<L.length;R++)p.push(L[R])}let x=new ki(r,void 0,p);return kn(x,i),x})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(r){let a=n._getNodeRef(n.meshCache,i.mesh,r);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=i.weights.length;c<l;c++)o.morphTargetInfluences[c]=i.weights[c]}),a})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),a=[],o=i.children||[];for(let l=0,h=o.length;l<h;l++)a.push(n.getDependency("node",o[l]));let c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(a),c]).then(function(l){let h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(d,W0)});for(let f=0,g=u.length;f<g;f++)h.add(u[f]);if(h.userData.pivot!==void 0&&u.length>0){let f=h.userData.pivot,g=u[0];h.pivot=new D().fromArray(f),h.position.x-=f[0],h.position.y-=f[1],h.position.z-=f[2],g.position.set(0,0,0),delete h.userData.pivot}return h})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),r.camera!==void 0&&o.push(i.getDependency("camera",r.camera).then(function(l){return i._getNodeRef(i.cameraCache,r.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){o.push(l)}),this.nodeCache[e]=Promise.all(o).then(function(l){let h;if(r.isBone===!0?h=new xs:l.length>1?h=new gn:l.length===1?h=l[0]:h=new lt,h!==l[0])for(let u=0,d=l.length;u<d;u++)h.add(l[u]);if(r.name&&(h.userData.name=r.name,h.name=a),kn(h,r),r.extensions&&ji(n,h,r),r.matrix!==void 0){let u=new Oe;u.fromArray(r.matrix),h.applyMatrix4(u)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);if(!i.associations.has(h))i.associations.set(h,{});else if(r.mesh!==void 0&&i.meshCache.refs[r.mesh]>1){let u=i.associations.get(h);i.associations.set(h,{...u})}return i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,r=new gn;n.name&&(r.name=i.createUniqueName(n.name)),kn(r,n),n.extensions&&ji(t,r,n);let a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(i.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let h=0,u=c.length;h<u;h++){let d=c[h];d.parent!==null?r.add(fd(d)):r.add(d)}let l=h=>{let u=new Map;for(let[d,f]of i.associations)(d instanceof Ot||d instanceof Dt)&&u.set(d,f);return h.traverse(d=>{let f=i.associations.get(d);f!=null&&u.set(d,f)}),u};return i.associations=l(r),r})}_createAnimationTracks(e,t,n,i,r){let a=[],o=e.name?e.name:e.uuid,c=[];function l(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}yi[r.path]===yi.weights?(l(e),e.isGroup&&e.children.forEach(l)):c.push(o);let h;switch(yi[r.path]){case yi.weights:h=In;break;case yi.rotation:h=Dn;break;case yi.translation:case yi.scale:h=Ln;break;default:n.itemSize===1?h=In:h=Ln;break}let u=i.interpolation!==void 0?B0[i.interpolation]:Li,d=this._getArrayFromAccessor(n);for(let f=0,g=c.length;f<g;f++){let y=new h(c[f]+"."+yi[r.path],t.array,d,u);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(y),a.push(y)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=Jl(t.constructor),i=new Float32Array(t.length);for(let r=0,a=t.length;r<a;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){let i=this instanceof Dn?Kl:Wo;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function q0(s,e,t){let n=e.attributes,i=new Vt;if(n.POSITION!==void 0){let o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(i.set(new D(c[0],c[1],c[2]),new D(l[0],l[1],l[2])),o.normalized){let h=Jl(Ns[o.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let r=e.targets;if(r!==void 0){let o=new D,c=new D;for(let l=0,h=r.length;l<h;l++){let u=r[l];if(u.POSITION!==void 0){let d=t.json.accessors[u.POSITION],f=d.min,g=d.max;if(f!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(g[2]))),d.normalized){let y=Jl(Ns[d.componentType]);c.multiplyScalar(y)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}s.boundingBox=i;let a=new Wt;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=a}function _d(s,e,t){let n=e.attributes,i=[];function r(a,o){return t.getDependency("accessor",a).then(function(c){s.setAttribute(o,c)})}for(let a in n){let o=Yl[a]||a.toLowerCase();o in s.attributes||i.push(r(n[a],o))}if(e.indices!==void 0&&!s.index){let a=t.getDependency("accessor",e.indices).then(function(o){s.setIndex(o)});i.push(a)}return ze.workingColorSpace!==Gt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ze.workingColorSpace}" not supported.`),kn(s,e),q0(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?z0(s,e.targets,t):s})}var qo=class extends Ni{constructor(){super(),this.name="RoomEnvironment",this.position.y=-3.5;let e=new fi;e.deleteAttribute("uv");let t=new Cn({side:Lt}),n=new Cn,i=new Gi(16777215,900,28,2);i.position.set(.418,16.199,.3),this.add(i);let r=new at(e,t);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);let a=new Ui(e,n,6),o=new lt;o.position.set(-10.906,2.009,1.846),o.rotation.set(0,-.195,0),o.scale.set(2.328,7.905,4.651),o.updateMatrix(),a.setMatrixAt(0,o.matrix),o.position.set(-5.607,-.754,-.758),o.rotation.set(0,.994,0),o.scale.set(1.97,1.534,3.955),o.updateMatrix(),a.setMatrixAt(1,o.matrix),o.position.set(6.167,.857,7.803),o.rotation.set(0,.561,0),o.scale.set(3.927,6.285,3.687),o.updateMatrix(),a.setMatrixAt(2,o.matrix),o.position.set(-2.017,.018,6.124),o.rotation.set(0,.333,0),o.scale.set(2.002,4.566,2.064),o.updateMatrix(),a.setMatrixAt(3,o.matrix),o.position.set(2.291,-.756,-2.621),o.rotation.set(0,-.286,0),o.scale.set(1.546,1.552,1.496),o.updateMatrix(),a.setMatrixAt(4,o.matrix),o.position.set(-2.193,-.369,-5.547),o.rotation.set(0,.516,0),o.scale.set(3.875,3.487,2.986),o.updateMatrix(),a.setMatrixAt(5,o.matrix),this.add(a);let c=new at(e,Us(50));c.position.set(-16.116,14.37,8.208),c.scale.set(.1,2.428,2.739),this.add(c);let l=new at(e,Us(50));l.position.set(-16.109,18.021,-8.207),l.scale.set(.1,2.425,2.751),this.add(l);let h=new at(e,Us(17));h.position.set(14.904,12.198,-1.832),h.scale.set(.15,4.265,6.331),this.add(h);let u=new at(e,Us(43));u.position.set(-.462,8.89,14.52),u.scale.set(4.38,5.441,.088),this.add(u);let d=new at(e,Us(20));d.position.set(3.235,11.486,-12.541),d.scale.set(2.5,2,.1),this.add(d);let f=new at(e,Us(100));f.position.set(0,20,0),f.scale.set(1,.1,1),this.add(f)}dispose(){let e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(let t of e)t.dispose()}};function Us(s){return new cr({color:0,emissive:16777215,emissiveIntensity:s})}var $l=(function(){var s="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaocwffagRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbahaocdffagRb:q:W:cjbfhokalcdfhlaiczfgiaQ6mbkkaohAaoTmoka8EaQfh8Ea5cefg5cl9hmbkdndndndnawTmbaza8Acd4fRbbglciGPlbedwbkaQTmdavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep9Ta8Fpxeeeeeeeeeeeeeeeegap9op9Hp9rg8Fa8Jp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ugap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp9Ugap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp9Ugap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9AbbbaladfhlaoczfgoaQ6mbxikkaQTmeavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep:nea8Fpxebebebebebebebebgap9op:bep9rg8Fa8Jp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oegap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp:oegap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp:oegap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9AbbbaladfhlaoczfgoaQ6mbxdkkaQTmbcbhocbalcl4gl9Rc8FGhiavcjdfa8Afhrava8Afpbdbhainaravcj;cbfaofpblbg8JaYaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaLaofpblbg8MaKaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Faap9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8LaypmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var i=WebAssembly.validate(t)?o(e):o(s),r,a=WebAssembly.instantiate(i,{}).then(function(p){r=p.instance,r.exports.__wasm_call_ctors()});function o(p){for(var x=new Uint8Array(p.length),S=0;S<p.length;++S){var M=p.charCodeAt(S);x[S]=M>96?M-97:M>64?M-39:M+4}for(var E=0,S=0;S<p.length;++S)x[E++]=x[S]<60?n[x[S]]:(x[S]-60)*64+x[++S];return x.buffer.slice(0,E)}function c(p,x,S,M,E,A,C){var _=p.exports.sbrk,w=M+3&-4,L=_(w*E),R=_(A.length),O=new Uint8Array(p.exports.memory.buffer);O.set(A,R);var H=x(L,M,E,R,A.length);if(H==0&&C&&C(L,w,E),S.set(O.subarray(L,L+M*E)),_(L-_(0)),H!=0)throw new Error("Malformed buffer data: "+H)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],d=0;function f(p){var x={object:new Worker(p),pending:0,requests:{}};return x.object.onmessage=function(S){var M=S.data;x.pending-=M.count,x.requests[M.id][M.action](M.value),delete x.requests[M.id]},x}function g(p){for(var x="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(i)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+m.name+";"+c.toString()+m.toString(),S=new Blob([x],{type:"text/javascript"}),M=URL.createObjectURL(S),E=u.length;E<p;++E)u[E]=f(M);for(var E=p;E<u.length;++E)u[E].object.postMessage({});u.length=p,URL.revokeObjectURL(M)}function y(p,x,S,M,E){for(var A=u[0],C=1;C<u.length;++C)u[C].pending<A.pending&&(A=u[C]);return new Promise(function(_,w){var L=new Uint8Array(S),R=++d;A.pending+=p,A.requests[R]={resolve:_,reject:w},A.object.postMessage({id:R,count:p,size:x,source:L,mode:M,filter:E},[L.buffer])})}function m(p){var x=p.data;self.ready.then(function(S){if(!x.id)return self.close();try{var M=new Uint8Array(x.count*x.size);c(S,S.exports[x.mode],M,x.count,x.size,x.source,S.exports[x.filter]),self.postMessage({id:x.id,count:x.count,action:"resolve",value:M},[M.buffer])}catch(E){self.postMessage({id:x.id,count:x.count,action:"reject",value:E})}})}return{ready:a,supported:!0,useWorkers:function(p){g(p)},decodeVertexBuffer:function(p,x,S,M,E){c(r,r.exports.meshopt_decodeVertexBuffer,p,x,S,M,r.exports[l[E]])},decodeIndexBuffer:function(p,x,S,M){c(r,r.exports.meshopt_decodeIndexBuffer,p,x,S,M)},decodeIndexSequence:function(p,x,S,M){c(r,r.exports.meshopt_decodeIndexSequence,p,x,S,M)},decodeGltfBuffer:function(p,x,S,M,E,A){c(r,r.exports[h[E]],p,x,S,M,r.exports[l[A]])},decodeGltfBufferAsync:function(p,x,S,M,E){return u.length>0?y(p,x,S,h[M],l[E]):a.then(function(){var A=new Uint8Array(p*x);return c(r,r.exports[h[M]],A,p,x,S,r.exports[l[E]]),A})}}})();var Ql=window.matchMedia("(prefers-reduced-motion: reduce)").matches,eh={dark:{bg:658448,css:"#0a0c10",text:"#e8eaed",muted:"#9aa3ad",panel:"rgba(13,16,21,0.72)",stroke:"rgba(255,255,255,0.12)"},light:{bg:15659509,css:"#eef1f5",text:"#15181d",muted:"#5b636d",panel:"rgba(255,255,255,0.78)",stroke:"rgba(0,0,0,0.10)"}};function Xo(s,e){if(!s||typeof s!="object")return"";for(let t of e){let n=s[t];if(typeof n=="string"&&/^https?:\/\//i.test(n))return n}return""}function X0(){let s=typeof window.openai=="object"&&window.openai&&window.openai.toolOutput||null;if(s)return{glb:Xo(s,["glb_url","glbUrl","model_url","modelUrl","url"]),viewer:Xo(s,["viewer_url","viewerUrl","view_url","viewUrl","preview"]),name:typeof s.name=="string"?s.name:typeof s.prompt=="string"?s.prompt:"",source:"host"};let e=new URLSearchParams(location.search),t=location.hash.length>1?decodeURIComponent(location.hash.slice(1)):"";return{glb:Xo({u:e.get("glb")||t},["u"]),viewer:Xo({u:e.get("viewer")||""},["u"]),name:e.get("name")||"",source:"standalone"}}function j0(){let s=typeof window.openai=="object"&&window.openai&&window.openai.theme||"",e=(typeof s=="string"?s:s?.mode)||"";return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}var K0={download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>',external:'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>',reset:'<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>',rotate:'<path d="M23 4v6h-6"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>',warn:'<circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>',cube:'<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>'};function vd(s){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'+(K0[s]||"")+"</svg>"}var Y0=`-:root{color-scheme:dark light}-*{box-sizing:border-box}-html,body{margin:0;height:100%;overflow:hidden;font-family:ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;-webkit-font-smoothing:antialiased}-#studio-stage{position:fixed;inset:0}-#studio-stage canvas{display:block;width:100%;height:100%;outline:none}-.sv-hud{position:fixed;left:12px;top:12px;right:12px;display:flex;gap:8px;pointer-events:none;opacity:0;transition:opacity .5s ease}-.sv-hud.on{opacity:1}-.sv-title{max-width:70%;padding:6px 11px;font-size:12.5px;line-height:1.35;border-radius:9px;border:1px solid var(--sv-stroke);background:var(--sv-panel);color:var(--sv-text);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}-.sv-bar{position:fixed;left:50%;bottom:12px;transform:translateX(-50%) translateY(8px);display:flex;gap:5px;padding:5px;border-radius:13px;border:1px solid var(--sv-stroke);background:var(--sv-panel);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);box-shadow:0 10px 30px rgba(0,0,0,.34);opacity:0;transition:opacity .5s ease,transform .5s ease;max-width:calc(100vw - 24px);flex-wrap:wrap;justify-content:center}-.sv-bar.on{opacity:1;transform:translateX(-50%) translateY(0)}-.sv-btn{appearance:none;border:1px solid transparent;background:transparent;color:var(--sv-text);font:inherit;font-size:12.5px;font-weight:600;display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:9px;cursor:pointer;text-decoration:none;white-space:nowrap;transition:background .15s ease,border-color .15s ease}-.sv-btn:hover{background:var(--sv-hover)}-.sv-btn:active{background:var(--sv-active)}-.sv-btn:focus-visible{outline:none;border-color:#18e0c8;box-shadow:0 0 0 2px rgba(24,224,200,.4)}-.sv-btn[aria-pressed=true]{background:rgba(124,92,255,.22);border-color:rgba(124,92,255,.5)}-.sv-btn.primary{background:linear-gradient(90deg,#7c5cff,#6b8bff);color:#fff;border-color:transparent}-.sv-btn.primary:hover{filter:brightness(1.08);background:linear-gradient(90deg,#7c5cff,#6b8bff)}-.sv-btn svg{width:15px;height:15px;flex:0 0 auto}-@media (max-width:540px){.sv-btn .lbl{display:none}.sv-btn{padding:9px 10px}}-.sv-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:20px;transition:opacity .4s ease}-.sv-overlay.hidden{opacity:0;pointer-events:none}-.sv-card{width:min(420px,90%);padding:24px;border-radius:16px;border:1px solid var(--sv-stroke);background:var(--sv-panel);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);text-align:center;box-shadow:0 20px 50px rgba(0,0,0,.4)}-.sv-spinner{width:30px;height:30px;margin:0 auto 14px}-.sv-spinner circle{fill:none;stroke:#18e0c8;stroke-width:4;stroke-linecap:round;stroke-dasharray:90 150;transform-origin:center;animation:sv-spin 1s linear infinite}-@keyframes sv-spin{to{transform:rotate(360deg)}}-.sv-ic{width:44px;height:44px;margin:0 auto 14px;display:grid;place-items:center;border-radius:50%;color:#18e0c8}-.sv-ic.err{color:#ff6b6b;background:rgba(255,107,107,.13)}-.sv-ic.empty{color:var(--sv-muted);background:var(--sv-hover)}-.sv-ic svg{width:24px;height:24px}-.sv-ttl{font-size:16px;font-weight:700;color:var(--sv-text);margin-bottom:7px}-.sv-msg{font-size:13px;line-height:1.5;color:var(--sv-muted);margin-bottom:18px}-.sv-acts{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}-.sv-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}-`,Sd=s=>document.getElementById(s),th=class{constructor(e){this.host=e,this.theme=eh[j0()]||eh.dark,this.autoRotate=!Ql,this.disposed=!1,this.frameInfo=null,this.glbUrl=null,this.objectUrl=null,this._applyThemeVars(),this._buildChrome()}_applyThemeVars(){let e=this.theme,t=e===eh.light;document.documentElement.style.setProperty("--sv-text",e.text),document.documentElement.style.setProperty("--sv-muted",e.muted),document.documentElement.style.setProperty("--sv-panel",e.panel),document.documentElement.style.setProperty("--sv-stroke",e.stroke),document.documentElement.style.setProperty("--sv-hover",t?"rgba(0,0,0,0.06)":"rgba(255,255,255,0.08)"),document.documentElement.style.setProperty("--sv-active",t?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.14)"),document.body.style.background=e.css}_buildChrome(){let e=document.createElement("header");e.className="sv-hud",e.id="sv-hud",e.innerHTML='<div class="sv-title" id="sv-title"></div>';let t=document.createElement("nav");t.className="sv-bar",t.id="sv-bar",t.setAttribute("aria-label","Model controls");let n=document.createElement("div");n.className="sv-overlay",n.id="sv-overlay",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),this.host.append(e,t,n),this.hud=e,this.bar=t,this.overlay=n}showLoading(e){this.overlay.classList.remove("hidden"),this.overlay.innerHTML='<div class="sv-card"><svg class="sv-spinner" viewBox="0 0 50 50" aria-hidden="true"><circle cx="25" cy="25" r="20"/></svg><div class="sv-ttl">'+yd(e||"Loading 3D model\u2026")+'</div><div class="sv-msg">Rendering your generated model</div></div>'}hideOverlay(){this.overlay.classList.add("hidden")}showState({kind:e,title:t,msg:n,actions:i}){this.overlay.classList.remove("hidden");let r=document.createElement("div");r.className="sv-card";let a=document.createElement("div");a.className="sv-ic "+(e==="error"?"err":"empty"),a.innerHTML=vd(e==="error"?"warn":"cube");let o=document.createElement("div");o.className="sv-ttl",o.textContent=t;let c=document.createElement("div");c.className="sv-msg",c.textContent=n;let l=document.createElement("div");l.className="sv-acts";for(let h of i||[])l.appendChild(this._mkBtn(h));r.append(a,o,c,l),this.overlay.replaceChildren(r)}_mkBtn({icon:e,label:t,onClick:n,href:i,primary:r,pressed:a,aria:o}){let c=document.createElement(i?"a":"button");return c.className="sv-btn"+(r?" primary":""),c.innerHTML=(e?vd(e):"")+'<span class="lbl">'+yd(t)+"</span>",c.setAttribute("aria-label",o||t),a!==void 0&&c.setAttribute("aria-pressed",String(a)),i?(c.href=i,c.target="_blank",c.rel="noopener noreferrer"):n&&(c.type="button",c.addEventListener("click",n)),c}initThree(){let e=document.createElement("canvas");e.setAttribute("aria-label","3D model viewer \u2014 drag to orbit"),e.tabIndex=0,this.host.insertBefore(e,this.host.firstChild);try{this.renderer=new Oo({canvas:e,antialias:!0,alpha:!1})}catch{return!1}let t=this.renderer;t.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),t.setSize(this.w(),this.h(),!1),t.outputColorSpace=_t,t.toneMapping=yr,t.toneMappingExposure=1.05,t.shadowMap.enabled=!0,t.shadowMap.type=Va,this.scene=new Ni,this.scene.background=new Ae(this.theme.bg),this.pmrem=new Ls(t),this.scene.environment=this.pmrem.fromScene(new qo,.04).texture,this.camera=new St(45,this.w()/this.h(),.01,2e3),this.camera.position.set(0,1.1,3.2),this.controls=new Go(this.camera,e),this.controls.enableDamping=!0,this.controls.dampingFactor=.07,this.controls.autoRotate=this.autoRotate,this.controls.autoRotateSpeed=1.3,this.controls.listenToKeyEvents(e),this.controls.addEventListener("start",()=>{this.autoRotate&&(this.autoRotate=!1,this.controls.autoRotate=!1,this._syncRotate())});let n=new Vi(16777215,2);return n.position.set(4,7,5),n.castShadow=!0,n.shadow.mapSize.set(2048,2048),n.shadow.bias=-4e-4,n.shadow.normalBias=.02,this.scene.add(n),this.scene.add(new dr(12571903,1053466,.35)),this.clock=new _r,this._onResize=()=>this.resize(),window.addEventListener("resize",this._onResize),this._ro=new ResizeObserver(()=>this.resize()),this._ro.observe(document.body),t.setAnimationLoop(()=>this.render()),!0}w(){return Math.max(1,window.innerWidth)}h(){let e=Number(typeof window.openai=="object"&&window.openai&&window.openai.maxHeight)||0;return Math.max(1,e>0?Math.min(window.innerHeight,e):window.innerHeight)}resize(){this.disposed||!this.renderer||(this.renderer.setSize(this.w(),this.h(),!1),this.camera.aspect=this.w()/this.h(),this.camera.updateProjectionMatrix())}render(){if(this.disposed)return;let e=this.clock.getDelta();this.mixer&&this.mixer.update(e),this.controls&&this.controls.update(),this.renderer.render(this.scene,this.camera)}frame(e){let t=new Vt().setFromObject(e),n=t.getSize(new D),i=t.getCenter(new D),r=Math.max(n.x,n.y,n.z)||1;e.position.sub(i);let a=r/2/Math.tan(this.camera.fov*Math.PI/360)*1.5;this.camera.near=r/100,this.camera.far=r*100,this.camera.updateProjectionMatrix(),this.controls.minDistance=r*.4,this.controls.maxDistance=r*6,this.frameInfo={dist:a,height:r*.18},this.resetView(!0);let o=new at(new Bi(r*12,r*12),new or({opacity:.26}));o.rotation.x=-Math.PI/2,o.position.y=-n.y/2,o.receiveShadow=!0,this.scene.add(o),this.ground=o}resetView(e){if(!this.frameInfo)return;let{dist:t,height:n}=this.frameInfo,i=new D(0,n,t);if(this.controls.target.set(0,0,0),e||Ql){this.camera.position.copy(i);return}let r=this.camera.position.clone(),a=performance.now(),o=()=>{if(this.disposed)return;let c=Math.min(1,(performance.now()-a)/450);this.camera.position.lerpVectors(r,i,1-Math.pow(1-c,3)),c<1&&requestAnimationFrame(o)};o()}fadeIn(e){let t=[];if(e.traverse(r=>{if(r.isMesh){r.castShadow=!0,r.receiveShadow=!0;for(let a of Array.isArray(r.material)?r.material:[r.material])a&&(a.userData._t=a.transparent,a.userData._o=a.opacity,a.transparent=!0,a.opacity=0,t.push(a))}}),Ql){for(let r of t)r.transparent=r.userData._t??!1,r.opacity=r.userData._o??1,r.needsUpdate=!0;return}let n=performance.now(),i=()=>{if(this.disposed)return;let r=Math.min(1,(performance.now()-n)/550);for(let a of t)a.opacity=(a.userData._o??1)*r;if(r<1)requestAnimationFrame(i);else for(let a of t)a.transparent=a.userData._t??!1,a.opacity=a.userData._o??1,a.needsUpdate=!0};i()}pickIdle(e){return!e||!e.length?null:e.find(t=>/idle|breath|stand|loop|rest/i.test(t.name||""))||e[0]}async load(e){if(this.glbUrl=e.glb,this.viewerUrl=e.viewer||(e.glb?"https://three.ws/viewer?src="+encodeURIComponent(e.glb):"https://three.ws/forge"),this.modelName=(e.name||"").trim(),!this.glbUrl)return this.showState({kind:"empty",title:"No model yet",msg:"Ask three.ws 3D Studio to generate a 3D model \u2014 e.g. \u201Cmake a friendly robot mascot\u201D \u2014 and it will appear here.",actions:[{label:"Open three.ws Studio",href:"https://three.ws/forge",primary:!0,icon:"external"}]});if(!this.renderer&&!this.initThree())return this.showState({kind:"error",title:"3D not supported here",msg:"This device or browser can\u2019t render WebGL. You can still download the model or open it on three.ws.",actions:[{label:"Download GLB",href:this.glbUrl,primary:!0,icon:"download"},{label:"Open on three.ws",href:this.viewerUrl,icon:"external"}]});this.showLoading("Loading 3D model\u2026");let t=new Vo;if($l)try{t.setMeshoptDecoder($l)}catch{}let n=this.glbUrl;try{let i=await fetch(this.glbUrl,{mode:"cors",credentials:"omit"});if(i.ok){let r=await i.blob();this.objectUrl=URL.createObjectURL(r),n=this.objectUrl}}catch{}t.load(n,i=>{if(this.disposed)return;this.disposeModel();let r=i.scene||i.scenes?.[0];if(!r)return this.failLoad();this.model=r,this.scene.add(r),this.frame(r),this.fadeIn(r);let a=this.pickIdle(i.animations);a&&(this.mixer=new br(r),this.mixer.clipAction(a).play(),this.rigged=!0),this.reveal()},void 0,()=>{this.disposed||this.failLoad()})}failLoad(){this.showState({kind:"error",title:"Couldn\u2019t load the model",msg:"The generated file didn\u2019t load \u2014 it may have expired. Generate it again, or open it on three.ws.",actions:[{label:"Download GLB",href:this.glbUrl,primary:!0,icon:"download"},{label:"Open on three.ws",href:this.viewerUrl,icon:"external"}]})}reveal(){this.hideOverlay(),this.buildHud(),this.buildBar(),requestAnimationFrame(()=>{this.hud.classList.add("on"),this.bar.classList.add("on")})}buildHud(){let e=Sd("sv-title");this.modelName?e.textContent=this.modelName:e.style.display="none"}_syncRotate(){this._rotBtn&&this._rotBtn.setAttribute("aria-pressed",String(this.autoRotate))}buildBar(){this.bar.replaceChildren(),this.bar.appendChild(this._mkBtn({icon:"download",label:"Download",aria:"Download GLB",onClick:()=>this.download()})),this._rotBtn=this._mkBtn({icon:"rotate",label:"Spin",pressed:this.autoRotate,onClick:()=>{this.autoRotate=!this.autoRotate,this.controls.autoRotate=this.autoRotate,this._syncRotate()}}),this.bar.appendChild(this._rotBtn),this.bar.appendChild(this._mkBtn({icon:"reset",label:"Recenter",aria:"Recenter camera",onClick:()=>this.resetView(!1)})),this.bar.appendChild(this._mkBtn({icon:"external",label:"Open in three.ws",aria:"Open in three.ws",href:this.viewerUrl,primary:!0}))}async download(){let e=(this.modelName?this.modelName.slice(0,40).replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,""):"studio-model")||"studio-model";try{let t=this.objectUrl;if(!t){let i=await fetch(this.glbUrl,{mode:"cors",credentials:"omit"});if(!i.ok)throw new Error("fetch failed");t=URL.createObjectURL(await i.blob())}let n=document.createElement("a");n.href=t,n.download=e+".glb",document.body.appendChild(n),n.click(),n.remove(),t!==this.objectUrl&&setTimeout(()=>URL.revokeObjectURL(t),4e3)}catch{window.open(this.glbUrl,"_blank","noopener,noreferrer")}}disposeModel(){this.mixer&&(this.mixer.stopAllAction(),this.mixer=null),this.model&&(this.scene.remove(this.model),this.model.traverse(e=>{if(e.isMesh){e.geometry?.dispose?.();for(let t of Array.isArray(e.material)?e.material:[e.material])J0(t)}}),this.model=null),this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null)}dispose(){this.disposed||(this.disposed=!0,window.removeEventListener("resize",this._onResize),this._ro?.disconnect(),this.disposeModel(),this.ground?.geometry?.dispose?.(),this.ground?.material?.dispose?.(),this.controls?.dispose?.(),this.pmrem?.dispose?.(),this.scene?.environment&&this.scene.environment.dispose?.(),this.renderer&&(this.renderer.setAnimationLoop(null),this.renderer.dispose()))}};function J0(s){if(s){for(let e of Object.keys(s)){let t=s[e];t&&t.isTexture&&t.dispose()}s.dispose?.()}}function yd(s){return String(s).replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Md(){let s=document.createElement("style");s.textContent=Y0,document.head.appendChild(s);let e=Sd("studio-stage");e||(e=document.createElement("div"),e.id="studio-stage",document.body.appendChild(e));let t=new th(e);t.showLoading("Preparing viewer\u2026");let n=null,i=()=>{let r=X0();r.glb===n&&n!==null||(n=r.glb,t.load(r))};i(),window.addEventListener("openai:set_globals",i),window.addEventListener("pagehide",()=>t.dispose(),{once:!0})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Md):Md();})();diff --git a/public/apps-sdk/studio-viewer.html b/public/apps-sdk/studio-viewer.htmldeleted file mode 100644index c4313af7e..000000000--- a/public/apps-sdk/studio-viewer.html+++ /dev/null@@ -1,4151 +0,0 @@-<!doctype html>-<html lang="en">-<head>-<meta charset="utf-8">-<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">-<title>three.ws 3D Studio — viewer</title>-<style>html,body{margin:0;height:100%;background:#0a0c10;overflow:hidden}</style>-</head>-<body>-<div id="studio-stage"></div>-<script>"use strict";(()=>{var mi={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},gi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Xh=0,Ic=1,jh=2;var vr=1,Va=2,ws=3,_n=0,Lt=1,ln=2,Nn=0,Pi=1,Dc=2,Lc=3,Fc=4,Kh=5;var hi=100,Yh=101,Jh=102,Zh=103,$h=104,Qh=200,eu=201,tu=202,nu=203,ua=204,da=205,iu=206,su=207,ru=208,au=209,ou=210,cu=211,lu=212,hu=213,uu=214,fa=0,pa=1,ma=2,Ii=3,ga=4,ba=5,_a=6,xa=7,Ha=0,du=1,fu=2,vn=0,Nc=1,Uc=2,Oc=3,yr=4,Bc=5,kc=6,zc=7,yc="attached",pu="detached",Gc=300,bi=301,Hi=302,Wa=303,qa=304,Mr=306,ui=1e3,on=1001,us=1002,xt=1003,Xa=1004;var Wi=1005;var vt=1006,Es=1007;var yn=1008;var jt=1009,Vc=1010,Hc=1011,Rs=1012,ja=1013,Mn=1014,tn=1015,Un=1016,Ka=1017,Ya=1018,Cs=1020,Wc=35902,qc=35899,Xc=1021,jc=1022,nn=1023,En=1026,_i=1027,Ja=1028,Za=1029,xi=1030,$a=1031;var Qa=1033,Sr=33776,Tr=33777,Ar=33778,wr=33779,eo=35840,to=35841,no=35842,io=35843,so=36196,ro=37492,ao=37496,oo=37488,co=37489,Er=37490,lo=37491,ho=37808,uo=37809,fo=37810,po=37811,mo=37812,go=37813,bo=37814,_o=37815,xo=37816,vo=37817,yo=37818,Mo=37819,So=37820,To=37821,Ao=36492,wo=36494,Eo=36495,Ro=36283,Co=36284,Rr=36285,Po=36286,mu=2200,gu=2201,bu=2202,Di=2300,Li=2301,ha=2302,Mc=2303,Ri=2400,Ci=2401,js=2402,Io=2500,_u=2501,Kc=0,Cr=1,Ps=2,xu=3200;var Pr=0,vu=1,Qn="",_t="srgb",Gt="srgb-linear",Ks="linear",Ye="srgb";var Ei=7680;var Sc=519,yu=512,Mu=513,Su=514,Do=515,Tu=516,Au=517,Lo=518,wu=519,va=35044;var Yc="300 es",mn=2e3,ds=2001;function Dd(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}function Ld(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function fs(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function Eu(){let s=fs("canvas");return s.style.display="block",s}var hh={},ps=null;function Ys(...s){let e="THREE."+s.shift();ps?ps("log",e,...s):console.log(e,...s)}function Ru(s){let e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function _e(...s){s=Ru(s);let e="THREE."+s.shift();if(ps)ps("warn",e,...s);else{let t=s[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...s)}}function we(...s){s=Ru(s);let e="THREE."+s.shift();if(ps)ps("error",e,...s);else{let t=s[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...s)}}function ya(...s){let e=s.join(" ");e in hh||(hh[e]=!0,_e(...s))}function Cu(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}var Pu={[fa]:pa,[ma]:_a,[ga]:xa,[Ii]:ba,[pa]:fa,[_a]:ma,[xa]:ga,[ba]:Ii},cn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}},Nt=["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"],uh=1234567,qs=Math.PI/180,Fi=180/Math.PI;function bn(){let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Nt[s&255]+Nt[s>>8&255]+Nt[s>>16&255]+Nt[s>>24&255]+"-"+Nt[e&255]+Nt[e>>8&255]+"-"+Nt[e>>16&15|64]+Nt[e>>24&255]+"-"+Nt[t&63|128]+Nt[t>>8&255]+"-"+Nt[t>>16&255]+Nt[t>>24&255]+Nt[n&255]+Nt[n>>8&255]+Nt[n>>16&255]+Nt[n>>24&255]).toLowerCase()}function Ge(s,e,t){return Math.max(e,Math.min(t,s))}function Jc(s,e){return(s%e+e)%e}function Fd(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function Nd(s,e,t){return s!==e?(t-s)/(e-s):0}function Xs(s,e,t){return(1-t)*s+t*e}function Ud(s,e,t,n){return Xs(s,e,1-Math.exp(-t*n))}function Od(s,e=1){return e-Math.abs(Jc(s,e*2)-e)}function Bd(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function kd(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function zd(s,e){return s+Math.floor(Math.random()*(e-s+1))}function Gd(s,e){return s+Math.random()*(e-s)}function Vd(s){return s*(.5-Math.random())}function Hd(s){s!==void 0&&(uh=s);let e=uh+=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 Wd(s){return s*qs}function qd(s){return s*Fi}function Xd(s){return(s&s-1)===0&&s!==0}function jd(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Kd(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Yd(s,e,t,n,i){let r=Math.cos,a=Math.sin,o=r(t/2),c=a(t/2),l=r((e+n)/2),h=a((e+n)/2),u=r((e-n)/2),d=a((e-n)/2),f=r((n-e)/2),g=a((n-e)/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*g,c*f,o*l);break;case"YXY":s.set(c*f,o*h,c*g,o*l);break;case"ZYZ":s.set(c*g,c*f,o*h,o*l);break;default:_e("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function pn(s,e){switch(e.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 Je(s,e){switch(e.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 Ir={DEG2RAD:qs,RAD2DEG:Fi,generateUUID:bn,clamp:Ge,euclideanModulo:Jc,mapLinear:Fd,inverseLerp:Nd,lerp:Xs,damp:Ud,pingpong:Od,smoothstep:Bd,smootherstep:kd,randInt:zd,randFloat:Gd,randFloatSpread:Vd,seededRandom:Hd,degToRad:Wd,radToDeg:qd,isPowerOfTwo:Xd,ceilPowerOfTwo:jd,floorPowerOfTwo:Kd,setQuaternionFromProperEuler:Yd,normalize:Je,denormalize:pn},tl=class tl{constructor(e=0,t=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,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ge(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,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 n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};tl.prototype.isVector2=!0;var Re=tl,Et=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,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],g=r[a+2],y=r[a+3];if(u!==y||c!==d||l!==f||h!==g){let m=c*d+l*f+h*g+u*y;m<0&&(d=-d,f=-f,g=-g,y=-y,m=-m);let p=1-o;if(m<.9995){let x=Math.acos(m),S=Math.sin(x);p=Math.sin(p*x)/S,o=Math.sin(o*x)/S,c=c*p+d*o,l=l*p+f*o,h=h*p+g*o,u=u*p+y*o}else{c=c*p+d*o,l=l*p+f*o,h=h*p+g*o,u=u*p+y*o;let x=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=x,l*=x,h*=x,u*=x}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,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],g=r[a+3];return e[t]=o*g+h*u+c*f-l*d,e[t+1]=c*g+h*d+l*u-o*f,e[t+2]=l*g+h*f+o*d-c*u,e[t+3]=h*g-o*u-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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 n=e._x,i=e._y,r=e._z,a=e._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),g=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u-d*f*g;break;case"YXZ":this._x=d*h*u+l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u+d*f*g;break;case"ZXY":this._x=d*h*u-l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u-d*f*g;break;case"ZYX":this._x=d*h*u-l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u+d*f*g;break;case"YZX":this._x=d*h*u+l*f*g,this._y=l*f*u+d*h*g,this._z=l*h*g-d*f*u,this._w=l*h*u-d*f*g;break;case"XZY":this._x=d*h*u-l*f*g,this._y=l*f*u-d*h*g,this._z=l*h*g+d*f*u,this._w=l*h*u+d*f*g;break;default:_e("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],c=t[9],l=t[2],h=t[6],u=t[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(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ge(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,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(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 n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,c=t._y,l=t._z,h=t._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(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,r=-r,a=-a,o=-o);let c=1-t;if(o<.9995){let l=Math.acos(o),h=Math.sin(l);c=Math.sin(c*l)/h,t=Math.sin(t*l)/h,this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+r*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+r*t,this._w=this._w*c+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*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}},nl=class nl{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw 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(dh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(dh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*i-o*n),h=2*(o*t-r*i),u=2*(r*n-a*t);return this.x=t+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(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,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=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,c=t.z;return this.x=i*c-r*o,this.y=r*a-n*c,this.z=n*o-i*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Yo.copy(this).projectOnVector(e),this.sub(Yo)}reflect(e){return this.sub(Yo.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 n=this.dot(e)/t;return Math.acos(Ge(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};nl.prototype.isVector3=!0;var D=nl,Yo=new D,dh=new Et,il=class il{constructor(e,t,n,i,r,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l)}set(e,t,n,i,r,a,o,c,l){let h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,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(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.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],g=n[8],y=i[0],m=i[3],p=i[6],x=i[1],S=i[4],M=i[7],E=i[2],A=i[5],C=i[8];return r[0]=a*y+o*x+c*E,r[3]=a*m+o*S+c*A,r[6]=a*p+o*M+c*C,r[1]=l*y+h*x+u*E,r[4]=l*m+h*S+u*A,r[7]=l*p+h*M+u*C,r[2]=d*y+f*x+g*E,r[5]=d*m+f*S+g*A,r[8]=d*p+f*M+g*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],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*a*h-t*o*l-n*r*h+n*o*c+i*r*l-i*a*c}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*a-o*l,d=o*c-h*r,f=l*r-a*c,g=t*u+n*d+i*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/g;return e[0]=u*y,e[1]=(i*l-h*n)*y,e[2]=(o*n-i*a)*y,e[3]=d*y,e[4]=(h*t-i*c)*y,e[5]=(i*r-o*t)*y,e[6]=f*y,e[7]=(n*c-l*t)*y,e[8]=(a*t-n*r)*y,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,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+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Jo.makeScale(e,t)),this}rotate(e){return this.premultiply(Jo.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jo.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};il.prototype.isMatrix3=!0;var Ie=il,Jo=new Ie,fh=new Ie().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ph=new Ie().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Jd(){let s={enabled:!0,workingColorSpace:Gt,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===Ye&&(i.r=jn(i.r),i.g=jn(i.g),i.b=jn(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ye&&(i.r=hs(i.r),i.g=hs(i.g),i.b=hs(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Qn?Ks:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return ya("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return ya("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Gt]:{primaries:e,whitePoint:n,transfer:Ks,toXYZ:fh,fromXYZ:ph,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:_t},outputColorSpaceConfig:{drawingBufferColorSpace:_t}},[_t]:{primaries:e,whitePoint:n,transfer:Ye,toXYZ:fh,fromXYZ:ph,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:_t}}}),s}var ze=Jd();function jn(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function hs(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var Ji,Ma=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ji===void 0&&(Ji=fs("canvas")),Ji.width=e.width,Ji.height=e.height;let i=Ji.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ji}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=fs("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=jn(r[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(jn(t[n]/255)*255):t[n]=jn(t[n]);return{data:t,width:e.width,height:e.height}}else return _e("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Zd=0,ms=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Zd++}),this.uuid=bn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}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 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(Zo(i[a].image)):r.push(Zo(i[a]))}else r=Zo(i);n.url=r}return t||(e.images[this.uuid]=n),n}};function Zo(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?Ma.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(_e("Texture: Unable to serialize Texture."),{})}var $d=0,$o=new D,Dt=class s extends cn{constructor(e=s.DEFAULT_IMAGE,t=s.DEFAULT_MAPPING,n=on,i=on,r=vt,a=yn,o=nn,c=jt,l=s.DEFAULT_ANISOTROPY,h=Qn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$d++}),this.uuid=bn(),this.name="",this.source=new ms(e),this.mipmaps=[],this.mapping=t,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 Re(0,0),this.repeat=new Re(1,1),this.center=new Re(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ie,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize($o).x}get height(){return this.source.getSize($o).y}get depth(){return this.source.getSize($o).z}get image(){return this.source.data}set image(e){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)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.normalized=e.normalized,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.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){_e(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){_e(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,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,normalized:this.normalized,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),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Gc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ui:e.x=e.x-Math.floor(e.x);break;case on:e.x=e.x<0?0:1;break;case us: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 ui:e.y=e.y-Math.floor(e.y);break;case on:e.y=e.y<0?0:1;break;case us: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++}};Dt.DEFAULT_IMAGE=null;Dt.DEFAULT_MAPPING=Gc;Dt.DEFAULT_ANISOTROPY=1;var sl=class sl{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+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,n,i,r,c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],g=c[9],y=c[2],m=c[6],p=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-y)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+y)<.1&&Math.abs(g+m)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let S=(l+1)/2,M=(f+1)/2,E=(p+1)/2,A=(h+d)/4,C=(u+y)/4,_=(g+m)/4;return S>M&&S>E?S<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(S),i=A/n,r=C/n):M>E?M<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(M),n=A/i,r=_/i):E<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(E),n=C/r,i=_/r),this.set(n,i,r,t),this}let x=Math.sqrt((m-g)*(m-g)+(u-y)*(u-y)+(d-h)*(d-h));return Math.abs(x)<.001&&(x=1),this.x=(m-g)/x,this.y=(u-y)/x,this.z=(d-h)/x,this.w=Math.acos((l+f+p-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=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this.w=Ge(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this.w=Ge(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ge(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,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}};sl.prototype.isVector4=!0;var nt=sl,Sa=class extends cn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new nt(0,0,e,t),this.scissorTest=!1,this.viewport=new nt(0,0,e,t),this.textures=[];let i={width:e,height:t,depth:n.depth},r=new Dt(i),a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:vt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new ms(i)}return 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.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}},Qt=class extends Sa{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Js=class extends Dt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=on,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var Ta=class extends Dt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=on,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ga=class Ga{constructor(e,t,n,i,r,a,o,c,l,h,u,d,f,g,y,m){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,n,i,r,a,o,c,l,h,u,d,f,g,y,m)}set(e,t,n,i,r,a,o,c,l,h,u,d,f,g,y,m){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=a,p[9]=o,p[13]=c,p[2]=l,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=g,p[11]=y,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ga().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Zi.setFromMatrixColumn(e,0).length(),r=1/Zi.setFromMatrixColumn(e,1).length(),a=1/Zi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let d=a*h,f=a*u,g=o*h,y=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+g*l,t[5]=d-y*l,t[9]=-o*c,t[2]=y-d*l,t[6]=g+f*l,t[10]=a*c}else if(e.order==="YXZ"){let d=c*h,f=c*u,g=l*h,y=l*u;t[0]=d+y*o,t[4]=g*o-f,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-g,t[6]=y+d*o,t[10]=a*c}else if(e.order==="ZXY"){let d=c*h,f=c*u,g=l*h,y=l*u;t[0]=d-y*o,t[4]=-a*u,t[8]=g+f*o,t[1]=f+g*o,t[5]=a*h,t[9]=y-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){let d=a*h,f=a*u,g=o*h,y=o*u;t[0]=c*h,t[4]=g*l-f,t[8]=d*l+y,t[1]=c*u,t[5]=y*l+d,t[9]=f*l-g,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){let d=a*c,f=a*l,g=o*c,y=o*l;t[0]=c*h,t[4]=y-d*u,t[8]=g*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=f*u+g,t[10]=d-y*u}else if(e.order==="XZY"){let d=a*c,f=a*l,g=o*c,y=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+y,t[5]=a*h,t[9]=f*u-g,t[2]=g*u-f,t[6]=o*h,t[10]=y*u+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(Qd,e,ef)}lookAt(e,t,n){let i=this.elements;return Zt.subVectors(e,t),Zt.lengthSq()===0&&(Zt.z=1),Zt.normalize(),ii.crossVectors(n,Zt),ii.lengthSq()===0&&(Math.abs(n.z)===1?Zt.x+=1e-4:Zt.z+=1e-4,Zt.normalize(),ii.crossVectors(n,Zt)),ii.normalize(),Br.crossVectors(Zt,ii),i[0]=ii.x,i[4]=Br.x,i[8]=Zt.x,i[1]=ii.y,i[5]=Br.y,i[9]=Zt.y,i[2]=ii.z,i[6]=Br.z,i[10]=Zt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],f=n[13],g=n[2],y=n[6],m=n[10],p=n[14],x=n[3],S=n[7],M=n[11],E=n[15],A=i[0],C=i[4],_=i[8],w=i[12],L=i[1],R=i[5],O=i[9],H=i[13],q=i[2],N=i[6],z=i[10],V=i[14],$=i[3],Q=i[7],le=i[11],xe=i[15];return r[0]=a*A+o*L+c*q+l*$,r[4]=a*C+o*R+c*N+l*Q,r[8]=a*_+o*O+c*z+l*le,r[12]=a*w+o*H+c*V+l*xe,r[1]=h*A+u*L+d*q+f*$,r[5]=h*C+u*R+d*N+f*Q,r[9]=h*_+u*O+d*z+f*le,r[13]=h*w+u*H+d*V+f*xe,r[2]=g*A+y*L+m*q+p*$,r[6]=g*C+y*R+m*N+p*Q,r[10]=g*_+y*O+m*z+p*le,r[14]=g*w+y*H+m*V+p*xe,r[3]=x*A+S*L+M*q+E*$,r[7]=x*C+S*R+M*N+E*Q,r[11]=x*_+S*O+M*z+E*le,r[15]=x*w+S*H+M*V+E*xe,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],f=e[14],g=e[3],y=e[7],m=e[11],p=e[15],x=c*f-l*d,S=o*f-l*u,M=o*d-c*u,E=a*f-l*h,A=a*d-c*h,C=a*u-o*h;return t*(y*x-m*S+p*M)-n*(g*x-m*E+p*A)+i*(g*S-y*E+p*C)-r*(g*M-y*A+m*C)}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,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],f=e[11],g=e[12],y=e[13],m=e[14],p=e[15],x=t*o-n*a,S=t*c-i*a,M=t*l-r*a,E=n*c-i*o,A=n*l-r*o,C=i*l-r*c,_=h*y-u*g,w=h*m-d*g,L=h*p-f*g,R=u*m-d*y,O=u*p-f*y,H=d*p-f*m,q=x*H-S*O+M*R+E*L-A*w+C*_;if(q===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let N=1/q;return e[0]=(o*H-c*O+l*R)*N,e[1]=(i*O-n*H-r*R)*N,e[2]=(y*C-m*A+p*E)*N,e[3]=(d*A-u*C-f*E)*N,e[4]=(c*L-a*H-l*w)*N,e[5]=(t*H-i*L+r*w)*N,e[6]=(m*M-g*C-p*S)*N,e[7]=(h*C-d*M+f*S)*N,e[8]=(a*O-o*L+l*_)*N,e[9]=(n*L-t*O-r*_)*N,e[10]=(g*A-y*M+p*x)*N,e[11]=(u*M-h*A-f*x)*N,e[12]=(o*w-a*R-c*_)*N,e[13]=(t*R-n*w+i*_)*N,e[14]=(y*S-g*E-m*x)*N,e[15]=(h*E-u*S+d*x)*N,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,c=e.z,l=r*a,h=r*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,h*o+n,h*c-i*a,0,l*c-i*o,h*c+i*a,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,a=t._y,o=t._z,c=t._w,l=r+r,h=a+a,u=o+o,d=r*l,f=r*h,g=r*u,y=a*h,m=a*u,p=o*u,x=c*l,S=c*h,M=c*u,E=n.x,A=n.y,C=n.z;return i[0]=(1-(y+p))*E,i[1]=(f+M)*E,i[2]=(g-S)*E,i[3]=0,i[4]=(f-M)*A,i[5]=(1-(d+p))*A,i[6]=(m+x)*A,i[7]=0,i[8]=(g+S)*C,i[9]=(m-x)*C,i[10]=(1-(d+y))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinant();if(r===0)return n.set(1,1,1),t.identity(),this;let a=Zi.set(i[0],i[1],i[2]).length(),o=Zi.set(i[4],i[5],i[6]).length(),c=Zi.set(i[8],i[9],i[10]).length();r<0&&(a=-a),un.copy(this);let l=1/a,h=1/o,u=1/c;return un.elements[0]*=l,un.elements[1]*=l,un.elements[2]*=l,un.elements[4]*=h,un.elements[5]*=h,un.elements[6]*=h,un.elements[8]*=u,un.elements[9]*=u,un.elements[10]*=u,t.setFromRotationMatrix(un),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,i,r,a,o=mn,c=!1){let l=this.elements,h=2*r/(t-e),u=2*r/(n-i),d=(t+e)/(t-e),f=(n+i)/(n-i),g,y;if(c)g=r/(a-r),y=a*r/(a-r);else if(o===mn)g=-(a+r)/(a-r),y=-2*a*r/(a-r);else if(o===ds)g=-a/(a-r),y=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=mn,c=!1){let l=this.elements,h=2/(t-e),u=2/(n-i),d=-(t+e)/(t-e),f=-(n+i)/(n-i),g,y;if(c)g=1/(a-r),y=a/(a-r);else if(o===mn)g=-2/(a-r),y=-(a+r)/(a-r);else if(o===ds)g=-1/(a-r),y=-r/(a-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=u,l[9]=0,l[13]=f,l[2]=0,l[6]=0,l[10]=g,l[14]=y,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};Ga.prototype.isMatrix4=!0;var Oe=Ga,Zi=new D,un=new Oe,Qd=new D(0,0,0),ef=new D(1,1,1),ii=new D,Br=new D,Zt=new D,mh=new Oe,gh=new Et,Rn=class s{constructor(e=0,t=0,n=0,i=s.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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,n=!0){let i=e.elements,r=i[0],a=i[4],o=i[8],c=i[1],l=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(Ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Ge(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ge(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Ge(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Ge(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-Ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,f),this._y=0);break;default:_e("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return mh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gh.setFromEuler(this),this.setFromQuaternion(gh,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}};Rn.DEFAULT_ORDER="XYZ";var Zs=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}},tf=0,bh=new D,$i=new Et,Gn=new Oe,kr=new D,Os=new D,nf=new D,sf=new Et,_h=new D(1,0,0),xh=new D(0,1,0),vh=new D(0,0,1),yh={type:"added"},rf={type:"removed"},Qi={type:"childadded",child:null},Qo={type:"childremoved",child:null},lt=class s extends cn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:tf++}),this.uuid=bn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=s.DEFAULT_UP.clone();let e=new D,t=new Rn,n=new Et,i=new D(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._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:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Oe},normalMatrix:{value:new Ie}}),this.matrix=new Oe,this.matrixWorld=new Oe,this.matrixAutoUpdate=s.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=s.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Zs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}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 $i.setFromAxisAngle(e,t),this.quaternion.multiply($i),this}rotateOnWorldAxis(e,t){return $i.setFromAxisAngle(e,t),this.quaternion.premultiply($i),this}rotateX(e){return this.rotateOnAxis(_h,e)}rotateY(e){return this.rotateOnAxis(xh,e)}rotateZ(e){return this.rotateOnAxis(vh,e)}translateOnAxis(e,t){return bh.copy(e).applyQuaternion(this.quaternion),this.position.add(bh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(_h,e)}translateY(e){return this.translateOnAxis(xh,e)}translateZ(e){return this.translateOnAxis(vh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Gn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?kr.copy(e):kr.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),Os.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Gn.lookAt(Os,kr,this.up):Gn.lookAt(kr,Os,this.up),this.quaternion.setFromRotationMatrix(Gn),i&&(Gn.extractRotation(i.matrixWorld),$i.setFromRotationMatrix(Gn),this.quaternion.premultiply($i.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(we("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(yh),Qi.child=e,this.dispatchEvent(Qi),Qi.child=null):we("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rf),Qo.child=e,this.dispatchEvent(Qo),Qo.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),Gn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Gn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Gn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(yh),Qi.child=e,this.dispatchEvent(Qi),Qi.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 n=0,i=this.children.length;n<i;n++){let a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Os,e,nf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Os,sf,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 n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].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);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}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 n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.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 i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let c=this.animations[o];i.animations.push(r(e.animations,c))}}if(t){let o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),f=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),g.length>0&&(n.nodes=g)}return n.object=i,n;function a(o){let c=[];for(let l in o){let h=o[l];delete h.metadata,c.push(h)}return c}}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.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};lt.DEFAULT_UP=new D(0,1,0);lt.DEFAULT_MATRIX_AUTO_UPDATE=!0;lt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var gn=class extends lt{constructor(){super(),this.isGroup=!0,this.type="Group"}},af={type:"move"},gs=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new gn,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 gn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new gn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D,this._grip.eventsEnabled=!1),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 n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),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,n){let i=null,r=null,a=null,o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(let y of e.hand.values()){let m=t.getJointPose(y,n),p=this._getHandJoint(l,y);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}let h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,g=.005;l.inputState.pinching&&d>f+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(af)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new gn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Iu={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},si={h:0,s:0,l:0},zr={h:0,s:0,l:0};function ec(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}var Ae=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_t){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ze.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=ze.workingColorSpace){return this.r=e,this.g=t,this.b=n,ze.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=ze.workingColorSpace){if(e=Jc(e,1),t=Ge(t,0,1),n=Ge(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=ec(a,r,e+1/3),this.g=ec(a,r,e),this.b=ec(a,r,e-1/3)}return ze.colorSpaceToWorking(this,i),this}setStyle(e,t=_t){function n(r){r!==void 0&&parseFloat(r)<1&&_e("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=i[1],o=i[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 n(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 n(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 n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:_e("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[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);_e("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_t){let n=Iu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):_e("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=jn(e.r),this.g=jn(e.g),this.b=jn(e.b),this}copyLinearToSRGB(e){return this.r=hs(e.r),this.g=hs(e.g),this.b=hs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_t){return ze.workingToColorSpace(Ut.copy(this),e),Math.round(Ge(Ut.r*255,0,255))*65536+Math.round(Ge(Ut.g*255,0,255))*256+Math.round(Ge(Ut.b*255,0,255))}getHexString(e=_t){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ze.workingColorSpace){ze.workingToColorSpace(Ut.copy(this),t);let n=Ut.r,i=Ut.g,r=Ut.b,a=Math.max(n,i,r),o=Math.min(n,i,r),c,l,h=(o+a)/2;if(o===a)c=0,l=0;else{let u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(i-r)/u+(i<r?6:0);break;case i:c=(r-n)/u+2;break;case r:c=(n-i)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=ze.workingColorSpace){return ze.workingToColorSpace(Ut.copy(this),t),e.r=Ut.r,e.g=Ut.g,e.b=Ut.b,e}getStyle(e=_t){ze.workingToColorSpace(Ut.copy(this),e);let t=Ut.r,n=Ut.g,i=Ut.b;return e!==_t?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(si),this.setHSL(si.h+e,si.s+t,si.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(si),e.getHSL(zr);let n=Xs(si.h,zr.h,t),i=Xs(si.s,zr.s,t),r=Xs(si.l,zr.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,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}},Ut=new Ae;Ae.NAMES=Iu;var Ni=class extends lt{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 Rn,this.environmentIntensity=1,this.environmentRotation=new Rn,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}},dn=new D,Vn=new D,tc=new D,Hn=new D,es=new D,ts=new D,Mh=new D,nc=new D,ic=new D,sc=new D,rc=new nt,ac=new nt,oc=new nt,li=class s{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),dn.subVectors(e,t),i.cross(dn);let r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){dn.subVectors(i,t),Vn.subVectors(n,t),tc.subVectors(e,t);let a=dn.dot(dn),o=dn.dot(Vn),c=dn.dot(tc),l=Vn.dot(Vn),h=Vn.dot(tc),u=a*l-o*o;if(u===0)return r.set(0,0,0),null;let d=1/u,f=(l*c-o*h)*d,g=(a*h-o*c)*d;return r.set(1-f-g,g,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Hn)===null?!1:Hn.x>=0&&Hn.y>=0&&Hn.x+Hn.y<=1}static getInterpolation(e,t,n,i,r,a,o,c){return this.getBarycoord(e,t,n,i,Hn)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,Hn.x),c.addScaledVector(a,Hn.y),c.addScaledVector(o,Hn.z),c)}static getInterpolatedAttribute(e,t,n,i,r,a){return rc.setScalar(0),ac.setScalar(0),oc.setScalar(0),rc.fromBufferAttribute(e,t),ac.fromBufferAttribute(e,n),oc.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(rc,r.x),a.addScaledVector(ac,r.y),a.addScaledVector(oc,r.z),a}static isFrontFacing(e,t,n,i){return dn.subVectors(n,t),Vn.subVectors(e,t),dn.cross(Vn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 dn.subVectors(this.c,this.b),Vn.subVectors(this.a,this.b),dn.cross(Vn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return s.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return s.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return s.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return s.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return s.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,r=this.c,a,o;es.subVectors(i,n),ts.subVectors(r,n),nc.subVectors(e,n);let c=es.dot(nc),l=ts.dot(nc);if(c<=0&&l<=0)return t.copy(n);ic.subVectors(e,i);let h=es.dot(ic),u=ts.dot(ic);if(h>=0&&u<=h)return t.copy(i);let d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(es,a);sc.subVectors(e,r);let f=es.dot(sc),g=ts.dot(sc);if(g>=0&&f<=g)return t.copy(r);let y=f*l-c*g;if(y<=0&&l>=0&&g<=0)return o=l/(l-g),t.copy(n).addScaledVector(ts,o);let m=h*g-f*u;if(m<=0&&u-h>=0&&f-g>=0)return Mh.subVectors(r,i),o=(u-h)/(u-h+(f-g)),t.copy(i).addScaledVector(Mh,o);let p=1/(m+y+d);return a=y*p,o=d*p,t.copy(n).addScaledVector(es,a).addScaledVector(ts,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Vt=class{constructor(e=new D(1/0,1/0,1/0),t=new D(-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,n=e.length;t<n;t+=3)this.expandByPoint(fn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(fn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=fn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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 n=e.geometry;if(n!==void 0){let r=n.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,fn):fn.fromBufferAttribute(r,a),fn.applyMatrix4(e.matrixWorld),this.expandByPoint(fn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Gr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Gr.copy(n.boundingBox)),Gr.applyMatrix4(e.matrixWorld),this.union(Gr)}let i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[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,fn),fn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bs),Vr.subVectors(this.max,Bs),ns.subVectors(e.a,Bs),is.subVectors(e.b,Bs),ss.subVectors(e.c,Bs),ri.subVectors(is,ns),ai.subVectors(ss,is),Si.subVectors(ns,ss);let t=[0,-ri.z,ri.y,0,-ai.z,ai.y,0,-Si.z,Si.y,ri.z,0,-ri.x,ai.z,0,-ai.x,Si.z,0,-Si.x,-ri.y,ri.x,0,-ai.y,ai.x,0,-Si.y,Si.x,0];return!cc(t,ns,is,ss,Vr)||(t=[1,0,0,0,1,0,0,0,1],!cc(t,ns,is,ss,Vr))?!1:(Hr.crossVectors(ri,ai),t=[Hr.x,Hr.y,Hr.z],cc(t,ns,is,ss,Vr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,fn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(fn).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:(Wn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Wn=[new D,new D,new D,new D,new D,new D,new D,new D],fn=new D,Gr=new Vt,ns=new D,is=new D,ss=new D,ri=new D,ai=new D,Si=new D,Bs=new D,Vr=new D,Hr=new D,Ti=new D;function cc(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Ti.fromArray(s,r);let o=i.x*Math.abs(Ti.x)+i.y*Math.abs(Ti.y)+i.z*Math.abs(Ti.z),c=e.dot(Ti),l=t.dot(Ti),h=n.dot(Ti);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}var Mt=new D,Wr=new Re,of=0,Tt=class extends cn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:of++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=va,this.updateRanges=[],this.gpuType=tn,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,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Wr.fromBufferAttribute(this,t),Wr.applyMatrix3(e),this.setXY(t,Wr.x,Wr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyMatrix3(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyMatrix4(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyNormalMatrix(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.transformDirection(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=pn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=pn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=pn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Je(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=pn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Je(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=pn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),r=Je(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,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!==va&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var $s=class extends Tt{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var Qs=class extends Tt{constructor(e,t,n){super(new Uint32Array(e),t,n)}};var zt=class extends Tt{constructor(e,t,n){super(new Float32Array(e),t,n)}},cf=new Vt,ks=new D,lc=new D,Wt=class{constructor(e=new D,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 n=this.center;t!==void 0?n.copy(t):cf.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),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 n=this.center.distanceToSquared(e);return t.copy(e),n>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;ks.subVectors(e,this.center);let t=ks.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ks,i/n),this.radius+=i}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):(lc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ks.copy(e.center).add(lc)),this.expandByPoint(ks.copy(e.center).sub(lc))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},lf=0,rn=new Oe,hc=new lt,rs=new D,$t=new Vt,zs=new Vt,It=new D,Ht=class s extends cn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:lf++}),this.uuid=bn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,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(Dd(e)?Qs:$s)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,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,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Ie().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return rn.makeRotationFromQuaternion(e),this.applyMatrix4(rn),this}rotateX(e){return rn.makeRotationX(e),this.applyMatrix4(rn),this}rotateY(e){return rn.makeRotationY(e),this.applyMatrix4(rn),this}rotateZ(e){return rn.makeRotationZ(e),this.applyMatrix4(rn),this}translate(e,t,n){return rn.makeTranslation(e,t,n),this.applyMatrix4(rn),this}scale(e,t,n){return rn.makeScale(e,t,n),this.applyMatrix4(rn),this}lookAt(e){return hc.lookAt(e),hc.updateMatrix(),this.applyMatrix4(hc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rs).negate(),this.translate(rs.x,rs.y,rs.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,r=e.length;i<r;i++){let a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new zt(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&_e("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 Vt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){we("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let r=t[n];$t.setFromBufferAttribute(r),this.morphTargetsRelative?(It.addVectors(this.boundingBox.min,$t.min),this.boundingBox.expandByPoint(It),It.addVectors(this.boundingBox.max,$t.max),this.boundingBox.expandByPoint(It)):(this.boundingBox.expandByPoint($t.min),this.boundingBox.expandByPoint($t.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&we('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 Wt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){we("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){let n=this.boundingSphere.center;if($t.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){let o=t[r];zs.setFromBufferAttribute(o),this.morphTargetsRelative?(It.addVectors($t.min,zs.min),$t.expandByPoint(It),It.addVectors($t.max,zs.max),$t.expandByPoint(It)):($t.expandByPoint(zs.min),$t.expandByPoint(zs.max))}$t.getCenter(n);let i=0;for(let r=0,a=e.count;r<a;r++)It.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(It));if(t)for(let r=0,a=t.length;r<a;r++){let o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)It.fromBufferAttribute(o,l),c&&(rs.fromBufferAttribute(e,l),It.add(rs)),i=Math.max(i,n.distanceToSquared(It))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&we('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){we("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Tt(new Float32Array(4*n.count),4));let a=this.getAttribute("tangent"),o=[],c=[];for(let _=0;_<n.count;_++)o[_]=new D,c[_]=new D;let l=new D,h=new D,u=new D,d=new Re,f=new Re,g=new Re,y=new D,m=new D;function p(_,w,L){l.fromBufferAttribute(n,_),h.fromBufferAttribute(n,w),u.fromBufferAttribute(n,L),d.fromBufferAttribute(r,_),f.fromBufferAttribute(r,w),g.fromBufferAttribute(r,L),h.sub(l),u.sub(l),f.sub(d),g.sub(d);let R=1/(f.x*g.y-g.x*f.y);isFinite(R)&&(y.copy(h).multiplyScalar(g.y).addScaledVector(u,-f.y).multiplyScalar(R),m.copy(u).multiplyScalar(f.x).addScaledVector(h,-g.x).multiplyScalar(R),o[_].add(y),o[w].add(y),o[L].add(y),c[_].add(m),c[w].add(m),c[L].add(m))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let _=0,w=x.length;_<w;++_){let L=x[_],R=L.start,O=L.count;for(let H=R,q=R+O;H<q;H+=3)p(e.getX(H+0),e.getX(H+1),e.getX(H+2))}let S=new D,M=new D,E=new D,A=new D;function C(_){E.fromBufferAttribute(i,_),A.copy(E);let w=o[_];S.copy(w),S.sub(E.multiplyScalar(E.dot(w))).normalize(),M.crossVectors(A,w);let R=M.dot(c[_])<0?-1:1;a.setXYZW(_,S.x,S.y,S.z,R)}for(let _=0,w=x.length;_<w;++_){let L=x[_],R=L.start,O=L.count;for(let H=R,q=R+O;H<q;H+=3)C(e.getX(H+0)),C(e.getX(H+1)),C(e.getX(H+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Tt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);let i=new D,r=new D,a=new D,o=new D,c=new D,l=new D,h=new D,u=new D;if(e)for(let d=0,f=e.count;d<f;d+=3){let g=e.getX(d+0),y=e.getX(d+1),m=e.getX(d+2);i.fromBufferAttribute(t,g),r.fromBufferAttribute(t,y),a.fromBufferAttribute(t,m),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),o.fromBufferAttribute(n,g),c.fromBufferAttribute(n,y),l.fromBufferAttribute(n,m),o.add(h),c.add(h),l.add(h),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)It.fromBufferAttribute(e,t),It.normalize(),e.setXYZ(t,It.x,It.y,It.z)}toNonIndexed(){function e(o,c){let l=o.array,h=o.itemSize,u=o.normalized,d=new l.constructor(c.length*h),f=0,g=0;for(let y=0,m=c.length;y<m;y++){o.isInterleavedBufferAttribute?f=c[y]*o.data.stride+o.offset:f=c[y]*h;for(let p=0;p<h;p++)d[g++]=l[f++]}return new Tt(d,h,u)}if(this.index===null)return _e("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new s,n=this.index.array,i=this.attributes;for(let o in i){let c=i[o],l=e(c,n);t.setAttribute(o,l)}let r=this.morphAttributes;for(let o in r){let c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){let d=l[h],f=e(d,n);c.push(f)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,c=a.length;o<c;o++){let l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,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 c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);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 n=this.attributes;for(let c in n){let l=n[c];e.data.attributes[c]=l.toJSON(e.data)}let i={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){let f=l[u];h.push(f.toJSON(e.data))}h.length>0&&(i[c]=h,r=!0)}r&&(e.data.morphAttributes=i,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=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let i=e.attributes;for(let l in i){let h=i[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],u=r[l];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let l=0,h=a.length;l<h;l++){let u=a[l];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},bs=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=va,this.updateRanges=[],this.version=0,this.uuid=bn()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},kt=new D,_s=class s{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)kt.fromBufferAttribute(this,t),kt.applyMatrix4(e),this.setXYZ(t,kt.x,kt.y,kt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)kt.fromBufferAttribute(this,t),kt.applyNormalMatrix(e),this.setXYZ(t,kt.x,kt.y,kt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)kt.fromBufferAttribute(this,t),kt.transformDirection(e),this.setXYZ(t,kt.x,kt.y,kt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=pn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=pn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=pn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=pn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=pn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),r=Je(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){Ys("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new Tt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new s(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Ys("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},hf=0,Ot=class extends cn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:hf++}),this.uuid=bn(),this.name="",this.type="Material",this.blending=Pi,this.side=_n,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ua,this.blendDst=da,this.blendEquation=hi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ae(0,0,0),this.blendAlpha=0,this.depthFunc=Ii,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Sc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ei,this.stencilZFail=Ei,this.stencilZPass=Ei,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}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 n=e[t];if(n===void 0){_e(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){_e(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Pi&&(n.blending=this.blending),this.side!==_n&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ua&&(n.blendSrc=this.blendSrc),this.blendDst!==da&&(n.blendDst=this.blendDst),this.blendEquation!==hi&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ii&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Sc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ei&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ei&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ei&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){let a=[];for(let o in r){let c=r[o];delete c.metadata,a.push(c)}return a}if(t){let r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,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++}};var qn=new D,uc=new D,qr=new D,oi=new D,dc=new D,Xr=new D,fc=new D,Kn=class{constructor(e=new D,t=new D(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,qn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=qn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qn.copy(this.origin).addScaledVector(this.direction,t),qn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){uc.copy(e).add(t).multiplyScalar(.5),qr.copy(t).sub(e).normalize(),oi.copy(this.origin).sub(uc);let r=e.distanceTo(t)*.5,a=-this.direction.dot(qr),o=oi.dot(this.direction),c=-oi.dot(qr),l=oi.lengthSq(),h=Math.abs(1-a*a),u,d,f,g;if(h>0)if(u=a*c-o,d=a*o-c,g=r*h,u>=0)if(d>=-g)if(d<=g){let y=1/h;u*=y,d*=y,f=u*(u+a*d+2*o)+d*(a*u+d+2*c)+l}else d=r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d=-r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d<=-g?(u=Math.max(0,-(-a*r+o)),d=u>0?-r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l):d<=g?(u=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(u=Math.max(0,-(a*r+o)),d=u>0?r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l);else d=a>0?-r:r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(uc).addScaledVector(qr,d),f}intersectSphere(e,t){qn.subVectors(e.center,this.origin);let n=qn.dot(this.direction),i=qn.dot(qn)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1: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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,c,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),h>=0?(r=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(r=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||o>i)||((o>n||n!==n)&&(n=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,qn)!==null}intersectTriangle(e,t,n,i,r){dc.subVectors(t,e),Xr.subVectors(n,e),fc.crossVectors(dc,Xr);let a=this.direction.dot(fc),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;oi.subVectors(this.origin,e);let c=o*this.direction.dot(Xr.crossVectors(oi,Xr));if(c<0)return null;let l=o*this.direction.dot(dc.cross(oi));if(l<0||c+l>a)return null;let h=-o*oi.dot(fc);return h<0?null:this.at(h/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)}},xn=class extends Ot{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ae(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 Rn,this.combine=Ha,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}},Sh=new Oe,Ai=new Kn,jr=new Wt,Th=new D,Kr=new D,Yr=new D,Jr=new D,pc=new D,Zr=new D,Ah=new D,$r=new D,at=class extends lt{constructor(e=new Ht,t=new xn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,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,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(r&&o){Zr.set(0,0,0);for(let c=0,l=r.length;c<l;c++){let h=o[c],u=r[c];h!==0&&(pc.fromBufferAttribute(u,e),a?Zr.addScaledVector(pc,h):Zr.addScaledVector(pc.sub(t),h))}t.add(Zr)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),jr.copy(n.boundingSphere),jr.applyMatrix4(r),Ai.copy(e.ray).recast(e.near),!(jr.containsPoint(Ai.origin)===!1&&(Ai.intersectSphere(jr,Th)===null||Ai.origin.distanceToSquared(Th)>(e.far-e.near)**2))&&(Sh.copy(r).invert(),Ai.copy(e.ray).applyMatrix4(Sh),!(n.boundingBox!==null&&Ai.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ai)))}_computeIntersections(e,t,n){let i,r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,d=r.groups,f=r.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,y=d.length;g<y;g++){let m=d[g],p=a[m.materialIndex],x=Math.max(m.start,f.start),S=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let M=x,E=S;M<E;M+=3){let A=o.getX(M),C=o.getX(M+1),_=o.getX(M+2);i=Qr(this,p,e,n,l,h,u,A,C,_),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let g=Math.max(0,f.start),y=Math.min(o.count,f.start+f.count);for(let m=g,p=y;m<p;m+=3){let x=o.getX(m),S=o.getX(m+1),M=o.getX(m+2);i=Qr(this,a,e,n,l,h,u,x,S,M),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(a))for(let g=0,y=d.length;g<y;g++){let m=d[g],p=a[m.materialIndex],x=Math.max(m.start,f.start),S=Math.min(c.count,Math.min(m.start+m.count,f.start+f.count));for(let M=x,E=S;M<E;M+=3){let A=M,C=M+1,_=M+2;i=Qr(this,p,e,n,l,h,u,A,C,_),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let g=Math.max(0,f.start),y=Math.min(c.count,f.start+f.count);for(let m=g,p=y;m<p;m+=3){let x=m,S=m+1,M=m+2;i=Qr(this,a,e,n,l,h,u,x,S,M),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}};function uf(s,e,t,n,i,r,a,o){let c;if(e.side===Lt?c=n.intersectTriangle(a,r,i,!0,o):c=n.intersectTriangle(i,r,a,e.side===_n,o),c===null)return null;$r.copy(o),$r.applyMatrix4(s.matrixWorld);let l=t.ray.origin.distanceTo($r);return l<t.near||l>t.far?null:{distance:l,point:$r.clone(),object:s}}function Qr(s,e,t,n,i,r,a,o,c,l){s.getVertexPosition(o,Kr),s.getVertexPosition(c,Yr),s.getVertexPosition(l,Jr);let h=uf(s,e,t,n,Kr,Yr,Jr,Ah);if(h){let u=new D;li.getBarycoord(Ah,Kr,Yr,Jr,u),i&&(h.uv=li.getInterpolatedAttribute(i,o,c,l,u,new Re)),r&&(h.uv1=li.getInterpolatedAttribute(r,o,c,l,u,new Re)),a&&(h.normal=li.getInterpolatedAttribute(a,o,c,l,u,new D),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let d={a:o,b:c,c:l,normal:new D,materialIndex:0};li.getNormal(Kr,Yr,Jr,d.normal),h.face=d,h.barycoord=u}return h}var Gs=new nt,wh=new nt,Eh=new nt,df=new nt,Rh=new Oe,ea=new D,mc=new Wt,Ch=new Oe,gc=new Kn,er=class extends at{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=yc,this.bindMatrix=new Oe,this.bindMatrixInverse=new Oe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Vt),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ea),this.boundingBox.expandByPoint(ea)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Wt),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ea),this.boundingSphere.expandByPoint(ea)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),mc.copy(this.boundingSphere),mc.applyMatrix4(i),e.ray.intersectsSphere(mc)!==!1&&(Ch.copy(i).invert(),gc.copy(e.ray).applyMatrix4(Ch),!(this.boundingBox!==null&&gc.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,gc)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new nt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===yc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===pu?this.bindMatrixInverse.copy(this.bindMatrix).invert():_e("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;wh.fromBufferAttribute(i.attributes.skinIndex,e),Eh.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4?(Gs.copy(t),t.set(0,0,0,0)):(Gs.set(...t,1),t.set(0,0,0)),Gs.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let a=Eh.getComponent(r);if(a!==0){let o=wh.getComponent(r);Rh.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(df.copy(Gs).applyMatrix4(Rh),a)}}return t.isVector4&&(t.w=Gs.w),t.applyMatrix4(this.bindMatrixInverse)}},xs=class extends lt{constructor(){super(),this.isBone=!0,this.type="Bone"}},vs=class extends Dt{constructor(e=null,t=1,n=1,i,r,a,o,c,l=xt,h=xt,u,d){super(null,a,o,c,l,h,i,r,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Ph=new Oe,ff=new Oe,tr=class s{constructor(e=[],t=[]){this.uuid=bn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){_e("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Oe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Oe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=e.length;r<a;r++){let o=e[r]?e[r].matrixWorld:ff;Ph.multiplyMatrices(o,t[r]),Ph.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new s(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new vs(t,e,e,nn,tn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let r=e.bones[n],a=t[r];a===void 0&&(_e("Skeleton: No bone found with UUID:",r),a=new xs),this.bones.push(a),this.boneInverses.push(new Oe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){let a=t[i];e.bones.push(a.uuid);let o=n[i];e.boneInverses.push(o.toArray())}return e}},di=class extends Tt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}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}},as=new Oe,Ih=new Oe,ta=[],Dh=new Vt,pf=new Oe,Vs=new at,Hs=new Wt,Ui=class extends at{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new di(new Float32Array(n*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,pf)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Vt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,as),Dh.copy(e.boundingBox).applyMatrix4(as),this.boundingBox.union(Dh)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Wt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,as),Hs.copy(e.boundingSphere).applyMatrix4(as),this.boundingSphere.union(Hs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),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){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,a=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(Vs.geometry=this.geometry,Vs.material=this.material,Vs.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Hs.copy(this.boundingSphere),Hs.applyMatrix4(n),e.ray.intersectsSphere(Hs)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,as),Ih.multiplyMatrices(n,as),Vs.matrixWorld=Ih,Vs.raycast(e,ta);for(let a=0,o=ta.length;a<o;a++){let c=ta[a];c.instanceId=r,c.object=this,t.push(c)}ta.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new di(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new vs(new Float32Array(i*this.count),i,this.count,Ja,tn));let r=this.morphTexture.source.data.data,a=0;for(let l=0;l<n.length;l++)a+=n[l];let o=this.geometry.morphTargetsRelative?1:1-a,c=i*e;return r[c]=o,r.set(n,c+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},bc=new D,mf=new D,gf=new Ie,an=class{constructor(e=new D(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=bc.subVectors(n,t).cross(mf.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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,n=!0){let i=e.delta(bc),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/r;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||gf.getNormalMatrix(e),i=this.coplanarPoint(bc).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.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)}},wi=new Wt,bf=new Re(.5,.5),na=new D,ys=class{constructor(e=new an,t=new an,n=new an,i=new an,r=new an,a=new an){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=mn,n=!1){let i=this.planes,r=e.elements,a=r[0],o=r[1],c=r[2],l=r[3],h=r[4],u=r[5],d=r[6],f=r[7],g=r[8],y=r[9],m=r[10],p=r[11],x=r[12],S=r[13],M=r[14],E=r[15];if(i[0].setComponents(l-a,f-h,p-g,E-x).normalize(),i[1].setComponents(l+a,f+h,p+g,E+x).normalize(),i[2].setComponents(l+o,f+u,p+y,E+S).normalize(),i[3].setComponents(l-o,f-u,p-y,E-S).normalize(),n)i[4].setComponents(c,d,m,M).normalize(),i[5].setComponents(l-c,f-d,p-m,E-M).normalize();else if(i[4].setComponents(l-c,f-d,p-m,E-M).normalize(),t===mn)i[5].setComponents(l+c,f+d,p+m,E+M).normalize();else if(t===ds)i[5].setComponents(c,d,m,M).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(),wi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),wi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(wi)}intersectsSprite(e){wi.center.set(0,0,0);let t=bf.distanceTo(e.center);return wi.radius=.7071067811865476+t,wi.applyMatrix4(e.matrixWorld),this.intersectsSphere(wi)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(na.x=i.normal.x>0?e.max.x:e.min.x,na.y=i.normal.y>0?e.max.y:e.min.y,na.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(na)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var Ms=class extends Ot{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ae(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Aa=new D,wa=new D,Lh=new Oe,Ws=new Kn,ia=new Wt,_c=new D,Fh=new D,Oi=class extends lt{constructor(e=new Ht,t=new Ms){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Aa.fromBufferAttribute(t,i-1),wa.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Aa.distanceTo(wa);e.setAttribute("lineDistance",new zt(n,1))}else _e("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ia.copy(n.boundingSphere),ia.applyMatrix4(i),ia.radius+=r,e.ray.intersectsSphere(ia)===!1)return;Lh.copy(i).invert(),Ws.copy(e.ray).applyMatrix4(Lh);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){let f=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let y=f,m=g-1;y<m;y+=l){let p=h.getX(y),x=h.getX(y+1),S=sa(this,e,Ws,c,p,x,y);S&&t.push(S)}if(this.isLineLoop){let y=h.getX(g-1),m=h.getX(f),p=sa(this,e,Ws,c,y,m,g-1);p&&t.push(p)}}else{let f=Math.max(0,a.start),g=Math.min(d.count,a.start+a.count);for(let y=f,m=g-1;y<m;y+=l){let p=sa(this,e,Ws,c,y,y+1,y);p&&t.push(p)}if(this.isLineLoop){let y=sa(this,e,Ws,c,g-1,f,g-1);y&&t.push(y)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}};function sa(s,e,t,n,i,r,a){let o=s.geometry.attributes.position;if(Aa.fromBufferAttribute(o,i),wa.fromBufferAttribute(o,r),t.distanceSqToSegment(Aa,wa,_c,Fh)>n)return;_c.applyMatrix4(s.matrixWorld);let l=e.ray.origin.distanceTo(_c);if(!(l<e.near||l>e.far))return{distance:l,point:Fh.clone().applyMatrix4(s.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:s}}var Nh=new D,Uh=new D,nr=class extends Oi{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)Nh.fromBufferAttribute(t,i),Uh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Nh.distanceTo(Uh);e.setAttribute("lineDistance",new zt(n,1))}else _e("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},ir=class extends Oi{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}},Ss=class extends Ot{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ae(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}},Oh=new Oe,Tc=new Kn,ra=new Wt,aa=new D,sr=class extends lt{constructor(e=new Ht,t=new Ss){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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 n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ra.copy(n.boundingSphere),ra.applyMatrix4(i),ra.radius+=r,e.ray.intersectsSphere(ra)===!1)return;Oh.copy(i).invert(),Tc.copy(e.ray).applyMatrix4(Oh);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,u=n.attributes.position;if(l!==null){let d=Math.max(0,a.start),f=Math.min(l.count,a.start+a.count);for(let g=d,y=f;g<y;g++){let m=l.getX(g);aa.fromBufferAttribute(u,m),Bh(aa,m,c,i,e,t,this)}}else{let d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let g=d,y=f;g<y;g++)aa.fromBufferAttribute(u,g),Bh(aa,g,c,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){let o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}};function Bh(s,e,t,n,i,r,a){let o=Tc.distanceSqToPoint(s);if(o<t){let c=new D;Tc.closestPointToPoint(s,c),c.applyMatrix4(n);let l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}var rr=class extends Dt{constructor(e=[],t=bi,n,i,r,a,o,c,l,h){super(e,t,n,i,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Yn=class extends Dt{constructor(e,t,n=Mn,i,r,a,o=xt,c=xt,l,h=En,u=1){if(h!==En&&h!==_i)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:u};super(d,i,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ms(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Ea=class extends Yn{constructor(e,t=Mn,n=bi,i,r,a=xt,o=xt,c,l=En){let h={width:e,height:e,depth:1},u=[h,h,h,h,h,h];super(e,e,t,n,i,r,a,o,c,l),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},ar=class extends Dt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},fi=class s extends Ht{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};let o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);let c=[],l=[],h=[],u=[],d=0,f=0;g("z","y","x",-1,-1,n,t,e,a,r,0),g("z","y","x",1,-1,n,t,-e,a,r,1),g("x","z","y",1,1,e,n,t,i,a,2),g("x","z","y",1,-1,e,n,-t,i,a,3),g("x","y","z",1,-1,e,t,n,i,r,4),g("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new zt(l,3)),this.setAttribute("normal",new zt(h,3)),this.setAttribute("uv",new zt(u,2));function g(y,m,p,x,S,M,E,A,C,_,w){let L=M/C,R=E/_,O=M/2,H=E/2,q=A/2,N=C+1,z=_+1,V=0,$=0,Q=new D;for(let le=0;le<z;le++){let xe=le*R-H;for(let Se=0;Se<N;Se++){let Xe=Se*L-O;Q[y]=Xe*x,Q[m]=xe*S,Q[p]=q,l.push(Q.x,Q.y,Q.z),Q[y]=0,Q[m]=0,Q[p]=A>0?1:-1,h.push(Q.x,Q.y,Q.z),u.push(Se/C),u.push(1-le/_),V+=1}}for(let le=0;le<_;le++)for(let xe=0;xe<C;xe++){let Se=d+xe+N*le,Xe=d+xe+N*(le+1),Ze=d+(xe+1)+N*(le+1),Ne=d+(xe+1)+N*le;c.push(Se,Xe,Ne),c.push(Xe,Ze,Ne),$+=6}o.addGroup(f,$,w),f+=$,d+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var Bi=class s extends Ht{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let r=e/2,a=t/2,o=Math.floor(n),c=Math.floor(i),l=o+1,h=c+1,u=e/o,d=t/c,f=[],g=[],y=[],m=[];for(let p=0;p<h;p++){let x=p*d-a;for(let S=0;S<l;S++){let M=S*u-r;g.push(M,-x,0),y.push(0,0,1),m.push(S/o),m.push(1-p/c)}}for(let p=0;p<c;p++)for(let x=0;x<o;x++){let S=x+l*p,M=x+l*(p+1),E=x+1+l*(p+1),A=x+1+l*p;f.push(S,M,A),f.push(M,E,A)}this.setIndex(f),this.setAttribute("position",new zt(g,3)),this.setAttribute("normal",new zt(y,3)),this.setAttribute("uv",new zt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s(e.width,e.height,e.widthSegments,e.heightSegments)}};var or=class extends Ot{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ae(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function qi(s){let e={};for(let t in s){e[t]={};for(let n in s[t]){let i=s[t][n];if(kh(i))i.isRenderTargetTexture?(_e("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(kh(i[0])){let r=[];for(let a=0,o=i.length;a<o;a++)r[a]=i[a].clone();e[t][n]=r}else e[t][n]=i.slice();else e[t][n]=i}}return e}function Bt(s){let e={};for(let t=0;t<s.length;t++){let n=qi(s[t]);for(let i in n)e[i]=n[i]}return e}function kh(s){return s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)}function _f(s){let e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Zc(s){let e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ze.workingColorSpace}var Du={clone:qi,merge:Bt},xf=`void main() {- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );-}`,vf=`void main() {- gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );-}`,en=class extends Ot{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=xf,this.fragmentShader=vf,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=qi(e.uniforms),this.uniformsGroups=_f(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.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={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 n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},Ra=class extends en{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},Cn=class extends Ot{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ae(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 Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pr,this.normalScale=new Re(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 Rn,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}},qt=class extends Cn{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Re(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ge(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 Ae(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 Ae(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ae(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}};var cr=class extends Ot{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ae(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pr,this.normalScale=new Re(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rn,this.combine=Ha,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Ca=class extends Ot{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xu,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}},Pa=class extends Ot{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}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}};function oa(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function yf(s){function e(i,r){return s[i]-s[r]}let t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function zh(s,e,t){let n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){let o=t[r]*e;for(let c=0;c!==e;++c)i[a++]=s[o+c]}return i}function Lu(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push(...a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}var Pn=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=r)){let o=t[1];e<o&&(n=2,r=o);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){let o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ia=class extends Pn{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ri,endingEnd:Ri}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,a=e+1,o=i[r],c=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ci:r=e,o=2*t-n;break;case js:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Ci:a=e,c=2*n-t;break;case js:a=1,c=n+i[1]-i[0];break;default:a=e-1,c=t}let l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(c-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,g=(n-t)/(i-t),y=g*g,m=y*g,p=-d*m+2*d*y-d*g,x=(1+d)*m+(-1.5-2*d)*y+(-.5+d)*g+1,S=(-1-f)*m+(1.5+f)*y+.5*g,M=f*m-f*y;for(let E=0;E!==o;++E)r[E]=p*a[h+E]+x*a[l+E]+S*a[c+E]+M*a[u+E];return r}},lr=class extends Pn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)r[d]=a[l+d]*u+a[c+d]*h;return r}},Da=class extends Pn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},La=class extends Pn{interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this.settings||this.DefaultSettings_,u=h.inTangents,d=h.outTangents;if(!u||!d){let y=(n-t)/(i-t),m=1-y;for(let p=0;p!==o;++p)r[p]=a[l+p]*m+a[c+p]*y;return r}let f=o*2,g=e-1;for(let y=0;y!==o;++y){let m=a[l+y],p=a[c+y],x=g*f+y*2,S=d[x],M=d[x+1],E=e*f+y*2,A=u[E],C=u[E+1],_=(n-t)/(i-t),w,L,R,O,H;for(let q=0;q<8;q++){w=_*_,L=w*_,R=1-_,O=R*R,H=O*R;let z=H*t+3*O*_*S+3*R*w*A+L*i-n;if(Math.abs(z)<1e-10)break;let V=3*O*(S-t)+6*R*_*(A-S)+3*w*(i-A);if(Math.abs(V)<1e-10)break;_=_-z/V,_=Math.max(0,Math.min(1,_))}r[y]=H*m+3*O*_*M+3*R*w*C+L*p}return r}},Xt=class{constructor(e,t,n,i){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=oa(t,this.TimeBufferType),this.values=oa(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:oa(e.times,Array),values:oa(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Da(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new lr(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ia(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new La(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case Di:t=this.InterpolantFactoryMethodDiscrete;break;case Li:t=this.InterpolantFactoryMethodLinear;break;case ha:t=this.InterpolantFactoryMethodSmooth;break;case Mc:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="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(n);return _e("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Di;case this.InterpolantFactoryMethodLinear:return Li;case this.InterpolantFactoryMethodSmooth:return ha;case this.InterpolantFactoryMethodBezier:return Mc}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=n.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&&(we("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;r===0&&(we("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){let c=n[o];if(typeof c=="number"&&isNaN(c)){we("KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){we("KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&Ld(i))for(let o=0,c=i.length;o!==c;++o){let l=i[o];if(isNaN(l)){we("KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===ha,r=e.length-1,a=1;for(let o=1;o<r;++o){let c=!1,l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(i)c=!0;else{let u=o*n,d=u-n,f=u+n;for(let g=0;g!==n;++g){let y=t[u+g];if(y!==t[d+g]||y!==t[f+g]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];let u=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++a}}if(r>0){e[a]=e[r];for(let o=r*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Xt.prototype.ValueTypeName="";Xt.prototype.TimeBufferType=Float32Array;Xt.prototype.ValueBufferType=Float32Array;Xt.prototype.DefaultInterpolation=Li;var Jn=class extends Xt{constructor(e,t,n){super(e,t,n)}};Jn.prototype.ValueTypeName="bool";Jn.prototype.ValueBufferType=Array;Jn.prototype.DefaultInterpolation=Di;Jn.prototype.InterpolantFactoryMethodLinear=void 0;Jn.prototype.InterpolantFactoryMethodSmooth=void 0;var hr=class extends Xt{constructor(e,t,n,i){super(e,t,n,i)}};hr.prototype.ValueTypeName="color";var In=class extends Xt{constructor(e,t,n,i){super(e,t,n,i)}};In.prototype.ValueTypeName="number";var Fa=class extends Pn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t),l=e*o;for(let h=l+o;l!==h;l+=4)Et.slerpFlat(r,0,a,l-o,a,l,c);return r}},Dn=class extends Xt{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Fa(this.times,this.values,this.getValueSize(),e)}};Dn.prototype.ValueTypeName="quaternion";Dn.prototype.InterpolantFactoryMethodSmooth=void 0;var Zn=class extends Xt{constructor(e,t,n){super(e,t,n)}};Zn.prototype.ValueTypeName="string";Zn.prototype.ValueBufferType=Array;Zn.prototype.DefaultInterpolation=Di;Zn.prototype.InterpolantFactoryMethodLinear=void 0;Zn.prototype.InterpolantFactoryMethodSmooth=void 0;var Ln=class extends Xt{constructor(e,t,n,i){super(e,t,n,i)}};Ln.prototype.ValueTypeName="vector";var ki=class{constructor(e="",t=-1,n=[],i=Io){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Sf(n[a]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,a=n.length;r!==a;++r)t.push(Xt.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,a=[];for(let o=0;o<r;o++){let c=[],l=[];c.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);let h=yf(c);c=zh(c,1,h),l=zh(l,1,h),!i&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new In(".morphTargetInfluences["+t[o].name+"]",c,l).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){let l=e[o],h=l.name.match(r);if(h&&h.length>1){let u=h[1],d=i[u];d||(i[u]=d=[]),d.push(l)}}let a=[];for(let o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(_e("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return we("AnimationClip: No animation in JSONLoader data."),null;let n=function(u,d,f,g,y){if(f.length!==0){let m=[],p=[];Lu(f,m,p,g),m.length!==0&&y.push(new u(d,m,p))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let u=0;u<l.length;u++){let d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){let f={},g;for(g=0;g<d.length;g++)if(d[g].morphTargets)for(let y=0;y<d[g].morphTargets.length;y++)f[d[g].morphTargets[y]]=-1;for(let y in f){let m=[],p=[];for(let x=0;x!==d[g].morphTargets.length;++x){let S=d[g];m.push(S.time),p.push(S.morphTarget===y?1:0)}i.push(new In(".morphTargetInfluence["+y+"]",m,p))}c=f.length*a}else{let f=".bones["+t[u].name+"]";n(Ln,f+".position",d,"pos",i),n(Dn,f+".quaternion",d,"rot",i),n(Ln,f+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,o)}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}};function Mf(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return In;case"vector":case"vector2":case"vector3":case"vector4":return Ln;case"color":return hr;case"quaternion":return Dn;case"bool":case"boolean":return Jn;case"string":return Zn}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function Sf(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=Mf(s.type);if(s.times===void 0){let t=[],n=[];Lu(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}var wn={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(Gh(s)||(this.files[s]=e))},get:function(s){if(this.enabled!==!1&&!Gh(s))return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};function Gh(s){try{let e=s.slice(s.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var Na=class{constructor(e,t,n){let i=this,r=!1,a=0,o=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){o++,r===!1&&i.onStart!==void 0&&i.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){let u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=l.length;u<d;u+=2){let f=l[u],g=l[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Fu=new Na,Fn=class{constructor(e){this.manager=e!==void 0?e:Fu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,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}abort(){return this}};Fn.DEFAULT_MATERIAL_NAME="__DEFAULT";var Xn={},Ac=class extends Error{constructor(e,t){super(e),this.response=t}},Ts=class extends Fn{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=wn.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0);return}if(Xn[e]!==void 0){Xn[e].push({onLoad:t,onProgress:n,onError:i});return}Xn[e]=[],Xn[e].push({onLoad:t,onProgress:n,onError:i});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&_e("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let h=Xn[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,g=f!==0,y=0,m=new ReadableStream({start(p){x();function x(){u.read().then(({done:S,value:M})=>{if(S)p.close();else{y+=M.byteLength;let E=new ProgressEvent("progress",{lengthComputable:g,loaded:y,total:f});for(let A=0,C=h.length;A<C;A++){let _=h[A];_.onProgress&&_.onProgress(E)}p.enqueue(M),x()}},S=>{p.error(S)})}}});return new Response(m)}else throw new Ac(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return l.json();default:if(o==="")return l.text();{let u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(g=>f.decode(g))}}}).then(l=>{wn.add(`file:${e}`,l);let h=Xn[e];delete Xn[e];for(let u=0,d=h.length;u<d;u++){let f=h[u];f.onLoad&&f.onLoad(l)}}).catch(l=>{let h=Xn[e];if(h===void 0)throw this.manager.itemError(e),l;delete Xn[e];for(let u=0,d=h.length;u<d;u++){let f=h[u];f.onError&&f.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var os=new WeakMap,Ua=class extends Fn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=wn.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);else{let u=os.get(a);u===void 0&&(u=[],os.set(a,u)),u.push({onLoad:t,onError:i})}return a}let o=fs("img");function c(){h(),t&&t(this);let u=os.get(this)||[];for(let d=0;d<u.length;d++){let f=u[d];f.onLoad&&f.onLoad(this)}os.delete(this),r.manager.itemEnd(e)}function l(u){h(),i&&i(u),wn.remove(`image:${e}`);let d=os.get(this)||[];for(let f=0;f<d.length;f++){let g=d[f];g.onError&&g.onError(u)}os.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),wn.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}};var ur=class extends Fn{constructor(e){super(e)}load(e,t,n,i){let r=new Dt,a=new Ua(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){r.image=o,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}},zi=class extends lt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ae(e),this.intensity=t}dispose(){this.dispatchEvent({type:"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,t}},dr=class extends zi{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ae(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},xc=new Oe,Vh=new D,Hh=new D,fr=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Re(512,512),this.mapType=jt,this.map=null,this.mapPass=null,this.matrix=new Oe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ys,this._frameExtents=new Re(1,1),this._viewportCount=1,this._viewports=[new nt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;Vh.setFromMatrixPosition(e.matrixWorld),t.position.copy(Vh),Hh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Hh),t.updateMatrixWorld(),xc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===ds||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(xc)}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.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,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}},ca=new D,la=new Et,An=new D,pr=class extends lt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Oe,this.projectionMatrix=new Oe,this.projectionMatrixInverse=new Oe,this.coordinateSystem=mn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(ca,la,An),An.x===1&&An.y===1&&An.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ca,la,An.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(ca,la,An),An.x===1&&An.y===1&&An.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ca,la,An.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ci=new D,Wh=new Re,qh=new Re,St=class extends pr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=Fi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(qs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Fi*2*Math.atan(Math.tan(qs*.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,n){ci.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ci.x,ci.y).multiplyScalar(-e/ci.z),ci.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ci.x,ci.y).multiplyScalar(-e/ci.z)}getViewSize(e,t){return this.getViewBounds(e,Wh,qh),t.subVectors(qh,Wh)}setViewOffset(e,t,n,i,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=n,this.view.offsetY=i,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(qs*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(this.view!==null&&this.view.enabled){let c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}let o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},wc=class extends fr{constructor(){super(new St(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Fi*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},mr=class extends zi{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.target=new lt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new wc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},Ec=class extends fr{constructor(){super(new St(90,1,.5,500)),this.isPointLightShadow=!0}},Gi=class extends zi{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Ec}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.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}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},pi=class extends pr{constructor(e=-1,t=1,n=1,i=-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=n,this.bottom=i,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,n,i,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=n,this.view.offsetY=i,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Rc=class extends fr{constructor(){super(new pi(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},Vi=class extends zi{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.target=new lt,this.shadow=new Rc}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}};var $n=class{static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}};var vc=new WeakMap,gr=class extends Fn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&_e("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&_e("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=wn.get(`image-bitmap:${e}`);if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(l=>{vc.has(a)===!0?(i&&i(vc.get(a)),r.manager.itemError(e),r.manager.itemEnd(e)):(t&&t(l),r.manager.itemEnd(e))});return}setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let c=fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){wn.add(`image-bitmap:${e}`,l),t&&t(l),r.manager.itemEnd(e)}).catch(function(l){i&&i(l),vc.set(c,l),wn.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});wn.add(`image-bitmap:${e}`,c),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var cs=-90,ls=1,Oa=class extends lt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new St(cs,ls,e,t);i.layers=this.layers,this.add(i);let r=new St(cs,ls,e,t);r.layers=this.layers,this.add(r);let a=new St(cs,ls,e,t);a.layers=this.layers,this.add(a);let o=new St(cs,ls,e,t);o.layers=this.layers,this.add(o);let c=new St(cs,ls,e,t);c.layers=this.layers,this.add(c);let l=new St(cs,ls,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,c]=t;for(let l of t)this.remove(l);if(e===mn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===ds)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;let y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(n,1,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=y,e.setRenderTarget(n,5,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}},Ba=class extends St{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}};var ka=class{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,a;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[r+o]=n[o];a=t}else{a+=t;let o=t/a;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){Et.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let a=this._workIndex*r;Et.multiplyQuaternionsFlat(e,a,e,t,e,n),Et.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){let a=1-i;for(let o=0;o!==r;++o){let c=t+o;e[c]=e[c]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){let o=t+a;e[o]=e[o]+e[n+a]*i}}},$c="\\[\\]\\.:\\/",Tf=new RegExp("["+$c+"]","g"),Qc="[^"+$c+"]",Af="[^"+$c.replace("\\.","")+"]",wf=/((?:WC+[\/:])*)/.source.replace("WC",Qc),Ef=/(WCOD+)?/.source.replace("WCOD",Af),Rf=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qc),Cf=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qc),Pf=new RegExp("^"+wf+Ef+Rf+Cf+"$"),If=["material","materials","bones","map"],Cc=class{constructor(e,t,n){let i=n||tt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},tt=class s{constructor(e,t,n){this.path=t,this.parsedPath=n||s.parseTrackName(t),this.node=s.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new s.Composite(e,t,n):new s(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Tf,"")}static parseTrackName(e){let t=Pf.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);If.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let a=0;a<r.length;a++){let o=r[a];if(o.name===t||o.uuid===t)return o;let c=n(o.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_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 n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=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,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=s.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){_e("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){we("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){we("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){we("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){we("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){we("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[n]===void 0){we("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){we("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let a=e[i];if(a===void 0){let l=t.nodeName;we("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){we("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){we("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])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};tt.Composite=Cc;tt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};tt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};tt.prototype.GetterByBindingType=[tt.prototype._getValue_direct,tt.prototype._getValue_array,tt.prototype._getValue_arrayElement,tt.prototype._getValue_toArray];tt.prototype.SetterByBindingTypeAndVersioning=[[tt.prototype._setValue_direct,tt.prototype._setValue_direct_setNeedsUpdate,tt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_array,tt.prototype._setValue_array_setNeedsUpdate,tt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_arrayElement,tt.prototype._setValue_arrayElement_setNeedsUpdate,tt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_fromArray,tt.prototype._setValue_fromArray_setNeedsUpdate,tt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var za=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,a=r.length,o=new Array(a),c={endingStart:Ri,endingEnd:Ri};for(let l=0;l!==a;++l){let h=r[l].createInterpolant(null);o[l]=h,h.settings&&Object.assign(c,h.settings),h.settings=c}this._interpolantSettings=c,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=gu,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,a=this.timeScale,o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);let c=o.parameterPositions,l=o.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let r=this._startTime;if(r!==null){let c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);let a=this._updateTime(t),o=this._updateWeight(e);if(o>0){let c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case _u:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case Io:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,a=n===bu;if(e===0)return r===-1?i:a&&(r&1)===1?t-i:i;if(n===mu){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){let o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);let c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){let l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(a&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=Ci,i.endingEnd=Ci):(e?i.endingStart=this.zeroSlopeAtStart?Ci:Ri:i.endingStart=js,t?i.endingEnd=this.zeroSlopeAtEnd?Ci:Ri:i.endingEnd=js)}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let o=a.parameterPositions,c=a.sampleValues;return o[0]=r,c[0]=t,o[1]=r+e,c[1]=n,this}},Df=new Float32Array(1),br=class extends cn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName,h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){let d=i[u],f=d.name,g=h[f];if(g!==void 0)++g.referenceCount,a[u]=g;else{if(g=a[u],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,c,f));continue}let y=t&&t._propertyBindings[u].binding.parsedPath;g=new ka(tt.create(n,f,y),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,c,f),a[u]=g}o[u].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,r=this._actionsByClip,a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{let o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,a=this._actionsByClip,o=a[r],c=o.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],c.length===0&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,r=this._bindings,a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete o[r],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new lr(new Float32Array(2),new Float32Array(2),1,Df),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){let i=t||this._root,r=i.uuid,a=typeof e=="string"?ki.findByName(i,e):e,o=a!==null?a.uuid:e,c=this._actionsByClip[o],l=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Io),c!==void 0){let u=c.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;l=c.knownActions[0],a===null&&(a=l._clip)}if(a===null)return null;let h=new za(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h}existingAction(e,t){let n=t||this._root,i=n.uuid,r=typeof e=="string"?ki.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,a);let o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){let a=r.knownActions;for(let o=0,c=a.length;o!==c;++o){let l=a[o];this._deactivateAction(l);let h=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let a in n){let o=n[a].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}let i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(let a in r){let o=r[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){let n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}};var _r=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,_e("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},As=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ge(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ge(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var rl=class rl{constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}};rl.prototype.isMatrix2=!0;var Pc=rl;var xr=class extends cn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){_e("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function el(s,e,t,n){let i=Lf(n);switch(t){case Xc:return s*e;case Ja:return s*e/i.components*i.byteLength;case Za:return s*e/i.components*i.byteLength;case xi:return s*e*2/i.components*i.byteLength;case $a:return s*e*2/i.components*i.byteLength;case jc:return s*e*3/i.components*i.byteLength;case nn:return s*e*4/i.components*i.byteLength;case Qa:return s*e*4/i.components*i.byteLength;case Sr:case Tr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Ar:case wr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case to:case io:return Math.max(s,16)*Math.max(e,8)/4;case eo:case no:return Math.max(s,8)*Math.max(e,8)/2;case so:case ro:case oo:case co:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case ao:case Er:case lo:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case ho:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case uo:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case fo:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case po:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case mo:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case go:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case bo:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case _o:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case xo:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case vo:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case yo:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case Mo:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case So:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case To:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case Ao:case wo:case Eo:return Math.ceil(s/4)*Math.ceil(e/4)*16;case Ro:case Co:return Math.ceil(s/4)*Math.ceil(e/4)*8;case Rr:case Po:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Lf(s){switch(s){case jt:case Vc:return{byteLength:1,components:1};case Rs:case Hc:case Un:return{byteLength:2,components:1};case Ka:case Ya:return{byteLength:2,components:4};case Mn:case ja:case tn:return{byteLength:4,components:1};case Wc:case qc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?_e("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");function id(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&s!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s!==null&&s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function Nf(s){let e=new WeakMap;function t(o,c){let l=o.array,h=o.usage,u=l.byteLength,d=s.createBuffer();s.bindBuffer(c,d),s.bufferData(c,l,h),o.onUploadCallback();let f;if(l instanceof Float32Array)f=s.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)f=s.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?f=s.HALF_FLOAT:f=s.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=s.SHORT;else if(l instanceof Uint32Array)f=s.UNSIGNED_INT;else if(l instanceof Int32Array)f=s.INT;else if(l instanceof Int8Array)f=s.BYTE;else if(l instanceof Uint8Array)f=s.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:f,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,c,l){let h=c.array,u=c.updateRanges;if(s.bindBuffer(l,o),u.length===0)s.bufferSubData(l,0,h);else{u.sort((f,g)=>f.start-g.start);let d=0;for(let f=1;f<u.length;f++){let g=u[d],y=u[f];y.start<=g.start+g.count+1?g.count=Math.max(g.count,y.start+y.count-g.start):(++d,u[d]=y)}u.length=d+1;for(let f=0,g=u.length;f<g;f++){let y=u[f];s.bufferSubData(l,y.start*h.BYTES_PER_ELEMENT,h,y.start,y.count)}c.clearUpdateRanges()}c.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);let c=e.get(o);c&&(s.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){let h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.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.");n(l.buffer,o,c),l.version=o.version}}return{get:i,remove:r,update:a}}var Uf=`#ifdef USE_ALPHAHASH- if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;-#endif`,Of=`#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`,Bf=`#ifdef USE_ALPHAMAP- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;-#endif`,kf=`#ifdef USE_ALPHAMAP- uniform sampler2D alphaMap;-#endif`,zf=`#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`,Gf=`#ifdef USE_ALPHATEST- uniform float alphaTest;-#endif`,Vf=`#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`,Hf=`#ifdef USE_AOMAP- uniform sampler2D aoMap;- uniform float aoMapIntensity;-#endif`,Wf=`#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;- vec4 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 );- }-#endif`,qf=`#ifdef USE_BATCHING- mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );-#endif`,Xf=`vec3 transformed = vec3( position );-#ifdef USE_ALPHAHASH- vPosition = vec3( position );-#endif`,jf=`vec3 objectNormal = vec3( normal );-#ifdef USE_TANGENT- vec3 objectTangent = vec3( tangent.xyz );-#endif`,Kf=`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`,Yf=`#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`,Jf=`#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`,Zf=`#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`,$f=`#if NUM_CLIPPING_PLANES > 0- varying vec3 vClipPosition;- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];-#endif`,Qf=`#if NUM_CLIPPING_PLANES > 0- varying vec3 vClipPosition;-#endif`,ep=`#if NUM_CLIPPING_PLANES > 0- vClipPosition = - mvPosition.xyz;-#endif`,tp=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )- diffuseColor *= vColor;-#endif`,np=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )- varying vec4 vColor;-#endif`,ip=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )- varying vec4 vColor;-#endif`,sp=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )- vColor = vec4( 1.0 );-#endif-#ifdef USE_COLOR_ALPHA- vColor *= color;-#elif defined( USE_COLOR )- vColor.rgb *= color;-#endif-#ifdef USE_INSTANCING_COLOR- vColor.rgb *= instanceColor.rgb;-#endif-#ifdef USE_BATCHING_COLOR- vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );-#endif`,rp=`#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 );-}-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`,ap=`#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`,op=`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`,cp=`#ifdef USE_DISPLACEMENTMAP- uniform sampler2D displacementMap;- uniform float displacementScale;- uniform float displacementBias;-#endif`,lp=`#ifdef USE_DISPLACEMENTMAP- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );-#endif`,hp=`#ifdef USE_EMISSIVEMAP- vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );- #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE- emissiveColor = sRGBTransferEOTF( emissiveColor );- #endif- totalEmissiveRadiance *= emissiveColor.rgb;-#endif`,up=`#ifdef USE_EMISSIVEMAP- uniform sampler2D emissiveMap;-#endif`,dp="gl_FragColor = linearToOutputTexel( gl_FragColor );",fp=`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 );-}`,pp=`#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 * reflectVec );- #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-#endif`,mp=`#ifdef USE_ENVMAP- uniform float envMapIntensity;- uniform mat3 envMapRotation;- #ifdef ENVMAP_TYPE_CUBE- uniform samplerCube envMap;- #else- uniform sampler2D envMap;- #endif-#endif`,gp=`#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`,bp=`#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`,_p=`#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`,xp=`#ifdef USE_FOG- vFogDepth = - mvPosition.z;-#endif`,vp=`#ifdef USE_FOG- varying float vFogDepth;-#endif`,yp=`#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`,Mp=`#ifdef USE_FOG- uniform vec3 fogColor;- varying float vFogDepth;- #ifdef FOG_EXP2- uniform float fogDensity;- #else- uniform float fogNear;- uniform float fogFar;- #endif-#endif`,Sp=`#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-}`,Tp=`#ifdef USE_LIGHTMAP- uniform sampler2D lightMap;- uniform float lightMapIntensity;-#endif`,Ap=`LambertMaterial material;-material.diffuseColor = diffuseColor.rgb;-material.specularStrength = specularStrength;`,wp=`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`,Ep=`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-#include <lightprobes_pars_fragment>`,Rp=`#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, pow4( 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`,Cp=`ToonMaterial material;-material.diffuseColor = diffuseColor.rgb;`,Pp=`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`,Ip=`BlinnPhongMaterial material;-material.diffuseColor = diffuseColor.rgb;-material.specularColor = specular;-material.specularShininess = shininess;-material.specularStrength = specularStrength;`,Dp=`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`,Lp=`PhysicalMaterial material;-material.diffuseColor = diffuseColor.rgb;-material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );-material.metalness = 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 = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;- material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );-#else- material.specularColor = vec3( 0.04 );- material.specularColorBlended = mix( material.specularColor, 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.0001, 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`,Fp=`uniform sampler2D dfgLUT;-struct PhysicalMaterial {- vec3 diffuseColor;- vec3 diffuseContribution;- vec3 specularColor;- vec3 specularColorBlended;- float roughness;- float metalness;- 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;- vec3 iridescenceFresnelDielectric;- vec3 iridescenceFresnelMetallic;- #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 ) );- return 0.5 / max( gv + gl, EPSILON );- }- 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.specularColorBlended;- 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 * transpose( 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 rInv = 1.0 / ( roughness + 0.1 );- float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;- float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;- float DG = exp( a * dotNV + b );- return saturate( DG );-}-vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {- float dotNV = saturate( dot( normal, viewDir ) );- vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;- 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- float dotNV = saturate( dot( normal, viewDir ) );- vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;- #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;-}-vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {- vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );- float dotNL = saturate( dot( normal, lightDir ) );- float dotNV = saturate( dot( normal, viewDir ) );- vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;- vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;- vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;- vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;- float Ess_V = dfgV.x + dfgV.y;- float Ess_L = dfgL.x + dfgL.y;- float Ems_V = 1.0 - Ess_V;- float Ems_L = 1.0 - Ess_L;- vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;- vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );- float compensationFactor = Ems_V * Ems_L;- vec3 multiScatter = Fms * compensationFactor;- return singleScatter + multiScatter;-}-#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.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );- reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );- #ifdef USE_CLEARCOAT- vec3 Ncc = geometryClearcoatNormal;- vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );- vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );- vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );- mat3 mInvClearcoat = mat3(- vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),- vec3( 0, 1, 0 ),- vec3( t1Clearcoat.z, 0, t1Clearcoat.w )- );- vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;- clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );- #endif- }-#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 );-- float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );- float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );-- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );-- irradiance *= sheenEnergyComp;-- #endif- reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );-}-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 ) {- vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );- #ifdef USE_SHEEN- float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;- diffuse *= sheenEnergyComp;- #endif- reflectedLight.indirectDiffuse += diffuse;-}-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 ) * RECIPROCAL_PI;- #endif- vec3 singleScatteringDielectric = vec3( 0.0 );- vec3 multiScatteringDielectric = vec3( 0.0 );- vec3 singleScatteringMetallic = vec3( 0.0 );- vec3 multiScatteringMetallic = vec3( 0.0 );- #ifdef USE_IRIDESCENCE- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );- #else- computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );- computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );- #endif- vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );- vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );- vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;- vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;- vec3 indirectSpecular = radiance * singleScattering;- indirectSpecular += multiScattering * cosineWeightedIrradiance;- vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;- #ifdef USE_SHEEN- float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;- indirectSpecular *= sheenEnergyComp;- indirectDiffuse *= sheenEnergyComp;- #endif- reflectedLight.indirectSpecular += indirectSpecular;- reflectedLight.indirectDiffuse += indirectDiffuse;-}-#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 );-}`,Np=`-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.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );- material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );- material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );- 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 ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )- 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- #ifdef USE_LIGHT_PROBES_GRID- vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;- vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );- irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );- #endif-#endif-#if defined( RE_IndirectSpecular )- vec3 radiance = vec3( 0.0 );- vec3 clearcoatRadiance = vec3( 0.0 );-#endif`,Up=`#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( ENVMAP_TYPE_CUBE_UV )- #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )- iblIrradiance += getIBLIrradiance( geometryNormal );- #endif- #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`,Op=`#if defined( RE_IndirectDiffuse )- #if defined( LAMBERT ) || defined( PHONG )- irradiance += iblIrradiance;- #endif- 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`,Bp=`#ifdef USE_LIGHT_PROBES_GRID-uniform highp sampler3D probesSH;-uniform vec3 probesMin;-uniform vec3 probesMax;-uniform vec3 probesResolution;-vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {- vec3 res = probesResolution;- vec3 gridRange = probesMax - probesMin;- vec3 resMinusOne = res - 1.0;- vec3 probeSpacing = gridRange / resMinusOne;- vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;- vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );- uvw = uvw * resMinusOne / res + 0.5 / res;- float nz = res.z;- float paddedSlices = nz + 2.0;- float atlasDepth = 7.0 * paddedSlices;- float uvZBase = uvw.z * nz + 1.0;- vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );- vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );- vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );- vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );- vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );- vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );- vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );- vec3 c0 = s0.xyz;- vec3 c1 = vec3( s0.w, s1.xy );- vec3 c2 = vec3( s1.zw, s2.x );- vec3 c3 = s2.yzw;- vec3 c4 = s3.xyz;- vec3 c5 = vec3( s3.w, s4.xy );- vec3 c6 = vec3( s4.zw, s5.x );- vec3 c7 = s5.yzw;- vec3 c8 = s6.xyz;- float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;- vec3 result = c0 * 0.886227;- result += c1 * 2.0 * 0.511664 * y;- result += c2 * 2.0 * 0.511664 * z;- result += c3 * 2.0 * 0.511664 * x;- result += c4 * 2.0 * 0.429043 * x * y;- result += c5 * 2.0 * 0.429043 * y * z;- result += c6 * ( 0.743125 * z * z - 0.247708 );- result += c7 * 2.0 * 0.429043 * x * z;- result += c8 * 0.429043 * ( x * x - y * y );- return max( result, vec3( 0.0 ) );-}-#endif`,kp=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;-#endif`,zp=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )- uniform float logDepthBufFC;- varying float vFragDepth;- varying float vIsPerspective;-#endif`,Gp=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER- varying float vFragDepth;- varying float vIsPerspective;-#endif`,Vp=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER- vFragDepth = 1.0 + gl_Position.w;- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );-#endif`,Hp=`#ifdef USE_MAP- vec4 sampledDiffuseColor = texture2D( map, vMapUv );- #ifdef DECODE_VIDEO_TEXTURE- sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );- #endif- diffuseColor *= sampledDiffuseColor;-#endif`,Wp=`#ifdef USE_MAP- uniform sampler2D map;-#endif`,qp=`#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`,Xp=`#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`,jp=`float metalnessFactor = metalness;-#ifdef USE_METALNESSMAP- vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );- metalnessFactor *= texelMetalness.b;-#endif`,Kp=`#ifdef USE_METALNESSMAP- uniform sampler2D metalnessMap;-#endif`,Yp=`#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`,Jp=`#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`,Zp=`#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`,$p=`#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`,Qp=`#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`,em=`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;`,tm=`#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;- #if defined( USE_PACKED_NORMALMAP )- mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );- #endif- mapN.xy *= normalScale;- normal = normalize( tbn * mapN );-#elif defined( USE_BUMPMAP )- normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );-#endif`,nm=`#ifndef FLAT_SHADED- varying vec3 vNormal;- #ifdef USE_TANGENT- varying vec3 vTangent;- varying vec3 vBitangent;- #endif-#endif`,im=`#ifndef FLAT_SHADED- varying vec3 vNormal;- #ifdef USE_TANGENT- varying vec3 vTangent;- varying vec3 vBitangent;- #endif-#endif`,sm=`#ifndef FLAT_SHADED- vNormal = normalize( transformedNormal );- #ifdef USE_TANGENT- vTangent = normalize( transformedTangent );- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );- #endif-#endif`,rm=`#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`,am=`#ifdef USE_CLEARCOAT- vec3 clearcoatNormal = nonPerturbedNormal;-#endif`,om=`#ifdef USE_CLEARCOAT_NORMALMAP- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;- clearcoatMapN.xy *= clearcoatNormalScale;- clearcoatNormal = normalize( tbn2 * clearcoatMapN );-#endif`,cm=`#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`,lm=`#ifdef USE_IRIDESCENCEMAP- uniform sampler2D iridescenceMap;-#endif-#ifdef USE_IRIDESCENCE_THICKNESSMAP- uniform sampler2D iridescenceThicknessMap;-#endif`,hm=`#ifdef OPAQUE-diffuseColor.a = 1.0;-#endif-#ifdef USE_TRANSMISSION-diffuseColor.a *= material.transmissionAlpha;-#endif-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,um=`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 ) {- #ifdef USE_REVERSED_DEPTH_BUFFER-- return depth * ( far - near ) - far;- #else- return depth * ( near - far ) - near;- #endif-}-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 ) {-- #ifdef USE_REVERSED_DEPTH_BUFFER- return ( near * far ) / ( ( near - far ) * depth - near );- #else- return ( near * far ) / ( ( far - near ) * depth - far );- #endif-}`,dm=`#ifdef PREMULTIPLIED_ALPHA- gl_FragColor.rgb *= gl_FragColor.a;-#endif`,fm=`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;`,pm=`#ifdef DITHERING- gl_FragColor.rgb = dithering( gl_FragColor.rgb );-#endif`,mm=`#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`,gm=`float roughnessFactor = roughness;-#ifdef USE_ROUGHNESSMAP- vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );- roughnessFactor *= texelRoughness.g;-#endif`,bm=`#ifdef USE_ROUGHNESSMAP- uniform sampler2D roughnessMap;-#endif`,_m=`#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- #if defined( SHADOWMAP_TYPE_PCF )- uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];- #else- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];- #endif- 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- #if defined( SHADOWMAP_TYPE_PCF )- uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];- #else- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];- #endif- 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- #if defined( SHADOWMAP_TYPE_PCF )- uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];- #elif defined( SHADOWMAP_TYPE_BASIC )- uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];- #endif- 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- #if defined( SHADOWMAP_TYPE_PCF )- float interleavedGradientNoise( vec2 position ) {- return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );- }- vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {- const float goldenAngle = 2.399963229728653;- float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );- float theta = float( sampleIndex ) * goldenAngle + phi;- return vec2( cos( theta ), sin( theta ) ) * r;- }- #endif- #if defined( SHADOWMAP_TYPE_PCF )- float getShadow( sampler2DShadow 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 ) {- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;- float radius = shadowRadius * texelSize.x;- float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;- shadow = (- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )- ) * 0.2;- }- return mix( 1.0, shadow, shadowIntensity );- }- #elif defined( SHADOWMAP_TYPE_VSM )- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {- float shadow = 1.0;- shadowCoord.xyz /= shadowCoord.w;- #ifdef USE_REVERSED_DEPTH_BUFFER- shadowCoord.z -= shadowBias;- #else- shadowCoord.z += shadowBias;- #endif- 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 ) {- vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;- float mean = distribution.x;- float variance = distribution.y * distribution.y;- #ifdef USE_REVERSED_DEPTH_BUFFER- float hard_shadow = step( mean, shadowCoord.z );- #else- float hard_shadow = step( shadowCoord.z, mean );- #endif-- if ( hard_shadow == 1.0 ) {- shadow = 1.0;- } else {- variance = max( variance, 0.0000001 );- float d = shadowCoord.z - mean;- float p_max = variance / ( variance + d * d );- p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );- shadow = max( hard_shadow, p_max );- }- }- return mix( 1.0, shadow, shadowIntensity );- }- #else- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {- float shadow = 1.0;- shadowCoord.xyz /= shadowCoord.w;- #ifdef USE_REVERSED_DEPTH_BUFFER- shadowCoord.z -= shadowBias;- #else- shadowCoord.z += shadowBias;- #endif- 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 ) {- float depth = texture2D( shadowMap, shadowCoord.xy ).r;- #ifdef USE_REVERSED_DEPTH_BUFFER- shadow = step( depth, shadowCoord.z );- #else- shadow = step( shadowCoord.z, depth );- #endif- }- return mix( 1.0, shadow, shadowIntensity );- }- #endif- #if NUM_POINT_LIGHT_SHADOWS > 0- #if defined( SHADOWMAP_TYPE_PCF )- float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {- float shadow = 1.0;- vec3 lightToPosition = shadowCoord.xyz;- vec3 bd3D = normalize( lightToPosition );- vec3 absVec = abs( lightToPosition );- float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );- if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {- #ifdef USE_REVERSED_DEPTH_BUFFER- float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );- dp -= shadowBias;- #else- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );- dp += shadowBias;- #endif- float texelSize = shadowRadius / shadowMapSize.x;- vec3 absDir = abs( bd3D );- vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );- tangent = normalize( cross( bd3D, tangent ) );- vec3 bitangent = cross( bd3D, tangent );- float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;- vec2 sample0 = vogelDiskSample( 0, 5, phi );- vec2 sample1 = vogelDiskSample( 1, 5, phi );- vec2 sample2 = vogelDiskSample( 2, 5, phi );- vec2 sample3 = vogelDiskSample( 3, 5, phi );- vec2 sample4 = vogelDiskSample( 4, 5, phi );- shadow = (- texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +- texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +- texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +- texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +- texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )- ) * 0.2;- }- return mix( 1.0, shadow, shadowIntensity );- }- #elif defined( SHADOWMAP_TYPE_BASIC )- float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {- float shadow = 1.0;- vec3 lightToPosition = shadowCoord.xyz;- vec3 absVec = abs( lightToPosition );- float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );- if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );- dp += shadowBias;- vec3 bd3D = normalize( lightToPosition );- float depth = textureCube( shadowMap, bd3D ).r;- #ifdef USE_REVERSED_DEPTH_BUFFER- depth = 1.0 - depth;- #endif- shadow = step( dp, depth );- }- return mix( 1.0, shadow, shadowIntensity );- }- #endif- #endif-#endif`,xm=`#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`,vm=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )- #ifdef HAS_NORMAL- vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );- #else- vec3 shadowWorldNormal = vec3( 0.0 );- #endif- 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`,ym=`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 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )- 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;-}`,Mm=`#ifdef USE_SKINNING- mat4 boneMatX = getBoneMatrix( skinIndex.x );- mat4 boneMatY = getBoneMatrix( skinIndex.y );- mat4 boneMatZ = getBoneMatrix( skinIndex.z );- mat4 boneMatW = getBoneMatrix( skinIndex.w );-#endif`,Sm=`#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`,Tm=`#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`,Am=`#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`,wm=`float specularStrength;-#ifdef USE_SPECULARMAP- vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );- specularStrength = texelSpecular.r;-#else- specularStrength = 1.0;-#endif`,Em=`#ifdef USE_SPECULARMAP- uniform sampler2D specularMap;-#endif`,Rm=`#if defined( TONE_MAPPING )- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );-#endif`,Cm=`#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; }`,Pm=`#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.diffuseContribution, material.specularColorBlended, 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`,Im=`#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`,Dm=`#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`,Lm=`#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`,Fm=`#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`,Nm=`#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`,Um=`varying vec2 vUv;-uniform mat3 uvTransform;-void main() {- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;- gl_Position = vec4( position.xy, 1.0, 1.0 );-}`,Om=`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>-}`,Bm=`varying vec3 vWorldDirection;-#include <common>-void main() {- vWorldDirection = transformDirection( position, modelMatrix );- #include <begin_vertex>- #include <project_vertex>- gl_Position.z = gl_Position.w;-}`,km=`#ifdef ENVMAP_TYPE_CUBE- uniform samplerCube envMap;-#elif defined( ENVMAP_TYPE_CUBE_UV )- uniform sampler2D envMap;-#endif-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 * vWorldDirection );- #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>-}`,zm=`varying vec3 vWorldDirection;-#include <common>-void main() {- vWorldDirection = transformDirection( position, modelMatrix );- #include <begin_vertex>- #include <project_vertex>- gl_Position.z = gl_Position.w;-}`,Gm=`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>-}`,Vm=`#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;-}`,Hm=`#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>- #ifdef USE_REVERSED_DEPTH_BUFFER- float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];- #else- float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;- #endif- #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-}`,Wm=`#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;-}`,qm=`#define DISTANCE-uniform vec3 referencePosition;-uniform float nearDistance;-uniform float farDistance;-varying vec3 vWorldPosition;-#include <common>-#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 = vec4( dist, 0.0, 0.0, 1.0 );-}`,Xm=`varying vec3 vWorldDirection;-#include <common>-void main() {- vWorldDirection = transformDirection( position, modelMatrix );- #include <begin_vertex>- #include <project_vertex>-}`,jm=`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>-}`,Km=`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>-}`,Ym=`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>-}`,Jm=`#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>-}`,Zm=`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>-}`,$m=`#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>-}`,Qm=`#define LAMBERT-uniform vec3 diffuse;-uniform vec3 emissive;-uniform float opacity;-#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 <emissivemap_pars_fragment>-#include <cube_uv_reflection_fragment>-#include <envmap_common_pars_fragment>-#include <envmap_pars_fragment>-#include <envmap_physical_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>-}`,eg=`#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;-}`,tg=`#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>-}`,ng=`#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-}`,ig=`#define NORMAL-uniform float opacity;-#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )- varying vec3 vViewPosition;-#endif-#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( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );- #ifdef OPAQUE- gl_FragColor.a = 1.0;- #endif-}`,sg=`#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>-}`,rg=`#define PHONG-uniform vec3 diffuse;-uniform vec3 emissive;-uniform vec3 specular;-uniform float shininess;-uniform float opacity;-#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 <emissivemap_pars_fragment>-#include <cube_uv_reflection_fragment>-#include <envmap_common_pars_fragment>-#include <envmap_pars_fragment>-#include <envmap_physical_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>-}`,ag=`#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-}`,og=`#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 <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-- outgoingLight = outgoingLight + 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>-}`,cg=`#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>-}`,lg=`#define TOON-uniform vec3 diffuse;-uniform vec3 emissive;-uniform float opacity;-#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 <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>-}`,hg=`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>-}`,ug=`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>-}`,dg=`#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>-}`,fg=`uniform vec3 color;-uniform float opacity;-#include <common>-#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>- #include <premultiplied_alpha_fragment>-}`,pg=`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>-}`,mg=`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>-}`,Be={alphahash_fragment:Uf,alphahash_pars_fragment:Of,alphamap_fragment:Bf,alphamap_pars_fragment:kf,alphatest_fragment:zf,alphatest_pars_fragment:Gf,aomap_fragment:Vf,aomap_pars_fragment:Hf,batching_pars_vertex:Wf,batching_vertex:qf,begin_vertex:Xf,beginnormal_vertex:jf,bsdfs:Kf,iridescence_fragment:Yf,bumpmap_pars_fragment:Jf,clipping_planes_fragment:Zf,clipping_planes_pars_fragment:$f,clipping_planes_pars_vertex:Qf,clipping_planes_vertex:ep,color_fragment:tp,color_pars_fragment:np,color_pars_vertex:ip,color_vertex:sp,common:rp,cube_uv_reflection_fragment:ap,defaultnormal_vertex:op,displacementmap_pars_vertex:cp,displacementmap_vertex:lp,emissivemap_fragment:hp,emissivemap_pars_fragment:up,colorspace_fragment:dp,colorspace_pars_fragment:fp,envmap_fragment:pp,envmap_common_pars_fragment:mp,envmap_pars_fragment:gp,envmap_pars_vertex:bp,envmap_physical_pars_fragment:Rp,envmap_vertex:_p,fog_vertex:xp,fog_pars_vertex:vp,fog_fragment:yp,fog_pars_fragment:Mp,gradientmap_pars_fragment:Sp,lightmap_pars_fragment:Tp,lights_lambert_fragment:Ap,lights_lambert_pars_fragment:wp,lights_pars_begin:Ep,lights_toon_fragment:Cp,lights_toon_pars_fragment:Pp,lights_phong_fragment:Ip,lights_phong_pars_fragment:Dp,lights_physical_fragment:Lp,lights_physical_pars_fragment:Fp,lights_fragment_begin:Np,lights_fragment_maps:Up,lights_fragment_end:Op,lightprobes_pars_fragment:Bp,logdepthbuf_fragment:kp,logdepthbuf_pars_fragment:zp,logdepthbuf_pars_vertex:Gp,logdepthbuf_vertex:Vp,map_fragment:Hp,map_pars_fragment:Wp,map_particle_fragment:qp,map_particle_pars_fragment:Xp,metalnessmap_fragment:jp,metalnessmap_pars_fragment:Kp,morphinstance_vertex:Yp,morphcolor_vertex:Jp,morphnormal_vertex:Zp,morphtarget_pars_vertex:$p,morphtarget_vertex:Qp,normal_fragment_begin:em,normal_fragment_maps:tm,normal_pars_fragment:nm,normal_pars_vertex:im,normal_vertex:sm,normalmap_pars_fragment:rm,clearcoat_normal_fragment_begin:am,clearcoat_normal_fragment_maps:om,clearcoat_pars_fragment:cm,iridescence_pars_fragment:lm,opaque_fragment:hm,packing:um,premultiplied_alpha_fragment:dm,project_vertex:fm,dithering_fragment:pm,dithering_pars_fragment:mm,roughnessmap_fragment:gm,roughnessmap_pars_fragment:bm,shadowmap_pars_fragment:_m,shadowmap_pars_vertex:xm,shadowmap_vertex:vm,shadowmask_pars_fragment:ym,skinbase_vertex:Mm,skinning_pars_vertex:Sm,skinning_vertex:Tm,skinnormal_vertex:Am,specularmap_fragment:wm,specularmap_pars_fragment:Em,tonemapping_fragment:Rm,tonemapping_pars_fragment:Cm,transmission_fragment:Pm,transmission_pars_fragment:Im,uv_pars_fragment:Dm,uv_pars_vertex:Lm,uv_vertex:Fm,worldpos_vertex:Nm,background_vert:Um,background_frag:Om,backgroundCube_vert:Bm,backgroundCube_frag:km,cube_vert:zm,cube_frag:Gm,depth_vert:Vm,depth_frag:Hm,distance_vert:Wm,distance_frag:qm,equirect_vert:Xm,equirect_frag:jm,linedashed_vert:Km,linedashed_frag:Ym,meshbasic_vert:Jm,meshbasic_frag:Zm,meshlambert_vert:$m,meshlambert_frag:Qm,meshmatcap_vert:eg,meshmatcap_frag:tg,meshnormal_vert:ng,meshnormal_frag:ig,meshphong_vert:sg,meshphong_frag:rg,meshphysical_vert:ag,meshphysical_frag:og,meshtoon_vert:cg,meshtoon_frag:lg,points_vert:hg,points_frag:ug,shadow_vert:dg,shadow_frag:fg,sprite_vert:pg,sprite_frag:mg},ce={common:{diffuse:{value:new Ae(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ie},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ie}},envmap:{envMap:{value:null},envMapRotation:{value:new Ie},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ie}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ie}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ie},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ie},normalScale:{value:new Re(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ie},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ie}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ie}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ie}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ae(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new D},probesMax:{value:new D},probesResolution:{value:new D}},points:{diffuse:{value:new Ae(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0},uvTransform:{value:new Ie}},sprite:{diffuse:{value:new Ae(16777215)},opacity:{value:1},center:{value:new Re(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ie},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0}}},Bn={basic:{uniforms:Bt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.fog]),vertexShader:Be.meshbasic_vert,fragmentShader:Be.meshbasic_frag},lambert:{uniforms:Bt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Ae(0)},envMapIntensity:{value:1}}]),vertexShader:Be.meshlambert_vert,fragmentShader:Be.meshlambert_frag},phong:{uniforms:Bt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Ae(0)},specular:{value:new Ae(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Be.meshphong_vert,fragmentShader:Be.meshphong_frag},standard:{uniforms:Bt([ce.common,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.roughnessmap,ce.metalnessmap,ce.fog,ce.lights,{emissive:{value:new Ae(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag},toon:{uniforms:Bt([ce.common,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.gradientmap,ce.fog,ce.lights,{emissive:{value:new Ae(0)}}]),vertexShader:Be.meshtoon_vert,fragmentShader:Be.meshtoon_frag},matcap:{uniforms:Bt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,{matcap:{value:null}}]),vertexShader:Be.meshmatcap_vert,fragmentShader:Be.meshmatcap_frag},points:{uniforms:Bt([ce.points,ce.fog]),vertexShader:Be.points_vert,fragmentShader:Be.points_frag},dashed:{uniforms:Bt([ce.common,ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Be.linedashed_vert,fragmentShader:Be.linedashed_frag},depth:{uniforms:Bt([ce.common,ce.displacementmap]),vertexShader:Be.depth_vert,fragmentShader:Be.depth_frag},normal:{uniforms:Bt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,{opacity:{value:1}}]),vertexShader:Be.meshnormal_vert,fragmentShader:Be.meshnormal_frag},sprite:{uniforms:Bt([ce.sprite,ce.fog]),vertexShader:Be.sprite_vert,fragmentShader:Be.sprite_frag},background:{uniforms:{uvTransform:{value:new Ie},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Be.background_vert,fragmentShader:Be.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ie}},vertexShader:Be.backgroundCube_vert,fragmentShader:Be.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Be.cube_vert,fragmentShader:Be.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Be.equirect_vert,fragmentShader:Be.equirect_frag},distance:{uniforms:Bt([ce.common,ce.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Be.distance_vert,fragmentShader:Be.distance_frag},shadow:{uniforms:Bt([ce.lights,ce.fog,{color:{value:new Ae(0)},opacity:{value:1}}]),vertexShader:Be.shadow_vert,fragmentShader:Be.shadow_frag}};Bn.physical={uniforms:Bt([Bn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ie},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ie},clearcoatNormalScale:{value:new Re(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ie},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ie},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ie},sheen:{value:0},sheenColor:{value:new Ae(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ie},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ie},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ie},transmissionSamplerSize:{value:new Re},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ie},attenuationDistance:{value:0},attenuationColor:{value:new Ae(0)},specularColor:{value:new Ae(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ie},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ie},anisotropyVector:{value:new Re},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ie}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag};var Fo={r:0,b:0,g:0},gg=new Oe,sd=new Ie;sd.set(-1,0,0,0,1,0,0,0,1);function bg(s,e,t,n,i,r){let a=new Ae(0),o=i===!0?0:1,c,l,h=null,u=0,d=null;function f(x){let S=x.isScene===!0?x.background:null;if(S&&S.isTexture){let M=x.backgroundBlurriness>0;S=e.get(S,M)}return S}function g(x){let S=!1,M=f(x);M===null?m(a,o):M&&M.isColor&&(m(M,1),S=!0);let E=s.xr.getEnvironmentBlendMode();E==="additive"?t.buffers.color.setClear(0,0,0,1,r):E==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(s.autoClear||S)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function y(x,S){let M=f(S);M&&(M.isCubeTexture||M.mapping===Mr)?(l===void 0&&(l=new at(new fi(1,1,1),new en({name:"BackgroundCubeMaterial",uniforms:qi(Bn.backgroundCube.uniforms),vertexShader:Bn.backgroundCube.vertexShader,fragmentShader:Bn.backgroundCube.fragmentShader,side:Lt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(E,A,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(gg.makeRotationFromEuler(S.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(sd),l.material.toneMapped=ze.getTransfer(M.colorSpace)!==Ye,(h!==M||u!==M.version||d!==s.toneMapping)&&(l.material.needsUpdate=!0,h=M,u=M.version,d=s.toneMapping),l.layers.enableAll(),x.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new at(new Bi(2,2),new en({name:"BackgroundMaterial",uniforms:qi(Bn.background.uniforms),vertexShader:Bn.background.vertexShader,fragmentShader:Bn.background.fragmentShader,side:_n,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.toneMapped=ze.getTransfer(M.colorSpace)!==Ye,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||u!==M.version||d!==s.toneMapping)&&(c.material.needsUpdate=!0,h=M,u=M.version,d=s.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function m(x,S){x.getRGB(Fo,Zc(s)),t.buffers.color.setClear(Fo.r,Fo.g,Fo.b,S,r)}function p(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(x,S=1){a.set(x),o=S,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(x){o=x,m(a,o)},render:g,addToRenderList:y,dispose:p}}function _g(s,e){let t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=d(null),r=i,a=!1;function o(R,O,H,q,N){let z=!1,V=u(R,q,H,O);r!==V&&(r=V,l(r.object)),z=f(R,q,H,N),z&&g(R,q,H,N),N!==null&&e.update(N,s.ELEMENT_ARRAY_BUFFER),(z||a)&&(a=!1,M(R,O,H,q),N!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function c(){return s.createVertexArray()}function l(R){return s.bindVertexArray(R)}function h(R){return s.deleteVertexArray(R)}function u(R,O,H,q){let N=q.wireframe===!0,z=n[O.id];z===void 0&&(z={},n[O.id]=z);let V=R.isInstancedMesh===!0?R.id:0,$=z[V];$===void 0&&($={},z[V]=$);let Q=$[H.id];Q===void 0&&(Q={},$[H.id]=Q);let le=Q[N];return le===void 0&&(le=d(c()),Q[N]=le),le}function d(R){let O=[],H=[],q=[];for(let N=0;N<t;N++)O[N]=0,H[N]=0,q[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:H,attributeDivisors:q,object:R,attributes:{},index:null}}function f(R,O,H,q){let N=r.attributes,z=O.attributes,V=0,$=H.getAttributes();for(let Q in $)if($[Q].location>=0){let xe=N[Q],Se=z[Q];if(Se===void 0&&(Q==="instanceMatrix"&&R.instanceMatrix&&(Se=R.instanceMatrix),Q==="instanceColor"&&R.instanceColor&&(Se=R.instanceColor)),xe===void 0||xe.attribute!==Se||Se&&xe.data!==Se.data)return!0;V++}return r.attributesNum!==V||r.index!==q}function g(R,O,H,q){let N={},z=O.attributes,V=0,$=H.getAttributes();for(let Q in $)if($[Q].location>=0){let xe=z[Q];xe===void 0&&(Q==="instanceMatrix"&&R.instanceMatrix&&(xe=R.instanceMatrix),Q==="instanceColor"&&R.instanceColor&&(xe=R.instanceColor));let Se={};Se.attribute=xe,xe&&xe.data&&(Se.data=xe.data),N[Q]=Se,V++}r.attributes=N,r.attributesNum=V,r.index=q}function y(){let R=r.newAttributes;for(let O=0,H=R.length;O<H;O++)R[O]=0}function m(R){p(R,0)}function p(R,O){let H=r.newAttributes,q=r.enabledAttributes,N=r.attributeDivisors;H[R]=1,q[R]===0&&(s.enableVertexAttribArray(R),q[R]=1),N[R]!==O&&(s.vertexAttribDivisor(R,O),N[R]=O)}function x(){let R=r.newAttributes,O=r.enabledAttributes;for(let H=0,q=O.length;H<q;H++)O[H]!==R[H]&&(s.disableVertexAttribArray(H),O[H]=0)}function S(R,O,H,q,N,z,V){V===!0?s.vertexAttribIPointer(R,O,H,N,z):s.vertexAttribPointer(R,O,H,q,N,z)}function M(R,O,H,q){y();let N=q.attributes,z=H.getAttributes(),V=O.defaultAttributeValues;for(let $ in z){let Q=z[$];if(Q.location>=0){let le=N[$];if(le===void 0&&($==="instanceMatrix"&&R.instanceMatrix&&(le=R.instanceMatrix),$==="instanceColor"&&R.instanceColor&&(le=R.instanceColor)),le!==void 0){let xe=le.normalized,Se=le.itemSize,Xe=e.get(le);if(Xe===void 0)continue;let Ze=Xe.buffer,Ne=Xe.type,Y=Xe.bytesPerElement,de=Ne===s.INT||Ne===s.UNSIGNED_INT||le.gpuType===ja;if(le.isInterleavedBufferAttribute){let ie=le.data,Ee=ie.stride,De=le.offset;if(ie.isInstancedInterleavedBuffer){for(let Ce=0;Ce<Q.locationSize;Ce++)p(Q.location+Ce,ie.meshPerAttribute);R.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let Ce=0;Ce<Q.locationSize;Ce++)m(Q.location+Ce);s.bindBuffer(s.ARRAY_BUFFER,Ze);for(let Ce=0;Ce<Q.locationSize;Ce++)S(Q.location+Ce,Se/Q.locationSize,Ne,xe,Ee*Y,(De+Se/Q.locationSize*Ce)*Y,de)}else{if(le.isInstancedBufferAttribute){for(let ie=0;ie<Q.locationSize;ie++)p(Q.location+ie,le.meshPerAttribute);R.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let ie=0;ie<Q.locationSize;ie++)m(Q.location+ie);s.bindBuffer(s.ARRAY_BUFFER,Ze);for(let ie=0;ie<Q.locationSize;ie++)S(Q.location+ie,Se/Q.locationSize,Ne,xe,Se*Y,Se/Q.locationSize*ie*Y,de)}}else if(V!==void 0){let xe=V[$];if(xe!==void 0)switch(xe.length){case 2:s.vertexAttrib2fv(Q.location,xe);break;case 3:s.vertexAttrib3fv(Q.location,xe);break;case 4:s.vertexAttrib4fv(Q.location,xe);break;default:s.vertexAttrib1fv(Q.location,xe)}}}}x()}function E(){w();for(let R in n){let O=n[R];for(let H in O){let q=O[H];for(let N in q){let z=q[N];for(let V in z)h(z[V].object),delete z[V];delete q[N]}}delete n[R]}}function A(R){if(n[R.id]===void 0)return;let O=n[R.id];for(let H in O){let q=O[H];for(let N in q){let z=q[N];for(let V in z)h(z[V].object),delete z[V];delete q[N]}}delete n[R.id]}function C(R){for(let O in n){let H=n[O];for(let q in H){let N=H[q];if(N[R.id]===void 0)continue;let z=N[R.id];for(let V in z)h(z[V].object),delete z[V];delete N[R.id]}}}function _(R){for(let O in n){let H=n[O],q=R.isInstancedMesh===!0?R.id:0,N=H[q];if(N!==void 0){for(let z in N){let V=N[z];for(let $ in V)h(V[$].object),delete V[$];delete N[z]}delete H[q],Object.keys(H).length===0&&delete n[O]}}}function w(){L(),a=!0,r!==i&&(r=i,l(r.object))}function L(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:w,resetDefaultState:L,dispose:E,releaseStatesOfGeometry:A,releaseStatesOfObject:_,releaseStatesOfProgram:C,initAttributes:y,enableAttribute:m,disableUnusedAttributes:x}}function xg(s,e,t){let n;function i(c){n=c}function r(c,l){s.drawArrays(n,c,l),t.update(l,n,1)}function a(c,l,h){h!==0&&(s.drawArraysInstanced(n,c,l,h),t.update(l,n,h))}function o(c,l,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,l,0,h);let d=0;for(let f=0;f<h;f++)d+=l[f];t.update(d,n,1)}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function vg(s,e,t,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){let C=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(C){return!(C!==nn&&n.convert(C)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){let _=C===Un&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==jt&&n.convert(C)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==tn&&!_)}function c(C){if(C==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp",h=c(l);h!==l&&(_e("WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);let u=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&_e("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let f=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),g=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=s.getParameter(s.MAX_TEXTURE_SIZE),m=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),p=s.getParameter(s.MAX_VERTEX_ATTRIBS),x=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),S=s.getParameter(s.MAX_VARYING_VECTORS),M=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),E=s.getParameter(s.MAX_SAMPLES),A=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:u,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:g,maxTextureSize:y,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:x,maxVaryings:S,maxFragmentUniforms:M,maxSamples:E,samples:A}}function yg(s){let e=this,t=null,n=0,i=!1,r=!1,a=new an,o=new Ie,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){let f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){let g=u.clippingPlanes,y=u.clipIntersection,m=u.clipShadows,p=s.get(u);if(!i||g===null||g.length===0||r&&!m)r?h(null):l();else{let x=r?0:n,S=x*4,M=p.clippingState||null;c.value=M,M=h(g,d,S,f);for(let E=0;E!==S;++E)M[E]=t[E];p.clippingState=M,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=x}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,g){let y=u!==null?u.length:0,m=null;if(y!==0){if(m=c.value,g!==!0||m===null){let p=f+y*4,x=d.matrixWorldInverse;o.getNormalMatrix(x),(m===null||m.length<p)&&(m=new Float32Array(p));for(let S=0,M=f;S!==y;++S,M+=4)a.copy(u[S]).applyMatrix4(x,o),a.normal.toArray(m,M),m[M+3]=a.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,m}}var vi=4,Nu=[.125,.215,.35,.446,.526,.582],Xi=20,Mg=256,Dr=new pi,Uu=new Ae,al=null,ol=0,cl=0,ll=!1,Sg=new D,Ls=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,r={}){let{size:a=256,position:o=Sg}=r;al=this._renderer.getRenderTarget(),ol=this._renderer.getActiveCubeFace(),cl=this._renderer.getActiveMipmapLevel(),ll=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ku(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Bu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(al,ol,cl),this._renderer.xr.enabled=ll,e.scissorTest=!1,Is(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===bi||e.mapping===Hi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),al=this._renderer.getRenderTarget(),ol=this._renderer.getActiveCubeFace(),cl=this._renderer.getActiveMipmapLevel(),ll=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:vt,minFilter:vt,generateMipmaps:!1,type:Un,format:nn,colorSpace:Gt,depthBuffer:!1},i=Ou(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ou(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Tg(r)),this._blurMaterial=wg(r,e,t),this._ggxMaterial=Ag(r,e,t)}return i}_compileMaterial(e){let t=new at(new Ht,e);this._renderer.compile(t,Dr)}_sceneToCubeUV(e,t,n,i,r){let c=new St(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(Uu),u.toneMapping=vn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new at(new fi,new xn({name:"PMREM.Background",side:Lt,depthWrite:!1,depthTest:!1})));let y=this._backgroundBox,m=y.material,p=!1,x=e.background;x?x.isColor&&(m.color.copy(x),e.background=null,p=!0):(m.color.copy(Uu),p=!0);for(let S=0;S<6;S++){let M=S%3;M===0?(c.up.set(0,l[S],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+h[S],r.y,r.z)):M===1?(c.up.set(0,0,l[S]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+h[S],r.z)):(c.up.set(0,l[S],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+h[S]));let E=this._cubeSize;Is(i,M*E,S>2?E:0,E,E),u.setRenderTarget(i),p&&u.render(y,c),u.render(e,c)}u.toneMapping=f,u.autoClear=d,e.background=x}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===bi||e.mapping===Hi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=ku()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Bu());let r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;let o=r.uniforms;o.envMap.value=e;let c=this._cubeSize;Is(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Dr)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let c=a.uniforms,l=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),u=Math.sqrt(l*l-h*h),d=0+l*1.25,f=u*d,{_lodMax:g}=this,y=this._sizeLods[n],m=3*y*(n>g-vi?n-g+vi:0),p=4*(this._cubeSize-y);c.envMap.value=e.texture,c.roughness.value=f,c.mipInt.value=g-t,Is(r,m,p,3*y,2*y),i.setRenderTarget(r),i.render(o,Dr),c.envMap.value=r.texture,c.roughness.value=0,c.mipInt.value=g-n,Is(e,m,p,3*y,2*y),i.setRenderTarget(e),i.render(o,Dr)}_blur(e,t,n,i,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){let c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&we("blur direction must be either latitudinal or longitudinal!");let h=3,u=this._lodMeshes[i];u.material=l;let d=l.uniforms,f=this._sizeLods[n]-1,g=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*Xi-1),y=r/g,m=isFinite(r)?1+Math.floor(h*y):Xi;m>Xi&&_e(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Xi}`);let p=[],x=0;for(let C=0;C<Xi;++C){let _=C/y,w=Math.exp(-_*_/2);p.push(w),C===0?x+=w:C<m&&(x+=2*w)}for(let C=0;C<p.length;C++)p[C]=p[C]/x;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);let{_lodMax:S}=this;d.dTheta.value=g,d.mipInt.value=S-n;let M=this._sizeLods[i],E=3*M*(i>S-vi?i-S+vi:0),A=4*(this._cubeSize-M);Is(t,E,A,3*M,2*M),c.setRenderTarget(t),c.render(u,Dr)}};function Tg(s){let e=[],t=[],n=[],i=s,r=s-vi+1+Nu.length;for(let a=0;a<r;a++){let o=Math.pow(2,i);e.push(o);let c=1/o;a>s-vi?c=Nu[a-s+vi-1]:a===0&&(c=0),t.push(c);let l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,g=6,y=3,m=2,p=1,x=new Float32Array(y*g*f),S=new Float32Array(m*g*f),M=new Float32Array(p*g*f);for(let A=0;A<f;A++){let C=A%3*2/3-1,_=A>2?0:-1,w=[C,_,0,C+2/3,_,0,C+2/3,_+1,0,C,_,0,C+2/3,_+1,0,C,_+1,0];x.set(w,y*g*A),S.set(d,m*g*A);let L=[A,A,A,A,A,A];M.set(L,p*g*A)}let E=new Ht;E.setAttribute("position",new Tt(x,y)),E.setAttribute("uv",new Tt(S,m)),E.setAttribute("faceIndex",new Tt(M,p)),n.push(new at(E,null)),i>vi&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Ou(s,e,t){let n=new Qt(s,e,t);return n.texture.mapping=Mr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Is(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function Ag(s,e,t){return new en({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Mg,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Bo(),fragmentShader:`-- precision highp float;- precision highp int;-- varying vec3 vOutputDirection;-- uniform sampler2D envMap;- uniform float roughness;- uniform float mipInt;-- #define ENVMAP_TYPE_CUBE_UV- #include <cube_uv_reflection_fragment>-- #define PI 3.14159265359-- // Van der Corput radical inverse- float radicalInverse_VdC(uint bits) {- bits = (bits << 16u) | (bits >> 16u);- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);- return float(bits) * 2.3283064365386963e-10; // / 0x100000000- }-- // Hammersley sequence- vec2 hammersley(uint i, uint N) {- return vec2(float(i) / float(N), radicalInverse_VdC(i));- }-- // GGX VNDF importance sampling (Eric Heitz 2018)- // "Sampling the GGX Distribution of Visible Normals"- // https://jcgt.org/published/0007/04/01/- vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {- float alpha = roughness * roughness;-- // Section 4.1: Orthonormal basis- vec3 T1 = vec3(1.0, 0.0, 0.0);- vec3 T2 = cross(V, T1);-- // Section 4.2: Parameterization of projected area- float r = sqrt(Xi.x);- float phi = 2.0 * PI * Xi.y;- float t1 = r * cos(phi);- float t2 = r * sin(phi);- float s = 0.5 * (1.0 + V.z);- t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;-- // Section 4.3: Reprojection onto hemisphere- vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;-- // Section 3.4: Transform back to ellipsoid configuration- return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));- }-- void main() {- vec3 N = normalize(vOutputDirection);- vec3 V = N; // Assume view direction equals normal for pre-filtering-- vec3 prefilteredColor = vec3(0.0);- float totalWeight = 0.0;-- // For very low roughness, just sample the environment directly- if (roughness < 0.001) {- gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);- return;- }-- // Tangent space basis for VNDF sampling- vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);- vec3 tangent = normalize(cross(up, N));- vec3 bitangent = cross(N, tangent);-- for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {- vec2 Xi = hammersley(i, uint(GGX_SAMPLES));-- // For PMREM, V = N, so in tangent space V is always (0, 0, 1)- vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);-- // Transform H back to world space- vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);- vec3 L = normalize(2.0 * dot(V, H) * H - V);-- float NdotL = max(dot(N, L), 0.0);-- if(NdotL > 0.0) {- // Sample environment at fixed mip level- // VNDF importance sampling handles the distribution filtering- vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);-- // Weight by NdotL for the split-sum approximation- // VNDF PDF naturally accounts for the visible microfacet distribution- prefilteredColor += sampleColor * NdotL;- totalWeight += NdotL;- }- }-- if (totalWeight > 0.0) {- prefilteredColor = prefilteredColor / totalWeight;- }-- gl_FragColor = vec4(prefilteredColor, 1.0);- }- `,blending:Nn,depthTest:!1,depthWrite:!1})}function wg(s,e,t){let n=new Float32Array(Xi),i=new D(0,1,0);return new en({name:"SphericalGaussianBlur",defines:{n:Xi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Bo(),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:Nn,depthTest:!1,depthWrite:!1})}function Bu(){return new en({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Bo(),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:Nn,depthTest:!1,depthWrite:!1})}function ku(){return new en({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Bo(),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:Nn,depthTest:!1,depthWrite:!1})}function Bo(){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 );-- }- `}var Uo=class extends Qt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new rr(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={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 );-- }- `},i=new fi(5,5,5),r=new en({name:"CubemapFromEquirect",uniforms:qi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Lt,blending:Nn});r.uniforms.tEquirect.value=t;let a=new at(i,r),o=t.minFilter;return t.minFilter===yn&&(t.minFilter=vt),new Oa(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}};function Eg(s){let e=new WeakMap,t=new WeakMap,n=null;function i(d,f=!1){return d==null?null:f?a(d):r(d)}function r(d){if(d&&d.isTexture){let f=d.mapping;if(f===Wa||f===qa)if(e.has(d)){let g=e.get(d).texture;return o(g,d.mapping)}else{let g=d.image;if(g&&g.height>0){let y=new Uo(g.height);return y.fromEquirectangularTexture(s,d),e.set(d,y),d.addEventListener("dispose",l),o(y.texture,d.mapping)}else return null}}return d}function a(d){if(d&&d.isTexture){let f=d.mapping,g=f===Wa||f===qa,y=f===bi||f===Hi;if(g||y){let m=t.get(d),p=m!==void 0?m.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==p)return n===null&&(n=new Ls(s)),m=g?n.fromEquirectangular(d,m):n.fromCubemap(d,m),m.texture.pmremVersion=d.pmremVersion,t.set(d,m),m.texture;if(m!==void 0)return m.texture;{let x=d.image;return g&&x&&x.height>0||y&&x&&c(x)?(n===null&&(n=new Ls(s)),m=g?n.fromEquirectangular(d):n.fromCubemap(d),m.texture.pmremVersion=d.pmremVersion,t.set(d,m),d.addEventListener("dispose",h),m.texture):null}}}return d}function o(d,f){return f===Wa?d.mapping=bi:f===qa&&(d.mapping=Hi),d}function c(d){let f=0,g=6;for(let y=0;y<g;y++)d[y]!==void 0&&f++;return f===g}function l(d){let f=d.target;f.removeEventListener("dispose",l);let g=e.get(f);g!==void 0&&(e.delete(f),g.dispose())}function h(d){let f=d.target;f.removeEventListener("dispose",h);let g=t.get(f);g!==void 0&&(t.delete(f),g.dispose())}function u(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:u}}function Rg(s){let e={};function t(n){if(e[n]!==void 0)return e[n];let i=s.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==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(n){let i=t(n);return i===null&&ya("WebGLRenderer: "+n+" extension not supported."),i}}}function Cg(s,e,t,n){let i={},r=new WeakMap;function a(u){let d=u.target;d.index!==null&&e.remove(d.index);for(let g in d.attributes)e.remove(d.attributes[g]);d.removeEventListener("dispose",a),delete i[d.id];let f=r.get(d);f&&(e.remove(f),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function c(u){let d=u.attributes;for(let f in d)e.update(d[f],s.ARRAY_BUFFER)}function l(u){let d=[],f=u.index,g=u.attributes.position,y=0;if(g===void 0)return;if(f!==null){let x=f.array;y=f.version;for(let S=0,M=x.length;S<M;S+=3){let E=x[S+0],A=x[S+1],C=x[S+2];d.push(E,A,A,C,C,E)}}else{let x=g.array;y=g.version;for(let S=0,M=x.length/3-1;S<M;S+=3){let E=S+0,A=S+1,C=S+2;d.push(E,A,A,C,C,E)}}let m=new(g.count>=65535?Qs:$s)(d,1);m.version=y;let p=r.get(u);p&&e.remove(p),r.set(u,m)}function h(u){let d=r.get(u);if(d){let f=u.index;f!==null&&d.version<f.version&&l(u)}else l(u);return r.get(u)}return{get:o,update:c,getWireframeAttribute:h}}function Pg(s,e,t){let n;function i(u){n=u}let r,a;function o(u){r=u.type,a=u.bytesPerElement}function c(u,d){s.drawElements(n,d,r,u*a),t.update(d,n,1)}function l(u,d,f){f!==0&&(s.drawElementsInstanced(n,d,r,u*a,f),t.update(d,n,f))}function h(u,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,r,u,0,f);let y=0;for(let m=0;m<f;m++)y+=d[m];t.update(y,n,1)}this.setMode=i,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h}function Ig(s){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(t.calls++,a){case s.TRIANGLES:t.triangles+=o*(r/3);break;case s.LINES:t.lines+=o*(r/2);break;case s.LINE_STRIP:t.lines+=o*(r-1);break;case s.LINE_LOOP:t.lines+=o*r;break;case s.POINTS:t.points+=o*r;break;default:we("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function Dg(s,e,t){let n=new WeakMap,i=new nt;function r(a,o,c){let l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0,d=n.get(o);if(d===void 0||d.count!==u){let w=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",w)};d!==void 0&&d.texture.dispose();let f=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,y=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],x=o.morphAttributes.color||[],S=0;f===!0&&(S=1),g===!0&&(S=2),y===!0&&(S=3);let M=o.attributes.position.count*S,E=1;M>e.maxTextureSize&&(E=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);let A=new Float32Array(M*E*4*u),C=new Js(A,M,E,u);C.type=tn,C.needsUpdate=!0;let _=S*4;for(let L=0;L<u;L++){let R=m[L],O=p[L],H=x[L],q=M*E*4*L;for(let N=0;N<R.count;N++){let z=N*_;f===!0&&(i.fromBufferAttribute(R,N),A[q+z+0]=i.x,A[q+z+1]=i.y,A[q+z+2]=i.z,A[q+z+3]=0),g===!0&&(i.fromBufferAttribute(O,N),A[q+z+4]=i.x,A[q+z+5]=i.y,A[q+z+6]=i.z,A[q+z+7]=0),y===!0&&(i.fromBufferAttribute(H,N),A[q+z+8]=i.x,A[q+z+9]=i.y,A[q+z+10]=i.z,A[q+z+11]=H.itemSize===4?i.w:1)}}d={count:u,texture:C,size:new Re(M,E)},n.set(o,d),o.addEventListener("dispose",w)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(s,"morphTexture",a.morphTexture,t);else{let f=0;for(let y=0;y<l.length;y++)f+=l[y];let g=o.morphTargetsRelative?1:1-f;c.getUniforms().setValue(s,"morphTargetBaseInfluence",g),c.getUniforms().setValue(s,"morphTargetInfluences",l)}c.getUniforms().setValue(s,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(s,"morphTargetsTextureSize",d.size)}return{update:r}}function Lg(s,e,t,n,i){let r=new WeakMap;function a(l){let h=i.render.frame,u=l.geometry,d=e.get(l,u);if(r.get(d)!==h&&(e.update(d),r.set(d,h)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),r.get(l)!==h&&(t.update(l.instanceMatrix,s.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,s.ARRAY_BUFFER),r.set(l,h))),l.isSkinnedMesh){let f=l.skeleton;r.get(f)!==h&&(f.update(),r.set(f,h))}return d}function o(){r=new WeakMap}function c(l){let h=l.target;h.removeEventListener("dispose",c),n.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:a,dispose:o}}var Fg={[Nc]:"LINEAR_TONE_MAPPING",[Uc]:"REINHARD_TONE_MAPPING",[Oc]:"CINEON_TONE_MAPPING",[yr]:"ACES_FILMIC_TONE_MAPPING",[kc]:"AGX_TONE_MAPPING",[zc]:"NEUTRAL_TONE_MAPPING",[Bc]:"CUSTOM_TONE_MAPPING"};function Ng(s,e,t,n,i){let r=new Qt(e,t,{type:s,depthBuffer:n,stencilBuffer:i,depthTexture:n?new Yn(e,t):void 0}),a=new Qt(e,t,{type:Un,depthBuffer:!1,stencilBuffer:!1}),o=new Ht;o.setAttribute("position",new zt([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new zt([0,2,0,0,2,0],2));let c=new Ra({uniforms:{tDiffuse:{value:null}},vertexShader:`- precision highp float;-- uniform mat4 modelViewMatrix;- uniform mat4 projectionMatrix;-- attribute vec3 position;- attribute vec2 uv;-- varying vec2 vUv;-- void main() {- vUv = uv;- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );- }`,fragmentShader:`- precision highp float;-- uniform sampler2D tDiffuse;-- varying vec2 vUv;-- #include <tonemapping_pars_fragment>- #include <colorspace_pars_fragment>-- void main() {- gl_FragColor = texture2D( tDiffuse, vUv );-- #ifdef LINEAR_TONE_MAPPING- gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );- #elif defined( REINHARD_TONE_MAPPING )- gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );- #elif defined( CINEON_TONE_MAPPING )- gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );- #elif defined( ACES_FILMIC_TONE_MAPPING )- gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );- #elif defined( AGX_TONE_MAPPING )- gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );- #elif defined( NEUTRAL_TONE_MAPPING )- gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );- #elif defined( CUSTOM_TONE_MAPPING )- gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );- #endif-- #ifdef SRGB_TRANSFER- gl_FragColor = sRGBTransferOETF( gl_FragColor );- #endif- }`,depthTest:!1,depthWrite:!1}),l=new at(o,c),h=new pi(-1,1,1,-1,0,1),u=null,d=null,f=!1,g,y=null,m=[],p=!1;this.setSize=function(x,S){r.setSize(x,S),a.setSize(x,S);for(let M=0;M<m.length;M++){let E=m[M];E.setSize&&E.setSize(x,S)}},this.setEffects=function(x){m=x,p=m.length>0&&m[0].isRenderPass===!0;let S=r.width,M=r.height;for(let E=0;E<m.length;E++){let A=m[E];A.setSize&&A.setSize(S,M)}},this.begin=function(x,S){if(f||x.toneMapping===vn&&m.length===0)return!1;if(y=S,S!==null){let M=S.width,E=S.height;(r.width!==M||r.height!==E)&&this.setSize(M,E)}return p===!1&&x.setRenderTarget(r),g=x.toneMapping,x.toneMapping=vn,!0},this.hasRenderPass=function(){return p},this.end=function(x,S){x.toneMapping=g,f=!0;let M=r,E=a;for(let A=0;A<m.length;A++){let C=m[A];if(C.enabled!==!1&&(C.render(x,E,M,S),C.needsSwap!==!1)){let _=M;M=E,E=_}}if(u!==x.outputColorSpace||d!==x.toneMapping){u=x.outputColorSpace,d=x.toneMapping,c.defines={},ze.getTransfer(u)===Ye&&(c.defines.SRGB_TRANSFER="");let A=Fg[d];A&&(c.defines[A]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=M.texture,x.setRenderTarget(y),x.render(l,h),y=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){r.depthTexture&&r.depthTexture.dispose(),r.dispose(),a.dispose(),o.dispose(),c.dispose()}}var rd=new Dt,dl=new Yn(1,1),ad=new Js,od=new Ta,cd=new rr,zu=[],Gu=[],Vu=new Float32Array(16),Hu=new Float32Array(9),Wu=new Float32Array(4);function Fs(s,e,t){let n=s[0];if(n<=0||n>0)return s;let i=e*t,r=zu[i];if(r===void 0&&(r=new Float32Array(i),zu[i]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(r,o)}return r}function Rt(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function Ct(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function ko(s,e){let t=Gu[e];t===void 0&&(t=new Int32Array(e),Gu[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function Ug(s,e){let t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function Og(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2fv(this.addr,e),Ct(t,e)}}function Bg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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)&&(s.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;s.uniform3fv(this.addr,e),Ct(t,e)}}function kg(s,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)&&(s.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;s.uniform4fv(this.addr,e),Ct(t,e)}}function zg(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),Ct(t,e)}else{if(Rt(t,n))return;Wu.set(n),s.uniformMatrix2fv(this.addr,!1,Wu),Ct(t,n)}}function Gg(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),Ct(t,e)}else{if(Rt(t,n))return;Hu.set(n),s.uniformMatrix3fv(this.addr,!1,Hu),Ct(t,n)}}function Vg(s,e){let t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),Ct(t,e)}else{if(Rt(t,n))return;Vu.set(n),s.uniformMatrix4fv(this.addr,!1,Vu),Ct(t,n)}}function Hg(s,e){let t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function Wg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2iv(this.addr,e),Ct(t,e)}}function qg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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;s.uniform3iv(this.addr,e),Ct(t,e)}}function Xg(s,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)&&(s.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;s.uniform4iv(this.addr,e),Ct(t,e)}}function jg(s,e){let t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function Kg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2uiv(this.addr,e),Ct(t,e)}}function Yg(s,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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;s.uniform3uiv(this.addr,e),Ct(t,e)}}function Jg(s,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)&&(s.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;s.uniform4uiv(this.addr,e),Ct(t,e)}}function Zg(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(dl.compareFunction=t.isReversedDepthBuffer()?Lo:Do,r=dl):r=rd,t.setTexture2D(e||r,i)}function $g(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||od,i)}function Qg(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||cd,i)}function eb(s,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||ad,i)}function tb(s){switch(s){case 5126:return Ug;case 35664:return Og;case 35665:return Bg;case 35666:return kg;case 35674:return zg;case 35675:return Gg;case 35676:return Vg;case 5124:case 35670:return Hg;case 35667:case 35671:return Wg;case 35668:case 35672:return qg;case 35669:case 35673:return Xg;case 5125:return jg;case 36294:return Kg;case 36295:return Yg;case 36296:return Jg;case 35678:case 36198:case 36298:case 36306:case 35682:return Zg;case 35679:case 36299:case 36307:return $g;case 35680:case 36300:case 36308:case 36293:return Qg;case 36289:case 36303:case 36311:case 36292:return eb}}function nb(s,e){s.uniform1fv(this.addr,e)}function ib(s,e){let t=Fs(e,this.size,2);s.uniform2fv(this.addr,t)}function sb(s,e){let t=Fs(e,this.size,3);s.uniform3fv(this.addr,t)}function rb(s,e){let t=Fs(e,this.size,4);s.uniform4fv(this.addr,t)}function ab(s,e){let t=Fs(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function ob(s,e){let t=Fs(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function cb(s,e){let t=Fs(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function lb(s,e){s.uniform1iv(this.addr,e)}function hb(s,e){s.uniform2iv(this.addr,e)}function ub(s,e){s.uniform3iv(this.addr,e)}function db(s,e){s.uniform4iv(this.addr,e)}function fb(s,e){s.uniform1uiv(this.addr,e)}function pb(s,e){s.uniform2uiv(this.addr,e)}function mb(s,e){s.uniform3uiv(this.addr,e)}function gb(s,e){s.uniform4uiv(this.addr,e)}function bb(s,e,t){let n=this.cache,i=e.length,r=ko(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),Ct(n,r));let a;this.type===s.SAMPLER_2D_SHADOW?a=dl:a=rd;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,r[o])}function _b(s,e,t){let n=this.cache,i=e.length,r=ko(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),Ct(n,r));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||od,r[a])}function xb(s,e,t){let n=this.cache,i=e.length,r=ko(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),Ct(n,r));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||cd,r[a])}function vb(s,e,t){let n=this.cache,i=e.length,r=ko(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),Ct(n,r));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||ad,r[a])}function yb(s){switch(s){case 5126:return nb;case 35664:return ib;case 35665:return sb;case 35666:return rb;case 35674:return ab;case 35675:return ob;case 35676:return cb;case 5124:case 35670:return lb;case 35667:case 35671:return hb;case 35668:case 35672:return ub;case 35669:case 35673:return db;case 5125:return fb;case 36294:return pb;case 36295:return mb;case 36296:return gb;case 35678:case 36198:case 36298:case 36306:case 35682:return bb;case 35679:case 36299:case 36307:return _b;case 35680:case 36300:case 36308:case 36293:return xb;case 36289:case 36303:case 36311:case 36292:return vb}}var fl=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=tb(t.type)}},pl=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=yb(t.type)}},ml=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let r=0,a=i.length;r!==a;++r){let o=i[r];o.setValue(e,t[o.id],n)}}},hl=/(\w+)(\])?(\[|\.)?/g;function qu(s,e){s.seq.push(e),s.map[e.id]=e}function Mb(s,e,t){let n=s.name,i=n.length;for(hl.lastIndex=0;;){let r=hl.exec(n),a=hl.lastIndex,o=r[1],c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===i){qu(t,l===void 0?new fl(o,s,e):new pl(o,s,e));break}else{let u=t.map[o];u===void 0&&(u=new ml(o),qu(t,u)),t=u}}}var Ds=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){let o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);Mb(o,c,this)}let i=[],r=[];for(let a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):r.push(a);i.length>0&&(this.seq=i.concat(r))}setValue(e,t,n,i){let r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){let o=t[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let a=e[i];a.id in t&&n.push(a)}return n}};function Xu(s,e,t){let n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}var Sb=37297,Tb=0;function Ab(s,e){let t=s.split(`-`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=i;a<r;a++){let o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`-`)}var ju=new Ie;function wb(s){ze._getMatrix(ju,ze.workingColorSpace,s);let e=`mat3( ${ju.elements.map(t=>t.toFixed(4))} )`;switch(ze.getTransfer(s)){case Ks:return[e,"LinearTransferOETF"];case Ye:return[e,"sRGBTransferOETF"];default:return _e("WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function Ku(s,e,t){let n=s.getShaderParameter(e,s.COMPILE_STATUS),r=(s.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";let a=/ERROR: 0:(\d+)/.exec(r);if(a){let o=parseInt(a[1]);return t.toUpperCase()+`--`+r+`--`+Ab(s.getShaderSource(e),o)}else return r}function Eb(s,e){let t=wb(e);return[`vec4 ${s}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`-`)}var Rb={[Nc]:"Linear",[Uc]:"Reinhard",[Oc]:"Cineon",[yr]:"ACESFilmic",[kc]:"AgX",[zc]:"Neutral",[Bc]:"Custom"};function Cb(s,e){let t=Rb[e];return t===void 0?(_e("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+s+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var No=new D;function Pb(){ze.getLuminanceCoefficients(No);let s=No.x.toFixed(4),e=No.y.toFixed(4),t=No.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${s}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`-`)}function Ib(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fr).join(`-`)}function Db(s){let e=[];for(let t in s){let n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`-`)}function Lb(s,e){let t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){let r=s.getActiveAttrib(e,i),a=r.name,o=1;r.type===s.FLOAT_MAT2&&(o=2),r.type===s.FLOAT_MAT3&&(o=3),r.type===s.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:s.getAttribLocation(e,a),locationSize:o}}return t}function Fr(s){return s!==""}function Yu(s,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.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 Ju(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Fb=/^[ \t]*#include +<([\w\d./]+)>/gm;function gl(s){return s.replace(Fb,Ub)}var Nb=new Map;function Ub(s,e){let t=Be[e];if(t===void 0){let n=Nb.get(e);if(n!==void 0)t=Be[n],_e('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return gl(t)}var Ob=/#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 Zu(s){return s.replace(Ob,Bb)}function Bb(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function $u(s){let e=`precision ${s.precision} float;- precision ${s.precision} int;- precision ${s.precision} sampler2D;- precision ${s.precision} samplerCube;- precision ${s.precision} sampler3D;- precision ${s.precision} sampler2DArray;- precision ${s.precision} sampler2DShadow;- precision ${s.precision} samplerCubeShadow;- precision ${s.precision} sampler2DArrayShadow;- precision ${s.precision} isampler2D;- precision ${s.precision} isampler3D;- precision ${s.precision} isamplerCube;- precision ${s.precision} isampler2DArray;- precision ${s.precision} usampler2D;- precision ${s.precision} usampler3D;- precision ${s.precision} usamplerCube;- precision ${s.precision} usampler2DArray;- `;return s.precision==="highp"?e+=`-#define HIGH_PRECISION`:s.precision==="mediump"?e+=`-#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`-#define LOW_PRECISION`),e}var kb={[vr]:"SHADOWMAP_TYPE_PCF",[ws]:"SHADOWMAP_TYPE_VSM"};function zb(s){return kb[s.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Gb={[bi]:"ENVMAP_TYPE_CUBE",[Hi]:"ENVMAP_TYPE_CUBE",[Mr]:"ENVMAP_TYPE_CUBE_UV"};function Vb(s){return s.envMap===!1?"ENVMAP_TYPE_CUBE":Gb[s.envMapMode]||"ENVMAP_TYPE_CUBE"}var Hb={[Hi]:"ENVMAP_MODE_REFRACTION"};function Wb(s){return s.envMap===!1?"ENVMAP_MODE_REFLECTION":Hb[s.envMapMode]||"ENVMAP_MODE_REFLECTION"}var qb={[Ha]:"ENVMAP_BLENDING_MULTIPLY",[du]:"ENVMAP_BLENDING_MIX",[fu]:"ENVMAP_BLENDING_ADD"};function Xb(s){return s.envMap===!1?"ENVMAP_BLENDING_NONE":qb[s.combine]||"ENVMAP_BLENDING_NONE"}function jb(s){let e=s.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function Kb(s,e,t,n){let i=s.getContext(),r=t.defines,a=t.vertexShader,o=t.fragmentShader,c=zb(t),l=Vb(t),h=Wb(t),u=Xb(t),d=jb(t),f=Ib(t),g=Db(r),y=i.createProgram(),m,p,x=t.glslVersion?"#version "+t.glslVersion+`-`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Fr).join(`-`),m.length>0&&(m+=`-`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Fr).join(`-`),p.length>0&&(p+=`-`)):(m=[$u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+h:"",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.vertexNormals?"#define HAS_NORMAL":"",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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`-`].filter(Fr).join(`-`),p=[$u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==vn?"#define TONE_MAPPING":"",t.toneMapping!==vn?Be.tonemapping_pars_fragment:"",t.toneMapping!==vn?Cb("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Be.colorspace_pars_fragment,Eb("linearToOutputTexel",t.outputColorSpace),Pb(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`-`].filter(Fr).join(`-`)),a=gl(a),a=Yu(a,t),a=Ju(a,t),o=gl(o),o=Yu(o,t),o=Ju(o,t),a=Zu(a),o=Zu(o),t.isRawShaderMaterial!==!0&&(x=`#version 300 es-`,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`-`)+`-`+m,p=["#define varying in",t.glslVersion===Yc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Yc?"":"#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(`-`)+`-`+p);let S=x+m+a,M=x+p+o,E=Xu(i,i.VERTEX_SHADER,S),A=Xu(i,i.FRAGMENT_SHADER,M);i.attachShader(y,E),i.attachShader(y,A),t.index0AttributeName!==void 0?i.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);function C(R){if(s.debug.checkShaderErrors){let O=i.getProgramInfoLog(y)||"",H=i.getShaderInfoLog(E)||"",q=i.getShaderInfoLog(A)||"",N=O.trim(),z=H.trim(),V=q.trim(),$=!0,Q=!0;if(i.getProgramParameter(y,i.LINK_STATUS)===!1)if($=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,y,E,A);else{let le=Ku(i,E,"vertex"),xe=Ku(i,A,"fragment");we("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(y,i.VALIDATE_STATUS)+`--Material Name: `+R.name+`-Material Type: `+R.type+`--Program Info Log: `+N+`-`+le+`-`+xe)}else N!==""?_e("WebGLProgram: Program Info Log:",N):(z===""||V==="")&&(Q=!1);Q&&(R.diagnostics={runnable:$,programLog:N,vertexShader:{log:z,prefix:m},fragmentShader:{log:V,prefix:p}})}i.deleteShader(E),i.deleteShader(A),_=new Ds(i,y),w=Lb(i,y)}let _;this.getUniforms=function(){return _===void 0&&C(this),_};let w;this.getAttributes=function(){return w===void 0&&C(this),w};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=i.getProgramParameter(y,Sb)),L},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Tb++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=E,this.fragmentShader=A,this}var Yb=0,bl=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new _l(e),t.set(e,n)),n}},_l=class{constructor(e){this.id=Yb++,this.code=e,this.usedTimes=0}};function Jb(s){return s===xi||s===Er||s===Rr}function Zb(s,e,t,n,i,r){let a=new Zs,o=new bl,c=new Set,l=[],h=new Map,u=n.logarithmicDepthBuffer,d=n.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 g(_){return c.add(_),_===0?"uv":`uv${_}`}function y(_,w,L,R,O,H){let q=R.fog,N=O.geometry,z=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?R.environment:null,V=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,$=e.get(_.envMap||z,V),Q=$&&$.mapping===Mr?$.image.height:null,le=f[_.type];_.precision!==null&&(d=n.getMaxPrecision(_.precision),d!==_.precision&&_e("WebGLProgram.getParameters:",_.precision,"not supported, using",d,"instead."));let xe=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,Se=xe!==void 0?xe.length:0,Xe=0;N.morphAttributes.position!==void 0&&(Xe=1),N.morphAttributes.normal!==void 0&&(Xe=2),N.morphAttributes.color!==void 0&&(Xe=3);let Ze,Ne,Y,de;if(le){let Le=Bn[le];Ze=Le.vertexShader,Ne=Le.fragmentShader}else Ze=_.vertexShader,Ne=_.fragmentShader,o.update(_),Y=o.getVertexShaderID(_),de=o.getFragmentShaderID(_);let ie=s.getRenderTarget(),Ee=s.state.buffers.depth.getReversed(),De=O.isInstancedMesh===!0,Ce=O.isBatchedMesh===!0,ut=!!_.map,We=!!_.matcap,$e=!!$,ht=!!_.aoMap,He=!!_.lightMap,At=!!_.bumpMap,dt=!!_.normalMap,Yt=!!_.displacementMap,I=!!_.emissiveMap,wt=!!_.metalnessMap,qe=!!_.roughnessMap,ot=_.anisotropy>0,oe=_.clearcoat>0,ft=_.dispersion>0,T=_.iridescence>0,b=_.sheen>0,U=_.transmission>0,j=ot&&!!_.anisotropyMap,Z=oe&&!!_.clearcoatMap,ee=oe&&!!_.clearcoatNormalMap,ae=oe&&!!_.clearcoatRoughnessMap,W=T&&!!_.iridescenceMap,K=T&&!!_.iridescenceThicknessMap,fe=b&&!!_.sheenColorMap,ge=b&&!!_.sheenRoughnessMap,se=!!_.specularMap,te=!!_.specularColorMap,Pe=!!_.specularIntensityMap,Ue=U&&!!_.transmissionMap,Ke=U&&!!_.thicknessMap,P=!!_.gradientMap,ne=!!_.alphaMap,X=_.alphaTest>0,pe=!!_.alphaHash,re=!!_.extensions,J=vn;_.toneMapped&&(ie===null||ie.isXRRenderTarget===!0)&&(J=s.toneMapping);let ye={shaderID:le,shaderType:_.type,shaderName:_.name,vertexShader:Ze,fragmentShader:Ne,defines:_.defines,customVertexShaderID:Y,customFragmentShaderID:de,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:d,batching:Ce,batchingColor:Ce&&O._colorsTexture!==null,instancing:De,instancingColor:De&&O.instanceColor!==null,instancingMorph:De&&O.morphTexture!==null,outputColorSpace:ie===null?s.outputColorSpace:ie.isXRRenderTarget===!0?ie.texture.colorSpace:ze.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ut,matcap:We,envMap:$e,envMapMode:$e&&$.mapping,envMapCubeUVHeight:Q,aoMap:ht,lightMap:He,bumpMap:At,normalMap:dt,displacementMap:Yt,emissiveMap:I,normalMapObjectSpace:dt&&_.normalMapType===vu,normalMapTangentSpace:dt&&_.normalMapType===Pr,packedNormalMap:dt&&_.normalMapType===Pr&&Jb(_.normalMap.format),metalnessMap:wt,roughnessMap:qe,anisotropy:ot,anisotropyMap:j,clearcoat:oe,clearcoatMap:Z,clearcoatNormalMap:ee,clearcoatRoughnessMap:ae,dispersion:ft,iridescence:T,iridescenceMap:W,iridescenceThicknessMap:K,sheen:b,sheenColorMap:fe,sheenRoughnessMap:ge,specularMap:se,specularColorMap:te,specularIntensityMap:Pe,transmission:U,transmissionMap:Ue,thicknessMap:Ke,gradientMap:P,opaque:_.transparent===!1&&_.blending===Pi&&_.alphaToCoverage===!1,alphaMap:ne,alphaTest:X,alphaHash:pe,combine:_.combine,mapUv:ut&&g(_.map.channel),aoMapUv:ht&&g(_.aoMap.channel),lightMapUv:He&&g(_.lightMap.channel),bumpMapUv:At&&g(_.bumpMap.channel),normalMapUv:dt&&g(_.normalMap.channel),displacementMapUv:Yt&&g(_.displacementMap.channel),emissiveMapUv:I&&g(_.emissiveMap.channel),metalnessMapUv:wt&&g(_.metalnessMap.channel),roughnessMapUv:qe&&g(_.roughnessMap.channel),anisotropyMapUv:j&&g(_.anisotropyMap.channel),clearcoatMapUv:Z&&g(_.clearcoatMap.channel),clearcoatNormalMapUv:ee&&g(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ae&&g(_.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&g(_.iridescenceMap.channel),iridescenceThicknessMapUv:K&&g(_.iridescenceThicknessMap.channel),sheenColorMapUv:fe&&g(_.sheenColorMap.channel),sheenRoughnessMapUv:ge&&g(_.sheenRoughnessMap.channel),specularMapUv:se&&g(_.specularMap.channel),specularColorMapUv:te&&g(_.specularColorMap.channel),specularIntensityMapUv:Pe&&g(_.specularIntensityMap.channel),transmissionMapUv:Ue&&g(_.transmissionMap.channel),thicknessMapUv:Ke&&g(_.thicknessMap.channel),alphaMapUv:ne&&g(_.alphaMap.channel),vertexTangents:!!N.attributes.tangent&&(dt||ot),vertexNormals:!!N.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!N.attributes.uv&&(ut||ne),fog:!!q,useFog:_.fog===!0,fogExp2:!!q&&q.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||N.attributes.normal===void 0&&dt===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:Ee,skinning:O.isSkinnedMesh===!0,morphTargets:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.morphAttributes.color!==void 0,morphTargetsCount:Se,morphTextureStride:Xe,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numLightProbeGrids:H.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:_.dithering,shadowMapEnabled:s.shadowMap.enabled&&L.length>0,shadowMapType:s.shadowMap.type,toneMapping:J,decodeVideoTexture:ut&&_.map.isVideoTexture===!0&&ze.getTransfer(_.map.colorSpace)===Ye,decodeVideoTextureEmissive:I&&_.emissiveMap.isVideoTexture===!0&&ze.getTransfer(_.emissiveMap.colorSpace)===Ye,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===ln,flipSided:_.side===Lt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:re&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(re&&_.extensions.multiDraw===!0||Ce)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return ye.vertexUv1s=c.has(1),ye.vertexUv2s=c.has(2),ye.vertexUv3s=c.has(3),c.clear(),ye}function m(_){let w=[];if(_.shaderID?w.push(_.shaderID):(w.push(_.customVertexShaderID),w.push(_.customFragmentShaderID)),_.defines!==void 0)for(let L in _.defines)w.push(L),w.push(_.defines[L]);return _.isRawShaderMaterial===!1&&(p(w,_),x(w,_),w.push(s.outputColorSpace)),w.push(_.customProgramCacheKey),w.join()}function p(_,w){_.push(w.precision),_.push(w.outputColorSpace),_.push(w.envMapMode),_.push(w.envMapCubeUVHeight),_.push(w.mapUv),_.push(w.alphaMapUv),_.push(w.lightMapUv),_.push(w.aoMapUv),_.push(w.bumpMapUv),_.push(w.normalMapUv),_.push(w.displacementMapUv),_.push(w.emissiveMapUv),_.push(w.metalnessMapUv),_.push(w.roughnessMapUv),_.push(w.anisotropyMapUv),_.push(w.clearcoatMapUv),_.push(w.clearcoatNormalMapUv),_.push(w.clearcoatRoughnessMapUv),_.push(w.iridescenceMapUv),_.push(w.iridescenceThicknessMapUv),_.push(w.sheenColorMapUv),_.push(w.sheenRoughnessMapUv),_.push(w.specularMapUv),_.push(w.specularColorMapUv),_.push(w.specularIntensityMapUv),_.push(w.transmissionMapUv),_.push(w.thicknessMapUv),_.push(w.combine),_.push(w.fogExp2),_.push(w.sizeAttenuation),_.push(w.morphTargetsCount),_.push(w.morphAttributeCount),_.push(w.numDirLights),_.push(w.numPointLights),_.push(w.numSpotLights),_.push(w.numSpotLightMaps),_.push(w.numHemiLights),_.push(w.numRectAreaLights),_.push(w.numDirLightShadows),_.push(w.numPointLightShadows),_.push(w.numSpotLightShadows),_.push(w.numSpotLightShadowsWithMaps),_.push(w.numLightProbes),_.push(w.shadowMapType),_.push(w.toneMapping),_.push(w.numClippingPlanes),_.push(w.numClipIntersection),_.push(w.depthPacking)}function x(_,w){a.disableAll(),w.instancing&&a.enable(0),w.instancingColor&&a.enable(1),w.instancingMorph&&a.enable(2),w.matcap&&a.enable(3),w.envMap&&a.enable(4),w.normalMapObjectSpace&&a.enable(5),w.normalMapTangentSpace&&a.enable(6),w.clearcoat&&a.enable(7),w.iridescence&&a.enable(8),w.alphaTest&&a.enable(9),w.vertexColors&&a.enable(10),w.vertexAlphas&&a.enable(11),w.vertexUv1s&&a.enable(12),w.vertexUv2s&&a.enable(13),w.vertexUv3s&&a.enable(14),w.vertexTangents&&a.enable(15),w.anisotropy&&a.enable(16),w.alphaHash&&a.enable(17),w.batching&&a.enable(18),w.dispersion&&a.enable(19),w.batchingColor&&a.enable(20),w.gradientMap&&a.enable(21),w.packedNormalMap&&a.enable(22),w.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),w.fog&&a.enable(0),w.useFog&&a.enable(1),w.flatShading&&a.enable(2),w.logarithmicDepthBuffer&&a.enable(3),w.reversedDepthBuffer&&a.enable(4),w.skinning&&a.enable(5),w.morphTargets&&a.enable(6),w.morphNormals&&a.enable(7),w.morphColors&&a.enable(8),w.premultipliedAlpha&&a.enable(9),w.shadowMapEnabled&&a.enable(10),w.doubleSided&&a.enable(11),w.flipSided&&a.enable(12),w.useDepthPacking&&a.enable(13),w.dithering&&a.enable(14),w.transmission&&a.enable(15),w.sheen&&a.enable(16),w.opaque&&a.enable(17),w.pointsUvs&&a.enable(18),w.decodeVideoTexture&&a.enable(19),w.decodeVideoTextureEmissive&&a.enable(20),w.alphaToCoverage&&a.enable(21),w.numLightProbeGrids>0&&a.enable(22),_.push(a.mask)}function S(_){let w=f[_.type],L;if(w){let R=Bn[w];L=Du.clone(R.uniforms)}else L=_.uniforms;return L}function M(_,w){let L=h.get(w);return L!==void 0?++L.usedTimes:(L=new Kb(s,w,_,i),l.push(L),h.set(w,L)),L}function E(_){if(--_.usedTimes===0){let w=l.indexOf(_);l[w]=l[l.length-1],l.pop(),h.delete(_.cacheKey),_.destroy()}}function A(_){o.remove(_)}function C(){o.dispose()}return{getParameters:y,getProgramCacheKey:m,getUniforms:S,acquireProgram:M,releaseProgram:E,releaseShaderCache:A,programs:l,dispose:C}}function $b(){let s=new WeakMap;function e(a){return s.has(a)}function t(a){let o=s.get(a);return o===void 0&&(o={},s.set(a,o)),o}function n(a){s.delete(a)}function i(a,o,c){s.get(a)[o]=c}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function Qb(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.materialVariant!==e.materialVariant?s.materialVariant-e.materialVariant:s.z!==e.z?s.z-e.z:s.id-e.id}function Qu(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function ed(){let s=[],e=0,t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function a(d){let f=0;return d.isInstancedMesh&&(f+=2),d.isSkinnedMesh&&(f+=1),f}function o(d,f,g,y,m,p){let x=s[e];return x===void 0?(x={id:d.id,object:d,geometry:f,material:g,materialVariant:a(d),groupOrder:y,renderOrder:d.renderOrder,z:m,group:p},s[e]=x):(x.id=d.id,x.object=d,x.geometry=f,x.material=g,x.materialVariant=a(d),x.groupOrder=y,x.renderOrder=d.renderOrder,x.z=m,x.group=p),e++,x}function c(d,f,g,y,m,p){let x=o(d,f,g,y,m,p);g.transmission>0?n.push(x):g.transparent===!0?i.push(x):t.push(x)}function l(d,f,g,y,m,p){let x=o(d,f,g,y,m,p);g.transmission>0?n.unshift(x):g.transparent===!0?i.unshift(x):t.unshift(x)}function h(d,f){t.length>1&&t.sort(d||Qb),n.length>1&&n.sort(f||Qu),i.length>1&&i.sort(f||Qu)}function u(){for(let d=e,f=s.length;d<f;d++){let g=s[d];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:c,unshift:l,finish:u,sort:h}}function e0(){let s=new WeakMap;function e(n,i){let r=s.get(n),a;return r===void 0?(a=new ed,s.set(n,[a])):i>=r.length?(a=new ed,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function t0(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new D,color:new Ae};break;case"SpotLight":t={position:new D,direction:new D,color:new Ae,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Ae,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Ae,groundColor:new Ae};break;case"RectAreaLight":t={color:new Ae,position:new D,halfWidth:new D,halfHeight:new D};break}return s[e.id]=t,t}}}function n0(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}var i0=0;function s0(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function r0(s){let e=new t0,t=n0(),n={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 l=0;l<9;l++)n.probe.push(new D);let i=new D,r=new Oe,a=new Oe;function o(l){let h=0,u=0,d=0;for(let w=0;w<9;w++)n.probe[w].set(0,0,0);let f=0,g=0,y=0,m=0,p=0,x=0,S=0,M=0,E=0,A=0,C=0;l.sort(s0);for(let w=0,L=l.length;w<L;w++){let R=l[w],O=R.color,H=R.intensity,q=R.distance,N=null;if(R.shadow&&R.shadow.map&&(R.shadow.map.texture.format===xi?N=R.shadow.map.texture:N=R.shadow.map.depthTexture||R.shadow.map.texture),R.isAmbientLight)h+=O.r*H,u+=O.g*H,d+=O.b*H;else if(R.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(R.sh.coefficients[z],H);C++}else if(R.isDirectionalLight){let z=e.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){let V=R.shadow,$=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,n.directionalShadow[f]=$,n.directionalShadowMap[f]=N,n.directionalShadowMatrix[f]=R.shadow.matrix,x++}n.directional[f]=z,f++}else if(R.isSpotLight){let z=e.get(R);z.position.setFromMatrixPosition(R.matrixWorld),z.color.copy(O).multiplyScalar(H),z.distance=q,z.coneCos=Math.cos(R.angle),z.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),z.decay=R.decay,n.spot[y]=z;let V=R.shadow;if(R.map&&(n.spotLightMap[E]=R.map,E++,V.updateMatrices(R),R.castShadow&&A++),n.spotLightMatrix[y]=V.matrix,R.castShadow){let $=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,n.spotShadow[y]=$,n.spotShadowMap[y]=N,M++}y++}else if(R.isRectAreaLight){let z=e.get(R);z.color.copy(O).multiplyScalar(H),z.halfWidth.set(R.width*.5,0,0),z.halfHeight.set(0,R.height*.5,0),n.rectArea[m]=z,m++}else if(R.isPointLight){let z=e.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),z.distance=R.distance,z.decay=R.decay,R.castShadow){let V=R.shadow,$=t.get(R);$.shadowIntensity=V.intensity,$.shadowBias=V.bias,$.shadowNormalBias=V.normalBias,$.shadowRadius=V.radius,$.shadowMapSize=V.mapSize,$.shadowCameraNear=V.camera.near,$.shadowCameraFar=V.camera.far,n.pointShadow[g]=$,n.pointShadowMap[g]=N,n.pointShadowMatrix[g]=R.shadow.matrix,S++}n.point[g]=z,g++}else if(R.isHemisphereLight){let z=e.get(R);z.skyColor.copy(R.color).multiplyScalar(H),z.groundColor.copy(R.groundColor).multiplyScalar(H),n.hemi[p]=z,p++}}m>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ce.LTC_FLOAT_1,n.rectAreaLTC2=ce.LTC_FLOAT_2):(n.rectAreaLTC1=ce.LTC_HALF_1,n.rectAreaLTC2=ce.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;let _=n.hash;(_.directionalLength!==f||_.pointLength!==g||_.spotLength!==y||_.rectAreaLength!==m||_.hemiLength!==p||_.numDirectionalShadows!==x||_.numPointShadows!==S||_.numSpotShadows!==M||_.numSpotMaps!==E||_.numLightProbes!==C)&&(n.directional.length=f,n.spot.length=y,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=S,n.pointShadowMap.length=S,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=S,n.spotLightMatrix.length=M+E-A,n.spotLightMap.length=E,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=C,_.directionalLength=f,_.pointLength=g,_.spotLength=y,_.rectAreaLength=m,_.hemiLength=p,_.numDirectionalShadows=x,_.numPointShadows=S,_.numSpotShadows=M,_.numSpotMaps=E,_.numLightProbes=C,n.version=i0++)}function c(l,h){let u=0,d=0,f=0,g=0,y=0,m=h.matrixWorldInverse;for(let p=0,x=l.length;p<x;p++){let S=l[p];if(S.isDirectionalLight){let M=n.directional[u];M.direction.setFromMatrixPosition(S.matrixWorld),i.setFromMatrixPosition(S.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(m),u++}else if(S.isSpotLight){let M=n.spot[f];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),M.direction.setFromMatrixPosition(S.matrixWorld),i.setFromMatrixPosition(S.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(m),f++}else if(S.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),a.identity(),r.copy(S.matrixWorld),r.premultiply(m),a.extractRotation(r),M.halfWidth.set(S.width*.5,0,0),M.halfHeight.set(0,S.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),g++}else if(S.isPointLight){let M=n.point[d];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(m),d++}else if(S.isHemisphereLight){let M=n.hemi[y];M.direction.setFromMatrixPosition(S.matrixWorld),M.direction.transformDirection(m),y++}}}return{setup:o,setupView:c,state:n}}function td(s){let e=new r0(s),t=[],n=[],i=[];function r(d){u.camera=d,t.length=0,n.length=0,i.length=0}function a(d){t.push(d)}function o(d){n.push(d)}function c(d){i.push(d)}function l(){e.setup(t)}function h(d){e.setupView(t,d)}let u={lightsArray:t,shadowsArray:n,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:u,setupLights:l,setupLightsView:h,pushLight:a,pushShadow:o,pushLightProbeGrid:c}}function a0(s){let e=new WeakMap;function t(i,r=0){let a=e.get(i),o;return a===void 0?(o=new td(s),e.set(i,[o])):r>=a.length?(o=new td(s),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}var o0=`void main() {- gl_Position = vec4( position, 1.0 );-}`,c0=`uniform sampler2D shadow_pass;-uniform vec2 resolution;-uniform float radius;-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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;- mean += distribution.x;- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;- #else- float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;- mean += depth;- squared_mean += depth * depth;- #endif- }- mean = mean / samples;- squared_mean = squared_mean / samples;- float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );- gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );-}`,l0=[new D(1,0,0),new D(-1,0,0),new D(0,1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1)],h0=[new D(0,-1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1),new D(0,-1,0),new D(0,-1,0)],nd=new Oe,Lr=new D,ul=new D;function u0(s,e,t){let n=new ys,i=new Re,r=new Re,a=new nt,o=new Ca,c=new Pa,l={},h=t.maxTextureSize,u={[_n]:Lt,[Lt]:_n,[ln]:ln},d=new en({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Re},radius:{value:4}},vertexShader:o0,fragmentShader:c0}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let g=new Ht;g.setAttribute("position",new Tt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let y=new at(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=vr;let p=this.type;this.render=function(A,C,_){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;this.type===Va&&(_e("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=vr);let w=s.getRenderTarget(),L=s.getActiveCubeFace(),R=s.getActiveMipmapLevel(),O=s.state;O.setBlending(Nn),O.buffers.depth.getReversed()===!0?O.buffers.color.setClear(0,0,0,0):O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);let H=p!==this.type;H&&C.traverse(function(q){q.material&&(Array.isArray(q.material)?q.material.forEach(N=>N.needsUpdate=!0):q.material.needsUpdate=!0)});for(let q=0,N=A.length;q<N;q++){let z=A[q],V=z.shadow;if(V===void 0){_e("WebGLShadowMap:",z,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;i.copy(V.mapSize);let $=V.getFrameExtents();i.multiply($),r.copy(V.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/$.x),i.x=r.x*$.x,V.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/$.y),i.y=r.y*$.y,V.mapSize.y=r.y));let Q=s.state.buffers.depth.getReversed();if(V.camera._reversedDepth=Q,V.map===null||H===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===ws){if(z.isPointLight){_e("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}V.map=new Qt(i.x,i.y,{format:xi,type:Un,minFilter:vt,magFilter:vt,generateMipmaps:!1}),V.map.texture.name=z.name+".shadowMap",V.map.depthTexture=new Yn(i.x,i.y,tn),V.map.depthTexture.name=z.name+".shadowMapDepth",V.map.depthTexture.format=En,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=xt,V.map.depthTexture.magFilter=xt}else z.isPointLight?(V.map=new Uo(i.x),V.map.depthTexture=new Ea(i.x,Mn)):(V.map=new Qt(i.x,i.y),V.map.depthTexture=new Yn(i.x,i.y,Mn)),V.map.depthTexture.name=z.name+".shadowMap",V.map.depthTexture.format=En,this.type===vr?(V.map.depthTexture.compareFunction=Q?Lo:Do,V.map.depthTexture.minFilter=vt,V.map.depthTexture.magFilter=vt):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=xt,V.map.depthTexture.magFilter=xt);V.camera.updateProjectionMatrix()}let le=V.map.isWebGLCubeRenderTarget?6:1;for(let xe=0;xe<le;xe++){if(V.map.isWebGLCubeRenderTarget)s.setRenderTarget(V.map,xe),s.clear();else{xe===0&&(s.setRenderTarget(V.map),s.clear());let Se=V.getViewport(xe);a.set(r.x*Se.x,r.y*Se.y,r.x*Se.z,r.y*Se.w),O.viewport(a)}if(z.isPointLight){let Se=V.camera,Xe=V.matrix,Ze=z.distance||Se.far;Ze!==Se.far&&(Se.far=Ze,Se.updateProjectionMatrix()),Lr.setFromMatrixPosition(z.matrixWorld),Se.position.copy(Lr),ul.copy(Se.position),ul.add(l0[xe]),Se.up.copy(h0[xe]),Se.lookAt(ul),Se.updateMatrixWorld(),Xe.makeTranslation(-Lr.x,-Lr.y,-Lr.z),nd.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),V._frustum.setFromProjectionMatrix(nd,Se.coordinateSystem,Se.reversedDepth)}else V.updateMatrices(z);n=V.getFrustum(),M(C,_,V.camera,z,this.type)}V.isPointLightShadow!==!0&&this.type===ws&&x(V,_),V.needsUpdate=!1}p=this.type,m.needsUpdate=!1,s.setRenderTarget(w,L,R)};function x(A,C){let _=e.update(y);d.defines.VSM_SAMPLES!==A.blurSamples&&(d.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new Qt(i.x,i.y,{format:xi,type:Un})),d.uniforms.shadow_pass.value=A.map.depthTexture,d.uniforms.resolution.value=A.mapSize,d.uniforms.radius.value=A.radius,s.setRenderTarget(A.mapPass),s.clear(),s.renderBufferDirect(C,null,_,d,y,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radius,s.setRenderTarget(A.map),s.clear(),s.renderBufferDirect(C,null,_,f,y,null)}function S(A,C,_,w){let L=null,R=_.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(R!==void 0)L=R;else if(L=_.isPointLight===!0?c:o,s.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||C.alphaToCoverage===!0){let O=L.uuid,H=C.uuid,q=l[O];q===void 0&&(q={},l[O]=q);let N=q[H];N===void 0&&(N=L.clone(),q[H]=N,C.addEventListener("dispose",E)),L=N}if(L.visible=C.visible,L.wireframe=C.wireframe,w===ws?L.side=C.shadowSide!==null?C.shadowSide:C.side:L.side=C.shadowSide!==null?C.shadowSide:u[C.side],L.alphaMap=C.alphaMap,L.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,L.map=C.map,L.clipShadows=C.clipShadows,L.clippingPlanes=C.clippingPlanes,L.clipIntersection=C.clipIntersection,L.displacementMap=C.displacementMap,L.displacementScale=C.displacementScale,L.displacementBias=C.displacementBias,L.wireframeLinewidth=C.wireframeLinewidth,L.linewidth=C.linewidth,_.isPointLight===!0&&L.isMeshDistanceMaterial===!0){let O=s.properties.get(L);O.light=_}return L}function M(A,C,_,w,L){if(A.visible===!1)return;if(A.layers.test(C.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&L===ws)&&(!A.frustumCulled||n.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,A.matrixWorld);let H=e.update(A),q=A.material;if(Array.isArray(q)){let N=H.groups;for(let z=0,V=N.length;z<V;z++){let $=N[z],Q=q[$.materialIndex];if(Q&&Q.visible){let le=S(A,Q,w,L);A.onBeforeShadow(s,A,C,_,H,le,$),s.renderBufferDirect(_,null,H,le,A,$),A.onAfterShadow(s,A,C,_,H,le,$)}}}else if(q.visible){let N=S(A,q,w,L);A.onBeforeShadow(s,A,C,_,H,N,null),s.renderBufferDirect(_,null,H,N,A,null),A.onAfterShadow(s,A,C,_,H,N,null)}}let O=A.children;for(let H=0,q=O.length;H<q;H++)M(O[H],C,_,w,L)}function E(A){A.target.removeEventListener("dispose",E);for(let _ in l){let w=l[_],L=A.target.uuid;L in w&&(w[L].dispose(),delete w[L])}}}function d0(s,e){function t(){let P=!1,ne=new nt,X=null,pe=new nt(0,0,0,0);return{setMask:function(re){X!==re&&!P&&(s.colorMask(re,re,re,re),X=re)},setLocked:function(re){P=re},setClear:function(re,J,ye,Le,mt){mt===!0&&(re*=Le,J*=Le,ye*=Le),ne.set(re,J,ye,Le),pe.equals(ne)===!1&&(s.clearColor(re,J,ye,Le),pe.copy(ne))},reset:function(){P=!1,X=null,pe.set(-1,0,0,0)}}}function n(){let P=!1,ne=!1,X=null,pe=null,re=null;return{setReversed:function(J){if(ne!==J){let ye=e.get("EXT_clip_control");J?ye.clipControlEXT(ye.LOWER_LEFT_EXT,ye.ZERO_TO_ONE_EXT):ye.clipControlEXT(ye.LOWER_LEFT_EXT,ye.NEGATIVE_ONE_TO_ONE_EXT),ne=J;let Le=re;re=null,this.setClear(Le)}},getReversed:function(){return ne},setTest:function(J){J?ie(s.DEPTH_TEST):Ee(s.DEPTH_TEST)},setMask:function(J){X!==J&&!P&&(s.depthMask(J),X=J)},setFunc:function(J){if(ne&&(J=Pu[J]),pe!==J){switch(J){case fa:s.depthFunc(s.NEVER);break;case pa:s.depthFunc(s.ALWAYS);break;case ma:s.depthFunc(s.LESS);break;case Ii:s.depthFunc(s.LEQUAL);break;case ga:s.depthFunc(s.EQUAL);break;case ba:s.depthFunc(s.GEQUAL);break;case _a:s.depthFunc(s.GREATER);break;case xa:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}pe=J}},setLocked:function(J){P=J},setClear:function(J){re!==J&&(re=J,ne&&(J=1-J),s.clearDepth(J))},reset:function(){P=!1,X=null,pe=null,re=null,ne=!1}}}function i(){let P=!1,ne=null,X=null,pe=null,re=null,J=null,ye=null,Le=null,mt=null;return{setTest:function(Qe){P||(Qe?ie(s.STENCIL_TEST):Ee(s.STENCIL_TEST))},setMask:function(Qe){ne!==Qe&&!P&&(s.stencilMask(Qe),ne=Qe)},setFunc:function(Qe,zn,Sn){(X!==Qe||pe!==zn||re!==Sn)&&(s.stencilFunc(Qe,zn,Sn),X=Qe,pe=zn,re=Sn)},setOp:function(Qe,zn,Sn){(J!==Qe||ye!==zn||Le!==Sn)&&(s.stencilOp(Qe,zn,Sn),J=Qe,ye=zn,Le=Sn)},setLocked:function(Qe){P=Qe},setClear:function(Qe){mt!==Qe&&(s.clearStencil(Qe),mt=Qe)},reset:function(){P=!1,ne=null,X=null,pe=null,re=null,J=null,ye=null,Le=null,mt=null}}}let r=new t,a=new n,o=new i,c=new WeakMap,l=new WeakMap,h={},u={},d={},f=new WeakMap,g=[],y=null,m=!1,p=null,x=null,S=null,M=null,E=null,A=null,C=null,_=new Ae(0,0,0),w=0,L=!1,R=null,O=null,H=null,q=null,N=null,z=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS),V=!1,$=0,Q=s.getParameter(s.VERSION);Q.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(Q)[1]),V=$>=1):Q.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),V=$>=2);let le=null,xe={},Se=s.getParameter(s.SCISSOR_BOX),Xe=s.getParameter(s.VIEWPORT),Ze=new nt().fromArray(Se),Ne=new nt().fromArray(Xe);function Y(P,ne,X,pe){let re=new Uint8Array(4),J=s.createTexture();s.bindTexture(P,J),s.texParameteri(P,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(P,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let ye=0;ye<X;ye++)P===s.TEXTURE_3D||P===s.TEXTURE_2D_ARRAY?s.texImage3D(ne,0,s.RGBA,1,1,pe,0,s.RGBA,s.UNSIGNED_BYTE,re):s.texImage2D(ne+ye,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,re);return J}let de={};de[s.TEXTURE_2D]=Y(s.TEXTURE_2D,s.TEXTURE_2D,1),de[s.TEXTURE_CUBE_MAP]=Y(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),de[s.TEXTURE_2D_ARRAY]=Y(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),de[s.TEXTURE_3D]=Y(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ie(s.DEPTH_TEST),a.setFunc(Ii),At(!1),dt(Ic),ie(s.CULL_FACE),ht(Nn);function ie(P){h[P]!==!0&&(s.enable(P),h[P]=!0)}function Ee(P){h[P]!==!1&&(s.disable(P),h[P]=!1)}function De(P,ne){return d[P]!==ne?(s.bindFramebuffer(P,ne),d[P]=ne,P===s.DRAW_FRAMEBUFFER&&(d[s.FRAMEBUFFER]=ne),P===s.FRAMEBUFFER&&(d[s.DRAW_FRAMEBUFFER]=ne),!0):!1}function Ce(P,ne){let X=g,pe=!1;if(P){X=f.get(ne),X===void 0&&(X=[],f.set(ne,X));let re=P.textures;if(X.length!==re.length||X[0]!==s.COLOR_ATTACHMENT0){for(let J=0,ye=re.length;J<ye;J++)X[J]=s.COLOR_ATTACHMENT0+J;X.length=re.length,pe=!0}}else X[0]!==s.BACK&&(X[0]=s.BACK,pe=!0);pe&&s.drawBuffers(X)}function ut(P){return y!==P?(s.useProgram(P),y=P,!0):!1}let We={[hi]:s.FUNC_ADD,[Yh]:s.FUNC_SUBTRACT,[Jh]:s.FUNC_REVERSE_SUBTRACT};We[Zh]=s.MIN,We[$h]=s.MAX;let $e={[Qh]:s.ZERO,[eu]:s.ONE,[tu]:s.SRC_COLOR,[ua]:s.SRC_ALPHA,[ou]:s.SRC_ALPHA_SATURATE,[ru]:s.DST_COLOR,[iu]:s.DST_ALPHA,[nu]:s.ONE_MINUS_SRC_COLOR,[da]:s.ONE_MINUS_SRC_ALPHA,[au]:s.ONE_MINUS_DST_COLOR,[su]:s.ONE_MINUS_DST_ALPHA,[cu]:s.CONSTANT_COLOR,[lu]:s.ONE_MINUS_CONSTANT_COLOR,[hu]:s.CONSTANT_ALPHA,[uu]:s.ONE_MINUS_CONSTANT_ALPHA};function ht(P,ne,X,pe,re,J,ye,Le,mt,Qe){if(P===Nn){m===!0&&(Ee(s.BLEND),m=!1);return}if(m===!1&&(ie(s.BLEND),m=!0),P!==Kh){if(P!==p||Qe!==L){if((x!==hi||E!==hi)&&(s.blendEquation(s.FUNC_ADD),x=hi,E=hi),Qe)switch(P){case Pi:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Dc:s.blendFunc(s.ONE,s.ONE);break;case Lc:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case Fc:s.blendFuncSeparate(s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:we("WebGLState: Invalid blending: ",P);break}else switch(P){case Pi:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Dc:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case Lc:we("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fc:we("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:we("WebGLState: Invalid blending: ",P);break}S=null,M=null,A=null,C=null,_.set(0,0,0),w=0,p=P,L=Qe}return}re=re||ne,J=J||X,ye=ye||pe,(ne!==x||re!==E)&&(s.blendEquationSeparate(We[ne],We[re]),x=ne,E=re),(X!==S||pe!==M||J!==A||ye!==C)&&(s.blendFuncSeparate($e[X],$e[pe],$e[J],$e[ye]),S=X,M=pe,A=J,C=ye),(Le.equals(_)===!1||mt!==w)&&(s.blendColor(Le.r,Le.g,Le.b,mt),_.copy(Le),w=mt),p=P,L=!1}function He(P,ne){P.side===ln?Ee(s.CULL_FACE):ie(s.CULL_FACE);let X=P.side===Lt;ne&&(X=!X),At(X),P.blending===Pi&&P.transparent===!1?ht(Nn):ht(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),a.setFunc(P.depthFunc),a.setTest(P.depthTest),a.setMask(P.depthWrite),r.setMask(P.colorWrite);let pe=P.stencilWrite;o.setTest(pe),pe&&(o.setMask(P.stencilWriteMask),o.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),o.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),I(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?ie(s.SAMPLE_ALPHA_TO_COVERAGE):Ee(s.SAMPLE_ALPHA_TO_COVERAGE)}function At(P){R!==P&&(P?s.frontFace(s.CW):s.frontFace(s.CCW),R=P)}function dt(P){P!==Xh?(ie(s.CULL_FACE),P!==O&&(P===Ic?s.cullFace(s.BACK):P===jh?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):Ee(s.CULL_FACE),O=P}function Yt(P){P!==H&&(V&&s.lineWidth(P),H=P)}function I(P,ne,X){P?(ie(s.POLYGON_OFFSET_FILL),(q!==ne||N!==X)&&(q=ne,N=X,a.getReversed()&&(ne=-ne),s.polygonOffset(ne,X))):Ee(s.POLYGON_OFFSET_FILL)}function wt(P){P?ie(s.SCISSOR_TEST):Ee(s.SCISSOR_TEST)}function qe(P){P===void 0&&(P=s.TEXTURE0+z-1),le!==P&&(s.activeTexture(P),le=P)}function ot(P,ne,X){X===void 0&&(le===null?X=s.TEXTURE0+z-1:X=le);let pe=xe[X];pe===void 0&&(pe={type:void 0,texture:void 0},xe[X]=pe),(pe.type!==P||pe.texture!==ne)&&(le!==X&&(s.activeTexture(X),le=X),s.bindTexture(P,ne||de[P]),pe.type=P,pe.texture=ne)}function oe(){let P=xe[le];P!==void 0&&P.type!==void 0&&(s.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function ft(){try{s.compressedTexImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function T(){try{s.compressedTexImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function b(){try{s.texSubImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function U(){try{s.texSubImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function j(){try{s.compressedTexSubImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function Z(){try{s.compressedTexSubImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function ee(){try{s.texStorage2D(...arguments)}catch(P){we("WebGLState:",P)}}function ae(){try{s.texStorage3D(...arguments)}catch(P){we("WebGLState:",P)}}function W(){try{s.texImage2D(...arguments)}catch(P){we("WebGLState:",P)}}function K(){try{s.texImage3D(...arguments)}catch(P){we("WebGLState:",P)}}function fe(P){return u[P]!==void 0?u[P]:s.getParameter(P)}function ge(P,ne){u[P]!==ne&&(s.pixelStorei(P,ne),u[P]=ne)}function se(P){Ze.equals(P)===!1&&(s.scissor(P.x,P.y,P.z,P.w),Ze.copy(P))}function te(P){Ne.equals(P)===!1&&(s.viewport(P.x,P.y,P.z,P.w),Ne.copy(P))}function Pe(P,ne){let X=l.get(ne);X===void 0&&(X=new WeakMap,l.set(ne,X));let pe=X.get(P);pe===void 0&&(pe=s.getUniformBlockIndex(ne,P.name),X.set(P,pe))}function Ue(P,ne){let pe=l.get(ne).get(P);c.get(ne)!==pe&&(s.uniformBlockBinding(ne,pe,P.__bindingPointIndex),c.set(ne,pe))}function Ke(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),a.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),s.pixelStorei(s.PACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.BROWSER_DEFAULT_WEBGL),s.pixelStorei(s.PACK_ROW_LENGTH,0),s.pixelStorei(s.PACK_SKIP_PIXELS,0),s.pixelStorei(s.PACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_ROW_LENGTH,0),s.pixelStorei(s.UNPACK_IMAGE_HEIGHT,0),s.pixelStorei(s.UNPACK_SKIP_PIXELS,0),s.pixelStorei(s.UNPACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_SKIP_IMAGES,0),h={},u={},le=null,xe={},d={},f=new WeakMap,g=[],y=null,m=!1,p=null,x=null,S=null,M=null,E=null,A=null,C=null,_=new Ae(0,0,0),w=0,L=!1,R=null,O=null,H=null,q=null,N=null,Ze.set(0,0,s.canvas.width,s.canvas.height),Ne.set(0,0,s.canvas.width,s.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:ie,disable:Ee,bindFramebuffer:De,drawBuffers:Ce,useProgram:ut,setBlending:ht,setMaterial:He,setFlipSided:At,setCullFace:dt,setLineWidth:Yt,setPolygonOffset:I,setScissorTest:wt,activeTexture:qe,bindTexture:ot,unbindTexture:oe,compressedTexImage2D:ft,compressedTexImage3D:T,texImage2D:W,texImage3D:K,pixelStorei:ge,getParameter:fe,updateUBOMapping:Pe,uniformBlockBinding:Ue,texStorage2D:ee,texStorage3D:ae,texSubImage2D:b,texSubImage3D:U,compressedTexSubImage2D:j,compressedTexSubImage3D:Z,scissor:se,viewport:te,reset:Ke}}function f0(s,e,t,n,i,r,a){let o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Re,h=new WeakMap,u=new Set,d,f=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(T,b){return g?new OffscreenCanvas(T,b):fs("canvas")}function m(T,b,U){let j=1,Z=ft(T);if((Z.width>U||Z.height>U)&&(j=U/Math.max(Z.width,Z.height)),j<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){let ee=Math.floor(j*Z.width),ae=Math.floor(j*Z.height);d===void 0&&(d=y(ee,ae));let W=b?y(ee,ae):d;return W.width=ee,W.height=ae,W.getContext("2d").drawImage(T,0,0,ee,ae),_e("WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+ee+"x"+ae+")."),W}else return"data"in T&&_e("WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),T;return T}function p(T){return T.generateMipmaps}function x(T){s.generateMipmap(T)}function S(T){return T.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?s.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function M(T,b,U,j,Z,ee=!1){if(T!==null){if(s[T]!==void 0)return s[T];_e("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let ae;j&&(ae=e.get("EXT_texture_norm16"),ae||_e("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let W=b;if(b===s.RED&&(U===s.FLOAT&&(W=s.R32F),U===s.HALF_FLOAT&&(W=s.R16F),U===s.UNSIGNED_BYTE&&(W=s.R8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.R16_EXT),U===s.SHORT&&ae&&(W=ae.R16_SNORM_EXT)),b===s.RED_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.R8UI),U===s.UNSIGNED_SHORT&&(W=s.R16UI),U===s.UNSIGNED_INT&&(W=s.R32UI),U===s.BYTE&&(W=s.R8I),U===s.SHORT&&(W=s.R16I),U===s.INT&&(W=s.R32I)),b===s.RG&&(U===s.FLOAT&&(W=s.RG32F),U===s.HALF_FLOAT&&(W=s.RG16F),U===s.UNSIGNED_BYTE&&(W=s.RG8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.RG16_EXT),U===s.SHORT&&ae&&(W=ae.RG16_SNORM_EXT)),b===s.RG_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RG8UI),U===s.UNSIGNED_SHORT&&(W=s.RG16UI),U===s.UNSIGNED_INT&&(W=s.RG32UI),U===s.BYTE&&(W=s.RG8I),U===s.SHORT&&(W=s.RG16I),U===s.INT&&(W=s.RG32I)),b===s.RGB_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RGB8UI),U===s.UNSIGNED_SHORT&&(W=s.RGB16UI),U===s.UNSIGNED_INT&&(W=s.RGB32UI),U===s.BYTE&&(W=s.RGB8I),U===s.SHORT&&(W=s.RGB16I),U===s.INT&&(W=s.RGB32I)),b===s.RGBA_INTEGER&&(U===s.UNSIGNED_BYTE&&(W=s.RGBA8UI),U===s.UNSIGNED_SHORT&&(W=s.RGBA16UI),U===s.UNSIGNED_INT&&(W=s.RGBA32UI),U===s.BYTE&&(W=s.RGBA8I),U===s.SHORT&&(W=s.RGBA16I),U===s.INT&&(W=s.RGBA32I)),b===s.RGB&&(U===s.UNSIGNED_SHORT&&ae&&(W=ae.RGB16_EXT),U===s.SHORT&&ae&&(W=ae.RGB16_SNORM_EXT),U===s.UNSIGNED_INT_5_9_9_9_REV&&(W=s.RGB9_E5),U===s.UNSIGNED_INT_10F_11F_11F_REV&&(W=s.R11F_G11F_B10F)),b===s.RGBA){let K=ee?Ks:ze.getTransfer(Z);U===s.FLOAT&&(W=s.RGBA32F),U===s.HALF_FLOAT&&(W=s.RGBA16F),U===s.UNSIGNED_BYTE&&(W=K===Ye?s.SRGB8_ALPHA8:s.RGBA8),U===s.UNSIGNED_SHORT&&ae&&(W=ae.RGBA16_EXT),U===s.SHORT&&ae&&(W=ae.RGBA16_SNORM_EXT),U===s.UNSIGNED_SHORT_4_4_4_4&&(W=s.RGBA4),U===s.UNSIGNED_SHORT_5_5_5_1&&(W=s.RGB5_A1)}return(W===s.R16F||W===s.R32F||W===s.RG16F||W===s.RG32F||W===s.RGBA16F||W===s.RGBA32F)&&e.get("EXT_color_buffer_float"),W}function E(T,b){let U;return T?b===null||b===Mn||b===Cs?U=s.DEPTH24_STENCIL8:b===tn?U=s.DEPTH32F_STENCIL8:b===Rs&&(U=s.DEPTH24_STENCIL8,_e("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===Mn||b===Cs?U=s.DEPTH_COMPONENT24:b===tn?U=s.DEPTH_COMPONENT32F:b===Rs&&(U=s.DEPTH_COMPONENT16),U}function A(T,b){return p(T)===!0||T.isFramebufferTexture&&T.minFilter!==xt&&T.minFilter!==vt?Math.log2(Math.max(b.width,b.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?b.mipmaps.length:1}function C(T){let b=T.target;b.removeEventListener("dispose",C),w(b),b.isVideoTexture&&h.delete(b),b.isHTMLTexture&&u.delete(b)}function _(T){let b=T.target;b.removeEventListener("dispose",_),R(b)}function w(T){let b=n.get(T);if(b.__webglInit===void 0)return;let U=T.source,j=f.get(U);if(j){let Z=j[b.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&L(T),Object.keys(j).length===0&&f.delete(U)}n.remove(T)}function L(T){let b=n.get(T);s.deleteTexture(b.__webglTexture);let U=T.source,j=f.get(U);delete j[b.__cacheKey],a.memory.textures--}function R(T){let b=n.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),n.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let j=0;j<6;j++){if(Array.isArray(b.__webglFramebuffer[j]))for(let Z=0;Z<b.__webglFramebuffer[j].length;Z++)s.deleteFramebuffer(b.__webglFramebuffer[j][Z]);else s.deleteFramebuffer(b.__webglFramebuffer[j]);b.__webglDepthbuffer&&s.deleteRenderbuffer(b.__webglDepthbuffer[j])}else{if(Array.isArray(b.__webglFramebuffer))for(let j=0;j<b.__webglFramebuffer.length;j++)s.deleteFramebuffer(b.__webglFramebuffer[j]);else s.deleteFramebuffer(b.__webglFramebuffer);if(b.__webglDepthbuffer&&s.deleteRenderbuffer(b.__webglDepthbuffer),b.__webglMultisampledFramebuffer&&s.deleteFramebuffer(b.__webglMultisampledFramebuffer),b.__webglColorRenderbuffer)for(let j=0;j<b.__webglColorRenderbuffer.length;j++)b.__webglColorRenderbuffer[j]&&s.deleteRenderbuffer(b.__webglColorRenderbuffer[j]);b.__webglDepthRenderbuffer&&s.deleteRenderbuffer(b.__webglDepthRenderbuffer)}let U=T.textures;for(let j=0,Z=U.length;j<Z;j++){let ee=n.get(U[j]);ee.__webglTexture&&(s.deleteTexture(ee.__webglTexture),a.memory.textures--),n.remove(U[j])}n.remove(T)}let O=0;function H(){O=0}function q(){return O}function N(T){O=T}function z(){let T=O;return T>=i.maxTextures&&_e("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+i.maxTextures),O+=1,T}function V(T){let b=[];return b.push(T.wrapS),b.push(T.wrapT),b.push(T.wrapR||0),b.push(T.magFilter),b.push(T.minFilter),b.push(T.anisotropy),b.push(T.internalFormat),b.push(T.format),b.push(T.type),b.push(T.generateMipmaps),b.push(T.premultiplyAlpha),b.push(T.flipY),b.push(T.unpackAlignment),b.push(T.colorSpace),b.join()}function $(T,b){let U=n.get(T);if(T.isVideoTexture&&ot(T),T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&U.__version!==T.version){let j=T.image;if(j===null)_e("WebGLRenderer: Texture marked for update but no image data found.");else if(j.complete===!1)_e("WebGLRenderer: Texture marked for update but image is incomplete");else{Ee(U,T,b);return}}else T.isExternalTexture&&(U.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,U.__webglTexture,s.TEXTURE0+b)}function Q(T,b){let U=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&U.__version!==T.version){Ee(U,T,b);return}else T.isExternalTexture&&(U.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(s.TEXTURE_2D_ARRAY,U.__webglTexture,s.TEXTURE0+b)}function le(T,b){let U=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&U.__version!==T.version){Ee(U,T,b);return}t.bindTexture(s.TEXTURE_3D,U.__webglTexture,s.TEXTURE0+b)}function xe(T,b){let U=n.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&U.__version!==T.version){De(U,T,b);return}t.bindTexture(s.TEXTURE_CUBE_MAP,U.__webglTexture,s.TEXTURE0+b)}let Se={[ui]:s.REPEAT,[on]:s.CLAMP_TO_EDGE,[us]:s.MIRRORED_REPEAT},Xe={[xt]:s.NEAREST,[Xa]:s.NEAREST_MIPMAP_NEAREST,[Wi]:s.NEAREST_MIPMAP_LINEAR,[vt]:s.LINEAR,[Es]:s.LINEAR_MIPMAP_NEAREST,[yn]:s.LINEAR_MIPMAP_LINEAR},Ze={[yu]:s.NEVER,[wu]:s.ALWAYS,[Mu]:s.LESS,[Do]:s.LEQUAL,[Su]:s.EQUAL,[Lo]:s.GEQUAL,[Tu]:s.GREATER,[Au]:s.NOTEQUAL};function Ne(T,b){if(b.type===tn&&e.has("OES_texture_float_linear")===!1&&(b.magFilter===vt||b.magFilter===Es||b.magFilter===Wi||b.magFilter===yn||b.minFilter===vt||b.minFilter===Es||b.minFilter===Wi||b.minFilter===yn)&&_e("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(T,s.TEXTURE_WRAP_S,Se[b.wrapS]),s.texParameteri(T,s.TEXTURE_WRAP_T,Se[b.wrapT]),(T===s.TEXTURE_3D||T===s.TEXTURE_2D_ARRAY)&&s.texParameteri(T,s.TEXTURE_WRAP_R,Se[b.wrapR]),s.texParameteri(T,s.TEXTURE_MAG_FILTER,Xe[b.magFilter]),s.texParameteri(T,s.TEXTURE_MIN_FILTER,Xe[b.minFilter]),b.compareFunction&&(s.texParameteri(T,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(T,s.TEXTURE_COMPARE_FUNC,Ze[b.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===xt||b.minFilter!==Wi&&b.minFilter!==yn||b.type===tn&&e.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||n.get(b).__currentAnisotropy){let U=e.get("EXT_texture_filter_anisotropic");s.texParameterf(T,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,i.getMaxAnisotropy())),n.get(b).__currentAnisotropy=b.anisotropy}}}function Y(T,b){let U=!1;T.__webglInit===void 0&&(T.__webglInit=!0,b.addEventListener("dispose",C));let j=b.source,Z=f.get(j);Z===void 0&&(Z={},f.set(j,Z));let ee=V(b);if(ee!==T.__cacheKey){Z[ee]===void 0&&(Z[ee]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,U=!0),Z[ee].usedTimes++;let ae=Z[T.__cacheKey];ae!==void 0&&(Z[T.__cacheKey].usedTimes--,ae.usedTimes===0&&L(b)),T.__cacheKey=ee,T.__webglTexture=Z[ee].texture}return U}function de(T,b,U){return Math.floor(Math.floor(T/U)/b)}function ie(T,b,U,j){let ee=T.updateRanges;if(ee.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,b.width,b.height,U,j,b.data);else{ee.sort((ge,se)=>ge.start-se.start);let ae=0;for(let ge=1;ge<ee.length;ge++){let se=ee[ae],te=ee[ge],Pe=se.start+se.count,Ue=de(te.start,b.width,4),Ke=de(se.start,b.width,4);te.start<=Pe+1&&Ue===Ke&&de(te.start+te.count-1,b.width,4)===Ue?se.count=Math.max(se.count,te.start+te.count-se.start):(++ae,ee[ae]=te)}ee.length=ae+1;let W=t.getParameter(s.UNPACK_ROW_LENGTH),K=t.getParameter(s.UNPACK_SKIP_PIXELS),fe=t.getParameter(s.UNPACK_SKIP_ROWS);t.pixelStorei(s.UNPACK_ROW_LENGTH,b.width);for(let ge=0,se=ee.length;ge<se;ge++){let te=ee[ge],Pe=Math.floor(te.start/4),Ue=Math.ceil(te.count/4),Ke=Pe%b.width,P=Math.floor(Pe/b.width),ne=Ue,X=1;t.pixelStorei(s.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(s.UNPACK_SKIP_ROWS,P),t.texSubImage2D(s.TEXTURE_2D,0,Ke,P,ne,X,U,j,b.data)}T.clearUpdateRanges(),t.pixelStorei(s.UNPACK_ROW_LENGTH,W),t.pixelStorei(s.UNPACK_SKIP_PIXELS,K),t.pixelStorei(s.UNPACK_SKIP_ROWS,fe)}}function Ee(T,b,U){let j=s.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&(j=s.TEXTURE_2D_ARRAY),b.isData3DTexture&&(j=s.TEXTURE_3D);let Z=Y(T,b),ee=b.source;t.bindTexture(j,T.__webglTexture,s.TEXTURE0+U);let ae=n.get(ee);if(ee.version!==ae.__version||Z===!0){if(t.activeTexture(s.TEXTURE0+U),(typeof ImageBitmap<"u"&&b.image instanceof ImageBitmap)===!1){let X=ze.getPrimaries(ze.workingColorSpace),pe=b.colorSpace===Qn?null:ze.getPrimaries(b.colorSpace),re=b.colorSpace===Qn||X===pe?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,re)}t.pixelStorei(s.UNPACK_ALIGNMENT,b.unpackAlignment);let K=m(b.image,!1,i.maxTextureSize);K=oe(b,K);let fe=r.convert(b.format,b.colorSpace),ge=r.convert(b.type),se=M(b.internalFormat,fe,ge,b.normalized,b.colorSpace,b.isVideoTexture);Ne(j,b);let te,Pe=b.mipmaps,Ue=b.isVideoTexture!==!0,Ke=ae.__version===void 0||Z===!0,P=ee.dataReady,ne=A(b,K);if(b.isDepthTexture)se=E(b.format===_i,b.type),Ke&&(Ue?t.texStorage2D(s.TEXTURE_2D,1,se,K.width,K.height):t.texImage2D(s.TEXTURE_2D,0,se,K.width,K.height,0,fe,ge,null));else if(b.isDataTexture)if(Pe.length>0){Ue&&Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,Pe[0].width,Pe[0].height);for(let X=0,pe=Pe.length;X<pe;X++)te=Pe[X],Ue?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,ge,te.data):t.texImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,fe,ge,te.data);b.generateMipmaps=!1}else Ue?(Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,K.width,K.height),P&&ie(b,K,fe,ge)):t.texImage2D(s.TEXTURE_2D,0,se,K.width,K.height,0,fe,ge,K.data);else if(b.isCompressedTexture)if(b.isCompressedArrayTexture){Ue&&Ke&&t.texStorage3D(s.TEXTURE_2D_ARRAY,ne,se,Pe[0].width,Pe[0].height,K.depth);for(let X=0,pe=Pe.length;X<pe;X++)if(te=Pe[X],b.format!==nn)if(fe!==null)if(Ue){if(P)if(b.layerUpdates.size>0){let re=el(te.width,te.height,b.format,b.type);for(let J of b.layerUpdates){let ye=te.data.subarray(J*re/te.data.BYTES_PER_ELEMENT,(J+1)*re/te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,J,te.width,te.height,1,fe,ye)}b.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,0,te.width,te.height,K.depth,fe,te.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,X,se,te.width,te.height,K.depth,0,te.data,0,0);else _e("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ue?P&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,X,0,0,0,te.width,te.height,K.depth,fe,ge,te.data):t.texImage3D(s.TEXTURE_2D_ARRAY,X,se,te.width,te.height,K.depth,0,fe,ge,te.data)}else{Ue&&Ke&&t.texStorage2D(s.TEXTURE_2D,ne,se,Pe[0].width,Pe[0].height);for(let X=0,pe=Pe.length;X<pe;X++)te=Pe[X],b.format!==nn?fe!==null?Ue?P&&t.compressedTexSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,te.data):t.compressedTexImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,te.data):_e("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ue?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,te.width,te.height,fe,ge,te.data):t.texImage2D(s.TEXTURE_2D,X,se,te.width,te.height,0,fe,ge,te.data)}else if(b.isDataArrayTexture)if(Ue){if(Ke&&t.texStorage3D(s.TEXTURE_2D_ARRAY,ne,se,K.width,K.height,K.depth),P)if(b.layerUpdates.size>0){let X=el(K.width,K.height,b.format,b.type);for(let pe of b.layerUpdates){let re=K.data.subarray(pe*X/K.data.BYTES_PER_ELEMENT,(pe+1)*X/K.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,pe,K.width,K.height,1,fe,ge,re)}b.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,K.width,K.height,K.depth,fe,ge,K.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,se,K.width,K.height,K.depth,0,fe,ge,K.data);else if(b.isData3DTexture)Ue?(Ke&&t.texStorage3D(s.TEXTURE_3D,ne,se,K.width,K.height,K.depth),P&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,K.width,K.height,K.depth,fe,ge,K.data)):t.texImage3D(s.TEXTURE_3D,0,se,K.width,K.height,K.depth,0,fe,ge,K.data);else if(b.isFramebufferTexture){if(Ke)if(Ue)t.texStorage2D(s.TEXTURE_2D,ne,se,K.width,K.height);else{let X=K.width,pe=K.height;for(let re=0;re<ne;re++)t.texImage2D(s.TEXTURE_2D,re,se,X,pe,0,fe,ge,null),X>>=1,pe>>=1}}else if(b.isHTMLTexture){if("texElementImage2D"in s){let X=s.canvas;if(X.hasAttribute("layoutsubtree")||X.setAttribute("layoutsubtree","true"),K.parentNode!==X){X.appendChild(K),u.add(b),X.onpaint=Le=>{let mt=Le.changedElements;for(let Qe of u)mt.includes(Qe.image)&&(Qe.needsUpdate=!0)},X.requestPaint();return}let pe=0,re=s.RGBA,J=s.RGBA,ye=s.UNSIGNED_BYTE;s.texElementImage2D(s.TEXTURE_2D,pe,re,J,ye,K),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE)}}else if(Pe.length>0){if(Ue&&Ke){let X=ft(Pe[0]);t.texStorage2D(s.TEXTURE_2D,ne,se,X.width,X.height)}for(let X=0,pe=Pe.length;X<pe;X++)te=Pe[X],Ue?P&&t.texSubImage2D(s.TEXTURE_2D,X,0,0,fe,ge,te):t.texImage2D(s.TEXTURE_2D,X,se,fe,ge,te);b.generateMipmaps=!1}else if(Ue){if(Ke){let X=ft(K);t.texStorage2D(s.TEXTURE_2D,ne,se,X.width,X.height)}P&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,fe,ge,K)}else t.texImage2D(s.TEXTURE_2D,0,se,fe,ge,K);p(b)&&x(j),ae.__version=ee.version,b.onUpdate&&b.onUpdate(b)}T.__version=b.version}function De(T,b,U){if(b.image.length!==6)return;let j=Y(T,b),Z=b.source;t.bindTexture(s.TEXTURE_CUBE_MAP,T.__webglTexture,s.TEXTURE0+U);let ee=n.get(Z);if(Z.version!==ee.__version||j===!0){t.activeTexture(s.TEXTURE0+U);let ae=ze.getPrimaries(ze.workingColorSpace),W=b.colorSpace===Qn?null:ze.getPrimaries(b.colorSpace),K=b.colorSpace===Qn||ae===W?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(s.UNPACK_ALIGNMENT,b.unpackAlignment),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,K);let fe=b.isCompressedTexture||b.image[0].isCompressedTexture,ge=b.image[0]&&b.image[0].isDataTexture,se=[];for(let J=0;J<6;J++)!fe&&!ge?se[J]=m(b.image[J],!0,i.maxCubemapSize):se[J]=ge?b.image[J].image:b.image[J],se[J]=oe(b,se[J]);let te=se[0],Pe=r.convert(b.format,b.colorSpace),Ue=r.convert(b.type),Ke=M(b.internalFormat,Pe,Ue,b.normalized,b.colorSpace),P=b.isVideoTexture!==!0,ne=ee.__version===void 0||j===!0,X=Z.dataReady,pe=A(b,te);Ne(s.TEXTURE_CUBE_MAP,b);let re;if(fe){P&&ne&&t.texStorage2D(s.TEXTURE_CUBE_MAP,pe,Ke,te.width,te.height);for(let J=0;J<6;J++){re=se[J].mipmaps;for(let ye=0;ye<re.length;ye++){let Le=re[ye];b.format!==nn?Pe!==null?P?X&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye,0,0,Le.width,Le.height,Pe,Le.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye,Ke,Le.width,Le.height,0,Le.data):_e("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye,0,0,Le.width,Le.height,Pe,Ue,Le.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye,Ke,Le.width,Le.height,0,Pe,Ue,Le.data)}}}else{if(re=b.mipmaps,P&&ne){re.length>0&&pe++;let J=ft(se[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,pe,Ke,J.width,J.height)}for(let J=0;J<6;J++)if(ge){P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,se[J].width,se[J].height,Pe,Ue,se[J].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Ke,se[J].width,se[J].height,0,Pe,Ue,se[J].data);for(let ye=0;ye<re.length;ye++){let mt=re[ye].image[J].image;P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye+1,0,0,mt.width,mt.height,Pe,Ue,mt.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye+1,Ke,mt.width,mt.height,0,Pe,Ue,mt.data)}}else{P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,Pe,Ue,se[J]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Ke,Pe,Ue,se[J]);for(let ye=0;ye<re.length;ye++){let Le=re[ye];P?X&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye+1,0,0,Pe,Ue,Le.image[J]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+J,ye+1,Ke,Pe,Ue,Le.image[J])}}}p(b)&&x(s.TEXTURE_CUBE_MAP),ee.__version=Z.version,b.onUpdate&&b.onUpdate(b)}T.__version=b.version}function Ce(T,b,U,j,Z,ee){let ae=r.convert(U.format,U.colorSpace),W=r.convert(U.type),K=M(U.internalFormat,ae,W,U.normalized,U.colorSpace),fe=n.get(b),ge=n.get(U);if(ge.__renderTarget=b,!fe.__hasExternalTextures){let se=Math.max(1,b.width>>ee),te=Math.max(1,b.height>>ee);Z===s.TEXTURE_3D||Z===s.TEXTURE_2D_ARRAY?t.texImage3D(Z,ee,K,se,te,b.depth,0,ae,W,null):t.texImage2D(Z,ee,K,se,te,0,ae,W,null)}t.bindFramebuffer(s.FRAMEBUFFER,T),qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,j,Z,ge.__webglTexture,0,wt(b)):(Z===s.TEXTURE_2D||Z>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,j,Z,ge.__webglTexture,ee),t.bindFramebuffer(s.FRAMEBUFFER,null)}function ut(T,b,U){if(s.bindRenderbuffer(s.RENDERBUFFER,T),b.depthBuffer){let j=b.depthTexture,Z=j&&j.isDepthTexture?j.type:null,ee=E(b.stencilBuffer,Z),ae=b.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;qe(b)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,wt(b),ee,b.width,b.height):U?s.renderbufferStorageMultisample(s.RENDERBUFFER,wt(b),ee,b.width,b.height):s.renderbufferStorage(s.RENDERBUFFER,ee,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,ae,s.RENDERBUFFER,T)}else{let j=b.textures;for(let Z=0;Z<j.length;Z++){let ee=j[Z],ae=r.convert(ee.format,ee.colorSpace),W=r.convert(ee.type),K=M(ee.internalFormat,ae,W,ee.normalized,ee.colorSpace);qe(b)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,wt(b),K,b.width,b.height):U?s.renderbufferStorageMultisample(s.RENDERBUFFER,wt(b),K,b.width,b.height):s.renderbufferStorage(s.RENDERBUFFER,K,b.width,b.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function We(T,b,U){let j=b.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(s.FRAMEBUFFER,T),!(b.depthTexture&&b.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let Z=n.get(b.depthTexture);if(Z.__renderTarget=b,(!Z.__webglTexture||b.depthTexture.image.width!==b.width||b.depthTexture.image.height!==b.height)&&(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),j){if(Z.__webglInit===void 0&&(Z.__webglInit=!0,b.depthTexture.addEventListener("dispose",C)),Z.__webglTexture===void 0){Z.__webglTexture=s.createTexture(),t.bindTexture(s.TEXTURE_CUBE_MAP,Z.__webglTexture),Ne(s.TEXTURE_CUBE_MAP,b.depthTexture);let fe=r.convert(b.depthTexture.format),ge=r.convert(b.depthTexture.type),se;b.depthTexture.format===En?se=s.DEPTH_COMPONENT24:b.depthTexture.format===_i&&(se=s.DEPTH24_STENCIL8);for(let te=0;te<6;te++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,se,b.width,b.height,0,fe,ge,null)}}else $(b.depthTexture,0);let ee=Z.__webglTexture,ae=wt(b),W=j?s.TEXTURE_CUBE_MAP_POSITIVE_X+U:s.TEXTURE_2D,K=b.depthTexture.format===_i?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;if(b.depthTexture.format===En)qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,K,W,ee,0,ae):s.framebufferTexture2D(s.FRAMEBUFFER,K,W,ee,0);else if(b.depthTexture.format===_i)qe(b)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,K,W,ee,0,ae):s.framebufferTexture2D(s.FRAMEBUFFER,K,W,ee,0);else throw new Error("Unknown depthTexture format")}function $e(T){let b=n.get(T),U=T.isWebGLCubeRenderTarget===!0;if(b.__boundDepthTexture!==T.depthTexture){let j=T.depthTexture;if(b.__depthDisposeCallback&&b.__depthDisposeCallback(),j){let Z=()=>{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,j.removeEventListener("dispose",Z)};j.addEventListener("dispose",Z),b.__depthDisposeCallback=Z}b.__boundDepthTexture=j}if(T.depthTexture&&!b.__autoAllocateDepthBuffer)if(U)for(let j=0;j<6;j++)We(b.__webglFramebuffer[j],T,j);else{let j=T.texture.mipmaps;j&&j.length>0?We(b.__webglFramebuffer[0],T,0):We(b.__webglFramebuffer,T,0)}else if(U){b.__webglDepthbuffer=[];for(let j=0;j<6;j++)if(t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer[j]),b.__webglDepthbuffer[j]===void 0)b.__webglDepthbuffer[j]=s.createRenderbuffer(),ut(b.__webglDepthbuffer[j],T,!1);else{let Z=T.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ee=b.__webglDepthbuffer[j];s.bindRenderbuffer(s.RENDERBUFFER,ee),s.framebufferRenderbuffer(s.FRAMEBUFFER,Z,s.RENDERBUFFER,ee)}}else{let j=T.texture.mipmaps;if(j&&j.length>0?t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=s.createRenderbuffer(),ut(b.__webglDepthbuffer,T,!1);else{let Z=T.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ee=b.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,ee),s.framebufferRenderbuffer(s.FRAMEBUFFER,Z,s.RENDERBUFFER,ee)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function ht(T,b,U){let j=n.get(T);b!==void 0&&Ce(j.__webglFramebuffer,T,T.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),U!==void 0&&$e(T)}function He(T){let b=T.texture,U=n.get(T),j=n.get(b);T.addEventListener("dispose",_);let Z=T.textures,ee=T.isWebGLCubeRenderTarget===!0,ae=Z.length>1;if(ae||(j.__webglTexture===void 0&&(j.__webglTexture=s.createTexture()),j.__version=b.version,a.memory.textures++),ee){U.__webglFramebuffer=[];for(let W=0;W<6;W++)if(b.mipmaps&&b.mipmaps.length>0){U.__webglFramebuffer[W]=[];for(let K=0;K<b.mipmaps.length;K++)U.__webglFramebuffer[W][K]=s.createFramebuffer()}else U.__webglFramebuffer[W]=s.createFramebuffer()}else{if(b.mipmaps&&b.mipmaps.length>0){U.__webglFramebuffer=[];for(let W=0;W<b.mipmaps.length;W++)U.__webglFramebuffer[W]=s.createFramebuffer()}else U.__webglFramebuffer=s.createFramebuffer();if(ae)for(let W=0,K=Z.length;W<K;W++){let fe=n.get(Z[W]);fe.__webglTexture===void 0&&(fe.__webglTexture=s.createTexture(),a.memory.textures++)}if(T.samples>0&&qe(T)===!1){U.__webglMultisampledFramebuffer=s.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let W=0;W<Z.length;W++){let K=Z[W];U.__webglColorRenderbuffer[W]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,U.__webglColorRenderbuffer[W]);let fe=r.convert(K.format,K.colorSpace),ge=r.convert(K.type),se=M(K.internalFormat,fe,ge,K.normalized,K.colorSpace,T.isXRRenderTarget===!0),te=wt(T);s.renderbufferStorageMultisample(s.RENDERBUFFER,te,se,T.width,T.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+W,s.RENDERBUFFER,U.__webglColorRenderbuffer[W])}s.bindRenderbuffer(s.RENDERBUFFER,null),T.depthBuffer&&(U.__webglDepthRenderbuffer=s.createRenderbuffer(),ut(U.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(ee){t.bindTexture(s.TEXTURE_CUBE_MAP,j.__webglTexture),Ne(s.TEXTURE_CUBE_MAP,b);for(let W=0;W<6;W++)if(b.mipmaps&&b.mipmaps.length>0)for(let K=0;K<b.mipmaps.length;K++)Ce(U.__webglFramebuffer[W][K],T,b,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+W,K);else Ce(U.__webglFramebuffer[W],T,b,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+W,0);p(b)&&x(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ae){for(let W=0,K=Z.length;W<K;W++){let fe=Z[W],ge=n.get(fe),se=s.TEXTURE_2D;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(se=T.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(se,ge.__webglTexture),Ne(se,fe),Ce(U.__webglFramebuffer,T,fe,s.COLOR_ATTACHMENT0+W,se,0),p(fe)&&x(se)}t.unbindTexture()}else{let W=s.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(W=T.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(W,j.__webglTexture),Ne(W,b),b.mipmaps&&b.mipmaps.length>0)for(let K=0;K<b.mipmaps.length;K++)Ce(U.__webglFramebuffer[K],T,b,s.COLOR_ATTACHMENT0,W,K);else Ce(U.__webglFramebuffer,T,b,s.COLOR_ATTACHMENT0,W,0);p(b)&&x(W),t.unbindTexture()}T.depthBuffer&&$e(T)}function At(T){let b=T.textures;for(let U=0,j=b.length;U<j;U++){let Z=b[U];if(p(Z)){let ee=S(T),ae=n.get(Z).__webglTexture;t.bindTexture(ee,ae),x(ee),t.unbindTexture()}}}let dt=[],Yt=[];function I(T){if(T.samples>0){if(qe(T)===!1){let b=T.textures,U=T.width,j=T.height,Z=s.COLOR_BUFFER_BIT,ee=T.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ae=n.get(T),W=b.length>1;if(W)for(let fe=0;fe<b.length;fe++)t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,ae.__webglMultisampledFramebuffer);let K=T.texture.mipmaps;K&&K.length>0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglFramebuffer);for(let fe=0;fe<b.length;fe++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(Z|=s.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(Z|=s.STENCIL_BUFFER_BIT)),W){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,ae.__webglColorRenderbuffer[fe]);let ge=n.get(b[fe]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,ge,0)}s.blitFramebuffer(0,0,U,j,0,0,U,j,Z,s.NEAREST),c===!0&&(dt.length=0,Yt.length=0,dt.push(s.COLOR_ATTACHMENT0+fe),T.depthBuffer&&T.resolveDepthBuffer===!1&&(dt.push(ee),Yt.push(ee),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,Yt)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,dt))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),W)for(let fe=0;fe<b.length;fe++){t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.RENDERBUFFER,ae.__webglColorRenderbuffer[fe]);let ge=n.get(b[fe]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,ae.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+fe,s.TEXTURE_2D,ge,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ae.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&c){let b=T.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[b])}}}function wt(T){return Math.min(i.maxSamples,T.samples)}function qe(T){let b=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function ot(T){let b=a.render.frame;h.get(T)!==b&&(h.set(T,b),T.update())}function oe(T,b){let U=T.colorSpace,j=T.format,Z=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||U!==Gt&&U!==Qn&&(ze.getTransfer(U)===Ye?(j!==nn||Z!==jt)&&_e("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):we("WebGLTextures: Unsupported texture color space:",U)),b}function ft(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(l.width=T.naturalWidth||T.width,l.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(l.width=T.displayWidth,l.height=T.displayHeight):(l.width=T.width,l.height=T.height),l}this.allocateTextureUnit=z,this.resetTextureUnits=H,this.getTextureUnits=q,this.setTextureUnits=N,this.setTexture2D=$,this.setTexture2DArray=Q,this.setTexture3D=le,this.setTextureCube=xe,this.rebindTextures=ht,this.setupRenderTarget=He,this.updateRenderTargetMipmap=At,this.updateMultisampleRenderTarget=I,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=qe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function p0(s,e){function t(n,i=Qn){let r,a=ze.getTransfer(i);if(n===jt)return s.UNSIGNED_BYTE;if(n===Ka)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Ya)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Wc)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===qc)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vc)return s.BYTE;if(n===Hc)return s.SHORT;if(n===Rs)return s.UNSIGNED_SHORT;if(n===ja)return s.INT;if(n===Mn)return s.UNSIGNED_INT;if(n===tn)return s.FLOAT;if(n===Un)return s.HALF_FLOAT;if(n===Xc)return s.ALPHA;if(n===jc)return s.RGB;if(n===nn)return s.RGBA;if(n===En)return s.DEPTH_COMPONENT;if(n===_i)return s.DEPTH_STENCIL;if(n===Ja)return s.RED;if(n===Za)return s.RED_INTEGER;if(n===xi)return s.RG;if(n===$a)return s.RG_INTEGER;if(n===Qa)return s.RGBA_INTEGER;if(n===Sr||n===Tr||n===Ar||n===wr)if(a===Ye)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Sr)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Tr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ar)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===wr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Sr)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Tr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ar)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===wr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===eo||n===to||n===no||n===io)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===eo)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===to)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===no)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===io)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===so||n===ro||n===ao||n===oo||n===co||n===Er||n===lo)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===so||n===ro)return a===Ye?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ao)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===oo)return r.COMPRESSED_R11_EAC;if(n===co)return r.COMPRESSED_SIGNED_R11_EAC;if(n===Er)return r.COMPRESSED_RG11_EAC;if(n===lo)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ho||n===uo||n===fo||n===po||n===mo||n===go||n===bo||n===_o||n===xo||n===vo||n===yo||n===Mo||n===So||n===To)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===ho)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===uo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===fo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===po)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===mo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===go)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===bo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===_o)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===xo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===vo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===yo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Mo)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===So)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===To)return a===Ye?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ao||n===wo||n===Eo)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Ao)return a===Ye?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===wo)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Eo)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ro||n===Co||n===Rr||n===Po)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===Ro)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Co)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Rr)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Po)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Cs?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}var m0=`-void main() {-- gl_Position = vec4( position, 1.0 );--}`,g0=`-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;-- }--}`,xl=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new ar(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new en({vertexShader:m0,fragmentShader:g0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new at(new Bi(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},vl=class extends cn{constructor(e,t){super();let n=this,i=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,f=null,g=null,y=typeof XRWebGLBinding<"u",m=new xl,p={},x=t.getContextAttributes(),S=null,M=null,E=[],A=[],C=new Re,_=null,w=new St;w.viewport=new nt;let L=new St;L.viewport=new nt;let R=[w,L],O=new Ba,H=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let de=E[Y];return de===void 0&&(de=new gs,E[Y]=de),de.getTargetRaySpace()},this.getControllerGrip=function(Y){let de=E[Y];return de===void 0&&(de=new gs,E[Y]=de),de.getGripSpace()},this.getHand=function(Y){let de=E[Y];return de===void 0&&(de=new gs,E[Y]=de),de.getHandSpace()};function N(Y){let de=A.indexOf(Y.inputSource);if(de===-1)return;let ie=E[de];ie!==void 0&&(ie.update(Y.inputSource,Y.frame,l||a),ie.dispatchEvent({type:Y.type,data:Y.inputSource}))}function z(){i.removeEventListener("select",N),i.removeEventListener("selectstart",N),i.removeEventListener("selectend",N),i.removeEventListener("squeeze",N),i.removeEventListener("squeezestart",N),i.removeEventListener("squeezeend",N),i.removeEventListener("end",z),i.removeEventListener("inputsourceschange",V);for(let Y=0;Y<E.length;Y++){let de=A[Y];de!==null&&(A[Y]=null,E[Y].disconnect(de))}H=null,q=null,m.reset();for(let Y in p)delete p[Y];e.setRenderTarget(S),f=null,d=null,u=null,i=null,M=null,Ne.stop(),n.isPresenting=!1,e.setPixelRatio(_),e.setSize(C.width,C.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){r=Y,n.isPresenting===!0&&_e("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&_e("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(Y){l=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&y&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(S=e.getRenderTarget(),i.addEventListener("select",N),i.addEventListener("selectstart",N),i.addEventListener("selectend",N),i.addEventListener("squeeze",N),i.addEventListener("squeezestart",N),i.addEventListener("squeezeend",N),i.addEventListener("end",z),i.addEventListener("inputsourceschange",V),x.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(C),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let ie=null,Ee=null,De=null;x.depth&&(De=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ie=x.stencil?_i:En,Ee=x.stencil?Cs:Mn);let Ce={colorFormat:t.RGBA8,depthFormat:De,scaleFactor:r};u=this.getBinding(),d=u.createProjectionLayer(Ce),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),M=new Qt(d.textureWidth,d.textureHeight,{format:nn,type:jt,depthTexture:new Yn(d.textureWidth,d.textureHeight,Ee,void 0,void 0,void 0,void 0,void 0,void 0,ie),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let ie={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,t,ie),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new Qt(f.framebufferWidth,f.framebufferHeight,{format:nn,type:jt,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await i.requestReferenceSpace(o),Ne.setContext(i),Ne.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function V(Y){for(let de=0;de<Y.removed.length;de++){let ie=Y.removed[de],Ee=A.indexOf(ie);Ee>=0&&(A[Ee]=null,E[Ee].disconnect(ie))}for(let de=0;de<Y.added.length;de++){let ie=Y.added[de],Ee=A.indexOf(ie);if(Ee===-1){for(let Ce=0;Ce<E.length;Ce++)if(Ce>=A.length){A.push(ie),Ee=Ce;break}else if(A[Ce]===null){A[Ce]=ie,Ee=Ce;break}if(Ee===-1)break}let De=E[Ee];De&&De.connect(ie)}}let $=new D,Q=new D;function le(Y,de,ie){$.setFromMatrixPosition(de.matrixWorld),Q.setFromMatrixPosition(ie.matrixWorld);let Ee=$.distanceTo(Q),De=de.projectionMatrix.elements,Ce=ie.projectionMatrix.elements,ut=De[14]/(De[10]-1),We=De[14]/(De[10]+1),$e=(De[9]+1)/De[5],ht=(De[9]-1)/De[5],He=(De[8]-1)/De[0],At=(Ce[8]+1)/Ce[0],dt=ut*He,Yt=ut*At,I=Ee/(-He+At),wt=I*-He;if(de.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(wt),Y.translateZ(I),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),De[10]===-1)Y.projectionMatrix.copy(de.projectionMatrix),Y.projectionMatrixInverse.copy(de.projectionMatrixInverse);else{let qe=ut+I,ot=We+I,oe=dt-wt,ft=Yt+(Ee-wt),T=$e*We/ot*qe,b=ht*We/ot*qe;Y.projectionMatrix.makePerspective(oe,ft,T,b,qe,ot),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function xe(Y,de){de===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(de.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let de=Y.near,ie=Y.far;m.texture!==null&&(m.depthNear>0&&(de=m.depthNear),m.depthFar>0&&(ie=m.depthFar)),O.near=L.near=w.near=de,O.far=L.far=w.far=ie,(H!==O.near||q!==O.far)&&(i.updateRenderState({depthNear:O.near,depthFar:O.far}),H=O.near,q=O.far),O.layers.mask=Y.layers.mask|6,w.layers.mask=O.layers.mask&-5,L.layers.mask=O.layers.mask&-3;let Ee=Y.parent,De=O.cameras;xe(O,Ee);for(let Ce=0;Ce<De.length;Ce++)xe(De[Ce],Ee);De.length===2?le(O,w,L):O.projectionMatrix.copy(w.projectionMatrix),Se(Y,O,Ee)};function Se(Y,de,ie){ie===null?Y.matrix.copy(de.matrixWorld):(Y.matrix.copy(ie.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(de.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(de.projectionMatrix),Y.projectionMatrixInverse.copy(de.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=Fi*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(Y){c=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(O)},this.getCameraTexture=function(Y){return p[Y]};let Xe=null;function Ze(Y,de){if(h=de.getViewerPose(l||a),g=de,h!==null){let ie=h.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let Ee=!1;ie.length!==O.cameras.length&&(O.cameras.length=0,Ee=!0);for(let We=0;We<ie.length;We++){let $e=ie[We],ht=null;if(f!==null)ht=f.getViewport($e);else{let At=u.getViewSubImage(d,$e);ht=At.viewport,We===0&&(e.setRenderTargetTextures(M,At.colorTexture,At.depthStencilTexture),e.setRenderTarget(M))}let He=R[We];He===void 0&&(He=new St,He.layers.enable(We),He.viewport=new nt,R[We]=He),He.matrix.fromArray($e.transform.matrix),He.matrix.decompose(He.position,He.quaternion,He.scale),He.projectionMatrix.fromArray($e.projectionMatrix),He.projectionMatrixInverse.copy(He.projectionMatrix).invert(),He.viewport.set(ht.x,ht.y,ht.width,ht.height),We===0&&(O.matrix.copy(He.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),Ee===!0&&O.cameras.push(He)}let De=i.enabledFeatures;if(De&&De.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&y){u=n.getBinding();let We=u.getDepthInformation(ie[0]);We&&We.isValid&&We.texture&&m.init(We,i.renderState)}if(De&&De.includes("camera-access")&&y){e.state.unbindTexture(),u=n.getBinding();for(let We=0;We<ie.length;We++){let $e=ie[We].camera;if($e){let ht=p[$e];ht||(ht=new ar,p[$e]=ht);let He=u.getCameraImage($e);ht.sourceTexture=He}}}}for(let ie=0;ie<E.length;ie++){let Ee=A[ie],De=E[ie];Ee!==null&&De!==void 0&&De.update(Ee,de,l||a)}Xe&&Xe(Y,de),de.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:de}),g=null}let Ne=new id;Ne.setAnimationLoop(Ze),this.setAnimationLoop=function(Y){Xe=Y},this.dispose=function(){}}},b0=new Oe,ld=new Ie;ld.set(-1,0,0,0,1,0,0,0,1);function _0(s,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,Zc(s)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function i(m,p,x,S,M){p.isNodeMaterial?p.uniformsNeedUpdate=!1:p.isMeshBasicMaterial?r(m,p):p.isMeshLambertMaterial?(r(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(r(m,p),u(m,p)):p.isMeshPhongMaterial?(r(m,p),h(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(r(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,M)):p.isMeshMatcapMaterial?(r(m,p),g(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),y(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?c(m,p,x,S):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Lt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Lt&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);let x=e.get(p),S=x.envMap,M=x.envMapRotation;S&&(m.envMap.value=S,m.envMapRotation.value.setFromMatrix4(b0.makeRotationFromEuler(M)).transpose(),S.isCubeTexture&&S.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(ld),m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,x,S){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*x,m.scale.value=S*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,x){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Lt&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=x.texture,m.transmissionSamplerSize.value.set(x.width,x.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function y(m,p){let x=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(x.matrixWorld),m.nearDistance.value=x.shadow.camera.near,m.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function x0(s,e,t,n){let i={},r={},a=[],o=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(x,S){let M=S.program;n.uniformBlockBinding(x,M)}function l(x,S){let M=i[x.id];M===void 0&&(g(x),M=h(x),i[x.id]=M,x.addEventListener("dispose",m));let E=S.program;n.updateUBOMapping(x,E);let A=e.render.frame;r[x.id]!==A&&(d(x),r[x.id]=A)}function h(x){let S=u();x.__bindingPointIndex=S;let M=s.createBuffer(),E=x.__size,A=x.usage;return s.bindBuffer(s.UNIFORM_BUFFER,M),s.bufferData(s.UNIFORM_BUFFER,E,A),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,S,M),M}function u(){for(let x=0;x<o;x++)if(a.indexOf(x)===-1)return a.push(x),x;return we("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(x){let S=i[x.id],M=x.uniforms,E=x.__cache;s.bindBuffer(s.UNIFORM_BUFFER,S);for(let A=0,C=M.length;A<C;A++){let _=Array.isArray(M[A])?M[A]:[M[A]];for(let w=0,L=_.length;w<L;w++){let R=_[w];if(f(R,A,w,E)===!0){let O=R.__offset,H=Array.isArray(R.value)?R.value:[R.value],q=0;for(let N=0;N<H.length;N++){let z=H[N],V=y(z);typeof z=="number"||typeof z=="boolean"?(R.__data[0]=z,s.bufferSubData(s.UNIFORM_BUFFER,O+q,R.__data)):z.isMatrix3?(R.__data[0]=z.elements[0],R.__data[1]=z.elements[1],R.__data[2]=z.elements[2],R.__data[3]=0,R.__data[4]=z.elements[3],R.__data[5]=z.elements[4],R.__data[6]=z.elements[5],R.__data[7]=0,R.__data[8]=z.elements[6],R.__data[9]=z.elements[7],R.__data[10]=z.elements[8],R.__data[11]=0):ArrayBuffer.isView(z)?R.__data.set(new z.constructor(z.buffer,z.byteOffset,R.__data.length)):(z.toArray(R.__data,q),q+=V.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,O,R.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function f(x,S,M,E){let A=x.value,C=S+"_"+M;if(E[C]===void 0)return typeof A=="number"||typeof A=="boolean"?E[C]=A:ArrayBuffer.isView(A)?E[C]=A.slice():E[C]=A.clone(),!0;{let _=E[C];if(typeof A=="number"||typeof A=="boolean"){if(_!==A)return E[C]=A,!0}else{if(ArrayBuffer.isView(A))return!0;if(_.equals(A)===!1)return _.copy(A),!0}}return!1}function g(x){let S=x.uniforms,M=0,E=16;for(let C=0,_=S.length;C<_;C++){let w=Array.isArray(S[C])?S[C]:[S[C]];for(let L=0,R=w.length;L<R;L++){let O=w[L],H=Array.isArray(O.value)?O.value:[O.value];for(let q=0,N=H.length;q<N;q++){let z=H[q],V=y(z),$=M%E,Q=$%V.boundary,le=$+Q;M+=Q,le!==0&&E-le<V.storage&&(M+=E-le),O.__data=new Float32Array(V.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=M,M+=V.storage}}}let A=M%E;return A>0&&(M+=E-A),x.__size=M,x.__cache={},this}function y(x){let S={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(S.boundary=4,S.storage=4):x.isVector2?(S.boundary=8,S.storage=8):x.isVector3||x.isColor?(S.boundary=16,S.storage=12):x.isVector4?(S.boundary=16,S.storage=16):x.isMatrix3?(S.boundary=48,S.storage=48):x.isMatrix4?(S.boundary=64,S.storage=64):x.isTexture?_e("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(x)?(S.boundary=16,S.storage=x.byteLength):_e("WebGLRenderer: Unsupported uniform value type.",x),S}function m(x){let S=x.target;S.removeEventListener("dispose",m);let M=a.indexOf(S.__bindingPointIndex);a.splice(M,1),s.deleteBuffer(i[S.id]),delete i[S.id],delete r[S.id]}function p(){for(let x in i)s.deleteBuffer(i[x]);a=[],i={},r={}}return{bind:c,update:l,dispose:p}}var v0=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),On=null;function y0(){return On===null&&(On=new vs(v0,16,16,xi,Un),On.name="DFG_LUT",On.minFilter=vt,On.magFilter=vt,On.wrapS=on,On.wrapT=on,On.generateMipmaps=!1,On.needsUpdate=!0),On}var Oo=class{constructor(e={}){let{canvas:t=Eu(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=jt}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;let y=f,m=new Set([Qa,$a,Za]),p=new Set([jt,Mn,Rs,Cs,Ka,Ya]),x=new Uint32Array(4),S=new Int32Array(4),M=new D,E=null,A=null,C=[],_=[],w=null;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.toneMapping=vn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let L=this,R=!1,O=null;this._outputColorSpace=_t;let H=0,q=0,N=null,z=-1,V=null,$=new nt,Q=new nt,le=null,xe=new Ae(0),Se=0,Xe=t.width,Ze=t.height,Ne=1,Y=null,de=null,ie=new nt(0,0,Xe,Ze),Ee=new nt(0,0,Xe,Ze),De=!1,Ce=new ys,ut=!1,We=!1,$e=new Oe,ht=new D,He=new nt,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},dt=!1;function Yt(){return N===null?Ne:1}let I=n;function wt(v,F){return t.getContext(v,F)}try{let v={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"184"}`),t.addEventListener("webglcontextlost",J,!1),t.addEventListener("webglcontextrestored",ye,!1),t.addEventListener("webglcontextcreationerror",Le,!1),I===null){let F="webgl2";if(I=wt(F,v),I===null)throw wt(F)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(v){throw we("WebGLRenderer: "+v.message),v}let qe,ot,oe,ft,T,b,U,j,Z,ee,ae,W,K,fe,ge,se,te,Pe,Ue,Ke,P,ne,X;function pe(){qe=new Rg(I),qe.init(),P=new p0(I,qe),ot=new vg(I,qe,e,P),oe=new d0(I,qe),ot.reversedDepthBuffer&&d&&oe.buffers.depth.setReversed(!0),ft=new Ig(I),T=new $b,b=new f0(I,qe,oe,T,ot,P,ft),U=new Eg(L),j=new Nf(I),ne=new _g(I,j),Z=new Cg(I,j,ft,ne),ee=new Lg(I,Z,j,ne,ft),Pe=new Dg(I,ot,b),ge=new yg(T),ae=new Zb(L,U,qe,ot,ne,ge),W=new _0(L,T),K=new e0,fe=new a0(qe),te=new bg(L,U,oe,ee,g,c),se=new u0(L,ee,ot),X=new x0(I,ft,ot,oe),Ue=new xg(I,qe,ft),Ke=new Pg(I,qe,ft),ft.programs=ae.programs,L.capabilities=ot,L.extensions=qe,L.properties=T,L.renderLists=K,L.shadowMap=se,L.state=oe,L.info=ft}pe(),y!==jt&&(w=new Ng(y,t.width,t.height,i,r));let re=new vl(L,I);this.xr=re,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let v=qe.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){let v=qe.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return Ne},this.setPixelRatio=function(v){v!==void 0&&(Ne=v,this.setSize(Xe,Ze,!1))},this.getSize=function(v){return v.set(Xe,Ze)},this.setSize=function(v,F,G=!0){if(re.isPresenting){_e("WebGLRenderer: Can't change size while VR device is presenting.");return}Xe=v,Ze=F,t.width=Math.floor(v*Ne),t.height=Math.floor(F*Ne),G===!0&&(t.style.width=v+"px",t.style.height=F+"px"),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,v,F)},this.getDrawingBufferSize=function(v){return v.set(Xe*Ne,Ze*Ne).floor()},this.setDrawingBufferSize=function(v,F,G){Xe=v,Ze=F,Ne=G,t.width=Math.floor(v*G),t.height=Math.floor(F*G),this.setViewport(0,0,v,F)},this.setEffects=function(v){if(y===jt){we("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let F=0;F<v.length;F++)if(v[F].isOutputPass===!0){_e("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}w.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy($)},this.getViewport=function(v){return v.copy(ie)},this.setViewport=function(v,F,G,B){v.isVector4?ie.set(v.x,v.y,v.z,v.w):ie.set(v,F,G,B),oe.viewport($.copy(ie).multiplyScalar(Ne).round())},this.getScissor=function(v){return v.copy(Ee)},this.setScissor=function(v,F,G,B){v.isVector4?Ee.set(v.x,v.y,v.z,v.w):Ee.set(v,F,G,B),oe.scissor(Q.copy(Ee).multiplyScalar(Ne).round())},this.getScissorTest=function(){return De},this.setScissorTest=function(v){oe.setScissorTest(De=v)},this.setOpaqueSort=function(v){Y=v},this.setTransparentSort=function(v){de=v},this.getClearColor=function(v){return v.copy(te.getClearColor())},this.setClearColor=function(){te.setClearColor(...arguments)},this.getClearAlpha=function(){return te.getClearAlpha()},this.setClearAlpha=function(){te.setClearAlpha(...arguments)},this.clear=function(v=!0,F=!0,G=!0){let B=0;if(v){let k=!1;if(N!==null){let ue=N.texture.format;k=m.has(ue)}if(k){let ue=N.texture.type,be=p.has(ue),he=te.getClearColor(),ve=te.getClearAlpha(),Me=he.r,Fe=he.g,ke=he.b;be?(x[0]=Me,x[1]=Fe,x[2]=ke,x[3]=ve,I.clearBufferuiv(I.COLOR,0,x)):(S[0]=Me,S[1]=Fe,S[2]=ke,S[3]=ve,I.clearBufferiv(I.COLOR,0,S))}else B|=I.COLOR_BUFFER_BIT}F&&(B|=I.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),G&&(B|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B!==0&&I.clear(B)},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.setNodesHandler=function(v){v.setRenderer(this),O=v},this.dispose=function(){t.removeEventListener("webglcontextlost",J,!1),t.removeEventListener("webglcontextrestored",ye,!1),t.removeEventListener("webglcontextcreationerror",Le,!1),te.dispose(),K.dispose(),fe.dispose(),T.dispose(),U.dispose(),ee.dispose(),ne.dispose(),X.dispose(),ae.dispose(),re.dispose(),re.removeEventListener("sessionstart",nh),re.removeEventListener("sessionend",ih),Mi.stop()};function J(v){v.preventDefault(),Ys("WebGLRenderer: Context Lost."),R=!0}function ye(){Ys("WebGLRenderer: Context Restored."),R=!1;let v=ft.autoReset,F=se.enabled,G=se.autoUpdate,B=se.needsUpdate,k=se.type;pe(),ft.autoReset=v,se.enabled=F,se.autoUpdate=G,se.needsUpdate=B,se.type=k}function Le(v){we("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function mt(v){let F=v.target;F.removeEventListener("dispose",mt),Qe(F)}function Qe(v){zn(v),T.remove(v)}function zn(v){let F=T.get(v).programs;F!==void 0&&(F.forEach(function(G){ae.releaseProgram(G)}),v.isShaderMaterial&&ae.releaseShaderCache(v))}this.renderBufferDirect=function(v,F,G,B,k,ue){F===null&&(F=At);let be=k.isMesh&&k.matrixWorld.determinant()<0,he=wd(v,F,G,B,k);oe.setMaterial(B,be);let ve=G.index,Me=1;if(B.wireframe===!0){if(ve=Z.getWireframeAttribute(G),ve===void 0)return;Me=2}let Fe=G.drawRange,ke=G.attributes.position,Te=Fe.start*Me,et=(Fe.start+Fe.count)*Me;ue!==null&&(Te=Math.max(Te,ue.start*Me),et=Math.min(et,(ue.start+ue.count)*Me)),ve!==null?(Te=Math.max(Te,0),et=Math.min(et,ve.count)):ke!=null&&(Te=Math.max(Te,0),et=Math.min(et,ke.count));let gt=et-Te;if(gt<0||gt===1/0)return;ne.setup(k,B,he,G,ve);let pt,st=Ue;if(ve!==null&&(pt=j.get(ve),st=Ke,st.setIndex(pt)),k.isMesh)B.wireframe===!0?(oe.setLineWidth(B.wireframeLinewidth*Yt()),st.setMode(I.LINES)):st.setMode(I.TRIANGLES);else if(k.isLine){let Ft=B.linewidth;Ft===void 0&&(Ft=1),oe.setLineWidth(Ft*Yt()),k.isLineSegments?st.setMode(I.LINES):k.isLineLoop?st.setMode(I.LINE_LOOP):st.setMode(I.LINE_STRIP)}else k.isPoints?st.setMode(I.POINTS):k.isSprite&&st.setMode(I.TRIANGLES);if(k.isBatchedMesh)if(qe.get("WEBGL_multi_draw"))st.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{let Ft=k._multiDrawStarts,me=k._multiDrawCounts,Jt=k._multiDrawCount,je=ve?j.get(ve).bytesPerElement:1,sn=T.get(B).currentProgram.getUniforms();for(let Tn=0;Tn<Jt;Tn++)sn.setValue(I,"_gl_DrawID",Tn),st.render(Ft[Tn]/je,me[Tn])}else if(k.isInstancedMesh)st.renderInstances(Te,gt,k.count);else if(G.isInstancedBufferGeometry){let Ft=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,me=Math.min(G.instanceCount,Ft);st.renderInstances(Te,gt,me)}else st.render(Te,gt)};function Sn(v,F,G){v.transparent===!0&&v.side===ln&&v.forceSinglePass===!1?(v.side=Lt,v.needsUpdate=!0,Or(v,F,G),v.side=_n,v.needsUpdate=!0,Or(v,F,G),v.side=ln):Or(v,F,G)}this.compile=function(v,F,G=null){G===null&&(G=v),A=fe.get(G),A.init(F),_.push(A),G.traverseVisible(function(k){k.isLight&&k.layers.test(F.layers)&&(A.pushLight(k),k.castShadow&&A.pushShadow(k))}),v!==G&&v.traverseVisible(function(k){k.isLight&&k.layers.test(F.layers)&&(A.pushLight(k),k.castShadow&&A.pushShadow(k))}),A.setupLights();let B=new Set;return v.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;let ue=k.material;if(ue)if(Array.isArray(ue))for(let be=0;be<ue.length;be++){let he=ue[be];Sn(he,G,k),B.add(he)}else Sn(ue,G,k),B.add(ue)}),A=_.pop(),B},this.compileAsync=function(v,F,G=null){let B=this.compile(v,F,G);return new Promise(k=>{function ue(){if(B.forEach(function(be){T.get(be).currentProgram.isReady()&&B.delete(be)}),B.size===0){k(v);return}setTimeout(ue,10)}qe.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let jo=null;function Td(v){jo&&jo(v)}function nh(){Mi.stop()}function ih(){Mi.start()}let Mi=new id;Mi.setAnimationLoop(Td),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(v){jo=v,re.setAnimationLoop(v),v===null?Mi.stop():Mi.start()},re.addEventListener("sessionstart",nh),re.addEventListener("sessionend",ih),this.render=function(v,F){if(F!==void 0&&F.isCamera!==!0){we("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;O!==null&&O.renderStart(v,F);let G=re.enabled===!0&&re.isPresenting===!0,B=w!==null&&(N===null||G)&&w.begin(L,N);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),re.enabled===!0&&re.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(re.cameraAutoUpdate===!0&&re.updateCamera(F),F=re.getCamera()),v.isScene===!0&&v.onBeforeRender(L,v,F,N),A=fe.get(v,_.length),A.init(F),A.state.textureUnits=b.getTextureUnits(),_.push(A),$e.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),Ce.setFromProjectionMatrix($e,mn,F.reversedDepth),We=this.localClippingEnabled,ut=ge.init(this.clippingPlanes,We),E=K.get(v,C.length),E.init(),C.push(E),re.enabled===!0&&re.isPresenting===!0){let be=L.xr.getDepthSensingMesh();be!==null&&Ko(be,F,-1/0,L.sortObjects)}Ko(v,F,0,L.sortObjects),E.finish(),L.sortObjects===!0&&E.sort(Y,de),dt=re.enabled===!1||re.isPresenting===!1||re.hasDepthSensing()===!1,dt&&te.addToRenderList(E,v),this.info.render.frame++,ut===!0&&ge.beginShadows();let k=A.state.shadowsArray;if(se.render(k,v,F),ut===!0&&ge.endShadows(),this.info.autoReset===!0&&this.info.reset(),(B&&w.hasRenderPass())===!1){let be=E.opaque,he=E.transmissive;if(A.setupLights(),F.isArrayCamera){let ve=F.cameras;if(he.length>0)for(let Me=0,Fe=ve.length;Me<Fe;Me++){let ke=ve[Me];rh(be,he,v,ke)}dt&&te.render(v);for(let Me=0,Fe=ve.length;Me<Fe;Me++){let ke=ve[Me];sh(E,v,ke,ke.viewport)}}else he.length>0&&rh(be,he,v,F),dt&&te.render(v),sh(E,v,F)}N!==null&&q===0&&(b.updateMultisampleRenderTarget(N),b.updateRenderTargetMipmap(N)),B&&w.end(L),v.isScene===!0&&v.onAfterRender(L,v,F),ne.resetDefaultState(),z=-1,V=null,_.pop(),_.length>0?(A=_[_.length-1],b.setTextureUnits(A.state.textureUnits),ut===!0&&ge.setGlobalState(L.clippingPlanes,A.state.camera)):A=null,C.pop(),C.length>0?E=C[C.length-1]:E=null,O!==null&&O.renderEnd()};function Ko(v,F,G,B){if(v.visible===!1)return;if(v.layers.test(F.layers)){if(v.isGroup)G=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(F);else if(v.isLightProbeGrid)A.pushLightProbeGrid(v);else if(v.isLight)A.pushLight(v),v.castShadow&&A.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||Ce.intersectsSprite(v)){B&&He.setFromMatrixPosition(v.matrixWorld).applyMatrix4($e);let be=ee.update(v),he=v.material;he.visible&&E.push(v,be,he,G,He.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||Ce.intersectsObject(v))){let be=ee.update(v),he=v.material;if(B&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),He.copy(v.boundingSphere.center)):(be.boundingSphere===null&&be.computeBoundingSphere(),He.copy(be.boundingSphere.center)),He.applyMatrix4(v.matrixWorld).applyMatrix4($e)),Array.isArray(he)){let ve=be.groups;for(let Me=0,Fe=ve.length;Me<Fe;Me++){let ke=ve[Me],Te=he[ke.materialIndex];Te&&Te.visible&&E.push(v,be,Te,G,He.z,ke)}}else he.visible&&E.push(v,be,he,G,He.z,null)}}let ue=v.children;for(let be=0,he=ue.length;be<he;be++)Ko(ue[be],F,G,B)}function sh(v,F,G,B){let{opaque:k,transmissive:ue,transparent:be}=v;A.setupLightsView(G),ut===!0&&ge.setGlobalState(L.clippingPlanes,G),B&&oe.viewport($.copy(B)),k.length>0&&Ur(k,F,G),ue.length>0&&Ur(ue,F,G),be.length>0&&Ur(be,F,G),oe.buffers.depth.setTest(!0),oe.buffers.depth.setMask(!0),oe.buffers.color.setMask(!0),oe.setPolygonOffset(!1)}function rh(v,F,G,B){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(A.state.transmissionRenderTarget[B.id]===void 0){let Te=qe.has("EXT_color_buffer_half_float")||qe.has("EXT_color_buffer_float");A.state.transmissionRenderTarget[B.id]=new Qt(1,1,{generateMipmaps:!0,type:Te?Un:jt,minFilter:yn,samples:Math.max(4,ot.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ze.workingColorSpace})}let ue=A.state.transmissionRenderTarget[B.id],be=B.viewport||$;ue.setSize(be.z*L.transmissionResolutionScale,be.w*L.transmissionResolutionScale);let he=L.getRenderTarget(),ve=L.getActiveCubeFace(),Me=L.getActiveMipmapLevel();L.setRenderTarget(ue),L.getClearColor(xe),Se=L.getClearAlpha(),Se<1&&L.setClearColor(16777215,.5),L.clear(),dt&&te.render(G);let Fe=L.toneMapping;L.toneMapping=vn;let ke=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),A.setupLightsView(B),ut===!0&&ge.setGlobalState(L.clippingPlanes,B),Ur(v,G,B),b.updateMultisampleRenderTarget(ue),b.updateRenderTargetMipmap(ue),qe.has("WEBGL_multisampled_render_to_texture")===!1){let Te=!1;for(let et=0,gt=F.length;et<gt;et++){let pt=F[et],{object:st,geometry:Ft,material:me,group:Jt}=pt;if(me.side===ln&&st.layers.test(B.layers)){let je=me.side;me.side=Lt,me.needsUpdate=!0,ah(st,G,B,Ft,me,Jt),me.side=je,me.needsUpdate=!0,Te=!0}}Te===!0&&(b.updateMultisampleRenderTarget(ue),b.updateRenderTargetMipmap(ue))}L.setRenderTarget(he,ve,Me),L.setClearColor(xe,Se),ke!==void 0&&(B.viewport=ke),L.toneMapping=Fe}function Ur(v,F,G){let B=F.isScene===!0?F.overrideMaterial:null;for(let k=0,ue=v.length;k<ue;k++){let be=v[k],{object:he,geometry:ve,group:Me}=be,Fe=be.material;Fe.allowOverride===!0&&B!==null&&(Fe=B),he.layers.test(G.layers)&&ah(he,F,G,ve,Fe,Me)}}function ah(v,F,G,B,k,ue){v.onBeforeRender(L,F,G,B,k,ue),v.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),k.onBeforeRender(L,F,G,B,v,ue),k.transparent===!0&&k.side===ln&&k.forceSinglePass===!1?(k.side=Lt,k.needsUpdate=!0,L.renderBufferDirect(G,F,B,k,v,ue),k.side=_n,k.needsUpdate=!0,L.renderBufferDirect(G,F,B,k,v,ue),k.side=ln):L.renderBufferDirect(G,F,B,k,v,ue),v.onAfterRender(L,F,G,B,k,ue)}function Or(v,F,G){F.isScene!==!0&&(F=At);let B=T.get(v),k=A.state.lights,ue=A.state.shadowsArray,be=k.state.version,he=ae.getParameters(v,k.state,ue,F,G,A.state.lightProbeGridArray),ve=ae.getProgramCacheKey(he),Me=B.programs;B.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?F.environment:null,B.fog=F.fog;let Fe=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;B.envMap=U.get(v.envMap||B.environment,Fe),B.envMapRotation=B.environment!==null&&v.envMap===null?F.environmentRotation:v.envMapRotation,Me===void 0&&(v.addEventListener("dispose",mt),Me=new Map,B.programs=Me);let ke=Me.get(ve);if(ke!==void 0){if(B.currentProgram===ke&&B.lightsStateVersion===be)return ch(v,he),ke}else he.uniforms=ae.getUniforms(v),O!==null&&v.isNodeMaterial&&O.build(v,G,he),v.onBeforeCompile(he,L),ke=ae.acquireProgram(he,ve),Me.set(ve,ke),B.uniforms=he.uniforms;let Te=B.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Te.clippingPlanes=ge.uniform),ch(v,he),B.needsLights=Rd(v),B.lightsStateVersion=be,B.needsLights&&(Te.ambientLightColor.value=k.state.ambient,Te.lightProbe.value=k.state.probe,Te.directionalLights.value=k.state.directional,Te.directionalLightShadows.value=k.state.directionalShadow,Te.spotLights.value=k.state.spot,Te.spotLightShadows.value=k.state.spotShadow,Te.rectAreaLights.value=k.state.rectArea,Te.ltc_1.value=k.state.rectAreaLTC1,Te.ltc_2.value=k.state.rectAreaLTC2,Te.pointLights.value=k.state.point,Te.pointLightShadows.value=k.state.pointShadow,Te.hemisphereLights.value=k.state.hemi,Te.directionalShadowMatrix.value=k.state.directionalShadowMatrix,Te.spotLightMatrix.value=k.state.spotLightMatrix,Te.spotLightMap.value=k.state.spotLightMap,Te.pointShadowMatrix.value=k.state.pointShadowMatrix),B.lightProbeGrid=A.state.lightProbeGridArray.length>0,B.currentProgram=ke,B.uniformsList=null,ke}function oh(v){if(v.uniformsList===null){let F=v.currentProgram.getUniforms();v.uniformsList=Ds.seqWithValue(F.seq,v.uniforms)}return v.uniformsList}function ch(v,F){let G=T.get(v);G.outputColorSpace=F.outputColorSpace,G.batching=F.batching,G.batchingColor=F.batchingColor,G.instancing=F.instancing,G.instancingColor=F.instancingColor,G.instancingMorph=F.instancingMorph,G.skinning=F.skinning,G.morphTargets=F.morphTargets,G.morphNormals=F.morphNormals,G.morphColors=F.morphColors,G.morphTargetsCount=F.morphTargetsCount,G.numClippingPlanes=F.numClippingPlanes,G.numIntersection=F.numClipIntersection,G.vertexAlphas=F.vertexAlphas,G.vertexTangents=F.vertexTangents,G.toneMapping=F.toneMapping}function Ad(v,F){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(F.matrixWorld);for(let G=0,B=v.length;G<B;G++){let k=v[G];if(k.texture!==null&&k.boundingBox.containsPoint(M))return k}return null}function wd(v,F,G,B,k){F.isScene!==!0&&(F=At),b.resetTextureUnits();let ue=F.fog,be=B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial?F.environment:null,he=N===null?L.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:ze.workingColorSpace,ve=B.isMeshStandardMaterial||B.isMeshLambertMaterial&&!B.envMap||B.isMeshPhongMaterial&&!B.envMap,Me=U.get(B.envMap||be,ve),Fe=B.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,ke=!!G.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),Te=!!G.morphAttributes.position,et=!!G.morphAttributes.normal,gt=!!G.morphAttributes.color,pt=vn;B.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(pt=L.toneMapping);let st=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,Ft=st!==void 0?st.length:0,me=T.get(B),Jt=A.state.lights;if(ut===!0&&(We===!0||v!==V)){let ct=v===V&&B.id===z;ge.setState(B,v,ct)}let je=!1;B.version===me.__version?(me.needsLights&&me.lightsStateVersion!==Jt.state.version||me.outputColorSpace!==he||k.isBatchedMesh&&me.batching===!1||!k.isBatchedMesh&&me.batching===!0||k.isBatchedMesh&&me.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&me.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&me.instancing===!1||!k.isInstancedMesh&&me.instancing===!0||k.isSkinnedMesh&&me.skinning===!1||!k.isSkinnedMesh&&me.skinning===!0||k.isInstancedMesh&&me.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&me.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&me.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&me.instancingMorph===!1&&k.morphTexture!==null||me.envMap!==Me||B.fog===!0&&me.fog!==ue||me.numClippingPlanes!==void 0&&(me.numClippingPlanes!==ge.numPlanes||me.numIntersection!==ge.numIntersection)||me.vertexAlphas!==Fe||me.vertexTangents!==ke||me.morphTargets!==Te||me.morphNormals!==et||me.morphColors!==gt||me.toneMapping!==pt||me.morphTargetsCount!==Ft||!!me.lightProbeGrid!=A.state.lightProbeGridArray.length>0)&&(je=!0):(je=!0,me.__version=B.version);let sn=me.currentProgram;je===!0&&(sn=Or(B,F,k),O&&B.isNodeMaterial&&O.onUpdateProgram(B,sn,me));let Tn=!1,ei=!1,Ki=!1,rt=sn.getUniforms(),bt=me.uniforms;if(oe.useProgram(sn.program)&&(Tn=!0,ei=!0,Ki=!0),B.id!==z&&(z=B.id,ei=!0),me.needsLights){let ct=Ad(A.state.lightProbeGridArray,k);me.lightProbeGrid!==ct&&(me.lightProbeGrid=ct,ei=!0)}if(Tn||V!==v){oe.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),rt.setValue(I,"projectionMatrix",v.projectionMatrix),rt.setValue(I,"viewMatrix",v.matrixWorldInverse);let ni=rt.map.cameraPosition;ni!==void 0&&ni.setValue(I,ht.setFromMatrixPosition(v.matrixWorld)),ot.logarithmicDepthBuffer&&rt.setValue(I,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&rt.setValue(I,"isOrthographic",v.isOrthographicCamera===!0),V!==v&&(V=v,ei=!0,Ki=!0)}if(me.needsLights&&(Jt.state.directionalShadowMap.length>0&&rt.setValue(I,"directionalShadowMap",Jt.state.directionalShadowMap,b),Jt.state.spotShadowMap.length>0&&rt.setValue(I,"spotShadowMap",Jt.state.spotShadowMap,b),Jt.state.pointShadowMap.length>0&&rt.setValue(I,"pointShadowMap",Jt.state.pointShadowMap,b)),k.isSkinnedMesh){rt.setOptional(I,k,"bindMatrix"),rt.setOptional(I,k,"bindMatrixInverse");let ct=k.skeleton;ct&&(ct.boneTexture===null&&ct.computeBoneTexture(),rt.setValue(I,"boneTexture",ct.boneTexture,b))}k.isBatchedMesh&&(rt.setOptional(I,k,"batchingTexture"),rt.setValue(I,"batchingTexture",k._matricesTexture,b),rt.setOptional(I,k,"batchingIdTexture"),rt.setValue(I,"batchingIdTexture",k._indirectTexture,b),rt.setOptional(I,k,"batchingColorTexture"),k._colorsTexture!==null&&rt.setValue(I,"batchingColorTexture",k._colorsTexture,b));let ti=G.morphAttributes;if((ti.position!==void 0||ti.normal!==void 0||ti.color!==void 0)&&Pe.update(k,G,sn),(ei||me.receiveShadow!==k.receiveShadow)&&(me.receiveShadow=k.receiveShadow,rt.setValue(I,"receiveShadow",k.receiveShadow)),(B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial)&&B.envMap===null&&F.environment!==null&&(bt.envMapIntensity.value=F.environmentIntensity),bt.dfgLUT!==void 0&&(bt.dfgLUT.value=y0()),ei){if(rt.setValue(I,"toneMappingExposure",L.toneMappingExposure),me.needsLights&&Ed(bt,Ki),ue&&B.fog===!0&&W.refreshFogUniforms(bt,ue),W.refreshMaterialUniforms(bt,B,Ne,Ze,A.state.transmissionRenderTarget[v.id]),me.needsLights&&me.lightProbeGrid){let ct=me.lightProbeGrid;bt.probesSH.value=ct.texture,bt.probesMin.value.copy(ct.boundingBox.min),bt.probesMax.value.copy(ct.boundingBox.max),bt.probesResolution.value.copy(ct.resolution)}Ds.upload(I,oh(me),bt,b)}if(B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(Ds.upload(I,oh(me),bt,b),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&rt.setValue(I,"center",k.center),rt.setValue(I,"modelViewMatrix",k.modelViewMatrix),rt.setValue(I,"normalMatrix",k.normalMatrix),rt.setValue(I,"modelMatrix",k.matrixWorld),B.uniformsGroups!==void 0){let ct=B.uniformsGroups;for(let ni=0,Yi=ct.length;ni<Yi;ni++){let lh=ct[ni];X.update(lh,sn),X.bind(lh,sn)}}return sn}function Ed(v,F){v.ambientLightColor.needsUpdate=F,v.lightProbe.needsUpdate=F,v.directionalLights.needsUpdate=F,v.directionalLightShadows.needsUpdate=F,v.pointLights.needsUpdate=F,v.pointLightShadows.needsUpdate=F,v.spotLights.needsUpdate=F,v.spotLightShadows.needsUpdate=F,v.rectAreaLights.needsUpdate=F,v.hemisphereLights.needsUpdate=F}function Rd(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return q},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(v,F,G){let B=T.get(v);B.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,B.__autoAllocateDepthBuffer===!1&&(B.__useRenderToTexture=!1),T.get(v.texture).__webglTexture=F,T.get(v.depthTexture).__webglTexture=B.__autoAllocateDepthBuffer?void 0:G,B.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,F){let G=T.get(v);G.__webglFramebuffer=F,G.__useDefaultFramebuffer=F===void 0};let Cd=I.createFramebuffer();this.setRenderTarget=function(v,F=0,G=0){N=v,H=F,q=G;let B=null,k=!1,ue=!1;if(v){let he=T.get(v);if(he.__useDefaultFramebuffer!==void 0){oe.bindFramebuffer(I.FRAMEBUFFER,he.__webglFramebuffer),$.copy(v.viewport),Q.copy(v.scissor),le=v.scissorTest,oe.viewport($),oe.scissor(Q),oe.setScissorTest(le),z=-1;return}else if(he.__webglFramebuffer===void 0)b.setupRenderTarget(v);else if(he.__hasExternalTextures)b.rebindTextures(v,T.get(v.texture).__webglTexture,T.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){let Fe=v.depthTexture;if(he.__boundDepthTexture!==Fe){if(Fe!==null&&T.has(Fe)&&(v.width!==Fe.image.width||v.height!==Fe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");b.setupDepthRenderbuffer(v)}}let ve=v.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(ue=!0);let Me=T.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Me[F])?B=Me[F][G]:B=Me[F],k=!0):v.samples>0&&b.useMultisampledRTT(v)===!1?B=T.get(v).__webglMultisampledFramebuffer:Array.isArray(Me)?B=Me[G]:B=Me,$.copy(v.viewport),Q.copy(v.scissor),le=v.scissorTest}else $.copy(ie).multiplyScalar(Ne).floor(),Q.copy(Ee).multiplyScalar(Ne).floor(),le=De;if(G!==0&&(B=Cd),oe.bindFramebuffer(I.FRAMEBUFFER,B)&&oe.drawBuffers(v,B),oe.viewport($),oe.scissor(Q),oe.setScissorTest(le),k){let he=T.get(v.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+F,he.__webglTexture,G)}else if(ue){let he=F;for(let ve=0;ve<v.textures.length;ve++){let Me=T.get(v.textures[ve]);I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0+ve,Me.__webglTexture,G,he)}}else if(v!==null&&G!==0){let he=T.get(v.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,he.__webglTexture,G)}z=-1},this.readRenderTargetPixels=function(v,F,G,B,k,ue,be,he=0){if(!(v&&v.isWebGLRenderTarget)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ve=T.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&be!==void 0&&(ve=ve[be]),ve){oe.bindFramebuffer(I.FRAMEBUFFER,ve);try{let Me=v.textures[he],Fe=Me.format,ke=Me.type;if(v.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+he),!ot.textureFormatReadable(Fe)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ot.textureTypeReadable(ke)){we("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=v.width-B&&G>=0&&G<=v.height-k&&I.readPixels(F,G,B,k,P.convert(Fe),P.convert(ke),ue)}finally{let Me=N!==null?T.get(N).__webglFramebuffer:null;oe.bindFramebuffer(I.FRAMEBUFFER,Me)}}},this.readRenderTargetPixelsAsync=async function(v,F,G,B,k,ue,be,he=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ve=T.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&be!==void 0&&(ve=ve[be]),ve)if(F>=0&&F<=v.width-B&&G>=0&&G<=v.height-k){oe.bindFramebuffer(I.FRAMEBUFFER,ve);let Me=v.textures[he],Fe=Me.format,ke=Me.type;if(v.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+he),!ot.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ot.textureTypeReadable(ke))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Te=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,Te),I.bufferData(I.PIXEL_PACK_BUFFER,ue.byteLength,I.STREAM_READ),I.readPixels(F,G,B,k,P.convert(Fe),P.convert(ke),0);let et=N!==null?T.get(N).__webglFramebuffer:null;oe.bindFramebuffer(I.FRAMEBUFFER,et);let gt=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await Cu(I,gt,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,Te),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,ue),I.deleteBuffer(Te),I.deleteSync(gt),ue}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,F=null,G=0){let B=Math.pow(2,-G),k=Math.floor(v.image.width*B),ue=Math.floor(v.image.height*B),be=F!==null?F.x:0,he=F!==null?F.y:0;b.setTexture2D(v,0),I.copyTexSubImage2D(I.TEXTURE_2D,G,0,0,be,he,k,ue),oe.unbindTexture()};let Pd=I.createFramebuffer(),Id=I.createFramebuffer();this.copyTextureToTexture=function(v,F,G=null,B=null,k=0,ue=0){let be,he,ve,Me,Fe,ke,Te,et,gt,pt=v.isCompressedTexture?v.mipmaps[ue]:v.image;if(G!==null)be=G.max.x-G.min.x,he=G.max.y-G.min.y,ve=G.isBox3?G.max.z-G.min.z:1,Me=G.min.x,Fe=G.min.y,ke=G.isBox3?G.min.z:0;else{let bt=Math.pow(2,-k);be=Math.floor(pt.width*bt),he=Math.floor(pt.height*bt),v.isDataArrayTexture?ve=pt.depth:v.isData3DTexture?ve=Math.floor(pt.depth*bt):ve=1,Me=0,Fe=0,ke=0}B!==null?(Te=B.x,et=B.y,gt=B.z):(Te=0,et=0,gt=0);let st=P.convert(F.format),Ft=P.convert(F.type),me;F.isData3DTexture?(b.setTexture3D(F,0),me=I.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?(b.setTexture2DArray(F,0),me=I.TEXTURE_2D_ARRAY):(b.setTexture2D(F,0),me=I.TEXTURE_2D),oe.activeTexture(I.TEXTURE0),oe.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,F.flipY),oe.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),oe.pixelStorei(I.UNPACK_ALIGNMENT,F.unpackAlignment);let Jt=oe.getParameter(I.UNPACK_ROW_LENGTH),je=oe.getParameter(I.UNPACK_IMAGE_HEIGHT),sn=oe.getParameter(I.UNPACK_SKIP_PIXELS),Tn=oe.getParameter(I.UNPACK_SKIP_ROWS),ei=oe.getParameter(I.UNPACK_SKIP_IMAGES);oe.pixelStorei(I.UNPACK_ROW_LENGTH,pt.width),oe.pixelStorei(I.UNPACK_IMAGE_HEIGHT,pt.height),oe.pixelStorei(I.UNPACK_SKIP_PIXELS,Me),oe.pixelStorei(I.UNPACK_SKIP_ROWS,Fe),oe.pixelStorei(I.UNPACK_SKIP_IMAGES,ke);let Ki=v.isDataArrayTexture||v.isData3DTexture,rt=F.isDataArrayTexture||F.isData3DTexture;if(v.isDepthTexture){let bt=T.get(v),ti=T.get(F),ct=T.get(bt.__renderTarget),ni=T.get(ti.__renderTarget);oe.bindFramebuffer(I.READ_FRAMEBUFFER,ct.__webglFramebuffer),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,ni.__webglFramebuffer);for(let Yi=0;Yi<ve;Yi++)Ki&&(I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,T.get(v).__webglTexture,k,ke+Yi),I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,T.get(F).__webglTexture,ue,gt+Yi)),I.blitFramebuffer(Me,Fe,be,he,Te,et,be,he,I.DEPTH_BUFFER_BIT,I.NEAREST);oe.bindFramebuffer(I.READ_FRAMEBUFFER,null),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else if(k!==0||v.isRenderTargetTexture||T.has(v)){let bt=T.get(v),ti=T.get(F);oe.bindFramebuffer(I.READ_FRAMEBUFFER,Pd),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,Id);for(let ct=0;ct<ve;ct++)Ki?I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,bt.__webglTexture,k,ke+ct):I.framebufferTexture2D(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,bt.__webglTexture,k),rt?I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,ti.__webglTexture,ue,gt+ct):I.framebufferTexture2D(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,ti.__webglTexture,ue),k!==0?I.blitFramebuffer(Me,Fe,be,he,Te,et,be,he,I.COLOR_BUFFER_BIT,I.NEAREST):rt?I.copyTexSubImage3D(me,ue,Te,et,gt+ct,Me,Fe,be,he):I.copyTexSubImage2D(me,ue,Te,et,Me,Fe,be,he);oe.bindFramebuffer(I.READ_FRAMEBUFFER,null),oe.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else rt?v.isDataTexture||v.isData3DTexture?I.texSubImage3D(me,ue,Te,et,gt,be,he,ve,st,Ft,pt.data):F.isCompressedArrayTexture?I.compressedTexSubImage3D(me,ue,Te,et,gt,be,he,ve,st,pt.data):I.texSubImage3D(me,ue,Te,et,gt,be,he,ve,st,Ft,pt):v.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,ue,Te,et,be,he,st,Ft,pt.data):v.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,ue,Te,et,pt.width,pt.height,st,pt.data):I.texSubImage2D(I.TEXTURE_2D,ue,Te,et,be,he,st,Ft,pt);oe.pixelStorei(I.UNPACK_ROW_LENGTH,Jt),oe.pixelStorei(I.UNPACK_IMAGE_HEIGHT,je),oe.pixelStorei(I.UNPACK_SKIP_PIXELS,sn),oe.pixelStorei(I.UNPACK_SKIP_ROWS,Tn),oe.pixelStorei(I.UNPACK_SKIP_IMAGES,ei),ue===0&&F.generateMipmaps&&I.generateMipmap(me),oe.unbindTexture()},this.initRenderTarget=function(v){T.get(v).__webglFramebuffer===void 0&&b.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?b.setTextureCube(v,0):v.isData3DTexture?b.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?b.setTexture2DArray(v,0):b.setTexture2D(v,0),oe.unbindTexture()},this.resetState=function(){H=0,q=0,N=null,oe.reset(),ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return mn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ze._getDrawingBufferColorSpace(e),t.unpackColorSpace=ze._getUnpackColorSpace()}};var hd={type:"change"},Ml={type:"start"},dd={type:"end"},zo=new Kn,ud=new an,S0=Math.cos(70*Ir.DEG2RAD),Pt=new D,Kt=2*Math.PI,it={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},yl=1e-6,Go=class extends xr{constructor(e,t=null){super(e,t),this.state=it.NONE,this.target=new D,this.cursor=new D,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:mi.ROTATE,MIDDLE:mi.DOLLY,RIGHT:mi.PAN},this.touches={ONE:gi.ROTATE,TWO:gi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new D,this._lastQuaternion=new Et,this._lastTargetPosition=new D,this._quat=new Et().setFromUnitVectors(e.up,new D(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new As,this._sphericalDelta=new As,this._scale=1,this._panOffset=new D,this._rotateStart=new Re,this._rotateEnd=new Re,this._rotateDelta=new Re,this._panStart=new Re,this._panEnd=new Re,this._panDelta=new Re,this._dollyStart=new Re,this._dollyEnd=new Re,this._dollyDelta=new Re,this._dollyDirection=new D,this._mouse=new Re,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=A0.bind(this),this._onPointerDown=T0.bind(this),this._onPointerUp=w0.bind(this),this._onContextMenu=L0.bind(this),this._onMouseWheel=C0.bind(this),this._onKeyDown=P0.bind(this),this._onTouchStart=I0.bind(this),this._onTouchMove=D0.bind(this),this._onMouseDown=E0.bind(this),this._onMouseMove=R0.bind(this),this._interceptControlDown=F0.bind(this),this._interceptControlUp=N0.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(hd),this.update(),this.state=it.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;Pt.copy(t).sub(this.target),Pt.applyQuaternion(this._quat),this._spherical.setFromVector3(Pt),this.autoRotate&&this.state===it.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=Kt:n>Math.PI&&(n-=Kt),i<-Math.PI?i+=Kt:i>Math.PI&&(i-=Kt),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(Pt.setFromSpherical(this._spherical),Pt.applyQuaternion(this._quatInverse),t.copy(this.target).add(Pt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){let o=Pt.length();a=this._clampDistance(o*this._scale);let c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){let o=new D(this._mouse.x,this._mouse.y,0);o.unproject(this.object);let c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;let l=new D(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=Pt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(zo.origin.copy(this.object.position),zo.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(zo.direction))<S0?this.object.lookAt(this.target):(ud.setFromNormalAndCoplanarPoint(this.object.up,this.target),zo.intersectPlane(ud,this.target))))}else if(this.object.isOrthographicCamera){let a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>yl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>yl||this._lastTargetPosition.distanceToSquared(this.target)>yl?(this.dispatchEvent(hd),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Kt/60*this.autoRotateSpeed*e:Kt/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Pt.setFromMatrixColumn(t,0),Pt.multiplyScalar(-e),this._panOffset.add(Pt)}_panUp(e,t){this.screenSpacePanning===!0?Pt.setFromMatrixColumn(t,1):(Pt.setFromMatrixColumn(t,0),Pt.crossVectors(this.object.up,Pt)),Pt.multiplyScalar(e),this._panOffset.add(Pt)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let i=this.object.position;Pt.copy(i).sub(this.target);let r=Pt.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,a=n.width,o=n.height;this._mouse.x=i/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Kt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Kt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Kt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Kt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Kt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Kt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Kt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Kt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Re,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function T0(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(s)&&(this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function A0(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function w0(s){switch(this._removePointer(s),this._pointers.length){case 0:this.domElement.releasePointerCapture(s.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(dd),this.state=it.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function E0(s){let e;switch(s.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case mi.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(s),this.state=it.DOLLY;break;case mi.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=it.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=it.ROTATE}break;case mi.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=it.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=it.PAN}break;default:this.state=it.NONE}this.state!==it.NONE&&this.dispatchEvent(Ml)}function R0(s){switch(this.state){case it.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(s);break;case it.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(s);break;case it.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(s);break}}function C0(s){this.enabled===!1||this.enableZoom===!1||this.state!==it.NONE||(s.preventDefault(),this.dispatchEvent(Ml),this._handleMouseWheel(this._customWheelEvent(s)),this.dispatchEvent(dd))}function P0(s){this.enabled!==!1&&this._handleKeyDown(s)}function I0(s){switch(this._trackPointer(s),this._pointers.length){case 1:switch(this.touches.ONE){case gi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(s),this.state=it.TOUCH_ROTATE;break;case gi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(s),this.state=it.TOUCH_PAN;break;default:this.state=it.NONE}break;case 2:switch(this.touches.TWO){case gi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(s),this.state=it.TOUCH_DOLLY_PAN;break;case gi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(s),this.state=it.TOUCH_DOLLY_ROTATE;break;default:this.state=it.NONE}break;default:this.state=it.NONE}this.state!==it.NONE&&this.dispatchEvent(Ml)}function D0(s){switch(this._trackPointer(s),this.state){case it.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(s),this.update();break;case it.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(s),this.update();break;case it.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(s),this.update();break;case it.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(s),this.update();break;default:this.state=it.NONE}}function L0(s){this.enabled!==!1&&s.preventDefault()}function F0(s){s.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function N0(s){s.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Sl(s,e){if(e===Kc)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===Ps||e===Cr){let t=s.getIndex();if(t===null){let a=[],o=s.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);s.setIndex(a),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}let n=t.count-2,i=[];if(e===Ps)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let r=s.clone();return r.setIndex(i),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}function fd(s){let e=new Map,t=new Map,n=s.clone();return pd(s,n,function(i,r){e.set(r,i),t.set(i,r)}),n.traverse(function(i){if(!i.isSkinnedMesh)return;let r=i,a=e.get(i),o=a.skeleton.bones;r.skeleton=a.skeleton.clone(),r.bindMatrix.copy(a.bindMatrix),r.skeleton.bones=o.map(function(c){return t.get(c)}),r.bind(r.skeleton,r.bindMatrix)}),n}function pd(s,e,t){t(s,e);for(let n=0;n<s.children.length;n++)pd(s.children[n],e.children[n],t)}var Vo=class extends Fn{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Pl(t)}),this.register(function(t){return new Il(t)}),this.register(function(t){return new zl(t)}),this.register(function(t){return new Gl(t)}),this.register(function(t){return new Vl(t)}),this.register(function(t){return new Ll(t)}),this.register(function(t){return new Fl(t)}),this.register(function(t){return new Nl(t)}),this.register(function(t){return new Ul(t)}),this.register(function(t){return new Cl(t)}),this.register(function(t){return new Ol(t)}),this.register(function(t){return new Dl(t)}),this.register(function(t){return new kl(t)}),this.register(function(t){return new Bl(t)}),this.register(function(t){return new El(t)}),this.register(function(t){return new Ho(t,Ve.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new Ho(t,Ve.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Hl(t)})}load(e,t,n,i){let r=this,a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){let l=$n.extractUrlBase(e);a=$n.resolveURL(l,this.path)}else a=$n.extractUrlBase(e);this.manager.itemStart(e);let o=function(l){i?i(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new Ts(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{r.parse(l,a,function(h){t(h),r.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r,a={},o={},c=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===xd){try{a[Ve.KHR_BINARY_GLTF]=new Wl(e)}catch(u){i&&i(u);return}r=JSON.parse(a[Ve.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new Zl(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){let u=this.pluginCallbacks[h](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){let u=r.extensionsUsed[h],d=r.extensionsRequired||[];switch(u){case Ve.KHR_MATERIALS_UNLIT:a[u]=new Rl;break;case Ve.KHR_DRACO_MESH_COMPRESSION:a[u]=new ql(r,this.dracoLoader);break;case Ve.KHR_TEXTURE_TRANSFORM:a[u]=new Xl;break;case Ve.KHR_MESH_QUANTIZATION:a[u]=new jl;break;default:d.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}};function U0(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}function yt(s,e,t){let n=s.json.materials[e];return n.extensions&&n.extensions[t]?n.extensions[t]:null}var Ve={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},El=class{constructor(e){this.parser=e,this.name=Ve.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],l,h=new Ae(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],Gt);let u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new Vi(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new Gi(h),l.distance=u;break;case"spot":l=new mr(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),kn(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(c){return n._getNodeRef(t.cache,o,c)})}},Rl=class{constructor(){this.name=Ve.KHR_MATERIALS_UNLIT}getMaterialType(){return xn}extendParams(e,t,n){let i=[];e.color=new Ae(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let a=r.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Gt),e.opacity=a[3]}r.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",r.baseColorTexture,_t))}return Promise.all(i)}},Cl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},Pl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Re(r,r)}return Promise.all(i)}},Il=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_DISPERSION}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}},Dl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(i)}},Ll=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_SHEEN}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Ae(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],Gt)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,_t)),n.sheenRoughnessTexture!==void 0&&i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(i)}},Fl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture)),Promise.all(i)}},Nl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_VOLUME}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new Ae().setRGB(r[0],r[1],r[2],Gt),Promise.all(i)}},Ul=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_IOR}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);return n===null||(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}},Ol=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_SPECULAR}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];return t.specularColor=new Ae().setRGB(r[0],r[1],r[2],Gt),n.specularColorTexture!==void 0&&i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,_t)),Promise.all(i)}},Bl=class{constructor(e){this.parser=e,this.name=Ve.EXT_MATERIALS_BUMP}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture)),Promise.all(i)}},kl=class{constructor(e){this.parser=e,this.name=Ve.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return yt(this.parser,e,this.name)!==null?qt:null}extendMaterialParams(e,t){let n=yt(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture)),Promise.all(i)}},zl=class{constructor(e){this.parser=e,this.name=Ve.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}},Gl=class{constructor(e){this.parser=e,this.name=Ve.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],o=i.images[a.source],c=n.textureLoader;if(o.uri){let l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}},Vl=class{constructor(e){this.parser=e,this.name=Ve.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],o=i.images[a.source],c=n.textureLoader;if(o.uri){let l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}},Ho=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(o){let c=i.byteOffset||0,l=i.byteLength||0,h=i.count,u=i.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,d,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){let f=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(f),h,u,d,i.mode,i.filter),f})})}else return null}},Hl=class{constructor(e){this.name=Ve.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let l of i.primitives)if(l.mode!==hn.TRIANGLES&&l.mode!==hn.TRIANGLE_STRIP&&l.mode!==hn.TRIANGLE_FAN&&l.mode!==void 0)return null;let a=n.extensions[this.name].attributes,o=[],c={};for(let l in a)o.push(this.parser.getDependency("accessor",a[l]).then(h=>(c[l]=h,c[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{let h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,f=[];for(let g of u){let y=new Oe,m=new D,p=new Et,x=new D(1,1,1),S=new Ui(g.geometry,g.material,d);for(let M=0;M<d;M++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,M),c.ROTATION&&p.fromBufferAttribute(c.ROTATION,M),c.SCALE&&x.fromBufferAttribute(c.SCALE,M),S.setMatrixAt(M,y.compose(m,p,x));for(let M in c)if(M==="_COLOR_0"){let E=c[M];S.instanceColor=new di(E.array,E.itemSize,E.normalized)}else M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE"&&g.geometry.setAttribute(M,c[M]);lt.prototype.copy.call(S,g),this.parser.assignFinalMaterial(S),f.push(S)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}},xd="glTF",Nr=12,md={JSON:1313821514,BIN:5130562},Wl=class{constructor(e){this.name=Ve.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,Nr),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==xd)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-Nr,r=new DataView(e,Nr),a=0;for(;a<i;){let o=r.getUint32(a,!0);a+=4;let c=r.getUint32(a,!0);if(a+=4,c===md.JSON){let l=new Uint8Array(e,Nr+a,o);this.content=n.decode(l)}else if(c===md.BIN){let l=Nr+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},ql=class{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ve.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(let h in a){let u=Yl[h]||h.toLowerCase();o[u]=a[h]}for(let h in e.attributes){let u=Yl[h]||h.toLowerCase();if(a[h]!==void 0){let d=n.accessors[e.attributes[h]],f=Ns[d.componentType];l[u]=f.name,c[u]=d.normalized===!0}}return t.getDependency("bufferView",r).then(function(h){return new Promise(function(u,d){i.decodeDracoFile(h,function(f){for(let g in f.attributes){let y=f.attributes[g],m=c[g];m!==void 0&&(y.normalized=m)}u(f)},o,l,Gt,d)})})}},Xl=class{constructor(){this.name=Ve.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}},jl=class{constructor(){this.name=Ve.KHR_MESH_QUANTIZATION}},Wo=class extends Pn{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[r+a];return t}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,h=i-t,u=(n-t)/h,d=u*u,f=d*u,g=e*l,y=g-l,m=-2*f+3*d,p=f-d,x=1-m,S=p-d+u;for(let M=0;M!==o;M++){let E=a[y+M+o],A=a[y+M+c]*h,C=a[g+M+o],_=a[g+M]*h;r[M]=x*E+S*A+m*C+p*_}return r}},O0=new Et,Kl=class extends Wo{interpolate_(e,t,n,i){let r=super.interpolate_(e,t,n,i);return O0.fromArray(r).normalize().toArray(r),r}},hn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ns={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},gd={9728:xt,9729:vt,9984:Xa,9985:Es,9986:Wi,9987:yn},bd={33071:on,33648:us,10497:ui},Tl={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Yl={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},yi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},B0={CUBICSPLINE:void 0,LINEAR:Li,STEP:Di},Al={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function k0(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new Cn({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:_n})),s.DefaultMaterial}function ji(s,e,t){for(let n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function kn(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function z0(s,e,t){let n=!1,i=!1,r=!1;for(let l=0,h=e.length;l<h;l++){let u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(s);let a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){let u=e[l];if(n){let d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):s.attributes.position;a.push(d)}if(i){let d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):s.attributes.normal;o.push(d)}if(r){let d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):s.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){let h=l[0],u=l[1],d=l[2];return n&&(s.morphAttributes.position=h),i&&(s.morphAttributes.normal=u),r&&(s.morphAttributes.color=d),s.morphTargetsRelative=!0,s})}function G0(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function V0(s){let e,t=s.extensions&&s.extensions[Ve.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+wl(t.attributes):e=s.indices+":"+wl(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+wl(s.targets[n]);return e}function wl(s){let e="",t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function Jl(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function H0(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":s.search(/\.ktx2($|\?)/i)>0||s.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var W0=new Oe,Zl=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new U0,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,a=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;let c=o.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,r=o.indexOf("Firefox")>-1,a=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||r&&a<98?this.textureLoader=new ur(this.options.manager):this.textureLoader=new gr(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ts(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){let o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return ji(r,o,i),kn(o,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){for(let c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let a=t[i].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){let a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),r=(a,o)=>{let c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(let[l,h]of a.children.entries())r(h,o.children[l])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Ve.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(r,a){n.load($n.resolveURL(t.uri,i.path),r,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let a=Tl[i.type],o=Ns[i.componentType],c=i.normalized===!0,l=new o(i.count*a);return Promise.resolve(new Tt(l,a,c))}let r=[];return i.bufferView!==void 0?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),i.sparse!==void 0&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(a){let o=a[0],c=Tl[i.type],l=Ns[i.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,g=i.normalized===!0,y,m;if(f&&f!==u){let p=Math.floor(d/f),x="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,S=t.cache.get(x);S||(y=new l(o,p*f,i.count*f/h),S=new bs(y,f/h),t.cache.add(x,S)),m=new _s(S,c,d%f/h,g)}else o===null?y=new l(i.count*c):y=new l(o,d,i.count*c),m=new Tt(y,c,g);if(i.sparse!==void 0){let p=Tl.SCALAR,x=Ns[i.sparse.indices.componentType],S=i.sparse.indices.byteOffset||0,M=i.sparse.values.byteOffset||0,E=new x(a[1],S,i.sparse.count*p),A=new l(a[2],M,i.sparse.count*c);o!==null&&(m=new Tt(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let C=0,_=E.length;C<_;C++){let w=E[C];if(m.setX(w,A[C*c]),c>=2&&m.setY(w,A[C*c+1]),c>=3&&m.setZ(w,A[C*c+2]),c>=4&&m.setW(w,A[C*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,a=t.images[r],o=this.textureLoader;if(a.uri){let c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){let i=this,r=this.json,a=r.textures[e],o=r.images[t],c=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[c])return this.textureCache[c];let l=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);let d=(r.samplers||{})[a.sampler]||{};return h.magFilter=gd[d.magFilter]||vt,h.minFilter=gd[d.minFilter]||yn,h.wrapS=bd[d.wrapS]||ui,h.wrapT=bd[d.wrapT]||ui,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==xt&&h.minFilter!==vt,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){let n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());let a=i.images[e],o=self.URL||self.webkitURL,c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(u){l=!0;let d=new Blob([u],{type:a.mimeType});return c=o.createObjectURL(d),c});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let h=Promise.resolve(c).then(function(u){return new Promise(function(d,f){let g=d;t.isImageBitmapLoader===!0&&(g=function(y){let m=new Dt(y);m.needsUpdate=!0,d(m)}),t.load($n.resolveURL(u,r.path),g,void 0,f)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),kn(u,a),u.userData.mimeType=a.mimeType||H0(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){let r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),r.extensions[Ve.KHR_TEXTURE_TRANSFORM]){let o=n.extensions!==void 0?n.extensions[Ve.KHR_TEXTURE_TRANSFORM]:void 0;if(o){let c=r.associations.get(a);a=r.extensions[Ve.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,c)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let o="PointsMaterial:"+n.uuid,c=this.cache.get(o);c||(c=new Ss,Ot.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(o,c)),n=c}else if(e.isLine){let o="LineBasicMaterial:"+n.uuid,c=this.cache.get(o);c||(c=new Ms,Ot.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(i||r||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),r&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let c=this.cache.get(o);c||(c=n.clone(),r&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(o,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return Cn}loadMaterial(e){let t=this,n=this.json,i=this.extensions,r=n.materials[e],a,o={},c=r.extensions||{},l=[];if(c[Ve.KHR_MATERIALS_UNLIT]){let u=i[Ve.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,r,t))}else{let u=r.pbrMetallicRoughness||{};if(o.color=new Ae(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){let d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],Gt),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,_t)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}r.doubleSided===!0&&(o.side=ln);let h=r.alphaMode||Al.OPAQUE;if(h===Al.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Al.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==xn&&(l.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Re(1,1),r.normalTexture.scale!==void 0)){let u=r.normalTexture.scale;o.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&a!==xn&&(l.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==xn){let u=r.emissiveFactor;o.emissive=new Ae().setRGB(u[0],u[1],u[2],Gt)}return r.emissiveTexture!==void 0&&a!==xn&&l.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,_t)),Promise.all(l).then(function(){let u=new a(o);return r.name&&(u.name=r.name),kn(u,r),t.associations.set(u,{materials:e}),r.extensions&&ji(i,u,r),u})}createUniqueName(e){let t=tt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[Ve.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return _d(c,o,t)})}let a=[];for(let o=0,c=e.length;o<c;o++){let l=e[o],h=V0(l),u=i[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[Ve.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=_d(new Ht,l,t),i[h]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let c=0,l=a.length;c<l;c++){let h=a[c].material===void 0?k0(this.cache):this.getDependency("material",a[c].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){let l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let f=0,g=h.length;f<g;f++){let y=h[f],m=a[f],p,x=l[f];if(m.mode===hn.TRIANGLES||m.mode===hn.TRIANGLE_STRIP||m.mode===hn.TRIANGLE_FAN||m.mode===void 0)p=r.isSkinnedMesh===!0?new er(y,x):new at(y,x),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),m.mode===hn.TRIANGLE_STRIP?p.geometry=Sl(p.geometry,Cr):m.mode===hn.TRIANGLE_FAN&&(p.geometry=Sl(p.geometry,Ps));else if(m.mode===hn.LINES)p=new nr(y,x);else if(m.mode===hn.LINE_STRIP)p=new Oi(y,x);else if(m.mode===hn.LINE_LOOP)p=new ir(y,x);else if(m.mode===hn.POINTS)p=new sr(y,x);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(p.geometry.morphAttributes).length>0&&G0(p,r),p.name=t.createUniqueName(r.name||"mesh_"+e),kn(p,r),m.extensions&&ji(i,p,m),t.assignFinalMaterial(p),u.push(p)}for(let f=0,g=u.length;f<g;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return r.extensions&&ji(i,u[0],r),u[0];let d=new gn;r.extensions&&ji(i,d,r),t.associations.set(d,{meshes:e});for(let f=0,g=u.length;f<g;f++)d.add(u[f]);return d})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new St(Ir.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new pi(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),kn(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){let r=i.pop(),a=i,o=[],c=[];for(let l=0,h=a.length;l<h;l++){let u=a[l];if(u){o.push(u);let d=new Oe;r!==null&&d.fromArray(r.array,l*16),c.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new tr(o,c)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],c=[],l=[],h=[];for(let u=0,d=i.channels.length;u<d;u++){let f=i.channels[u],g=i.samplers[f.sampler],y=f.target,m=y.node,p=i.parameters!==void 0?i.parameters[g.input]:g.input,x=i.parameters!==void 0?i.parameters[g.output]:g.output;y.node!==void 0&&(a.push(this.getDependency("node",m)),o.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",x)),l.push(g),h.push(y))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){let d=u[0],f=u[1],g=u[2],y=u[3],m=u[4],p=[];for(let S=0,M=d.length;S<M;S++){let E=d[S],A=f[S],C=g[S],_=y[S],w=m[S];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();let L=n._createAnimationTracks(E,A,C,_,w);if(L)for(let R=0;R<L.length;R++)p.push(L[R])}let x=new ki(r,void 0,p);return kn(x,i),x})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(r){let a=n._getNodeRef(n.meshCache,i.mesh,r);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=i.weights.length;c<l;c++)o.morphTargetInfluences[c]=i.weights[c]}),a})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),a=[],o=i.children||[];for(let l=0,h=o.length;l<h;l++)a.push(n.getDependency("node",o[l]));let c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(a),c]).then(function(l){let h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(d,W0)});for(let f=0,g=u.length;f<g;f++)h.add(u[f]);if(h.userData.pivot!==void 0&&u.length>0){let f=h.userData.pivot,g=u[0];h.pivot=new D().fromArray(f),h.position.x-=f[0],h.position.y-=f[1],h.position.z-=f[2],g.position.set(0,0,0),delete h.userData.pivot}return h})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),r.camera!==void 0&&o.push(i.getDependency("camera",r.camera).then(function(l){return i._getNodeRef(i.cameraCache,r.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){o.push(l)}),this.nodeCache[e]=Promise.all(o).then(function(l){let h;if(r.isBone===!0?h=new xs:l.length>1?h=new gn:l.length===1?h=l[0]:h=new lt,h!==l[0])for(let u=0,d=l.length;u<d;u++)h.add(l[u]);if(r.name&&(h.userData.name=r.name,h.name=a),kn(h,r),r.extensions&&ji(n,h,r),r.matrix!==void 0){let u=new Oe;u.fromArray(r.matrix),h.applyMatrix4(u)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);if(!i.associations.has(h))i.associations.set(h,{});else if(r.mesh!==void 0&&i.meshCache.refs[r.mesh]>1){let u=i.associations.get(h);i.associations.set(h,{...u})}return i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,r=new gn;n.name&&(r.name=i.createUniqueName(n.name)),kn(r,n),n.extensions&&ji(t,r,n);let a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(i.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let h=0,u=c.length;h<u;h++){let d=c[h];d.parent!==null?r.add(fd(d)):r.add(d)}let l=h=>{let u=new Map;for(let[d,f]of i.associations)(d instanceof Ot||d instanceof Dt)&&u.set(d,f);return h.traverse(d=>{let f=i.associations.get(d);f!=null&&u.set(d,f)}),u};return i.associations=l(r),r})}_createAnimationTracks(e,t,n,i,r){let a=[],o=e.name?e.name:e.uuid,c=[];function l(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}yi[r.path]===yi.weights?(l(e),e.isGroup&&e.children.forEach(l)):c.push(o);let h;switch(yi[r.path]){case yi.weights:h=In;break;case yi.rotation:h=Dn;break;case yi.translation:case yi.scale:h=Ln;break;default:n.itemSize===1?h=In:h=Ln;break}let u=i.interpolation!==void 0?B0[i.interpolation]:Li,d=this._getArrayFromAccessor(n);for(let f=0,g=c.length;f<g;f++){let y=new h(c[f]+"."+yi[r.path],t.array,d,u);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(y),a.push(y)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=Jl(t.constructor),i=new Float32Array(t.length);for(let r=0,a=t.length;r<a;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){let i=this instanceof Dn?Kl:Wo;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function q0(s,e,t){let n=e.attributes,i=new Vt;if(n.POSITION!==void 0){let o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(i.set(new D(c[0],c[1],c[2]),new D(l[0],l[1],l[2])),o.normalized){let h=Jl(Ns[o.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let r=e.targets;if(r!==void 0){let o=new D,c=new D;for(let l=0,h=r.length;l<h;l++){let u=r[l];if(u.POSITION!==void 0){let d=t.json.accessors[u.POSITION],f=d.min,g=d.max;if(f!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(g[2]))),d.normalized){let y=Jl(Ns[d.componentType]);c.multiplyScalar(y)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}s.boundingBox=i;let a=new Wt;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=a}function _d(s,e,t){let n=e.attributes,i=[];function r(a,o){return t.getDependency("accessor",a).then(function(c){s.setAttribute(o,c)})}for(let a in n){let o=Yl[a]||a.toLowerCase();o in s.attributes||i.push(r(n[a],o))}if(e.indices!==void 0&&!s.index){let a=t.getDependency("accessor",e.indices).then(function(o){s.setIndex(o)});i.push(a)}return ze.workingColorSpace!==Gt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ze.workingColorSpace}" not supported.`),kn(s,e),q0(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?z0(s,e.targets,t):s})}var qo=class extends Ni{constructor(){super(),this.name="RoomEnvironment",this.position.y=-3.5;let e=new fi;e.deleteAttribute("uv");let t=new Cn({side:Lt}),n=new Cn,i=new Gi(16777215,900,28,2);i.position.set(.418,16.199,.3),this.add(i);let r=new at(e,t);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);let a=new Ui(e,n,6),o=new lt;o.position.set(-10.906,2.009,1.846),o.rotation.set(0,-.195,0),o.scale.set(2.328,7.905,4.651),o.updateMatrix(),a.setMatrixAt(0,o.matrix),o.position.set(-5.607,-.754,-.758),o.rotation.set(0,.994,0),o.scale.set(1.97,1.534,3.955),o.updateMatrix(),a.setMatrixAt(1,o.matrix),o.position.set(6.167,.857,7.803),o.rotation.set(0,.561,0),o.scale.set(3.927,6.285,3.687),o.updateMatrix(),a.setMatrixAt(2,o.matrix),o.position.set(-2.017,.018,6.124),o.rotation.set(0,.333,0),o.scale.set(2.002,4.566,2.064),o.updateMatrix(),a.setMatrixAt(3,o.matrix),o.position.set(2.291,-.756,-2.621),o.rotation.set(0,-.286,0),o.scale.set(1.546,1.552,1.496),o.updateMatrix(),a.setMatrixAt(4,o.matrix),o.position.set(-2.193,-.369,-5.547),o.rotation.set(0,.516,0),o.scale.set(3.875,3.487,2.986),o.updateMatrix(),a.setMatrixAt(5,o.matrix),this.add(a);let c=new at(e,Us(50));c.position.set(-16.116,14.37,8.208),c.scale.set(.1,2.428,2.739),this.add(c);let l=new at(e,Us(50));l.position.set(-16.109,18.021,-8.207),l.scale.set(.1,2.425,2.751),this.add(l);let h=new at(e,Us(17));h.position.set(14.904,12.198,-1.832),h.scale.set(.15,4.265,6.331),this.add(h);let u=new at(e,Us(43));u.position.set(-.462,8.89,14.52),u.scale.set(4.38,5.441,.088),this.add(u);let d=new at(e,Us(20));d.position.set(3.235,11.486,-12.541),d.scale.set(2.5,2,.1),this.add(d);let f=new at(e,Us(100));f.position.set(0,20,0),f.scale.set(1,.1,1),this.add(f)}dispose(){let e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(let t of e)t.dispose()}};function Us(s){return new cr({color:0,emissive:16777215,emissiveIntensity:s})}var $l=(function(){var s="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaocwffagRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbahaocdffagRb:q:W:cjbfhokalcdfhlaiczfgiaQ6mbkkaohAaoTmoka8EaQfh8Ea5cefg5cl9hmbkdndndndnawTmbaza8Acd4fRbbglciGPlbedwbkaQTmdavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep9Ta8Fpxeeeeeeeeeeeeeeeegap9op9Hp9rg8Fa8Jp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ugap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp9Ugap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp9Ugap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9AbbbaladfhlaoczfgoaQ6mbxikkaQTmeavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep:nea8Fpxebebebebebebebebgap9op:bep9rg8Fa8Jp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oegap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp:oegap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp:oegap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9AbbbaladfhlaoczfgoaQ6mbxdkkaQTmbcbhocbalcl4gl9Rc8FGhiavcjdfa8Afhrava8Afpbdbhainaravcj;cbfaofpblbg8JaYaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaLaofpblbg8MaKaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Faap9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8LaypmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var i=WebAssembly.validate(t)?o(e):o(s),r,a=WebAssembly.instantiate(i,{}).then(function(p){r=p.instance,r.exports.__wasm_call_ctors()});function o(p){for(var x=new Uint8Array(p.length),S=0;S<p.length;++S){var M=p.charCodeAt(S);x[S]=M>96?M-97:M>64?M-39:M+4}for(var E=0,S=0;S<p.length;++S)x[E++]=x[S]<60?n[x[S]]:(x[S]-60)*64+x[++S];return x.buffer.slice(0,E)}function c(p,x,S,M,E,A,C){var _=p.exports.sbrk,w=M+3&-4,L=_(w*E),R=_(A.length),O=new Uint8Array(p.exports.memory.buffer);O.set(A,R);var H=x(L,M,E,R,A.length);if(H==0&&C&&C(L,w,E),S.set(O.subarray(L,L+M*E)),_(L-_(0)),H!=0)throw new Error("Malformed buffer data: "+H)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],d=0;function f(p){var x={object:new Worker(p),pending:0,requests:{}};return x.object.onmessage=function(S){var M=S.data;x.pending-=M.count,x.requests[M.id][M.action](M.value),delete x.requests[M.id]},x}function g(p){for(var x="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(i)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+m.name+";"+c.toString()+m.toString(),S=new Blob([x],{type:"text/javascript"}),M=URL.createObjectURL(S),E=u.length;E<p;++E)u[E]=f(M);for(var E=p;E<u.length;++E)u[E].object.postMessage({});u.length=p,URL.revokeObjectURL(M)}function y(p,x,S,M,E){for(var A=u[0],C=1;C<u.length;++C)u[C].pending<A.pending&&(A=u[C]);return new Promise(function(_,w){var L=new Uint8Array(S),R=++d;A.pending+=p,A.requests[R]={resolve:_,reject:w},A.object.postMessage({id:R,count:p,size:x,source:L,mode:M,filter:E},[L.buffer])})}function m(p){var x=p.data;self.ready.then(function(S){if(!x.id)return self.close();try{var M=new Uint8Array(x.count*x.size);c(S,S.exports[x.mode],M,x.count,x.size,x.source,S.exports[x.filter]),self.postMessage({id:x.id,count:x.count,action:"resolve",value:M},[M.buffer])}catch(E){self.postMessage({id:x.id,count:x.count,action:"reject",value:E})}})}return{ready:a,supported:!0,useWorkers:function(p){g(p)},decodeVertexBuffer:function(p,x,S,M,E){c(r,r.exports.meshopt_decodeVertexBuffer,p,x,S,M,r.exports[l[E]])},decodeIndexBuffer:function(p,x,S,M){c(r,r.exports.meshopt_decodeIndexBuffer,p,x,S,M)},decodeIndexSequence:function(p,x,S,M){c(r,r.exports.meshopt_decodeIndexSequence,p,x,S,M)},decodeGltfBuffer:function(p,x,S,M,E,A){c(r,r.exports[h[E]],p,x,S,M,r.exports[l[A]])},decodeGltfBufferAsync:function(p,x,S,M,E){return u.length>0?y(p,x,S,h[M],l[E]):a.then(function(){var A=new Uint8Array(p*x);return c(r,r.exports[h[M]],A,p,x,S,r.exports[l[E]]),A})}}})();var Ql=window.matchMedia("(prefers-reduced-motion: reduce)").matches,eh={dark:{bg:658448,css:"#0a0c10",text:"#e8eaed",muted:"#9aa3ad",panel:"rgba(13,16,21,0.72)",stroke:"rgba(255,255,255,0.12)"},light:{bg:15659509,css:"#eef1f5",text:"#15181d",muted:"#5b636d",panel:"rgba(255,255,255,0.78)",stroke:"rgba(0,0,0,0.10)"}};function Xo(s,e){if(!s||typeof s!="object")return"";for(let t of e){let n=s[t];if(typeof n=="string"&&/^https?:\/\//i.test(n))return n}return""}function X0(){let s=typeof window.openai=="object"&&window.openai&&window.openai.toolOutput||null;if(s)return{glb:Xo(s,["glb_url","glbUrl","model_url","modelUrl","url"]),viewer:Xo(s,["viewer_url","viewerUrl","view_url","viewUrl","preview"]),name:typeof s.name=="string"?s.name:typeof s.prompt=="string"?s.prompt:"",source:"host"};let e=new URLSearchParams(location.search),t=location.hash.length>1?decodeURIComponent(location.hash.slice(1)):"";return{glb:Xo({u:e.get("glb")||t},["u"]),viewer:Xo({u:e.get("viewer")||""},["u"]),name:e.get("name")||"",source:"standalone"}}function j0(){let s=typeof window.openai=="object"&&window.openai&&window.openai.theme||"",e=(typeof s=="string"?s:s?.mode)||"";return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}var K0={download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>',external:'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>',reset:'<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>',rotate:'<path d="M23 4v6h-6"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>',warn:'<circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>',cube:'<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>'};function vd(s){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'+(K0[s]||"")+"</svg>"}var Y0=`-:root{color-scheme:dark light}-*{box-sizing:border-box}-html,body{margin:0;height:100%;overflow:hidden;font-family:ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;-webkit-font-smoothing:antialiased}-#studio-stage{position:fixed;inset:0}-#studio-stage canvas{display:block;width:100%;height:100%;outline:none}-.sv-hud{position:fixed;left:12px;top:12px;right:12px;display:flex;gap:8px;pointer-events:none;opacity:0;transition:opacity .5s ease}-.sv-hud.on{opacity:1}-.sv-title{max-width:70%;padding:6px 11px;font-size:12.5px;line-height:1.35;border-radius:9px;border:1px solid var(--sv-stroke);background:var(--sv-panel);color:var(--sv-text);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}-.sv-bar{position:fixed;left:50%;bottom:12px;transform:translateX(-50%) translateY(8px);display:flex;gap:5px;padding:5px;border-radius:13px;border:1px solid var(--sv-stroke);background:var(--sv-panel);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);box-shadow:0 10px 30px rgba(0,0,0,.34);opacity:0;transition:opacity .5s ease,transform .5s ease;max-width:calc(100vw - 24px);flex-wrap:wrap;justify-content:center}-.sv-bar.on{opacity:1;transform:translateX(-50%) translateY(0)}-.sv-btn{appearance:none;border:1px solid transparent;background:transparent;color:var(--sv-text);font:inherit;font-size:12.5px;font-weight:600;display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:9px;cursor:pointer;text-decoration:none;white-space:nowrap;transition:background .15s ease,border-color .15s ease}-.sv-btn:hover{background:var(--sv-hover)}-.sv-btn:active{background:var(--sv-active)}-.sv-btn:focus-visible{outline:none;border-color:#18e0c8;box-shadow:0 0 0 2px rgba(24,224,200,.4)}-.sv-btn[aria-pressed=true]{background:rgba(124,92,255,.22);border-color:rgba(124,92,255,.5)}-.sv-btn.primary{background:linear-gradient(90deg,#7c5cff,#6b8bff);color:#fff;border-color:transparent}-.sv-btn.primary:hover{filter:brightness(1.08);background:linear-gradient(90deg,#7c5cff,#6b8bff)}-.sv-btn svg{width:15px;height:15px;flex:0 0 auto}-@media (max-width:540px){.sv-btn .lbl{display:none}.sv-btn{padding:9px 10px}}-.sv-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:20px;transition:opacity .4s ease}-.sv-overlay.hidden{opacity:0;pointer-events:none}-.sv-card{width:min(420px,90%);padding:24px;border-radius:16px;border:1px solid var(--sv-stroke);background:var(--sv-panel);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);text-align:center;box-shadow:0 20px 50px rgba(0,0,0,.4)}-.sv-spinner{width:30px;height:30px;margin:0 auto 14px}-.sv-spinner circle{fill:none;stroke:#18e0c8;stroke-width:4;stroke-linecap:round;stroke-dasharray:90 150;transform-origin:center;animation:sv-spin 1s linear infinite}-@keyframes sv-spin{to{transform:rotate(360deg)}}-.sv-ic{width:44px;height:44px;margin:0 auto 14px;display:grid;place-items:center;border-radius:50%;color:#18e0c8}-.sv-ic.err{color:#ff6b6b;background:rgba(255,107,107,.13)}-.sv-ic.empty{color:var(--sv-muted);background:var(--sv-hover)}-.sv-ic svg{width:24px;height:24px}-.sv-ttl{font-size:16px;font-weight:700;color:var(--sv-text);margin-bottom:7px}-.sv-msg{font-size:13px;line-height:1.5;color:var(--sv-muted);margin-bottom:18px}-.sv-acts{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}-.sv-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}-`,Sd=s=>document.getElementById(s),th=class{constructor(e){this.host=e,this.theme=eh[j0()]||eh.dark,this.autoRotate=!Ql,this.disposed=!1,this.frameInfo=null,this.glbUrl=null,this.objectUrl=null,this._applyThemeVars(),this._buildChrome()}_applyThemeVars(){let e=this.theme,t=e===eh.light;document.documentElement.style.setProperty("--sv-text",e.text),document.documentElement.style.setProperty("--sv-muted",e.muted),document.documentElement.style.setProperty("--sv-panel",e.panel),document.documentElement.style.setProperty("--sv-stroke",e.stroke),document.documentElement.style.setProperty("--sv-hover",t?"rgba(0,0,0,0.06)":"rgba(255,255,255,0.08)"),document.documentElement.style.setProperty("--sv-active",t?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.14)"),document.body.style.background=e.css}_buildChrome(){let e=document.createElement("header");e.className="sv-hud",e.id="sv-hud",e.innerHTML='<div class="sv-title" id="sv-title"></div>';let t=document.createElement("nav");t.className="sv-bar",t.id="sv-bar",t.setAttribute("aria-label","Model controls");let n=document.createElement("div");n.className="sv-overlay",n.id="sv-overlay",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),this.host.append(e,t,n),this.hud=e,this.bar=t,this.overlay=n}showLoading(e){this.overlay.classList.remove("hidden"),this.overlay.innerHTML='<div class="sv-card"><svg class="sv-spinner" viewBox="0 0 50 50" aria-hidden="true"><circle cx="25" cy="25" r="20"/></svg><div class="sv-ttl">'+yd(e||"Loading 3D model\u2026")+'</div><div class="sv-msg">Rendering your generated model</div></div>'}hideOverlay(){this.overlay.classList.add("hidden")}showState({kind:e,title:t,msg:n,actions:i}){this.overlay.classList.remove("hidden");let r=document.createElement("div");r.className="sv-card";let a=document.createElement("div");a.className="sv-ic "+(e==="error"?"err":"empty"),a.innerHTML=vd(e==="error"?"warn":"cube");let o=document.createElement("div");o.className="sv-ttl",o.textContent=t;let c=document.createElement("div");c.className="sv-msg",c.textContent=n;let l=document.createElement("div");l.className="sv-acts";for(let h of i||[])l.appendChild(this._mkBtn(h));r.append(a,o,c,l),this.overlay.replaceChildren(r)}_mkBtn({icon:e,label:t,onClick:n,href:i,primary:r,pressed:a,aria:o}){let c=document.createElement(i?"a":"button");return c.className="sv-btn"+(r?" primary":""),c.innerHTML=(e?vd(e):"")+'<span class="lbl">'+yd(t)+"</span>",c.setAttribute("aria-label",o||t),a!==void 0&&c.setAttribute("aria-pressed",String(a)),i?(c.href=i,c.target="_blank",c.rel="noopener noreferrer"):n&&(c.type="button",c.addEventListener("click",n)),c}initThree(){let e=document.createElement("canvas");e.setAttribute("aria-label","3D model viewer \u2014 drag to orbit"),e.tabIndex=0,this.host.insertBefore(e,this.host.firstChild);try{this.renderer=new Oo({canvas:e,antialias:!0,alpha:!1})}catch{return!1}let t=this.renderer;t.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),t.setSize(this.w(),this.h(),!1),t.outputColorSpace=_t,t.toneMapping=yr,t.toneMappingExposure=1.05,t.shadowMap.enabled=!0,t.shadowMap.type=Va,this.scene=new Ni,this.scene.background=new Ae(this.theme.bg),this.pmrem=new Ls(t),this.scene.environment=this.pmrem.fromScene(new qo,.04).texture,this.camera=new St(45,this.w()/this.h(),.01,2e3),this.camera.position.set(0,1.1,3.2),this.controls=new Go(this.camera,e),this.controls.enableDamping=!0,this.controls.dampingFactor=.07,this.controls.autoRotate=this.autoRotate,this.controls.autoRotateSpeed=1.3,this.controls.listenToKeyEvents(e),this.controls.addEventListener("start",()=>{this.autoRotate&&(this.autoRotate=!1,this.controls.autoRotate=!1,this._syncRotate())});let n=new Vi(16777215,2);return n.position.set(4,7,5),n.castShadow=!0,n.shadow.mapSize.set(2048,2048),n.shadow.bias=-4e-4,n.shadow.normalBias=.02,this.scene.add(n),this.scene.add(new dr(12571903,1053466,.35)),this.clock=new _r,this._onResize=()=>this.resize(),window.addEventListener("resize",this._onResize),this._ro=new ResizeObserver(()=>this.resize()),this._ro.observe(document.body),t.setAnimationLoop(()=>this.render()),!0}w(){return Math.max(1,window.innerWidth)}h(){let e=Number(typeof window.openai=="object"&&window.openai&&window.openai.maxHeight)||0;return Math.max(1,e>0?Math.min(window.innerHeight,e):window.innerHeight)}resize(){this.disposed||!this.renderer||(this.renderer.setSize(this.w(),this.h(),!1),this.camera.aspect=this.w()/this.h(),this.camera.updateProjectionMatrix())}render(){if(this.disposed)return;let e=this.clock.getDelta();this.mixer&&this.mixer.update(e),this.controls&&this.controls.update(),this.renderer.render(this.scene,this.camera)}frame(e){let t=new Vt().setFromObject(e),n=t.getSize(new D),i=t.getCenter(new D),r=Math.max(n.x,n.y,n.z)||1;e.position.sub(i);let a=r/2/Math.tan(this.camera.fov*Math.PI/360)*1.5;this.camera.near=r/100,this.camera.far=r*100,this.camera.updateProjectionMatrix(),this.controls.minDistance=r*.4,this.controls.maxDistance=r*6,this.frameInfo={dist:a,height:r*.18},this.resetView(!0);let o=new at(new Bi(r*12,r*12),new or({opacity:.26}));o.rotation.x=-Math.PI/2,o.position.y=-n.y/2,o.receiveShadow=!0,this.scene.add(o),this.ground=o}resetView(e){if(!this.frameInfo)return;let{dist:t,height:n}=this.frameInfo,i=new D(0,n,t);if(this.controls.target.set(0,0,0),e||Ql){this.camera.position.copy(i);return}let r=this.camera.position.clone(),a=performance.now(),o=()=>{if(this.disposed)return;let c=Math.min(1,(performance.now()-a)/450);this.camera.position.lerpVectors(r,i,1-Math.pow(1-c,3)),c<1&&requestAnimationFrame(o)};o()}fadeIn(e){let t=[];if(e.traverse(r=>{if(r.isMesh){r.castShadow=!0,r.receiveShadow=!0;for(let a of Array.isArray(r.material)?r.material:[r.material])a&&(a.userData._t=a.transparent,a.userData._o=a.opacity,a.transparent=!0,a.opacity=0,t.push(a))}}),Ql){for(let r of t)r.transparent=r.userData._t??!1,r.opacity=r.userData._o??1,r.needsUpdate=!0;return}let n=performance.now(),i=()=>{if(this.disposed)return;let r=Math.min(1,(performance.now()-n)/550);for(let a of t)a.opacity=(a.userData._o??1)*r;if(r<1)requestAnimationFrame(i);else for(let a of t)a.transparent=a.userData._t??!1,a.opacity=a.userData._o??1,a.needsUpdate=!0};i()}pickIdle(e){return!e||!e.length?null:e.find(t=>/idle|breath|stand|loop|rest/i.test(t.name||""))||e[0]}async load(e){if(this.glbUrl=e.glb,this.viewerUrl=e.viewer||(e.glb?"https://three.ws/viewer?src="+encodeURIComponent(e.glb):"https://three.ws/forge"),this.modelName=(e.name||"").trim(),!this.glbUrl)return this.showState({kind:"empty",title:"No model yet",msg:"Ask three.ws 3D Studio to generate a 3D model \u2014 e.g. \u201Cmake a friendly robot mascot\u201D \u2014 and it will appear here.",actions:[{label:"Open three.ws Studio",href:"https://three.ws/forge",primary:!0,icon:"external"}]});if(!this.renderer&&!this.initThree())return this.showState({kind:"error",title:"3D not supported here",msg:"This device or browser can\u2019t render WebGL. You can still download the model or open it on three.ws.",actions:[{label:"Download GLB",href:this.glbUrl,primary:!0,icon:"download"},{label:"Open on three.ws",href:this.viewerUrl,icon:"external"}]});this.showLoading("Loading 3D model\u2026");let t=new Vo;if($l)try{t.setMeshoptDecoder($l)}catch{}let n=this.glbUrl;try{let i=await fetch(this.glbUrl,{mode:"cors",credentials:"omit"});if(i.ok){let r=await i.blob();this.objectUrl=URL.createObjectURL(r),n=this.objectUrl}}catch{}t.load(n,i=>{if(this.disposed)return;this.disposeModel();let r=i.scene||i.scenes?.[0];if(!r)return this.failLoad();this.model=r,this.scene.add(r),this.frame(r),this.fadeIn(r);let a=this.pickIdle(i.animations);a&&(this.mixer=new br(r),this.mixer.clipAction(a).play(),this.rigged=!0),this.reveal()},void 0,()=>{this.disposed||this.failLoad()})}failLoad(){this.showState({kind:"error",title:"Couldn\u2019t load the model",msg:"The generated file didn\u2019t load \u2014 it may have expired. Generate it again, or open it on three.ws.",actions:[{label:"Download GLB",href:this.glbUrl,primary:!0,icon:"download"},{label:"Open on three.ws",href:this.viewerUrl,icon:"external"}]})}reveal(){this.hideOverlay(),this.buildHud(),this.buildBar(),requestAnimationFrame(()=>{this.hud.classList.add("on"),this.bar.classList.add("on")})}buildHud(){let e=Sd("sv-title");this.modelName?e.textContent=this.modelName:e.style.display="none"}_syncRotate(){this._rotBtn&&this._rotBtn.setAttribute("aria-pressed",String(this.autoRotate))}buildBar(){this.bar.replaceChildren(),this.bar.appendChild(this._mkBtn({icon:"download",label:"Download",aria:"Download GLB",onClick:()=>this.download()})),this._rotBtn=this._mkBtn({icon:"rotate",label:"Spin",pressed:this.autoRotate,onClick:()=>{this.autoRotate=!this.autoRotate,this.controls.autoRotate=this.autoRotate,this._syncRotate()}}),this.bar.appendChild(this._rotBtn),this.bar.appendChild(this._mkBtn({icon:"reset",label:"Recenter",aria:"Recenter camera",onClick:()=>this.resetView(!1)})),this.bar.appendChild(this._mkBtn({icon:"external",label:"Open in three.ws",aria:"Open in three.ws",href:this.viewerUrl,primary:!0}))}async download(){let e=(this.modelName?this.modelName.slice(0,40).replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,""):"studio-model")||"studio-model";try{let t=this.objectUrl;if(!t){let i=await fetch(this.glbUrl,{mode:"cors",credentials:"omit"});if(!i.ok)throw new Error("fetch failed");t=URL.createObjectURL(await i.blob())}let n=document.createElement("a");n.href=t,n.download=e+".glb",document.body.appendChild(n),n.click(),n.remove(),t!==this.objectUrl&&setTimeout(()=>URL.revokeObjectURL(t),4e3)}catch{window.open(this.glbUrl,"_blank","noopener,noreferrer")}}disposeModel(){this.mixer&&(this.mixer.stopAllAction(),this.mixer=null),this.model&&(this.scene.remove(this.model),this.model.traverse(e=>{if(e.isMesh){e.geometry?.dispose?.();for(let t of Array.isArray(e.material)?e.material:[e.material])J0(t)}}),this.model=null),this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null)}dispose(){this.disposed||(this.disposed=!0,window.removeEventListener("resize",this._onResize),this._ro?.disconnect(),this.disposeModel(),this.ground?.geometry?.dispose?.(),this.ground?.material?.dispose?.(),this.controls?.dispose?.(),this.pmrem?.dispose?.(),this.scene?.environment&&this.scene.environment.dispose?.(),this.renderer&&(this.renderer.setAnimationLoop(null),this.renderer.dispose()))}};function J0(s){if(s){for(let e of Object.keys(s)){let t=s[e];t&&t.isTexture&&t.dispose()}s.dispose?.()}}function yd(s){return String(s).replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Md(){let s=document.createElement("style");s.textContent=Y0,document.head.appendChild(s);let e=Sd("studio-stage");e||(e=document.createElement("div"),e.id="studio-stage",document.body.appendChild(e));let t=new th(e);t.showLoading("Preparing viewer\u2026");let n=null,i=()=>{let r=X0();r.glb===n&&n!==null||(n=r.glb,t.load(r))};i(),window.addEventListener("openai:set_globals",i),window.addEventListener("pagehide",()=>t.dispose(),{once:!0})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Md):Md();})();-</script>-</body>-</html>diff --git a/scripts/build-apps-sdk-viewer.mjs b/scripts/build-apps-sdk-viewer.mjsdeleted file mode 100644index c2e2270fd..000000000--- a/scripts/build-apps-sdk-viewer.mjs+++ /dev/null@@ -1,66 +0,0 @@-#!/usr/bin/env node-// Build the OpenAI Apps SDK 3D Studio viewer component.-//-// Outputs (both inline the same self-contained IIFE — three.js + GLTFLoader +-// OrbitControls + RoomEnvironment + the viewer; no external <script>):-// • public/apps-sdk/studio-viewer.bundle.js-// the bundle, read at runtime by api/_mcp3d/studio-viewer-resource.js and-// inlined into the `ui://widget/studio-viewer.html` skybridge resource.-// • public/apps-sdk/studio-viewer.html-// a standalone page that inlines the bundle and reads ?glb=<url> — used-// for local verification and the "open in a normal browser" fallback.-//-// Run via: node scripts/build-apps-sdk-viewer.mjs (npm run build:apps-sdk-viewer)--import { build } from 'esbuild';-import { fileURLToPath } from 'node:url';-import { dirname, resolve } from 'node:path';-import { writeFileSync, mkdirSync, statSync } from 'node:fs';--const __dirname = dirname(fileURLToPath(import.meta.url));-const ROOT = resolve(__dirname, '..');-const ENTRY = resolve(ROOT, 'apps-sdk/studio-viewer/src.js');-const OUT_DIR = resolve(ROOT, 'public/apps-sdk');-const OUT_BUNDLE = resolve(OUT_DIR, 'studio-viewer.bundle.js');-const OUT_HTML = resolve(OUT_DIR, 'studio-viewer.html');--mkdirSync(OUT_DIR, { recursive: true });--const result = await build({- entryPoints: [ENTRY],- bundle: true,- format: 'iife',- platform: 'browser',- target: ['es2020'],- minify: true,- legalComments: 'none',- write: false,- logLevel: 'info',- define: { 'process.env.NODE_ENV': '"production"' },-});--const [bundle] = result.outputFiles;-const banner =- '/* three.ws 3D Studio — Apps SDK viewer bundle (three.js + GLTFLoader + viewer).\n' +- ' * Built from apps-sdk/studio-viewer/src.js. Do not edit by hand.\n' +- ' * Regenerate with: npm run build:apps-sdk-viewer */\n';-writeFileSync(OUT_BUNDLE, banner + bundle.text);--const html = `<!doctype html>-<html lang="en">-<head>-<meta charset="utf-8">-<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">-<title>three.ws 3D Studio — viewer</title>-<style>html,body{margin:0;height:100%;background:#0a0c10;overflow:hidden}</style>-</head>-<body>-<div id="studio-stage"></div>-<script>${bundle.text}</script>-</body>-</html>-`;-writeFileSync(OUT_HTML, html);--console.log(`✓ ${OUT_BUNDLE}\n ${(statSync(OUT_BUNDLE).size / 1024).toFixed(1)} KB`);-console.log(`✓ ${OUT_HTML}\n ${(statSync(OUT_HTML).size / 1024).toFixed(1)} KB`);