Branchwell

Watch Encyclopedia / website · watchencyclopedia.org / x / phone-teardown / index.html

1<!doctype html>
2<html lang="en">
3<head>
4<meta charset="utf-8">
5<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6<title>iPhone Duo teardown</title>
7<meta name="description" content="An interactive 3D teardown of the iPhone Duo, rebuilt from code in the order iFixit opened it. Every number is sourced. Not affiliated with Apple or iFixit.">
8<meta name="theme-color" content="#FAF9F6">
9
10<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='4' y='6' width='24' height='20' rx='3' fill='%2317191C'/%3E%3Crect x='15.25' y='6' width='1.5' height='20' fill='%23F58025'/%3E%3C/svg%3E">
11<style>
12@font-face{font-family:'Space Grotesk';font-weight:300 700;font-style:normal;font-display:swap;src:url(data:font/woff2;base64,d09GMgABAAAAAFcQABQAAAAAzrwAAFagAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoMkG/p0HIlOP0hWQVKDKQZgP1NUQVRYJx4AhFovRBEICoGBMOZ3C4RIADDoWAE2AiQDiQwEIAWEbgeLCgwHG969N1C9ds4vQm9WFed8bvrxZyNqt+M7lhAPFHBj6IaNA4AmGZH9//9nJMghIwn6R7Bt9d22IAqpoBI7iIr2hQzbEEyP1hG+DDEsRbZ6qHFCVQUIyJxRmxGz0jGjEKqEjEBHcdLg8OSUCldUPu8UbeWAT9/KcjzRGd+RVbwJQoKQIJ3grGvPn2fr+w7Z8v21uOOvt65Ydgop8/AVJDuIlfzfT9LmAJb3DKd/B5zCx81oHuXIlREEiJUppXXyhSzdn+vVndgO39KdQgrnjfR2LLQO3znnrQJjl8eIqFgn2pfnn/xldu6rljSAbAK1xsj0vSEwRg4XTNliRkBlEc05+/exj2AhQMTRBpNCwGtOqZg7oTRQFaBuDM9vs4fB8PP/tjMSkSmKCFISn09IRNmoGCigs+byXOUtXcW5aM+tZbul7iq3q/Jqt6vtIqd/N/s/EVGScBIgWJB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woff2');}
13@font-face{font-family:'JetBrains Mono';font-weight:400;font-style:normal;font-display:swap;src:url(data:font/woff2;base64,d09GMgABAAAAAFKwABAAAAAA4cgAAFJMAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoEOG4ZQHIGacgZgP1NUQVReAIUiEQgKgdw4gawuC4YWAAE2AiQDjBoEIAWFAAejDAwHG4zFB5heZc7dDrCLfb19NuGOdzuo1uD1/EiEsHEgkGFPs///MxLUGMOH6kDMaqXbjjCRLRuFep5D7WpxVtZdUGnCv+8QXY9bv/czZepwp6YwFSEQi8AgBBYQFjCgSwT2L1Qz/6Z1nKunSURG4ETaadab3i9iOC3Ta97SKncd9tqSGh7CYxzldX6G/R47LSZypynE1PN+q9m3uZRLuJ8fe9Y3PDZ39c+MPcpdDOTmhwo15/Xh+W3+ufehAnYMUVFR0Rk9RUXMTWYPKxCr17o2lq3L9LssF+1c/d/rX6tQ4B/qYu/vEd4EnEQBB5aGjR8Ah1FAwWnV+v5UW36IAEkUuwc7V3pZswz3bgb/13/HJ+N6s5okq1nNs/bkyXyysnZWVnbeabLSpLPmkyTN6tyfJEnSaZJk3ZPMT66nyZpPs9Lk/ty/NGmS+5MkadIkSZKV+5MkN//9AYbsNK3fCLTJY+3xXvdOLuC8tcG/f72jzAxj4E+dpvJ8ce977u74R8sEG0soQBVbBwu3YsF49DX/e51v90qGmXuejOHps8T9btEFHsh+Hyz5U4gdubFbuTX/IFe7XC1PHxpYl32LaS59NZ/Elw4icBvt8j5rEgSh7HIvgiCYft71k5uP7w6xJIhYkAgQCJpflXXvMneeu6wdnJfzwMOK9/C8m/4fU1MliUmqlkYRHAgiqMhad8Jly+ECilcBBxpRcWYsO7I6TJptxjKj6cvYZuyO/5L9G9OpXWaOt5Y5XNt93Yg3w601lUgotCBuDR+2bV+2PZ0XoxMr/n+dfrVPtud/fbZnZoG4aCZ/AaCotub7np4s6cmKZTsgQxJbyd/IHxXngzwYW/YfKzCEKMdDzNUCYDtnTr9NuXVBUJT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2A3UvxHm78/yBpBvEc58zl1f1ua3RYDrF9n9sb6KKJg9nNcXUK8Nx5vnKBYQDo9z1qRCixHVTqKemh1V80oR4udIZkHM2SCo2Bg1SPgEzigueJQX1RaBIAXvcKT4ykbXAUSWQv5UXwf5pHTsTp4XNPC4PEcO2pn8JdeIH90xp0injd9LQkJtXnF2j6r6Ov96t/rxchLAUA) format('woff2');}
14@font-face{font-family:'JetBrains Mono';font-weight:600;font-style:normal;font-display:swap;src:url(data:font/woff2;base64,d09GMgABAAAAAFVkABAAAAAA4bAAAFUBAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoEOG4ZQHIGacgZgP1NUQVQ2AIUiEQgKgdwkgas/C4YWAAE2AiQDjBoEIAWFIgejDAwHGxfFF5Rtn4hBuhNKlWTf/NfXhBvjBhuHYXjhEWYjLNg4ACKehNn//9+TjsMWX5U49wZSo9EJQWemDEertBFOejIi6FiESUxZar67YEI+rsTb3mPNm71C5l5wILQt/nkJ0YzKmSm5wGVELDiZKYRrauir8990YHQq/Tz2tLwtqfExVznAfh9eJJh18kXhK/e7EbhDTd1MNd16bimtrHXLIFSPqS4D7BZsMUk5hvf04fm5/bn3rZgwRhi9j7TkbKItHBE9cGSPtBBtBIv6QhvVGNUYjbrx/P/vD/7n2vvpA0hkfFCIP1LZSm/0D1cog+lHJTiD995z+ef7i537F20BV9PA0rDxCMMk8ThMMA3eEK+bfyggwYXMkJA5IPNlDyCQkBACYWaQ5AV2kOUGWkGLE8W9OsT60V1t7XT8qlipVpwdS+1aCeD/P6hXJ5e61yqN1p4UKX3z9lNrbaiQCqHipVPzqb+I7Lms3Kczf0YyvDezMibc5QNzRws674Hgcr4QO1IjtVZrc5Crz1B/fsy0hRhQQIN33filtzXL8ARuo13eZ02CIFS5Ws9+SS65S2EMCE54jQDFj27yvYDXiEDRGiFQxGtQ+z5M083r/bS/eq/O7LX/faDTKmvmjFCU6gI6gEkz+K7+rf8yb82RjMxr0nzff2vN0SS9Lysrf3pN70vS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Uyk8iY6mZVDjPcD/Wrn1MHAPzysnaTJNCNhOvNwkrKb4tg3d3hvqqPu6Rh5UA6zPbkar9wCgZ7bv7nsHIDwP4ykK4pepbwUCL+Xloe+rt4sVZn3km7ziup2jChvbFD1KKT6QdkxG2d2R374zxS7+RJ/K/+79ftP+UAgMU=) format('woff2');}
15:root {
16 --site-top: 0px;
17 --paper: #fafaf6;
18 --ink: #17191c;
19 --ink-2: #5a5f66;
20 --rule: #d9d8d2;
21 --accent: #f58025;
22 --sans: 'Space Grotesk', system-ui, sans-serif;
23 --mono: 'JetBrains Mono', ui-monospace, monospace;
24 --enter: cubic-bezier(0.16, 1, 0.3, 1);
25 --move: cubic-bezier(0.65, 0, 0.35, 1);
26}
27* { box-sizing: border-box; }
28html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; }
29body { margin: 0; font: 400 15px/1.5 var(--sans); }
30h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
31ul { list-style: none; }
32a { color: inherit; text-underline-offset: 2px; text-decoration-thickness: 1px; }
33button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
34:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
35
36/* ------------------------------------------------------------ header and footer */
37.site-top, .site-foot { background: #000; color: #ececea; font-family: 'Space Grotesk', sans-serif; }
38.site-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--site-top); box-sizing: border-box; padding: 0 20px; }
39.site-brand { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 600; color: inherit; text-decoration: none; }
40.site-brand img { display: block; }
41.site-top nav, .site-foot nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
42.site-top nav a, .site-foot nav a { font-size: 14px; color: #b6b3aa; text-decoration: none; }
43.site-top nav a:hover, .site-foot nav a:hover { color: #f58025; }
44.site-top nav a.site-contact { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border: 1px solid #f58025; border-radius: 999px; color: #f58025; }
45.site-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 28px; padding: 26px 20px; }
46.site-foot span { font: 400 12px var(--mono, monospace); color: #76736b; }
47@media (max-width: 560px) {
48 .site-top { padding: 0 14px; }
49 .site-top nav { gap: 12px; flex-wrap: nowrap; }
50 .site-top nav a:not(.site-contact):not(:first-child) { display: none; }
51}
52
53/* ------------------------------------------------------------ the bench */
54.bench {
55 display: grid;
56 grid-template-columns: 236px minmax(0, 1fr) 308px;
57 grid-template-rows: auto minmax(0, 1fr) auto auto;
58 grid-template-areas:
59 'title stage sheet'
60 'steps stage sheet'
61 'steps procedure sheet'
62 'credit credit credit';
63 gap: 0 20px;
64 height: calc(100svh - var(--site-top));
65 min-height: 680px;
66 padding: 18px 20px 10px;
67}
68.title { grid-area: title; padding-bottom: 12px; }
69.steps { grid-area: steps; min-height: 0; overflow: auto; scrollbar-width: thin; }
70.stage { grid-area: stage; position: relative; min-height: 0; }
71.sheet { grid-area: sheet; position: relative; min-height: 0; overflow: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 18px; }
72.procedure { grid-area: procedure; padding-top: 6px; }
73.credit { grid-area: credit; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--rule); }
74
75h1 { font-size: 25px; line-height: 1.1; font-weight: 600; letter-spacing: -0.01em; }
76.lede { margin-top: 7px; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
77.independent { display: none; font-size: 13px; color: var(--ink-2); }
78
79/* the removal order: one chapter open at a time, because 32 rows would not fit beside the phone */
80.group + .group { border-top: 1px solid var(--rule); }
81.group h2 { font-size: 13.5px; font-weight: 500; }
82.chapter-toggle { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 0; text-align: left; line-height: 1.2; color: var(--ink-2); }
83.chapter-toggle:hover, .group.open .chapter-toggle { color: var(--ink); }
84.group.open .chapter-toggle { font-weight: 600; }
85.chapter-toggle .count { font: 400 12px/1.3 var(--mono); }
86.group-steps { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s var(--move); }
87.group.open .group-steps { grid-template-rows: 1fr; }
88.group-inner { min-height: 0; overflow: hidden; visibility: hidden; transition: visibility 0s 0.3s; }
89.group.open .group-inner { visibility: visible; transition-delay: 0s; }
90.step:last-child { margin-bottom: 6px; }
91.step {
92 display: grid;
93 grid-template-columns: 22px 1fr;
94 gap: 8px;
95 align-items: center;
96 width: 100%;
97 min-height: 25px;
98 text-align: left;
99 font-size: 14px;
100 line-height: 1.15;
101}
102.step .n {
103 width: 22px;
104 height: 22px;
105 display: grid;
106 place-items: center;
107 border: 1px solid var(--rule);
108 border-radius: 50%;
109 font: 400 11px/1 var(--mono);
110 color: var(--ink-2);
111 background: var(--paper);
112 transition: background-color 0.2s, border-color 0.2s, color 0.2s;
113}
114.step:hover .n { border-color: var(--ink); color: var(--ink); }
115.step.out .n { background: var(--ink); border-color: var(--ink); color: var(--paper); }
116.step.active .n, .step[aria-pressed='true'] .n { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }
117.step.active span:last-child, .step[aria-pressed='true'] span:last-child { font-weight: 600; }
118
119/* every screw and chip on the part in the sheet */
120.pieces { margin-bottom: 14px; }
121.pieces-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding-bottom: 3px; border-bottom: 1px solid var(--rule); }
122.pieces-head h3 { font-size: 14px; font-weight: 600; }
123.pieces-head a { font-size: 12px; white-space: nowrap; }
124.piece { display: grid; grid-template-columns: 32px 1fr; gap: 0 8px; width: 100%; min-height: 34px; padding: 4px 0; text-align: left; border-bottom: 1px solid var(--rule); }
125.piece-tag { grid-row: span 2; align-self: center; justify-self: start; min-width: 26px; padding: 2px 3px; text-align: center; border: 1px solid var(--rule); border-radius: 999px; font: 400 11px/1.2 var(--mono); color: var(--ink-2); }
126.piece-name { font-size: 13.5px; line-height: 1.2; }
127.piece-role { font-size: 12.5px; line-height: 1.25; color: var(--ink-2); }
128.piece:hover .piece-tag { border-color: var(--ink); color: var(--ink); }
129.piece[aria-pressed='true'] .piece-tag { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }
130.piece[aria-pressed='true'] .piece-name { font-weight: 600; }
131
132/* the stage */
133/* the canvas sits between the two rows of controls, so the model never runs under them */
134.stage canvas, .leaders { position: absolute; left: 0; top: 30px; width: 100%; height: calc(100% - 72px); display: block; }
135.stage canvas { cursor: grab; touch-action: pan-y; }
136.stage canvas:active { cursor: grabbing; }
137.leaders { pointer-events: none; overflow: hidden; }
138.leaders line { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
139.leaders circle.anchor { fill: var(--ink); }
140.leaders g.active line { stroke: var(--accent); stroke-width: 1.5; }
141.leaders g.active circle.anchor { fill: var(--accent); }
142.leaders circle.tag { fill: var(--paper); stroke: var(--ink); stroke-width: 1; pointer-events: auto; cursor: pointer; }
143.leaders g.active circle.tag { fill: var(--accent); stroke: var(--accent); }
144.leaders text { font: 400 11px var(--mono); fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
145.leaders text.name { font: 600 13.5px var(--sans); text-anchor: start; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
146.leaders text.name.end { text-anchor: end; }
147.stage-top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; pointer-events: none; }
148.chapter { font-size: 13.5px; color: var(--ink-2); pointer-events: auto; }
149.restart { pointer-events: auto; font-size: 13px; padding: 3px 10px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); white-space: nowrap; }
150.restart:hover { border-color: var(--ink); }
151.views { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); display: flex; gap: 2px; background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: 2px; }
152.views button { font-size: 13px; padding: 2px 11px; border-radius: 999px; white-space: nowrap; color: var(--ink-2); }
153.views button:hover { color: var(--ink); }
154.views button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
155.no-webgl { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 36ch; }
156
157/* the slider, drawn as a line with a step for each chapter */
158.readout { display: flex; flex-wrap: wrap; gap: 2px 20px; font-size: 13.5px; align-items: baseline; min-height: 21px; }
159.readout strong { font-weight: 600; }
160.readout .num { font-family: var(--mono); font-size: 12.5px; }
161.readout .wide { margin-left: auto; color: var(--ink-2); }
162.transport { display: flex; gap: 14px; align-items: flex-start; padding-top: 4px; }
163.play { flex: none; display: flex; align-items: center; gap: 7px; min-width: 88px; height: 30px; padding: 0 14px 0 12px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 500; }
164.play svg { width: 12px; height: 12px; fill: currentColor; }
165.play:hover { background: #33373c; }
166.track { position: relative; flex: 1; min-width: 0; padding-top: 2px; }
167#progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 26px; margin: 0; background: none; cursor: pointer; touch-action: pan-y; }
168#progress::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--ink) var(--done, 0%), var(--rule) var(--done, 0%)); }
169#progress::-moz-range-track { height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--ink) var(--done, 0%), var(--rule) var(--done, 0%)); }
170#progress::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8.5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--ink); }
171#progress::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid var(--ink); }
172.ticks { position: relative; height: 18px; font-size: 12px; color: var(--ink-2); }
173.ticks span { position: absolute; top: 0; padding-left: 5px; border-left: 1px solid var(--rule); line-height: 16px; white-space: nowrap; overflow: hidden; }
174.ticks span.current { color: var(--ink); font-weight: 600; border-left-color: var(--ink); }
175
176/* the sheet */
177.sheet h2 { font-size: 21px; line-height: 1.15; font-weight: 600; }
178.sheet .partno { font: 400 12.5px var(--mono); color: var(--ink-2); margin-bottom: 2px; }
179.sheet .does { margin-top: 7px; font-size: 14.5px; line-height: 1.42; }
180.facts, .specs dl { margin-top: 9px; border-top: 1px solid var(--rule); }
181.fact { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 5px 0 6px; border-bottom: 1px solid var(--rule); align-items: baseline; }
182.fact dt { font-size: 12.5px; color: var(--ink-2); }
183.fact dd.source { font-size: 12px; white-space: nowrap; }
184.fact dd.value { grid-column: 1 / -1; font: 600 13px/1.35 var(--mono); }
185.fact dd.note { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.35; color: var(--ink-2); margin-top: 2px; }
186.specs h2 { font-size: 15px; }
187.specs .fact { padding: 3px 0 4px; }
188
189/* ------------------------------------------------------------ below the fold */
190.notes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; padding: 36px 20px 48px; border-top: 1px solid var(--rule); font-size: 14px; line-height: 1.5; }
191.notes h2 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
192.notes p + p { margin-top: 9px; }
193.notes li { margin-bottom: 4px; }
194.notes ul + p { margin-top: 9px; color: var(--ink-2); }
195
196/* ------------------------------------------------------------ narrower screens */
197@media (max-width: 1180px) {
198 .bench { grid-template-columns: 200px minmax(0, 1fr) 264px; gap: 0 14px; }
199 .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
200}
201@media (max-width: 920px) {
202 .bench {
203 display: flex;
204 flex-direction: column;
205 height: auto;
206 min-height: 0;
207 padding: 12px 16px 12px;
208 }
209 .title { order: 0; padding-bottom: 6px; }
210 h1 { font-size: 22px; }
211 .lede { display: none; }
212 .independent { display: block; }
213 .stage { order: 1; position: sticky; top: 0; z-index: 2; height: 56svh; min-height: 300px; margin: 0 -16px; background: var(--paper); }
214 .stage canvas, .leaders { top: 38px; height: calc(100% - 88px); }
215 .stage-top { padding: 4px 16px 0; align-items: center; }
216 .chapter-name { display: none; }
217 .chapter { padding: 6px 0; }
218 .procedure { order: 2; position: sticky; top: 56svh; z-index: 2; background: var(--paper); margin: 0 -16px; padding: 0 16px 4px; border-bottom: 1px solid var(--rule); }
219 .steps { order: 3; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; margin: 8px -16px 0; padding: 2px 16px 8px; -webkit-overflow-scrolling: touch; }
220 .steps { position: relative; }
221 .group, .group-steps, .group-inner { display: contents; }
222 .group h2 { display: none; }
223 .step:last-child { margin-bottom: 0; }
224 .step { display: flex; width: auto; flex: none; min-height: 40px; padding: 0 12px 0 6px; border: 1px solid var(--rule); border-radius: 999px; white-space: nowrap; }
225 .piece { min-height: 44px; }
226 .sheet { order: 4; overflow: visible; margin-top: 6px; }
227 .credit { order: 5; }
228 .views { bottom: 4px; max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }
229 .views button { padding: 7px 11px; }
230 .restart { padding: 6px 10px; }
231 .transport { gap: 12px; align-items: center; padding-top: 0; }
232 .play { height: 44px; }
233 .track { padding-top: 0; }
234 .readout { flex-direction: column; flex-wrap: nowrap; gap: 0; }
235 .readout > * { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
236 .readout .wide { display: none; }
237 .ticks { display: none; }
238 #progress { height: 44px; }
239 #progress::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -11.5px; }
240 #progress::-moz-range-thumb { width: 22px; height: 22px; }
241 .notes { grid-template-columns: minmax(0, 1fr); padding: 26px 16px 36px; gap: 22px; }
242}
243
244/* a phone on its side: nothing sticks, or the model would cover the page */
245@media (max-width: 920px) and (max-height: 560px) {
246 .stage, .procedure { position: relative; top: auto; }
247 .stage { height: 86svh; min-height: 0; }
248}
249
250@media (prefers-reduced-motion: reduce) {
251 .group-steps, .group-inner, .step .n { transition: none; }
252}
253
254/* ------------------------------------------------------------ the share card, 1200 x 630 */
255body.card { width: 1200px; height: 630px; overflow: hidden; }
256body.card .site-top, body.card .site-foot, body.card .notes, body.card .independent, body.card .steps, body.card .sheet, body.card .procedure, body.card .credit, body.card .views, body.card .stage-top, body.card .leaders, body.card .lede { display: none; }
257body.card .stage canvas { top: 0; height: 100%; }
258body.card .bench { display: block; position: relative; height: 630px; min-height: 0; padding: 0; }
259body.card .stage { position: absolute; left: 330px; top: 0; right: 0; bottom: 0; }
260body.card .title { position: absolute; left: 56px; bottom: 56px; width: 460px; z-index: 2; padding: 0; }
261body.card h1 { font-size: 76px; line-height: 0.98; letter-spacing: -0.02em; }
262body.card .title::after { content: '32 parts, 67 screws and 45 chips, with a source on every number.'; display: block; margin-top: 18px; font-size: 25px; line-height: 1.25; color: var(--ink-2); max-width: 380px; }
263
264.source-link { margin: 6px 0 0; font-size: 13px; } .source-link a { color: #f58025; text-decoration: none; } .source-link a:hover { text-decoration: underline; } body.card .source-link { display: none; }
265
266/* ------------------------------------------------------------ video link (top of the title) */
267.doc-link { display: flex; align-items: center; gap: 10px; max-width: 100%; margin-bottom: 14px; padding: 5px 8px 5px 5px; border: 1px solid rgba(245, 128, 37, 0.55); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; transition: border-color .2s, box-shadow .2s; }
268.doc-link:hover, .doc-link:focus-visible { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); }
269.doc-thumb { position: relative; flex: none; width: 84px; aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; background: #111; }
270.doc-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
271.doc-thumb::after { content: ''; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6.5v11l9-5.5z' fill='%23fff'/%3E%3C/svg%3E") center / 13px no-repeat; }
272.doc-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; white-space: nowrap; }
273.doc-k { font: 600 10px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: #c65f0f; }
274.doc-t { font: 600 14px/1.2 var(--sans); }
275.doc-m { font: 500 11px/1.2 var(--mono); color: var(--ink-2); }
276@media (max-width: 1180px) { .doc-thumb { width: 64px; } .doc-k { letter-spacing: 0.08em; } }
277@media (max-width: 920px) {
278 .doc-link { width: max-content; margin-bottom: 10px; padding-right: 14px; }
279 .doc-thumb { width: 96px; }
280}
281body.card .doc-link { display: none; }
282</style>
283<meta name="robots" content="noindex"><style id="framed-noscroll">html.framed,html.framed body{scrollbar-width:none;-ms-overflow-style:none}html.framed::-webkit-scrollbar,html.framed body::-webkit-scrollbar{display:none;width:0;height:0}</style><script>if(self!==top)document.documentElement.classList.add("framed")</script></head>
284<body>
285<main class="bench" id="bench">
286 <header class="title">
287 <h1>iPhone Duo teardown</h1>
288 <p class="lede">Apple’s first folding iPhone, rebuilt from code and taken apart in repair order: 32 parts, 67 screws and 45 chips.</p>
289 <p class="independent">Not affiliated with Apple or iFixit.</p>
290 </header>
291
292 <nav class="steps" id="steps" data-ga="teardown_part" aria-label="Parts in removal order"></nav>
293
294 <section class="stage" id="stage" aria-label="3D model of the iPhone Duo">
295 <canvas id="view" aria-hidden="true"></canvas>
296 <svg class="leaders" id="leaders" aria-hidden="true"></svg>
297 <div class="stage-top">
298 <a class="chapter" id="chapter" target="_blank" rel="noopener"></a>
299 <button class="restart" id="restart" data-ga="teardown_restart" type="button">Start over</button>
300 </div>
301 <div class="views" id="views" data-ga="teardown_view" role="group" aria-label="Camera views"></div>
302 <p class="no-webgl" id="no-webgl" hidden>The 3D model needs WebGL. Turn on hardware acceleration in your browser settings and reload this page. The parts list and every sourced number still work.</p>
303 </section>
304
305 <aside class="sheet" id="sheet">
306 <div id="detail" aria-live="polite"></div>
307 <div id="pieces"></div>
308 <section class="specs" aria-label="iPhone Duo specifications">
309 <h2>iPhone Duo</h2>
310 <dl id="specs"></dl>
311 </section>
312 </aside>
313
314 <section class="procedure" aria-label="Teardown progress">
315 <div class="readout" id="readout"></div>
316 <div class="transport">
317 <button class="play" id="play" data-ga="teardown_play" type="button"></button>
318 <div class="track">
319 <input id="progress" type="range" min="0" max="1" step="0.001" value="0" aria-label="Teardown progress, sealed to fully exploded">
320 <div class="ticks" id="ticks" aria-hidden="true"></div>
321 </div>
322 </div>
323 </section>
324
325 <p class="credit">
326 Teardown order and findings from <a href="https://www.ifixit.com/News/119895/iphone-duo-teardown" target="_blank" rel="noopener">iFixit’s iPhone Duo teardown</a>, restated in our own words under <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank" rel="noopener">CC BY-NC-SA 3.0</a>.
327 Not affiliated with, authorized or endorsed by Apple or iFixit.
328 </p>
329</main>
330
331<section class="notes" aria-label="Notes and sources">
332 <div>
333 <h2>How this was made</h2>
334 <p>No photo appears on this page. The phone is drawn entirely by code, using iFixit’s photos and Apple’s service diagrams as a reference for what goes where.</p>
335 <p>Part shapes and positions are traced by eye to place them in the model. They are not measurements. The hinge is the exception: its two pivot points are worked out from Apple’s published open and closed sizes, so the model lands on both.</p>
336 <p>Every screw is placed from Apple’s screw diagrams and carries Apple’s part number and torque. Every named chip is placed from iFixit’s chip ID photos. The crowd of tiny capacitors and resistors around them is drawn to look right: nobody has published those, so they are not counted or named.</p>
337 <p>The chapters follow iFixit’s video. Inside each chapter, the order of the small parts comes from Apple’s repair procedures, because iFixit did not call out every step. iFixit’s repairability score is provisional, and iFixit has not published a Duo repair guide yet.</p>
338 </div>
339 <div>
340 <h2>Not published anywhere we could find</h2>
341 <ul id="unsourced"></ul>
342 <p>These stay blank here rather than being estimated.</p>
343 </div>
344 <div>
345 <h2>Sources</h2>
346 <ul class="sources" id="sources"></ul>
347 </div>
348 <div class="legal">
349 <h2>Credits</h2>
350 <p>Findings by <a href="https://www.ifixit.com/" target="_blank" rel="noopener">iFixit</a>, licensed <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank" rel="noopener">CC BY-NC-SA 3.0</a>. Changes: rewritten and rearranged as an interactive model. iPhone is a trademark of Apple Inc. iFixit is a trademark of iFixit. This is an independent project with no connection to either company.</p>
351 </div>
352</section>
353
354
355<script>
356(()=>{var Em=Object.defineProperty;var Tm=(n,e)=>{for(var t in e)Em(n,t,{get:e[t],enumerable:!0})};var hi={};Tm(hi,{CHAPTERS:()=>Zn,CHIPS_ON:()=>qn,COUNTS:()=>Rl,DISPLAY:()=>Cm,FACTS:()=>xr,FOV:()=>qo,HALF_H:()=>_r,HEADS:()=>vs,HEIGHT:()=>Hu,HINGE:()=>It,ISLAND:()=>Im,LENSES:()=>Rm,PART:()=>Nt,PARTS:()=>Vt,PIECE:()=>vr,PIECES:()=>Oo,SCREWS_OF:()=>li,SEALED:()=>Ci,SPEC:()=>Pn,TOUR_DURATION:()=>Ai,TOUR_KEYS:()=>Xn,UNSOURCED:()=>Il,VIEWS:()=>yr,WINDOW:()=>Kt,accentOf:()=>nd,activeAt:()=>Wo,anchorOf:()=>rd,blendCamera:()=>Sr,bounds:()=>Xo,cableCurve:()=>Fl,calloutsAt:()=>zl,cameraFor:()=>Mr,chapterAt:()=>td,coverY:()=>bs,displayClear:()=>Ju,displayCurve:()=>Ho,ease:()=>cn,envelope:()=>ju,fit:()=>Fo,foldAngle:()=>Ku,foldPhi:()=>Vo,framePhi:()=>Dl,gearTurn:()=>Ul,hingeLinks:()=>ws,hingeRise:()=>Go,hingeSpread:()=>Ll,offsetOf:()=>ci,partBox:()=>od,partK:()=>Yn,partsOut:()=>id,pieceAnchor:()=>ad,pieceHome:()=>ko,pieceK:()=>Bo,pieceOffset:()=>zo,pieceStyle:()=>Bl,readout:()=>Ol,rootPose:()=>es,settledAt:()=>Qi,sizeAt:()=>sd,styleOf:()=>Yo,tourAt:()=>ts,tourCamera:()=>ns});var vs={crosshead:"Crosshead",pentalobe:"Pentalobe PL1.1",super:"Super screw",torx:"Torx Plus 3IP",trilobe:"Trilobe"},Am=[0,1,0],Po=[0,0,1],Sl=[0,0,-1],Ae=(n,e,t,i,s,r,o,a,c=Am)=>({id:n,kind:"screw",part:e,head:t,torque:i,x:s,y:a,z:r,host:o,dir:c}),an=-.82,bl=-1.5,oi=-1.8,ys=[Ae("P1","923-16065 or 923-16067","pentalobe","0.55 kgf cm",-33.6,58.75,"backGlass",-2.6,Po),Ae("P2","923-16065 or 923-16067","pentalobe","0.55 kgf cm",-47.6,58.75,"backGlass",-2.6,Po),Ae("P3","923-16064 or 923-16066","pentalobe","0.55 kgf cm",33.6,58.75,"outerDisplay",-2.6,Po),Ae("P4","923-16064 or 923-16066","pentalobe","0.55 kgf cm",47.6,58.75,"outerDisplay",-2.6,Po),Ae("A1","923-13683","trilobe","0.45 kgf cm",-14.1,-24.4,"batteryCowling",an),Ae("A2","923-13683","trilobe","0.45 kgf cm",-27.2,9.5,"batteryCowling",an),Ae("E2","923-16052","trilobe","0.55 kgf cm",-37,-40.6,"boardCowling",an),Ae("E1","923-16051","trilobe","0.45 kgf cm",-28.9,-34.7,"boardCowling",an),Ae("D6","923-16045","trilobe","0.45 kgf cm",-37.6,-19.9,"boardCowling",an),Ae("E3","923-16049","trilobe","0.55 kgf cm",-41.3,-53.7,"faceTimeCowling",an),Ae("E4","923-16049","trilobe","0.55 kgf cm",-9.4,-50.6,"faceTimeCowling",an),Ae("K1","923-13683","trilobe","0.45 kgf cm",47.6,46.8,"ioCowling",an),Ae("K2","923-16061","trilobe","0.45 kgf cm",64.6,41.6,"ioCowling",an),Ae("K3","923-16061","trilobe","0.45 kgf cm",71.1,53.4,"ioCowling",an),Ae("K4","923-16061","trilobe","0.45 kgf cm",41.1,38.9,"ioCowling",an),Ae("K5","923-16061","trilobe","0.45 kgf cm",14.6,44.4,"ioCowling",an),Ae("K6","923-16061","trilobe","0.45 kgf cm",14.3,54.4,"ioCowling",an),Ae("J6","923-16041","crosshead","0.65 kgf cm",63.6,-49.2,"alsCowling",an),Ae("A6","923-16053","crosshead","0.85 kgf cm",-72.9,44.1,"bottomSpeaker",-1),Ae("A3","923-16054","crosshead","0.85 kgf cm",-69.5,56.5,"bottomSpeaker",-1),Ae("A4","923-16048","crosshead","11.5 Ncm",-39.6,44.1,"bottomSpeaker",-1),Ae("A5","923-16048","crosshead","11.5 Ncm",-35.6,54.4,"bottomSpeaker",-1),Ae("B5","923-16026","trilobe","0.45 kgf cm",-6.4,19,"lowerAntenna",-.84),Ae("B2","923-16051","trilobe","0.45 kgf cm",-6.4,37.1,"lowerAntenna",-.84),Ae("B3","923-16051","trilobe","0.45 kgf cm",-27.6,54.8,"lowerAntenna",-.84),Ae("B1","923-16038","crosshead","0.55 kgf cm",-33,55.5,"taptic",-1),Ae("B4","923-16059","crosshead","11.5 Ncm",-13.8,54.1,"taptic",-1),Ae("B6","923-16050","super","0.65 kgf cm",-27.6,54.8,"mainMic",-1.4),Ae("L1","923-16035","crosshead","0.85 kgf cm",13.6,-45.1,"topSpeaker",-1),Ae("L2","923-16035","crosshead","0.85 kgf cm",31.3,-54,"topSpeaker",-1),Ae("L3","923-16035","crosshead","0.85 kgf cm",52.7,-47.5,"topSpeaker",-1),Ae("F5","923-16055","torx","0.65 kgf cm",34,51,"usbC",-1.2),Ae("F6","923-16055","torx","0.65 kgf cm",47.2,51,"usbC",-1.2),Ae("D1","923-16046","crosshead","0.55 kgf cm",-76.9,-36.5,"cameraSpacer",-1.1),Ae("C6","923-16042","crosshead","0.55 kgf cm",-70.2,-30.2,"cameraSpacer",-1.1),Ae("C5","923-16063","crosshead","0.55 kgf cm",-66.2,-30.2,"cameraSpacer",-1.1),Ae("D3","923-16031","crosshead","0.55 kgf cm",-58.8,-34.4,"cameraSpacer",-1.1),Ae("D2","923-16060","crosshead","14.5 Ncm",-76.9,-51.6,"rearCamera",-1.8),Ae("F1","923-16036","super","14.5 Ncm",-58.8,-34.4,"rearCamera",-1.8),Ae("F2","923-16033","super","14.5 Ncm",-37,-40.6,"rearCamera",-1.3),Ae("E5","923-16037","crosshead","0.55 kgf cm",71.1,-55.4,"outerFront",-.8),Ae("E6","923-16039","crosshead","0.55 kgf cm",78.9,-50.3,"outerFront",-.8),Ae("G6","923-16026","trilobe","0.45 kgf cm",-6.4,8.1,"upperAntenna",-1.1),Ae("G4","923-16030","crosshead","0.55 kgf cm",-22.5,-55.8,"upperAntenna",-1.1),Ae("G5","923-16025","crosshead","0.55 kgf cm",-14.1,-53.7,"upperAntenna",-1.1),Ae("G1","923-16040","super","0.75 kgf cm",-21.5,-49.6,"logicBoard",bl),Ae("G3","923-16044","super","0.75 kgf cm",-14.1,-24.4,"logicBoard",bl),Ae("G2","923-16044","super","0.75 kgf cm",-27.2,9.5,"logicBoard",bl),Ae("M5","923-16043","trilobe","0.45 kgf cm",21.8,56.5,"ioBoard",oi),Ae("M6","923-16043","trilobe","0.45 kgf cm",59.2,56.5,"ioBoard",oi),Ae("L5","923-16058","crosshead","0.55 kgf cm",31.6,53.4,"ioBoard",oi),Ae("L6","923-16058","crosshead","0.55 kgf cm",51.3,53.4,"ioBoard",oi),Ae("M3","923-16057","super","0.65 kgf cm",41.1,38.9,"ioBoard",oi),Ae("M1","923-16057","super","0.65 kgf cm",14.6,44.4,"ioBoard",oi),Ae("M2","923-16057","super","0.65 kgf cm",14.3,54.4,"ioBoard",oi),Ae("M4","923-16062","super","0.65 kgf cm",64.6,41.6,"ioBoard",oi),Ae("L4","923-16056","super","0.65 kgf cm",71.1,53.4,"ioBoard",oi),Ae("H1","923-16029","crosshead","0.55 kgf cm",-33.6,-56.6,"volumeButtons",-2.5,Sl),Ae("H2","923-16029","crosshead","0.55 kgf cm",-50,-56.6,"volumeButtons",-2.5,Sl),Ae("H3","923-16029","crosshead","0.55 kgf cm",-60.1,-56.6,"volumeButtons",-2.5,Sl),Ae("H4","923-16038","crosshead","0.55 kgf cm",-70.9,-55.8,"volumeButtons",-3),Ae("H5","923-16038","crosshead","0.55 kgf cm",-66.2,-55.8,"volumeButtons",-3),Ae("J4","923-16063","crosshead","0.55 kgf cm",-77.6,-19,"touchId",-3),Ae("J1","923-16047","crosshead","0.55 kgf cm",-79.6,-27,"touchId",-3),Ae("J2","923-16032","crosshead","0.65 kgf cm",-79.6,21,"touchId",-3),Ae("J3","923-16034","crosshead","0.55 kgf cm",-77.4,-11,"touchId",-3),Ae("J5","923-16028","crosshead","0.65 kgf cm",-77.4,11,"touchId",-3)],qe=(n,e,t,i,s,r,o,a,c,l,h="package",f=t==="back"?.7:.38)=>({id:n,kind:"chip",host:e,side:t,name:i,role:s,step:r,x:o,z:a,w:c,d:l,h:f,surface:h}),rt="logicBoard",ai="ioBoard",mr=[qe("apl106b",rt,"front","Apple APL106B/338S01447","Power management",1,-23.9,-25.3,7.1,6.1),qe("cp3201q5",rt,"front","Texas Instruments CP3201A0Q5","Battery charger",1,-23.5,-10.8,7,5.3),qe("cbtl",rt,"front","NXP CBTL1701B0","USB Type-C port controller",1,-30.1,-18.1,5.2,5.1),qe("codec",rt,"front","Apple/Cirrus Logic 338S01268","Audio codec",1,-34.8,-8.9,5.4,4.7),qe("amp1",rt,"front","Apple/Cirrus Logic 338S01377","Audio amplifier",1,-35,-14,4.4,3.8),qe("haptic",rt,"front","Apple/Cirrus Logic 338S01267","Haptic driver",1,-32.4,8.2,4.6,3.9),qe("eeprom",rt,"front","Rohm BRCC008GWZ-5","1 kB serial EEPROM memory",1,-19.4,-27.2,1.9,1.8),qe("cp5100",rt,"front","Texas Instruments CP5100A0","LED flash driver",2,-36.5,7.1,3.4,3.3),qe("stpmia",rt,"front","Possibly STMicroelectronics STPMIA3A","Power management",2,-33.7,-26.6,4.7,4.5),qe("lm3638",rt,"front","Likely Texas Instruments LM3638","DC-DC converter",2,-40.6,-.5,2.6,2.4),qe("richtekL",rt,"front","Richtek","DC-DC converter",2,-37.2,-3.9,3,2.9),qe("tps259",rt,"front","Texas Instruments TPS259482A","8 A efuse with bi-directional power delivery",2,-29.7,-12.9,3.7,3.1),qe("tps229",rt,"front","Texas Instruments TPS22915B","2 A, 37 m\u03A9 load switch",2,-40.6,-17.6,1.7,1.6),qe("uwb",rt,"front","USI UWB module","Contains Apple\u2019s U2 Ultra Wideband chip",3,-25,-48.9,8,8.2,"lid"),qe("nfc",rt,"front","NXP Semiconductors","NFC controller",3,-39,-16.3,4.5,4.7),qe("pn800",rt,"front","NXP Semiconductors PN800","NFC controller",3,-28.4,1.9,3.9,4.1),qe("a20",rt,"back","Apple A20 Pro","Applications processor with memory",4,-33.9,-10.1,18,19.4,"lid",1),qe("nand",rt,"back","256 GB NAND","Flash memory",4,-18.3,-5,11.8,16.1),qe("apl109h",rt,"back","Apple APL109H/343S00993","Power management",4,-35.9,4.4,9,8.8),qe("amp2",rt,"back","Apple/Cirrus Logic 338S01377","Audio amplifier",4,-14.9,8.2,4.9,3.7),qe("bcm",rt,"back","Broadcom BCM59367A1IUBG","Wireless charging receiver controller",4,-22.6,5.4,6.7,4.7),qe("qm",rt,"back","Qorvo QM81026A","Envelope tracker",4,-33.9,-23.7,5.6,5.3),qe("max",rt,"back","Analog Devices MAX11390A","Analog-to-digital converter",4,-39.8,-23.7,4.5,5.3),qe("dcdc392",rt,"back","Apple 338S01392","DC-DC converter",5,-39.7,-26.8,3,3.3),qe("tlv",rt,"back","Texas Instruments TLV4031R1YKAR","Comparator with reference",5,-15,4,2.6,2),qe("c2",rt,"back","Apple APL1117/343S00943","C2 5G modem",6,-24.9,-26.5,11.6,9.6,"package",.8),qe("rf",rt,"back","Apple APL1088/338S01421","RF transceiver",6,-25.3,-37.2,8.6,7.8,"package",.8),qe("mmwaveIf",rt,"back","Likely Apple APL1087/338S01410","5G mmWave IF transceiver",6,-15.9,-50.4,6.9,7.6),qe("wifi",rt,"back","Apple/USI 339M00482","Wi-Fi 7 and Bluetooth 6 module, with Apple\u2019s N1 chip inside",6,-18.3,-17.4,12.7,7.4,"lid"),qe("mmwaveFem",rt,"back","Likely Apple 339M00604","5G mmWave front-end module",6,-15.8,-39.7,7.1,12.5,"lid"),qe("afem8283",rt,"back","Broadcom AFEM-8283","Front-end module",6,-26.8,-45.3,5.6,6.5,"lid"),qe("sky540",rt,"back","Skyworks SKY58540-21","Front-end module",6,-38.3,-39.6,5.8,5.7,"lid"),qe("afem8274a",rt,"back","Broadcom AFEM-8274","Front-end module",7,-37.2,-34.1,4.3,4.1,"lid"),qe("afem8274b",rt,"back","Broadcom AFEM-8274","Front-end module",7,-34.6,-44.7,4.3,4.1,"lid"),qe("sky562",rt,"back","Likely Skyworks SKY58562","Front-end module",7,-33.3,-39.2,5.2,4.9,"lid"),qe("imu",rt,"back","Bosch Sensortec","Accelerometer and gyroscope",8,-14.3,-31.5,4.5,4.5),qe("richtekI",ai,"front","Richtek","DC-DC converter",9,25.5,51.7,2.6,2.3),qe("apl106i",ai,"back","Likely Apple APL106I/338S01452","Power management",10,29.2,46,7.4,4.9),qe("cp3201p5",ai,"back","Texas Instruments CP3201A0P5","Battery charger",10,18,46.4,6.3,6.7,"die"),qe("tps656a",ai,"back","Texas Instruments TPS65659A0","Display power supply",10,53.6,46.4,4.3,4.1),qe("tps656b",ai,"back","Texas Instruments TPS65659A0","Display power supply",10,58.8,47.6,4.7,4.1),qe("onsemiA",ai,"back","onsemi","DC-DC converter",10,54.3,42.9,2.5,2),qe("onsemiB",ai,"back","onsemi","DC-DC converter",10,57.4,42.9,2.5,2),qe("dcdcA",ai,"back","Not identified","DC-DC converter",10,61.9,43,2.9,2.5),qe("dcdcB",ai,"back","Not identified","DC-DC converter",10,67.8,46.7,2.9,3.1)].map((n,e)=>({...n,tag:e+1})),Uu=[[-42.7,-48],[-28.5,-48],[-28.5,-55.6],[-15.2,-55.6],[-12,-52.6],[-12,11],[-42.7,11]],Lo=[[14,42.3],[38.7,42.3],[40,40.3],[40,38],[42.8,38],[42.8,42.3],[63,42.4],[63.2,40.4],[66,40.4],[66,42.5],[72,42.7],[72,54.6],[62,54.6],[62,52.4],[49.8,52.8],[48.6,48],[40,48],[38.7,46.6],[33.3,54.2],[14,54.6]],Fu=[[-16.8,-.2,2.8,12.3],[-16.8,-12.5,2.8,12.3],[-39.5,-27.2,2.3,6.7],[-39.7,-33.9,2.7,6.1],[-38.8,-39.8,1.9,4.9],[-35.1,-33.3,1.9,4.9],[-33.9,-39,2.2,4.6],[-35.2,-44.3,5.8,1.9],[-25.8,-53.8,4.5,1.9],[-14.8,-22,1.5,4.6],[-17.1,8.7,6.4,1.8],[-21.4,-.3,2.3,8],[-23.9,7.4,1.6,4.9]],Ou=[[24,44.8,9.4,2.1],[34,44.8,9,2.1],[66.4,45,8.1,2],[66.4,49.2,8.1,2],[59,44.8,4,1.6]],Bu=[[-27.2,9.5],[-14.1,-24.4],[-37,-40.6],[-21.5,-49.6]],zu=[[41.1,38.9],[14.6,44.4],[14.3,54.4],[64.6,41.6],[71.1,53.4]];var Pn={open:{w:164.6,h:117.8,t:5.2},closed:{w:84.1,h:117.8,t:11.3},weightG:254,batteryWh:[7.5,11.6],batteryTotalWh:19.1,batteryMah:4883,repairScore:5},Do=25.4,Cm={inner:{w:2670/430*Do,h:1878/430*Do},outer:{w:1398/460*Do,h:2034/460*Do}},Ss=Pn.open.w/2,wl=Pn.closed.t/2,El=Pn.closed.w-Ss,It={halfOpen:Ss,halfThick:wl,spineReach:El,faceGap:Pn.closed.t-2*Pn.open.t,axisX:(wl-El)/2,axisY:-(wl+El)/2,panelEdge:2.4,coverBand:2.1,coverSplit:.45,displayEdge:14,coverDrop:.7,mechanismRest:.2,cableLift:1.25,pleatDepth:.16},Hu=Pn.open.h,_r=Hu/2,Rm={x:[-69.6,-51.4],z:-45.6,ring:8.4},Im={x0:-79.5,x1:-41.5,halfDepth:11.4},Wu=(n,e=0,t=1)=>Math.min(t,Math.max(e,n)),Bt=(n,e,t)=>n+(e-n)*t,cn=n=>{let e=Wu(n);return e*e*e*(e*(e*6-15)+10)},Ln=(n,e,t)=>Wu((n-e)/(t-e)),gr=Math.PI/180,Zn=[{id:"look",short:"Look",name:"First look",time:"0:00"},{id:"open",short:"Open",name:"Opening the phone",time:"4:02"},{id:"battery",short:"Batteries",name:"Electrically released batteries",time:"5:22"},{id:"audio",short:"Audio",name:"Speakers, sensors and USB-C",time:"6:33"},{id:"camera",short:"Cameras",name:"Taking out the cameras",time:"7:26"},{id:"board",short:"Boards",name:"The flat logic board",time:"8:39"},{id:"inner",short:"Display",name:"Removing the inner display",time:"9:29"},{id:"hinge",short:"Hinge",name:"Inside the hinge",time:"10:57"},{id:"cable",short:"Cable",name:"The cable joining both halves",time:"13:05"},{id:"shell",short:"Shell",name:"What is left in the shell",time:"13:05"}],at={panels:204,adhesive:192,cowlings:136,batteries:110,audio:88,antennas:76,cameras:62,boards:36,flex:14,hinge:-30,display:-58,cover:-72,trim:-84,clearance:62,button:16},oe=(n,e,t,i)=>({k:n,v:e,s:t,note:i}),Vt=[{id:"backGlass",chapter:"open",side:"B",name:"Back glass",weight:2.4,major:!0,rect:[-81.6,-58,-It.panelEdge,58],y:[-.7,0],out:[0,at.panels,0],view:"three",does:"Closes up the camera half of the phone. It stays tethered to the logic board by a flex cable while it opens, and Apple warns that a poor replacement can slow wireless charging.",facts:[oe("Material","Ceramic Shield","appleSpecs"),oe("Held by","Adhesive and 2 pentalobe screws beside USB-C","appleBackGlass"),oe("Part number","661-65096 or 661-65097","appleParts"),oe("Apple service price","$199","ifixitPrices")]},{id:"backAdhesive",chapter:"open",side:"B",name:"Back glass adhesive",weight:.8,rect:[-81.6,-58,-It.panelEdge-.3,58],y:[-.74,-.7],out:[0,at.adhesive,0],view:"three",does:"A thin sheet cut to the edge of the panel. It seals the phone, and it never goes back: Apple has you pull it off the frame and lay a new one.",facts:[oe("Part number","923-15257","appleParts"),oe("Sold as","30 sheets","appleParts")]},{id:"outerDisplay",chapter:"open",side:"O",name:"Outer display",weight:2.4,major:!0,rect:[It.panelEdge,-58,81.6,58],y:[-.7,0],out:[0,at.panels,0],view:"three",does:"The screen you use with the phone closed. It came off intact for iFixit, which matters because several internal repairs have to go through it.",facts:[oe("Size","5.4 in, 1398 \xD7 2034, 460 ppi","appleSpecs"),oe("Cover","Ceramic Shield 2","appleSpecs"),oe("Held by","Adhesive, clips and 2 pentalobe screws","appleOuterDisplay"),oe("Part number","661-65970","appleParts"),oe("Apple service price","$379","ifixitPrices")]},{id:"outerAdhesive",chapter:"open",side:"O",name:"Outer display adhesive",weight:.8,rect:[It.panelEdge+.3,-58,81.6,58],y:[-.74,-.7],out:[0,at.adhesive,0],view:"three",does:"The same job on the display side. Apple warns not to let it cover the top speaker grille when you clean it off.",facts:[oe("Part number","923-15256","appleParts"),oe("Sold as","30 sheets","appleParts")]},{id:"batteryCowling",chapter:"open",side:"B",name:"Battery connector cowling",weight:1.5,rect:[-30,-26.5,-12.6,12],y:[-.98,-.82],out:[0,at.cowlings,0],view:"three",does:"A cover that clamps the flex connectors to the board. Apple has you lift the battery flex first, so the phone stays off for everything after it.",facts:[oe("Part number","923-15755","appleParts"),oe("Reassembly","Hooks sit under the lip of the enclosure","appleBackGlass")]},{id:"boardCowling",chapter:"open",side:"B",name:"Logic board upper cowling",weight:1.5,rect:[-41,-44,-24,-16],y:[-.98,-.82],out:[0,at.cowlings,0],view:"three",does:"Covers flex connectors at the top of the board. Its three trilobe screws go in at two different torques.",facts:[oe("Part number","923-15754","appleParts"),oe("Screws","3 trilobe, on two different torques","appleScrews")]},{id:"faceTimeCowling",chapter:"open",side:"B",name:"FaceTime camera cowling",weight:1.5,rect:[-43,-56.4,-8,-47.6],y:[-.98,-.82],out:[0,at.cowlings,0],view:"three",does:"A long bar across the top of the board that holds the FaceTime camera\u2019s flex cable down.",facts:[oe("Part number","923-15757","appleParts")]},{id:"ioCowling",chapter:"open",side:"O",name:"I/O board cowling",weight:1.7,rect:[14,38,72,54.6],y:[-.98,-.82],out:[0,at.cowlings,0],view:"three",does:"A long cover across the I/O board. Two of its screws hide under caps, and five of them sit on top of the super screws that hold the board.",facts:[oe("Part number","923-15756","appleParts"),oe("Screw caps","2, part 923-16069","appleOuterDisplay"),oe("Screws","6 trilobe","appleOuterDisplay")]},{id:"alsCowling",chapter:"open",side:"O",name:"Ambient light sensor cowling",weight:1.1,rect:[59.6,-53.6,68,-44.6],y:[-.98,-.82],out:[0,at.cowlings,0],view:"three",does:"A small cover over the ambient light sensor\u2019s flex connector. It hooks under the top speaker.",facts:[oe("Part number","923-15758","appleParts")]},{id:"battery1",chapter:"battery",side:"B",name:"Battery 1",weight:2.6,major:!0,rect:[-78,-28,-16,40.6],y:[-3.7,-.9],out:[0,at.batteries,0],view:"outside",does:"The L-shaped cell, wrapped around the logic board. Its adhesive lets go when current runs through the release tabs, so it lifts out without prying.",facts:[oe("Energy","7.5 Wh","ifixitTeardown","iFixit labels its cells by photo position. Matched to Apple\u2019s Battery 1 by shape."),oe("Release","9 V for 90 seconds per tab","appleBattery"),oe("Part number","661-66166","appleParts"),oe("Apple service price","$229 for both cells","ifixitPrices")]},{id:"battery2",chapter:"battery",side:"O",name:"Battery 2",weight:2.6,major:!0,rect:[17.4,-40,79.8,37.4],y:[-3.7,-.9],out:[0,at.batteries,0],view:"outside",does:"The larger cell, on the outer display side. iFixit found charging hardware on one side only, so one of the two cells charges through the cable that crosses the hinge.",facts:[oe("Energy","11.6 Wh","ifixitTeardown","iFixit labels its cells by photo position. Matched to Apple\u2019s Battery 2 by shape."),oe("Both cells","19.1 Wh","ifixitTeardown"),oe("Rated capacity","4,883 mAh","macrumorsBattery"),oe("Release tabs","2, black, 9 V for 90 seconds each","appleBattery2"),oe("Part number","661-66165","appleParts")]},{id:"bottomSpeaker",chapter:"audio",side:"B",name:"Bottom speaker",weight:2.2,major:!0,rect:[-74,41.4,-35,57.6],y:[-3.6,-1],out:[0,at.audio,0],view:"three",does:"One half of the stereo pair. It sits in the back glass half, and its lower grounding screw doubles as the negative contact when you release Battery 1.",facts:[oe("Audio","Built-in stereo speakers","appleSpecs"),oe("Amplifier","Apple/Cirrus Logic 338S01377","ifixitChips"),oe("Ground point","Lower right screw","appleBattery"),oe("Part number","923-15993","appleParts")]},{id:"lowerAntenna",chapter:"audio",side:"B",name:"Lower antenna flex",weight:1.8,rect:[-30,6,-4,58],y:[-1,-.84],out:[0,at.antennas,0],view:"three",does:"A long flex cable down the hinge side and along the bottom edge. Apple has you peel it back to reach the Taptic Engine.",facts:[oe("Screws","3 trilobe","appleTaptic"),oe("Comes off","Peeled back to reach the Taptic Engine","appleTaptic")]},{id:"taptic",chapter:"audio",side:"B",name:"Taptic Engine",weight:2,rect:[-34.4,43.6,-9,56],y:[-3.6,-1],out:[0,at.audio,0],view:"three",does:"The small motor behind the taps and clicks you feel. iFixit does not call it out, so its place in this order comes from Apple\u2019s manual.",facts:[oe("Drives Haptic Touch","Both displays","appleSpecs"),oe("Driver chip","Apple/Cirrus Logic 338S01267","ifixitChips"),oe("Part number","923-15994","appleParts")]},{id:"mainMic",chapter:"audio",side:"B",name:"Main microphone",weight:1.6,rect:[-31,51.8,-18,57.8],y:[-3,-1.4],out:[0,at.audio,0],view:"three",does:"Held by one super screw and a strong adhesive. Apple says to slide it toward the top of the enclosure until the glue lets go.",facts:[oe("Part number","923-15996","appleParts"),oe("Adhesive","923-15260","appleParts")]},{id:"topSpeaker",chapter:"audio",side:"O",name:"Top speaker",weight:2,major:!0,rect:[12,-56.5,56,-41],y:[-3.6,-1],out:[0,at.audio,0],view:"three",does:"The other half of the stereo pair, in the outer display half, so the two speakers sit on opposite sides of the hinge. Apple warns not to touch its grounding springs.",facts:[oe("Audio","Built-in stereo speakers","appleSpecs"),oe("Position","Outer display side","appleParts"),oe("Part number","923-15995","appleParts")]},{id:"usbC",chapter:"audio",side:"O",name:"USB-C connector",weight:1.8,major:!0,rect:[31.6,49.6,49.6,58.4],y:[-3.8,-1.2],out:[0,at.audio,0],view:"three",does:"Charging, data and video all come through here, on the outer display half. iFixit calls the charging hardware easy to reach.",facts:[oe("Data","USB 3, up to 10 Gb/s","appleSpecs"),oe("Fast charge","Up to 50% in around 20 min, 60 W adapter","appleSpecs"),oe("Port controller","NXP CBTL1701B0","ifixitChips"),oe("Part number","923-16023 or 923-16024","appleParts")]},{id:"cameraSpacer",chapter:"camera",side:"B",name:"Camera spacer",weight:1.8,rect:[-80,-38,-44,-28.6],y:[-1.5,-1.1],out:[0,at.cameras+13,0],view:"three",does:"A thin frame under the camera\u2019s edge. One of its screws sits on top of a super screw that holds the camera, the arrangement Apple calls a top screw with a screw underneath.",facts:[oe("Part number","923-16068","appleParts"),oe("Screws","4 crosshead","appleCamera")]},{id:"rearCamera",chapter:"camera",side:"B",name:"Rear camera",weight:2.2,major:!0,rect:[-78.4,-55,-35.6,-33],y:[-4.2,-.8],out:[0,at.cameras,0],view:"edge",does:"Two 48 MP cameras in one assembly, sitting close to the surface under brackets and a lot of screws.",facts:[oe("Main","48 MP, 26 mm, \u0192/1.6, sensor-shift","appleSpecs"),oe("Ultra Wide","48 MP, 13 mm, \u0192/2.2","appleSpecs"),oe("Part number","661-65968","appleParts"),oe("Apple service price","$229","ifixitPrices")]},{id:"faceTime",chapter:"camera",side:"B",name:"FaceTime camera",weight:1.4,rect:[-41,-55,-29.6,-48.4],y:[-5,-2.2],out:[0,at.cameras,0],view:"edge",does:"Looks out through gaps in the inner display\u2019s pixel pattern. It keeps the screen unbroken, and iFixit notes reviewers call its photos muddy.",facts:[oe("Lens","\u0192/1.8","appleSpecs"),oe("Video","1080p at up to 60 fps","appleSpecs"),oe("Part number","661-65969","appleParts")]},{id:"outerFront",chapter:"camera",side:"O",name:"Outer front camera",weight:1.8,rect:[68,-56.4,80,-42],y:[-3,-.8],out:[0,at.cameras,0],view:"edge",does:"The selfie camera for the closed phone. iFixit calls it incredibly thin.",facts:[oe("Sensor","12 MP Center Stage","appleSpecs"),oe("Lens","\u0192/2.2","appleSpecs"),oe("Part number","661-65971","appleParts")]},{id:"upperAntenna",chapter:"board",side:"B",name:"Upper antenna flex",weight:1.8,rect:[-24,-57,-4,10],y:[-1.5,-1.1],out:[0,at.antennas-28,0],view:"three",does:"The other long flex, running up the hinge side and across the top of the board. It has to come off before the board can.",facts:[oe("Screws","1 trilobe, 2 crosshead","appleLogicBoard","Apple names the two crosshead screws under the lower antenna flex. They sit at the top of the board, so they are grouped with this part here.")]},{id:"logicBoard",chapter:"board",side:"B",name:"Logic board",weight:6,major:!0,rect:[-42.7,-55.6,-12,11],y:[-3.2,-1.5],out:[0,at.boards,0],view:"three",margin:1.08,does:"The main board, and unusually flat. Almost every iPhone since the 8 has stacked two boards, but this one is a single layer with some jobs moved to the I/O board.",facts:[oe("Chip","A20 Pro, 6-core CPU, 7-core GPU","appleSpecs"),oe("Memory","12 GB LPDDR5X","ifixitDevice"),oe("Modem","Apple C2 (APL1117)","ifixitChips"),oe("Wireless","Apple N1, Wi-Fi 7 and Bluetooth 6","ifixitChips"),oe("Flex cables","8 still connected at the last step","appleVolume"),oe("Part number","661-66067 to 661-66070, by storage","appleParts")]},{id:"ioBoard",chapter:"board",side:"O",name:"I/O board",weight:5,major:!0,rect:[14,38,72,57.4],y:[-3,-1.8],out:[0,at.boards,0],view:"three",margin:1.1,does:"The second single-layer board. It takes on work the logic board would otherwise carry, including a battery charger and the display power supply.",facts:[oe("Charger","TI CP3201A0P5","ifixitChips"),oe("Display power","TI TPS65659A0","ifixitChips"),oe("Grounding springs","2, one screw each","appleIo"),oe("Part number","923-16015","appleParts")]},{id:"displayTrim",chapter:"inner",side:"C",name:"Inner display trim",weight:1.4,rect:[-82,-58,82,58],y:[-5.32,-4.9],out:[0,at.trim,0],view:"inner",does:"The black surround of the big screen. Apple has you work it off with a black nylon stick and unhook its clips at the hinge before the display can move.",facts:[oe("Part number","923-16158","appleParts"),oe("In iFixit\u2019s teardown","Came off in one piece","ifixitTeardown")]},{id:"coverLayer",chapter:"inner",side:"C",name:"Cover layer",weight:1.4,rect:[-81,-57,81,57],y:[-5.24,-5.2],out:[0,at.cover,0],view:"inner",does:"The nano-texture skin that hides the crease. It is the cheapest part of the screen to replace, and it comes off without touching the OLED under it.",facts:[oe("Finish","Nano-texture","appleSpecs"),oe("Part number","923-16004","appleParts"),oe("Apple service price","$49","ifixitPrices")]},{id:"innerDisplay",chapter:"inner",side:"C",name:"Inner display",weight:3,major:!0,rect:[-81,-57,81,57],y:[-5.2,-4.6],out:[0,at.display,0],view:"inner",does:"The folding OLED, and the expensive part. Apple describes more than ten ultrathin layers on adhesives that let them glide.",facts:[oe("Size","7.6 in, 1878 \xD7 2670, 430 ppi","appleSpecs"),oe("Part number","923-15877","appleParts"),oe("Apple service price","$999","ifixitPrices")]},{id:"hinge",chapter:"hinge",side:"C",name:"Hinge",weight:6,major:!0,rect:[-17,-57,17,57],y:[-4.4,-1],out:[0,at.hinge,0],view:"three",margin:1.2,keeps:["enclosure","flexCable"],does:"Gears keep the two halves moving together, springs help it hold position, and a chain of joints shares the bend like a metal watch band. iFixit\u2019s untested hypothesis for the cracked screens is a center support bar that does not drop far enough. The cause is not confirmed.",facts:[oe("Components","More than 100","applePress"),oe("Dust test","Powder reached the moving parts","ifixitTeardown","iFixit says this is not an IP test."),oe("Apple\u2019s repair","Replace the inner display assembly","appleHinge")]},{id:"flexCable",chapter:"cable",side:"C",name:"Hinge flex cable",weight:3.6,major:!0,rect:[-15,-7,15,7],y:[-4.1,-3.6],out:[0,at.flex,0],view:"three",margin:3,does:"Crosses the gap between the halves in accordion pleats, carrying power, video and audio. One battery charges through it.",facts:[oe("Shape","Accordion-pleated flex","ifixitTeardown"),oe("Named in","Hinge and interposer flex cables","appleParts")]},{id:"volumeButtons",chapter:"shell",side:"B",name:"Volume buttons",weight:2.4,rect:[-74,-58.8,-33,-54],y:[-3.6,-1.4],out:[0,0,-at.button],view:"three",does:"Each button is held by a clip and a tiny roll bar. Once the clips are pushed up, the buttons go out through the enclosure.",facts:[oe("Roll bars","2, reused","appleVolume"),oe("Part number","923-16122 or 923-16123","appleParts"),oe("Flex cable","923-15873","appleParts")]},{id:"touchId",chapter:"shell",side:"B",name:"Touch ID and Camera Control",weight:2.4,rect:[-82.6,-31,-76,25],y:[-3.6,-1.4],out:[-at.button,0,0],view:"three",does:"Two side buttons sharing one flex cable. Unlike the volume buttons, their clips do not survive: Apple has you cut them with needle-nose pliers.",facts:[oe("Flex cable","923-15875 or 923-15876","appleParts"),oe("Cowlings","2, part 923-15753","appleTouchId")]},{id:"enclosure",chapter:"shell",side:"C",name:"Enclosure",weight:1.4,major:!1,rect:[-It.halfOpen,-_r,It.halfOpen,_r],y:[-5.2,0],out:[0,0,0],view:"three",margin:1.2,does:"What is left when everything else is out. Polished titanium side rails, a 3D-printed hinge cover and an aluminum internal frame. It is the last thing iFixit has on the table.",facts:[oe("Rails","Grade 5 titanium","applePress"),oe("Hinge cover","3D-printed recycled titanium","appleSpecs"),oe("Internal frame","Recycled aluminum","appleSpecs"),oe("Apple service price","$1,499 for other damage","ifixitPrices")]}].map((n,e)=>({...n,n:e+1})),Nt=Object.fromEntries(Vt.map(n=>[n.id,n])),Xu=n=>{var t;let e={};for(let i of n)(e[t=i.host]??(e[t]=[])).push(i);return e},li=Xu(ys),qn=Xu(mr),vr=Object.fromEntries([...ys,...mr].map(n=>[n.id,n])),Oo=Object.values(vr),Pm=n=>n.kind==="screw"?vs[n.head]:n.name,Rl={parts:Vt.length,screws:ys.length,chips:mr.length},Ci={id:"sealed",n:0,chapter:"look",name:"Sealed phone",view:"three",does:"Closed, the Duo is about the size of a passport. Open, it is the thinnest iPhone Apple has made. Everything below comes out in the order iFixit opened it.",facts:[]},xr=[{k:"Closed",v:"84.1 \xD7 117.8 \xD7 11.3 mm",s:"appleSpecs"},{k:"Open",v:"164.6 \xD7 117.8 \xD7 5.2 mm",s:"appleSpecs"},{k:"Weight",v:"254 g",s:"appleSpecs"},{k:"Batteries",v:"7.5 + 11.6 = 19.1 Wh",s:"ifixitTeardown"},{k:"Rated capacity",v:"4,883 mAh",s:"macrumorsBattery"},{k:"Chip",v:"A20 Pro",s:"appleSpecs"},{k:"Screws",v:`${ys.length}, in ${Object.keys(vs).length} head types`,s:"appleScrews",note:"Counted from Apple\u2019s repair procedures."},{k:"Chips named",v:`${mr.length}`,s:"ifixitChips",note:"Counted from iFixit\u2019s chip ID."},{k:"Repairability",v:"5/10, provisional",s:"ifixitTeardown"}],Il=["Part-by-part sizes and weights","Screw lengths and chip dimensions","Hinge dimensions and tolerances","Each cell\u2019s capacity in mAh from Apple","The cause of the reported screen cracks"],qu=[{id:"unfold",weight:3},...Vt.map(({id:n,weight:e})=>({id:n,weight:e}))],ku=qu.reduce((n,e)=>n+e.weight,0),Kt={};{let n=0;for(let{id:e,weight:t}of qu)Kt[e]=[n/ku,(n+t)/ku],n+=t}var Qi=n=>n==="sealed"?0:Kt[n][1],Yu=.46,Zu=.42,Pl=.66,$u=.86,Lm=n=>{let[e,t]=Kt[n];return n==="hinge"?[Bt(e,t,Pl),Bt(e,t,$u)]:[li[n]?Bt(e,t,Yu):e,qn[n]?Bt(e,t,1-Zu):t]},Yn=(n,e)=>{let[t,i]=Lm(n);return cn(Ln(e,t,i))},Vu=(n,e,t,i,s)=>{let r=(t-e)/(1+(s-1)/2),o=e+i*r/2;return cn(Ln(n,o,o+r))},Bo=(n,e)=>{let[t,i]=Kt[n.host];if(n.kind==="screw"){let r=li[n.host];return Vu(e,t,Bt(t,i,Yu),r.indexOf(n),r.length)}let s=qn[n.host];return Vu(e,Bt(t,i,1-Zu),i,s.indexOf(n),s.length)},Ll=n=>{let[e,t]=Kt.hinge,i=cn(Ln(n,Bt(e,t,$u),t));return{springs:6*i,gears:12*i,bar:-6*i}},Ju=n=>{let[e]=Kt.hinge,[,t]=Kt.flexCable,i=(t-e)*.16;return-at.clearance*cn(Ln(n,e-i,e))*(1-cn(Ln(n,t,t+i)))},Dm=new Set(["displayTrim","coverLayer","innerDisplay"]),ci=(n,e)=>{let t=Nt[n],i=Yn(n,e);return[t.out[0]*i,t.out[1]*i+(Dm.has(n)?Ju(e):0),t.out[2]*i]},No=8,Tl=6,zo=(n,e)=>{let t=Bo(n,e),[i,s,r]=ci(n.host,e);if(n.kind==="chip")return[i,s+(n.side==="back"?-Tl:Tl)*t,r];let[o,a,c]=n.dir;return[i+o*No*t,s+a*No*t,r+c*No*t]},Nm={logicBoard:[-3.2,-1.5],ioBoard:[-3,-1.8]},ko=n=>{if(n.kind==="screw")return[n.x,n.y,n.z];let[e,t]=Nm[n.host];return[n.x,n.side==="back"?e-n.h/2:t+n.h/2,n.z]},Vo=n=>{let[e,t]=Kt.unfold;return Math.PI/2*(1-cn(Ln(n,Bt(e,t,.14),t)))},Dl=n=>{let[e,t]=Kt.hinge,i=Ln(n,e,Bt(e,t,Pl));return 62*gr*Math.sin(Math.PI*cn(i))**2},Ku=n=>180-2*Vo(n)/gr,Nl=(n,e,t)=>{let i=n-It.axisX,s=e-It.axisY,r=Math.cos(t),o=Math.sin(t);return[It.axisX+i*r+s*o,It.axisY-i*o+s*r]},ju=n=>{let e=[[It.panelEdge,0],[Ss,0],[Ss,-Pn.open.t],[It.panelEdge,-Pn.open.t]].map(([o,a])=>Nl(o,a,n)),t=e.flatMap(([o])=>[o,-o]),i=e.map(([,o])=>o),s=bs(n);return{x:Math.max(...t,0),yMin:Math.min(...i),yMax:Math.max(...i,s)}},bs=n=>-It.coverDrop*(1-Math.sin(n))**12,Go=n=>It.mechanismRest+bs(n)-bs(0),es=n=>{let e=Vo(n),{x:t,yMin:i,yMax:s}=ju(e),r=(i+s)/2,o=-e,a=Math.cos(o),c=Math.sin(o);return{rot:o,x:r*c,y:-r*a,phi:e,reach:t}},Uo=(n,e,t)=>{let i=Math.cos(t.rot),s=Math.sin(t.rot);return[t.x+n*i-e*s,t.y+n*s+e*i]},ws=n=>{let e=[2,2,6.7],t=It.axisX,i=It.axisY+Go(n),s=0;return e.map((r,o)=>{s=-n*(o+1)/e.length;let a={x:t,y:i,rot:s,length:r};return t+=r*Math.cos(s),i+=r*Math.sin(s),a})},Ul=(n,e)=>(e%2?-1:1)*n*2,Qu=2*It.displayEdge,ed=(n,e,t)=>n*Math.cos(Math.PI*t)+e*Math.sin(2*Math.PI*t),Um=(n,e,t)=>{let i=t/2,s=0;for(let r=0;r<i;r++)s+=Math.cos(ed(n,e,(r+.5)/t));return s*Qu/t},Fm=(n,e,t)=>{let i=0,s=1.2;for(let r=0;r<24;r++){let o=(i+s)/2;Um(n,o,t)>e?i=o:s=o}return(i+s)/2},Ho=(n,e=32)=>{let[t,i]=Nl(It.displayEdge,-Pn.open.t,n),s=Fm(n,t,e),r=Qu/e,o=[[-t,i]];for(let a=0;a<e;a++){let c=ed(n,s,(a+.5)/e),[l,h]=o[a];o.push([l+Math.cos(c)*r,h+Math.sin(c)*r])}return o},Om=9,Fl=(n,e=72)=>{let t=Ho(n,e),i=It.pleatDepth*(1-Math.sin(n));return t.map(([s,r],o)=>{let[a,c]=t[Math.max(o-1,0)],[l,h]=t[Math.min(o+1,e)],f=Math.hypot(l-a,h-c),u=o/e,d=It.cableLift+i*Math.sin(2*Math.PI*Om*u)*Math.sin(Math.PI*u);return[s-(h-c)/f*d,r+(l-a)/f*d]})},Wo=n=>{let e=Ci;for(let t of Vt)n>Kt[t.id][0]+1e-6&&(e=t);return e},td=n=>Zn.findIndex(e=>e.id===Wo(n).chapter),nd=(n,e)=>{let[t,i]=Kt[n],s=i-t;return Math.min(cn(Ln(e,t,t+s*.3)),1-cn(Ln(e,Bt(t,i,.7),i)))},id=n=>Vt.filter(e=>n>=Kt[e.id][1]-1e-9).length,sd=n=>{let e=Vo(n);return e>=Math.PI/2-1e-6?xr[0]:e<=1e-6?xr[1]:null},Ol=n=>({part:Wo(n),chapter:td(n),angle:Ku(n),size:sd(n),out:id(n),total:Vt.length,screws:ys.filter(t=>Bo(t,n)>=1).length}),Al=({rect:n})=>n[0]+n[2]<0,Bm=n=>{let{rect:e,y:t}=n;return[Bt(e[0],e[2],Al(n)?.25:.75),t[1],Bt(e[1],e[3],.78)]},rd=(n,e)=>{let t=Nt[n],[i,s,r]=Bm(t),[o,a,c]=ci(n,e),[l,h]=Uo(i+o,s+a,es(e));return[l,h,r+c]},Xo=n=>{let e=es(n),t=[];for(let[l,h]of[[Ss,0],[Ss,-Pn.open.t],[It.panelEdge,0]]){let[f,u]=Nl(l,h,e.phi);t.push(Uo(f,u,e),Uo(-f,u,e))}let i=0,s=0;for(let l of Vt){let h=ci(l.id,n)[1];i=Math.max(i,l.y[1]+h),s=Math.min(s,l.y[0]+h)}let r=3,o=t.map(([l])=>l),a=t.map(([,l])=>l),c=at.button*Yn("volumeButtons",n);return{min:[Math.min(...o)-at.button*Yn("touchId",n),Math.min(...a,s+e.y),-_r-c],max:[Math.max(...o),Math.max(...a,i+r+e.y),_r]}},od=(n,e)=>{let t=Nt[n],i=ci(n,e)[1],s=es(e),r=3,o=qn[n]?Tl:li[n]?No:0,[a,,c]=ci(n,e);return{min:[t.rect[0]+a-r,t.y[0]+i+s.y-r-(qn[n]?o:0),t.rect[1]+c-r],max:[t.rect[2]+a+r,t.y[1]+i+s.y+r+o,t.rect[3]+c+r]}},qo=22,yr={three:{name:"Three-quarter",az:-24,el:30},outside:{name:"Outside",az:0,el:80},edge:{name:"Side",az:0,el:6},inner:{name:"Inner",az:22,el:-40},hinge:{name:"Hinge",az:16,el:-50,margin:1.75}},Fo=(n,e,t,i,s=1.12)=>{let r=e*gr,o=t*gr,a=[Math.cos(o)*Math.sin(r),Math.sin(o),Math.cos(o)*Math.cos(r)],c=[Math.cos(r),0,-Math.sin(r)],l=[a[1]*c[2]-a[2]*c[1],a[2]*c[0]-a[0]*c[2],a[0]*c[1]-a[1]*c[0]],h=[0,1,2].map(g=>(n.min[g]+n.max[g])/2),f=[0,1,2].map(g=>(n.max[g]-n.min[g])/2),u=0,d=0,m=0;for(let g of[-1,1])for(let p of[-1,1])for(let S of[-1,1]){let T=[g*f[0],p*f[1],S*f[2]],y=w=>T[0]*w[0]+T[1]*w[1]+T[2]*w[2];u=Math.max(u,Math.abs(y(c))),d=Math.max(d,Math.abs(y(l))),m=Math.max(m,y(a))}let v=Math.tan(qo*gr/2);return{target:h,az:e,el:t,dist:Math.max(u/(v*i),d/v)*s+m}},zm={back:{min:[-48,-6,-60],max:[0,2,16]}},Mr=(n,e,t,i=null)=>{let s=yr[n];return i?Fo(od(i,e),s.az,s.el,t,s.margin??Nt[i].margin??1.45):Fo(Xo(e),s.az,s.el,t)},Sr=(n,e,t)=>({target:n.target.map((i,s)=>Bt(i,e.target[s],t)),az:Bt(n.az,e.az,t),el:Bt(n.el,e.el,t),dist:Bt(n.dist,e.dist,t)}),Yo=(n,e,t,i,s=null,r=1)=>{let o=nd(n,e)*(1-i),a=n===t?i*r:n===s?i*(1-r):0,c=t&&(n===t||Yn(t,e)<.5&&Nt[t].keeps?.includes(n)),l=t&&!c?i:0;return{drawing:n===t?i*(1-r):n===s?l*r:l,line:Math.max(o,a*.25),tint:o*.6}},km=.72,Bl=(n,e,t,i,s,r=null,o=1)=>{let a=Bo(n,e);return{drawing:Yo(n.host,e,t,i,r,o).drawing,tint:n.id===s?km:.7*Math.sin(Math.PI*a)*(1-i)}},ad=(n,e)=>{let[t,i,s]=ko(n),[r,o,a]=zo(n,e),[c,l]=Uo(t+r,i+o,es(e));return[c,l,s+a]},zl=(n,e=null,t="three",i=null)=>{if(i){let c=vr[i];return[{id:c.host,n:c.kind==="screw"?c.id:c.tag,name:Pm(c),at:ad(c,n),side:Al(Nt[c.host])?"left":"right",active:!0}]}let s=Wo(n),r=t==="three"||t==="edge",o=c=>c===s||r&&c.major;return(e?[Nt[e]]:Vt.filter(c=>c.id!=="enclosure"&&Yn(c.id,n)>.55&&o(c))).map(c=>({id:c.id,n:c.n,name:c.name,at:rd(c.id,n),side:Al(c)?"left":"right",active:e?!0:c.id===s.id}))},ji=n=>Qi(n),Vm=1.5,Ms=.8,Gm=({id:n})=>Math.min(2.8+.2*(li[n]?.length??0)+.05*(qn[n]?.length??0),5.5),Hm={outside:"three"},Cl=n=>[{p:ji(n.id),view:Hm[n.view]??n.view,move:Gm(n),hold:0,label:`${n.name} comes out`},{p:ji(n.id),view:n.view,focus:n.id,move:Vm,hold:Ms,label:n.name}],Wm={outerAdhesive:n=>[...Cl(n),{p:ji(n.id),view:"three",zoom:"back",move:2.6,hold:Ms,label:"under the glass"}],logicBoard:n=>[...Cl(n),{p:ji(n.id),view:"inner",focus:n.id,pick:"a20",move:2.6,hold:Ms,label:"logic board back"}],hinge:n=>[{p:Bt(...Kt.hinge,Pl),view:"hinge",focus:n.id,move:7,hold:0,label:"hinge flexes"},{p:ji(n.id),view:"three",focus:n.id,move:4,hold:Ms,label:"hinge out"}]},Xm=[{p:0,view:"three",move:0,hold:Ms/2,label:"sealed"},{p:ji("unfold"),view:"inner",move:3,hold:0,label:"unfolded"},{p:ji("unfold"),view:"three",move:1.5,hold:0,label:"back glass up"},...Vt.flatMap(n=>(Wm[n.id]??Cl)(n)),{p:1,view:"three",move:4,hold:Ms,label:"fully exploded"},{p:0,view:"three",move:7,hold:0,label:"reassembled"}],Xn=(()=>{let n=0;return Xm.map(e=>{let t=n,i=t+e.move;return n=i+e.hold,{...e,start:t,at:i,until:n}})})(),Ai=Xn[Xn.length-1].until,qm=1.2,Ym=3,Zm=9,cd=n=>{let e=(n%Ai+Ai)%Ai,t=Xn.findIndex(r=>e<r.until),i=t<0?Xn.length-1:t,s=Xn[i];return{t:e,index:i,key:s,prev:Xn.at(i-1),k:s.move?cn(Ln(e,s.start,s.at)):1,fade:s.move?cn(Ln(e,s.start,s.start+qm)):1}},$m=(n,e,t)=>n.focus===e.focus?{focus:e.focus??null,iso:e.focus?1:0}:n.focus?e.focus?t<.5?{focus:n.focus,iso:1-2*t}:{focus:e.focus,iso:2*t-1}:{focus:t<1?n.focus:null,iso:1-t}:{focus:e.focus,iso:t},ts=n=>{let{t:e,index:t,key:i,prev:s,k:r,fade:o}=cd(n),a=$m(s,i,o),c=i.p<s.p?Ci.id:null;return{t:e,index:t,p:Bt(s.p,i.p,r),view:i.view,pick:r>.6?i.pick??null:null,selected:a.iso>.5?a.focus:c,...a}},Gu=(n,e,t)=>{if(!n.zoom)return Mr(n.view,e,t,n.focus??null);let{az:i,el:s}=yr[n.view];return Fo(zm[n.zoom],i,s,t,1.02)},ns=(n,e)=>{let{t,key:i,prev:s,k:r}=cd(n),o=Bt(s.p,i.p,r),a=Sr(Gu(s,o,e),Gu(i,o,e),r);return{...a,az:a.az+Ym*Math.sin(2*Math.PI*Zm*t/Ai)}};var Gd=0,wh=1,Hd=2;var hs=1,Wd=2,js=3,Tn=0,$t=1,An=2,ni=0,Qs=1,Eh=2,Th=3,Ah=4,uc=5;var us=100,Xd=101,qd=102,Yd=103,Zd=104,$d=200,dc=201,Jd=202,Kd=203,co=204,er=205,jd=206,Qd=207,ef=208,tf=209,nf=210,sf=211,rf=212,of=213,af=214,wa=0,Ea=1,Ta=2,ks=3,Aa=4,Ca=5,Ra=6,Ia=7,Ch=0,cf=1,lf=2,zn=0,Rh=1,Ih=2,Ph=3,Lh=4,Dh=5,Nh=6,lo=7;var Uh=300,Gi=301,ds=302,fc=303,pc=304,ho=306,Pa=1e3,Jn=1001,La=1002,Ht=1003,hf=1004;var uo=1005;var Yt=1006,mc=1007;var Hi=1008;var fn=1009,Fh=1010,Oh=1011,tr=1012,gc=1013,kn=1014,Cn=1015,Vn=1016,_c=1017,xc=1018,nr=1020,Bh=35902,zh=35899,kh=1021,Vh=1022,Rn=1023,jn=1026,Wi=1027,vc=1028,yc=1029,Xi=1030,Mc=1031;var Sc=1033,fo=33776,po=33777,mo=33778,go=33779,bc=35840,wc=35841,Ec=35842,Tc=35843,Ac=36196,Cc=37492,Rc=37496,Ic=37488,Pc=37489,_o=37490,Lc=37491,Dc=37808,Nc=37809,Uc=37810,Fc=37811,Oc=37812,Bc=37813,zc=37814,kc=37815,Vc=37816,Gc=37817,Hc=37818,Wc=37819,Xc=37820,qc=37821,Yc=36492,Zc=36494,$c=36495,Jc=36283,Kc=36284,xo=36285,jc=36286;var Nr=2300,Da=2301,Ma=2302,fh=2303,ph=2400,mh=2401,gh=2402;var uf=3200;var Qc=0,df=1,Mi="",sn="srgb",Ur="srgb-linear",Fr="linear",pt="srgb";var Sa=7680;var ff=519,pf=512,mf=513,gf=514,el=515,_f=516,xf=517,tl=518,vf=519,yf=35044,nl=35048;var Gh="300 es",On=2e3,Vs=2001;function Jm(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Km(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Or(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Mf(){let n=Or("canvas");return n.style.display="block",n}var ld={},Gs=null;function Hh(...n){let e="THREE."+n.shift();Gs?Gs("log",e,...n):console.log(e,...n)}function Sf(n){let e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function Be(...n){n=Sf(n);let e="THREE."+n.shift();if(Gs)Gs("warn",e,...n);else{let t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Ge(...n){n=Sf(n);let e="THREE."+n.shift();if(Gs)Gs("error",e,...n);else{let t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function as(...n){let e=n.join(" ");e in ld||(ld[e]=!0,Be(...n))}function bf(n,e,t){return new Promise(function(i,s){function r(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:s();break;case n.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:i()}}setTimeout(r,t)})}var wf={[wa]:Ea,[Ta]:Ra,[Aa]:Ia,[ks]:Ca,[Ea]:wa,[Ra]:Ta,[Ia]:Aa,[Ca]:ks},Qn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){let i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){let i=this._listeners;if(i===void 0)return;let s=i[e];if(s!==void 0){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let i=t[e.type];if(i!==void 0){e.target=this;let s=i.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,e);e.target=null}}},jt=["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"];var ba=Math.PI/180,Na=180/Math.PI;function ir(){let n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(jt[n&255]+jt[n>>8&255]+jt[n>>16&255]+jt[n>>24&255]+"-"+jt[e&255]+jt[e>>8&255]+"-"+jt[e>>16&15|64]+jt[e>>24&255]+"-"+jt[t&63|128]+jt[t>>8&255]+"-"+jt[t>>16&255]+jt[t>>24&255]+jt[i&255]+jt[i>>8&255]+jt[i>>16&255]+jt[i>>24&255]).toLowerCase()}function tt(n,e,t){return Math.max(e,Math.min(t,n))}function jm(n,e){return(n%e+e)%e}function kl(n,e,t){return(1-t)*n+t*e}function br(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:case Uint8ClampedArray:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function ln(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var $h=class $h{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("THREE.Vector2: 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("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,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 i=this.dot(e)/t;return Math.acos(tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};$h.prototype.isVector2=!0;var le=$h,un=class{constructor(e=0,t=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,o,a){let c=i[s+0],l=i[s+1],h=i[s+2],f=i[s+3],u=r[o+0],d=r[o+1],m=r[o+2],v=r[o+3];if(f!==v||c!==u||l!==d||h!==m){let g=c*u+l*d+h*m+f*v;g<0&&(u=-u,d=-d,m=-m,v=-v,g=-g);let p=1-a;if(g<.9995){let S=Math.acos(g),T=Math.sin(S);p=Math.sin(p*S)/T,a=Math.sin(a*S)/T,c=c*p+u*a,l=l*p+d*a,h=h*p+m*a,f=f*p+v*a}else{c=c*p+u*a,l=l*p+d*a,h=h*p+m*a,f=f*p+v*a;let S=1/Math.sqrt(c*c+l*l+h*h+f*f);c*=S,l*=S,h*=S,f*=S}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,s,r,o){let a=i[s],c=i[s+1],l=i[s+2],h=i[s+3],f=r[o],u=r[o+1],d=r[o+2],m=r[o+3];return e[t]=a*m+h*f+c*d-l*u,e[t+1]=c*m+h*u+l*f-a*d,e[t+2]=l*m+h*d+a*u-c*f,e[t+3]=h*m-a*f-c*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(i/2),h=a(s/2),f=a(r/2),u=c(i/2),d=c(s/2),m=c(r/2);switch(o){case"XYZ":this._x=u*h*f+l*d*m,this._y=l*d*f-u*h*m,this._z=l*h*m+u*d*f,this._w=l*h*f-u*d*m;break;case"YXZ":this._x=u*h*f+l*d*m,this._y=l*d*f-u*h*m,this._z=l*h*m-u*d*f,this._w=l*h*f+u*d*m;break;case"ZXY":this._x=u*h*f-l*d*m,this._y=l*d*f+u*h*m,this._z=l*h*m+u*d*f,this._w=l*h*f-u*d*m;break;case"ZYX":this._x=u*h*f-l*d*m,this._y=l*d*f+u*h*m,this._z=l*h*m-u*d*f,this._w=l*h*f+u*d*m;break;case"YZX":this._x=u*h*f+l*d*m,this._y=l*d*f+u*h*m,this._z=l*h*m-u*d*f,this._w=l*h*f-u*d*m;break;case"XZY":this._x=u*h*f-l*d*m,this._y=l*d*f-u*h*m,this._z=l*h*m+u*d*f,this._w=l*h*f+u*d*m;break;default:Be("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],c=t[9],l=t[2],h=t[6],f=t[10],u=i+a+f;if(u>0){let d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(h-c)*d,this._y=(r-l)*d,this._z=(o-s)*d}else if(i>a&&i>f){let d=2*Math.sqrt(1+i-a-f);this._w=(h-c)/d,this._x=.25*d,this._y=(s+o)/d,this._z=(r+l)/d}else if(a>f){let d=2*Math.sqrt(1+a-i-f);this._w=(r-l)/d,this._x=(s+o)/d,this._y=.25*d,this._z=(c+h)/d}else{let d=2*Math.sqrt(1+f-i-a);this._w=(o-s)/d,this._x=(r+l)/d,this._y=(c+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(tt(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,c=t._y,l=t._z,h=t._w;return this._x=i*h+o*a+s*l-r*c,this._y=s*h+o*c+r*a-i*l,this._z=r*h+o*l+i*c-s*a,this._w=o*h-i*a-s*c-r*l,this._onChangeCallback(),this}slerp(e,t){let i=e._x,s=e._y,r=e._z,o=e._w,a=this.dot(e);a<0&&(i=-i,s=-s,r=-r,o=-o,a=-a);let c=1-t;if(a<.9995){let l=Math.acos(a),h=Math.sin(l);c=Math.sin(c*l)/h,t=Math.sin(t*l)/h,this._x=this._x*c+i*t,this._y=this._y*c+s*t,this._z=this._z*c+r*t,this._w=this._w*c+o*t,this._onChangeCallback()}else this._x=this._x*c+i*t,this._y=this._y*c+s*t,this._z=this._z*c+r*t,this._w=this._w*c+o*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Jh=class Jh{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: 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("THREE.Vector3: 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(hd.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(hd.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){let t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*s-a*i),h=2*(a*t-r*s),f=2*(r*i-o*t);return this.x=t+c*l+o*f-a*h,this.y=i+c*h+a*l-r*f,this.z=s+c*f+r*h-o*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,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this.z=tt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this.z=tt(this.z,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,c=t.z;return this.x=s*c-r*a,this.y=r*o-i*c,this.z=i*a-s*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Vl.copy(this).projectOnVector(e),this.sub(Vl)}reflect(e){return this.sub(Vl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Jh.prototype.isVector3=!0;var N=Jh,Vl=new N,hd=new un,Kh=class Kh{constructor(e,t,i,s,r,o,a,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,c,l)}set(e,t,i,s,r,o,a,c,l){let h=this.elements;return h[0]=e,h[1]=s,h[2]=a,h[3]=t,h[4]=r,h[5]=c,h[6]=i,h[7]=o,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],c=i[6],l=i[1],h=i[4],f=i[7],u=i[2],d=i[5],m=i[8],v=s[0],g=s[3],p=s[6],S=s[1],T=s[4],y=s[7],w=s[2],b=s[5],C=s[8];return r[0]=o*v+a*S+c*w,r[3]=o*g+a*T+c*b,r[6]=o*p+a*y+c*C,r[1]=l*v+h*S+f*w,r[4]=l*g+h*T+f*b,r[7]=l*p+h*y+f*C,r[2]=u*v+d*S+m*w,r[5]=u*g+d*T+m*b,r[8]=u*p+d*y+m*C,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8];return t*o*h-t*a*l-i*r*h+i*a*c+s*r*l-s*o*c}invert(){let e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=h*o-a*l,u=a*c-h*r,d=l*r-o*c,m=t*f+i*u+s*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let v=1/m;return e[0]=f*v,e[1]=(s*l-h*i)*v,e[2]=(a*i-s*o)*v,e[3]=u*v,e[4]=(h*t-s*c)*v,e[5]=(s*r-a*t)*v,e[6]=d*v,e[7]=(i*c-l*t)*v,e[8]=(o*t-i*r)*v,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){let c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*o+l*a)+o+e,-s*l,s*c,-s*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return as("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Gl.makeScale(e,t)),this}rotate(e){return as("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Gl.makeRotation(-e)),this}translate(e,t){return as("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Gl.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Kh.prototype.isMatrix3=!0;var Ye=Kh,Gl=new Ye,ud=new Ye().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),dd=new Ye().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Qm(){let n={enabled:!0,workingColorSpace:Ur,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===pt&&(s.r=_i(s.r),s.g=_i(s.g),s.b=_i(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===pt&&(s.r=zs(s.r),s.g=zs(s.g),s.b=zs(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Mi?Fr:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return as("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return as("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(s,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[Ur]:{primaries:e,whitePoint:i,transfer:Fr,toXYZ:ud,fromXYZ:dd,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:sn},outputColorSpaceConfig:{drawingBufferColorSpace:sn}},[sn]:{primaries:e,whitePoint:i,transfer:pt,toXYZ:ud,fromXYZ:dd,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:sn}}}),n}var ot=Qm();function _i(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function zs(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var Es,Ua=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Es===void 0&&(Es=Or("canvas")),Es.width=e.width,Es.height=e.height;let s=Es.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=Es}return i.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=Or("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o<r.length;o++)r[o]=_i(r[o]/255)*255;return i.putImageData(s,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(_i(t[i]/255)*255):t[i]=_i(t[i]);return{data:t,width:e.width,height:e.height}}else return Be("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},eg=0,Hs=class{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:eg++}),this.uuid=ir(),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 i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let o=0,a=s.length;o<a;o++)s[o].isDataTexture?r.push(Hl(s[o].image)):r.push(Hl(s[o]))}else r=Hl(s);i.url=r}return t||(e.images[this.uuid]=i),i}};function Hl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ua.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(Be("Texture: Unable to serialize Texture."),{})}var tg=0,Wl=new N,rn=class n extends Qn{constructor(e=n.DEFAULT_IMAGE,t=n.DEFAULT_MAPPING,i=Jn,s=Jn,r=Yt,o=Hi,a=Rn,c=fn,l=n.DEFAULT_ANISOTROPY,h=Mi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:tg++}),this.uuid=ir(),this.name="",this.source=new Hs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new le(0,0),this.repeat=new le(1,1),this.center=new le(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ye,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(Wl).x}get height(){return this.source.getSize(Wl).y}get depth(){return this.source.getSize(Wl).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 i=e[t];if(i===void 0){Be(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){Be(`Texture.setValues(): property '${t}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Uh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pa:e.x=e.x-Math.floor(e.x);break;case Jn:e.x=e.x<0?0:1;break;case La: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 Pa:e.y=e.y-Math.floor(e.y);break;case Jn:e.y=e.y<0?0:1;break;case La: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++}};rn.DEFAULT_IMAGE=null;rn.DEFAULT_MAPPING=Uh;rn.DEFAULT_ANISOTROPY=1;var jh=class jh{constructor(e=0,t=0,i=0,s=1){this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: 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("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r,c=e.elements,l=c[0],h=c[4],f=c[8],u=c[1],d=c[5],m=c[9],v=c[2],g=c[6],p=c[10];if(Math.abs(h-u)<.01&&Math.abs(f-v)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+u)<.1&&Math.abs(f+v)<.1&&Math.abs(m+g)<.1&&Math.abs(l+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let T=(l+1)/2,y=(d+1)/2,w=(p+1)/2,b=(h+u)/4,C=(f+v)/4,x=(m+g)/4;return T>y&&T>w?T<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(T),s=b/i,r=C/i):y>w?y<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(y),i=b/s,r=x/s):w<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(w),i=C/r,s=x/r),this.set(i,s,r,t),this}let S=Math.sqrt((g-m)*(g-m)+(f-v)*(f-v)+(u-h)*(u-h));return Math.abs(S)<.001&&(S=1),this.x=(g-m)/S,this.y=(f-v)/S,this.z=(u-h)/S,this.w=Math.acos((l+d+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=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this.z=tt(this.z,e.z,t.z),this.w=tt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this.z=tt(this.z,e,t),this.w=tt(this.w,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};jh.prototype.isVector4=!0;var At=jh,Fa=class extends Qn{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Yt,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new At(0,0,e,t),this.scissorTest=!1,this.viewport=new At(0,0,e,t),this.textures=[];let s={width:e,height:t,depth:i.depth},r=new rn(s),o=i.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveColorBuffer=i.resolveColorBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.storeMultisampledColorBuffer=i.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=i.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=i.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:Yt,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 i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=i,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].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,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let s=Object.assign({},e.textures[t].image);this.textures[t].source=new Hs(s)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null)if(e.depthTexture.renderTarget===e){let t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},dn=class extends Fa{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},Br=class extends rn{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=Ht,this.minFilter=Ht,this.wrapR=Jn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var Oa=class extends rn{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=Ht,this.minFilter=Ht,this.wrapR=Jn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}};var hc=class hc{constructor(e,t,i,s,r,o,a,c,l,h,f,u,d,m,v,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,c,l,h,f,u,d,m,v,g)}set(e,t,i,s,r,o,a,c,l,h,f,u,d,m,v,g){let p=this.elements;return p[0]=e,p[4]=t,p[8]=i,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=h,p[10]=f,p[14]=u,p[3]=d,p[7]=m,p[11]=v,p[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new hc().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,i=e.elements,s=1/Ts.setFromMatrixColumn(e,0).length(),r=1/Ts.setFromMatrixColumn(e,1).length(),o=1/Ts.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(s),l=Math.sin(s),h=Math.cos(r),f=Math.sin(r);if(e.order==="XYZ"){let u=o*h,d=o*f,m=a*h,v=a*f;t[0]=c*h,t[4]=-c*f,t[8]=l,t[1]=d+m*l,t[5]=u-v*l,t[9]=-a*c,t[2]=v-u*l,t[6]=m+d*l,t[10]=o*c}else if(e.order==="YXZ"){let u=c*h,d=c*f,m=l*h,v=l*f;t[0]=u+v*a,t[4]=m*a-d,t[8]=o*l,t[1]=o*f,t[5]=o*h,t[9]=-a,t[2]=d*a-m,t[6]=v+u*a,t[10]=o*c}else if(e.order==="ZXY"){let u=c*h,d=c*f,m=l*h,v=l*f;t[0]=u-v*a,t[4]=-o*f,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*h,t[9]=v-u*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){let u=o*h,d=o*f,m=a*h,v=a*f;t[0]=c*h,t[4]=m*l-d,t[8]=u*l+v,t[1]=c*f,t[5]=v*l+u,t[9]=d*l-m,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){let u=o*c,d=o*l,m=a*c,v=a*l;t[0]=c*h,t[4]=v-u*f,t[8]=m*f+d,t[1]=f,t[5]=o*h,t[9]=-a*h,t[2]=-l*h,t[6]=d*f+m,t[10]=u-v*f}else if(e.order==="XZY"){let u=o*c,d=o*l,m=a*c,v=a*l;t[0]=c*h,t[4]=-f,t[8]=l*h,t[1]=u*f+v,t[5]=o*h,t[9]=d*f-m,t[2]=m*f-d,t[6]=a*h,t[10]=v*f+u}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(ng,e,ig)}lookAt(e,t,i){let s=this.elements;return gn.subVectors(e,t),gn.lengthSq()===0&&(gn.z=1),gn.normalize(),Ri.crossVectors(i,gn),Ri.lengthSq()===0&&(Math.abs(i.z)===1?gn.x+=1e-4:gn.z+=1e-4,gn.normalize(),Ri.crossVectors(i,gn)),Ri.normalize(),Zo.crossVectors(gn,Ri),s[0]=Ri.x,s[4]=Zo.x,s[8]=gn.x,s[1]=Ri.y,s[5]=Zo.y,s[9]=gn.y,s[2]=Ri.z,s[6]=Zo.z,s[10]=gn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],c=i[8],l=i[12],h=i[1],f=i[5],u=i[9],d=i[13],m=i[2],v=i[6],g=i[10],p=i[14],S=i[3],T=i[7],y=i[11],w=i[15],b=s[0],C=s[4],x=s[8],E=s[12],I=s[1],D=s[5],O=s[9],V=s[13],R=s[2],P=s[6],k=s[10],X=s[14],te=s[3],q=s[7],Z=s[11],j=s[15];return r[0]=o*b+a*I+c*R+l*te,r[4]=o*C+a*D+c*P+l*q,r[8]=o*x+a*O+c*k+l*Z,r[12]=o*E+a*V+c*X+l*j,r[1]=h*b+f*I+u*R+d*te,r[5]=h*C+f*D+u*P+d*q,r[9]=h*x+f*O+u*k+d*Z,r[13]=h*E+f*V+u*X+d*j,r[2]=m*b+v*I+g*R+p*te,r[6]=m*C+v*D+g*P+p*q,r[10]=m*x+v*O+g*k+p*Z,r[14]=m*E+v*V+g*X+p*j,r[3]=S*b+T*I+y*R+w*te,r[7]=S*C+T*D+y*P+w*q,r[11]=S*x+T*O+y*k+w*Z,r[15]=S*E+T*V+y*X+w*j,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],h=e[2],f=e[6],u=e[10],d=e[14],m=e[3],v=e[7],g=e[11],p=e[15],S=c*d-l*u,T=a*d-l*f,y=a*u-c*f,w=o*d-l*h,b=o*u-c*h,C=o*f-a*h;return t*(v*S-g*T+p*y)-i*(m*S-g*w+p*b)+s*(m*T-v*w+p*C)-r*(m*y-v*b+g*C)}determinantAffine(){let e=this.elements,t=e[0],i=e[4],s=e[8],r=e[1],o=e[5],a=e[9],c=e[2],l=e[6],h=e[10];return t*(o*h-a*l)-i*(r*h-a*c)+s*(r*l-o*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,i){let s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=e[9],u=e[10],d=e[11],m=e[12],v=e[13],g=e[14],p=e[15],S=t*a-i*o,T=t*c-s*o,y=t*l-r*o,w=i*c-s*a,b=i*l-r*a,C=s*l-r*c,x=h*v-f*m,E=h*g-u*m,I=h*p-d*m,D=f*g-u*v,O=f*p-d*v,V=u*p-d*g,R=S*V-T*O+y*D+w*I-b*E+C*x;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let P=1/R;return e[0]=(a*V-c*O+l*D)*P,e[1]=(s*O-i*V-r*D)*P,e[2]=(v*C-g*b+p*w)*P,e[3]=(u*b-f*C-d*w)*P,e[4]=(c*I-o*V-l*E)*P,e[5]=(t*V-s*I+r*E)*P,e[6]=(g*y-m*C-p*T)*P,e[7]=(h*C-u*y+d*T)*P,e[8]=(o*O-a*I+l*x)*P,e[9]=(i*I-t*O-r*x)*P,e[10]=(m*b-v*y+p*S)*P,e[11]=(f*y-h*b-d*S)*P,e[12]=(a*E-o*D-c*x)*P,e[13]=(t*D-i*E+s*x)*P,e[14]=(v*T-m*w-g*S)*P,e[15]=(h*w-f*T+u*S)*P,this}scale(e){let t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,c=e.z,l=r*o,h=r*a;return this.set(l*o+i,l*a-s*c,l*c+s*a,0,l*a+s*c,h*a+i,h*c-s*o,0,l*c-s*a,h*c+s*o,r*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){let s=this.elements,r=t._x,o=t._y,a=t._z,c=t._w,l=r+r,h=o+o,f=a+a,u=r*l,d=r*h,m=r*f,v=o*h,g=o*f,p=a*f,S=c*l,T=c*h,y=c*f,w=i.x,b=i.y,C=i.z;return s[0]=(1-(v+p))*w,s[1]=(d+y)*w,s[2]=(m-T)*w,s[3]=0,s[4]=(d-y)*b,s[5]=(1-(u+p))*b,s[6]=(g+S)*b,s[7]=0,s[8]=(m+T)*C,s[9]=(g-S)*C,s[10]=(1-(u+v))*C,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){let s=this.elements;e.x=s[12],e.y=s[13],e.z=s[14];let r=this.determinantAffine();if(r===0)return i.set(1,1,1),t.identity(),this;let o=Ts.set(s[0],s[1],s[2]).length(),a=Ts.set(s[4],s[5],s[6]).length(),c=Ts.set(s[8],s[9],s[10]).length();r<0&&(o=-o),Dn.copy(this);let l=1/o,h=1/a,f=1/c;return Dn.elements[0]*=l,Dn.elements[1]*=l,Dn.elements[2]*=l,Dn.elements[4]*=h,Dn.elements[5]*=h,Dn.elements[6]*=h,Dn.elements[8]*=f,Dn.elements[9]*=f,Dn.elements[10]*=f,t.setFromRotationMatrix(Dn),i.x=o,i.y=a,i.z=c,this}makePerspective(e,t,i,s,r,o,a=On,c=!1){let l=this.elements,h=2*r/(t-e),f=2*r/(i-s),u=(t+e)/(t-e),d=(i+s)/(i-s),m,v;if(c)m=r/(o-r),v=o*r/(o-r);else if(a===On)m=-(o+r)/(o-r),v=-2*o*r/(o-r);else if(a===Vs)m=-o/(o-r),v=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=h,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=f,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=On,c=!1){let l=this.elements,h=2/(t-e),f=2/(i-s),u=-(t+e)/(t-e),d=-(i+s)/(i-s),m,v;if(c)m=1/(o-r),v=o/(o-r);else if(a===On)m=-2/(o-r),v=-(o+r)/(o-r);else if(a===Vs)m=-1/(o-r),v=-r/(o-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=h,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=f,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=m,l[14]=v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};hc.prototype.isMatrix4=!0;var ht=hc,Ts=new N,Dn=new ht,ng=new N(0,0,0),ig=new N(1,1,1),Ri=new N,Zo=new N,gn=new N,fd=new ht,pd=new un,xi=class n{constructor(e=0,t=0,i=0,s=n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let s=e.elements,r=s[0],o=s[4],a=s[8],c=s[1],l=s[5],h=s[9],f=s[2],u=s[6],d=s[10];switch(t){case"XYZ":this._y=Math.asin(tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-tt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,r),this._z=0);break;case"ZXY":this._x=Math.asin(tt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-tt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(tt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-f,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-h,d),this._y=0);break;default:Be("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return fd.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fd,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return pd.setFromEuler(this),this.setFromQuaternion(pd,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}};xi.DEFAULT_ORDER="XYZ";var zr=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}},sg=0,md=new N,As=new un,ui=new ht,$o=new N,wr=new N,rg=new N,og=new un,gd=new N(1,0,0),_d=new N(0,1,0),xd=new N(0,0,1),vd={type:"added"},ag={type:"removed"},Cs={type:"childadded",child:null},Xl={type:"childremoved",child:null},Zt=class n extends Qn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:sg++}),this.uuid=ir(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let e=new N,t=new xi,i=new un,s=new N(1,1,1);function r(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(r),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new ht},normalMatrix:{value:new Ye}}),this.matrix=new ht,this.matrixWorld=new ht,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new zr,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 As.setFromAxisAngle(e,t),this.quaternion.multiply(As),this}rotateOnWorldAxis(e,t){return As.setFromAxisAngle(e,t),this.quaternion.premultiply(As),this}rotateX(e){return this.rotateOnAxis(gd,e)}rotateY(e){return this.rotateOnAxis(_d,e)}rotateZ(e){return this.rotateOnAxis(xd,e)}translateOnAxis(e,t){return md.copy(e).applyQuaternion(this.quaternion),this.position.add(md.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(gd,e)}translateY(e){return this.translateOnAxis(_d,e)}translateZ(e){return this.translateOnAxis(xd,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ui.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?$o.copy(e):$o.set(e,t,i);let s=this.parent;this.updateWorldMatrix(!0,!1),wr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ui.lookAt(wr,$o,this.up):ui.lookAt($o,wr,this.up),this.quaternion.setFromRotationMatrix(ui),s&&(ui.extractRotation(s.matrixWorld),As.setFromRotationMatrix(ui),this.quaternion.premultiply(As.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("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(vd),Cs.child=e,this.dispatchEvent(Cs),Cs.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ag),Xl.child=e,this.dispatchEvent(Xl),Xl.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),ui.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ui.multiply(e.parent.matrixWorld)),e.applyMatrix4(ui),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(vd),Cs.child=e,this.dispatchEvent(Cs),Cs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,s=this.children.length;i<s;i++){let o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(wr,e,rg),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(wr,og,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(e){e(this);let t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,i=e.y,s=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*i-r[8]*s,r[13]+=i-r[1]*t-r[5]*i-r[9]*s,r[14]+=s-r[2]*t-r[6]*i-r[10]*s}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t,i=!1){let s=this.parent;if(e===!0&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),t===!0){let r=this.children;for(let o=0,a=r.length;o<a;o++)r[o].updateWorldMatrix(!1,!0,i)}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let s={};s.uuid=this.uuid,s.type=this.type,s.name=this.name,s.castShadow=this.castShadow,s.receiveShadow=this.receiveShadow,s.visible=this.visible,s.frustumCulled=this.frustumCulled,s.renderOrder=this.renderOrder,s.static=this.static,s.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let c=a.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let f=c[l];r(e.shapes,f)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(r(e.materials,this.material[c]));s.material=a}else s.material=r(e.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){let c=this.animations[a];s.animations.push(r(e.animations,c))}}if(t){let a=o(e.geometries),c=o(e.materials),l=o(e.textures),h=o(e.images),f=o(e.shapes),u=o(e.skeletons),d=o(e.animations),m=o(e.nodes);a.length>0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),h.length>0&&(i.images=h),f.length>0&&(i.shapes=f),u.length>0&&(i.skeletons=u),d.length>0&&(i.animations=d),m.length>0&&(i.nodes=m)}return i.object=s,i;function o(a){let c=[];for(let l in a){let h=a[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 i=0;i<e.children.length;i++){let s=e.children[i];this.add(s.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};Zt.DEFAULT_UP=new N(0,1,0);Zt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var hn=class extends Zt{constructor(){super(),this.isGroup=!0,this.type="Group"}},cg={type:"move"},Ws=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new hn,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 hn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new hn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N,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 i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null,a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(let v of e.hand.values()){let g=t.getJointPose(v,i),p=this._getHandJoint(l,v);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}let h=l.joints["index-finger-tip"],f=l.joints["thumb-tip"],u=h.position.distanceTo(f.position),d=.02,m=.005;l.inputState.pinching&&u>d+m?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&u<=d-m&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),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})));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(cg)))}return a!==null&&(a.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let i=new hn;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},Ef={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},Ii={h:0,s:0,l:0},Jo={h:0,s:0,l:0};function ql(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}var Xe=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=sn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ot.colorSpaceToWorking(this,t),this}setRGB(e,t,i,s=ot.workingColorSpace){return this.r=e,this.g=t,this.b=i,ot.colorSpaceToWorking(this,s),this}setHSL(e,t,i,s=ot.workingColorSpace){if(e=jm(e,1),t=tt(t,0,1),i=tt(i,0,1),t===0)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=ql(o,r,e+1/3),this.g=ql(o,r,e),this.b=ql(o,r,e-1/3)}return ot.colorSpaceToWorking(this,s),this}setStyle(e,t=sn){function i(r){r!==void 0&&parseFloat(r)<1&&Be("Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:Be("Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);Be("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=sn){let i=Ef[e.toLowerCase()];return i!==void 0?this.setHex(i,t):Be("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=_i(e.r),this.g=_i(e.g),this.b=_i(e.b),this}copyLinearToSRGB(e){return this.r=zs(e.r),this.g=zs(e.g),this.b=zs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=sn){return ot.workingToColorSpace(Qt.copy(this),e),Math.round(tt(Qt.r*255,0,255))*65536+Math.round(tt(Qt.g*255,0,255))*256+Math.round(tt(Qt.b*255,0,255))}getHexString(e=sn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ot.workingColorSpace){ot.workingToColorSpace(Qt.copy(this),t);let i=Qt.r,s=Qt.g,r=Qt.b,o=Math.max(i,s,r),a=Math.min(i,s,r),c,l,h=(a+o)/2;if(a===o)c=0,l=0;else{let f=o-a;switch(l=h<=.5?f/(o+a):f/(2-o-a),o){case i:c=(s-r)/f+(s<r?6:0);break;case s:c=(r-i)/f+2;break;case r:c=(i-s)/f+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=ot.workingColorSpace){return ot.workingToColorSpace(Qt.copy(this),t),e.r=Qt.r,e.g=Qt.g,e.b=Qt.b,e}getStyle(e=sn){ot.workingToColorSpace(Qt.copy(this),e);let t=Qt.r,i=Qt.g,s=Qt.b;return e!==sn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(e,t,i){return this.getHSL(Ii),this.setHSL(Ii.h+e,Ii.s+t,Ii.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Ii),e.getHSL(Jo);let i=kl(Ii.h,Jo.h,t),s=kl(Ii.s,Jo.s,t),r=kl(Ii.l,Jo.l,t);return this.setHSL(i,s,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,s=this.b,r=e.elements;return this.r=r[0]*t+r[3]*i+r[6]*s,this.g=r[1]*t+r[4]*i+r[7]*s,this.b=r[2]*t+r[5]*i+r[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Qt=new Xe;Xe.NAMES=Ef;var Xs=class extends Zt{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 xi,this.environmentIntensity=1,this.environmentRotation=new xi,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()),t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}},Nn=new N,di=new N,Yl=new N,fi=new N,Rs=new N,Is=new N,yd=new N,Zl=new N,$l=new N,Jl=new N,Kl=new At,jl=new At,Ql=new At,gi=class n{constructor(e=new N,t=new N,i=new N){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,s){s.subVectors(i,t),Nn.subVectors(e,t),s.cross(Nn);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){Nn.subVectors(s,t),di.subVectors(i,t),Yl.subVectors(e,t);let o=Nn.dot(Nn),a=Nn.dot(di),c=Nn.dot(Yl),l=di.dot(di),h=di.dot(Yl),f=o*l-a*a;if(f===0)return r.set(0,0,0),null;let u=1/f,d=(l*c-a*h)*u,m=(o*h-a*c)*u;return r.set(1-d-m,m,d)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,fi)===null?!1:fi.x>=0&&fi.y>=0&&fi.x+fi.y<=1}static getInterpolation(e,t,i,s,r,o,a,c){return this.getBarycoord(e,t,i,s,fi)===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,fi.x),c.addScaledVector(o,fi.y),c.addScaledVector(a,fi.z),c)}static getInterpolatedAttribute(e,t,i,s,r,o){return Kl.setScalar(0),jl.setScalar(0),Ql.setScalar(0),Kl.fromBufferAttribute(e,t),jl.fromBufferAttribute(e,i),Ql.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(Kl,r.x),o.addScaledVector(jl,r.y),o.addScaledVector(Ql,r.z),o}static isFrontFacing(e,t,i,s){return Nn.subVectors(i,t),di.subVectors(e,t),Nn.cross(di).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Nn.subVectors(this.c,this.b),di.subVectors(this.a,this.b),Nn.cross(di).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return n.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return n.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,s,r){return n.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return n.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return n.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,s=this.b,r=this.c,o,a;Rs.subVectors(s,i),Is.subVectors(r,i),Zl.subVectors(e,i);let c=Rs.dot(Zl),l=Is.dot(Zl);if(c<=0&&l<=0)return t.copy(i);$l.subVectors(e,s);let h=Rs.dot($l),f=Is.dot($l);if(h>=0&&f<=h)return t.copy(s);let u=c*f-h*l;if(u<=0&&c>=0&&h<=0)return o=c/(c-h),t.copy(i).addScaledVector(Rs,o);Jl.subVectors(e,r);let d=Rs.dot(Jl),m=Is.dot(Jl);if(m>=0&&d<=m)return t.copy(r);let v=d*l-c*m;if(v<=0&&l>=0&&m<=0)return a=l/(l-m),t.copy(i).addScaledVector(Is,a);let g=h*m-d*f;if(g<=0&&f-h>=0&&d-m>=0)return yd.subVectors(r,s),a=(f-h)/(f-h+(d-m)),t.copy(s).addScaledVector(yd,a);let p=1/(g+v+u);return o=v*p,a=u*p,t.copy(i).addScaledVector(Rs,o).addScaledVector(Is,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ei=class{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Un.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Un.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=Un.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let r=i.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Un):Un.fromBufferAttribute(r,o),Un.applyMatrix4(e.matrixWorld),this.expandByPoint(Un);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ko.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Ko.copy(i.boundingBox)),Ko.applyMatrix4(e.matrixWorld),this.union(Ko)}let s=e.children;for(let r=0,o=s.length;r<o;r++)this.expandByObject(s[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Un),Un.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Er),jo.subVectors(this.max,Er),Ps.subVectors(e.a,Er),Ls.subVectors(e.b,Er),Ds.subVectors(e.c,Er),Pi.subVectors(Ls,Ps),Li.subVectors(Ds,Ls),is.subVectors(Ps,Ds);let t=[0,-Pi.z,Pi.y,0,-Li.z,Li.y,0,-is.z,is.y,Pi.z,0,-Pi.x,Li.z,0,-Li.x,is.z,0,-is.x,-Pi.y,Pi.x,0,-Li.y,Li.x,0,-is.y,is.x,0];return!eh(t,Ps,Ls,Ds,jo)||(t=[1,0,0,0,1,0,0,0,1],!eh(t,Ps,Ls,Ds,jo))?!1:(Qo.crossVectors(Pi,Li),t=[Qo.x,Qo.y,Qo.z],eh(t,Ps,Ls,Ds,jo))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Un).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Un).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:(pi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),pi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),pi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),pi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),pi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),pi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),pi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),pi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(pi),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}},pi=[new N,new N,new N,new N,new N,new N,new N,new N],Un=new N,Ko=new ei,Ps=new N,Ls=new N,Ds=new N,Pi=new N,Li=new N,is=new N,Er=new N,jo=new N,Qo=new N,ss=new N;function eh(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){ss.fromArray(n,r);let a=s.x*Math.abs(ss.x)+s.y*Math.abs(ss.y)+s.z*Math.abs(ss.z),c=e.dot(ss),l=t.dot(ss),h=i.dot(ss);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>a)return!1}return!0}var Ut=new N,ea=new le,lg=0,Ft=class extends Qn{constructor(e,t,i=!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:lg++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=yf,this.updateRanges=[],this.gpuType=Cn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[e+s]=t.array[i+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)ea.fromBufferAttribute(this,t),ea.applyMatrix3(e),this.setXY(t,ea.x,ea.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Ut.fromBufferAttribute(this,t),Ut.applyMatrix3(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Ut.fromBufferAttribute(this,t),Ut.applyMatrix4(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Ut.fromBufferAttribute(this,t),Ut.applyNormalMatrix(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Ut.fromBufferAttribute(this,t),Ut.transformDirection(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=br(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=ln(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=br(t,this.array)),t}setX(e,t){return this.normalized&&(t=ln(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=br(t,this.array)),t}setY(e,t){return this.normalized&&(t=ln(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=br(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ln(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=br(t,this.array)),t}setW(e,t){return this.normalized&&(t=ln(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=ln(t,this.array),i=ln(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,s){return e*=this.itemSize,this.normalized&&(t=ln(t,this.array),i=ln(i,this.array),s=ln(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=s,this}setXYZW(e,t,i,s,r){return e*=this.itemSize,this.normalized&&(t=ln(t,this.array),i=ln(i,this.array),s=ln(s,this.array),r=ln(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=s,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}};var kr=class extends Ft{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var Vr=class extends Ft{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var vt=class extends Ft{constructor(e,t,i){super(new Float32Array(e),t,i)}},hg=new ei,Tr=new N,th=new N,vi=class{constructor(e=new N,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):hg.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;r<o;r++)s=Math.max(s,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Tr.subVectors(e,this.center);let t=Tr.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(Tr,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(th.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Tr.copy(e.center).add(th)),this.expandByPoint(Tr.copy(e.center).sub(th))),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}},ug=0,wn=new ht,nh=new Zt,Ns=new N,_n=new ei,Ar=new ei,Gt=new N,Ot=class n extends Qn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ug++}),this.uuid=ir(),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={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Jm(e)?Vr:kr)(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,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let r=new Ye().getNormalMatrix(e);i.applyNormalMatrix(r),i.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return wn.makeRotationFromQuaternion(e),this.applyMatrix4(wn),this}rotateX(e){return wn.makeRotationX(e),this.applyMatrix4(wn),this}rotateY(e){return wn.makeRotationY(e),this.applyMatrix4(wn),this}rotateZ(e){return wn.makeRotationZ(e),this.applyMatrix4(wn),this}translate(e,t,i){return wn.makeTranslation(e,t,i),this.applyMatrix4(wn),this}scale(e,t,i){return wn.makeScale(e,t,i),this.applyMatrix4(wn),this}lookAt(e){return nh.lookAt(e),nh.updateMatrix(),this.applyMatrix4(nh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ns).negate(),this.translate(Ns.x,Ns.y,Ns.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let i=[];for(let s=0,r=e.length;s<r;s++){let o=e[s];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new vt(i,3))}else{let i=Math.min(e.length,t.count);for(let s=0;s<i;s++){let r=e[s];t.setXYZ(s,r.x,r.y,r.z||0)}e.length>t.count&&Be("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 ei);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,s=t.length;i<s;i++){let r=t[i];_n.setFromBufferAttribute(r),this.morphTargetsRelative?(Gt.addVectors(this.boundingBox.min,_n.min),this.boundingBox.expandByPoint(Gt),Gt.addVectors(this.boundingBox.max,_n.max),this.boundingBox.expandByPoint(Gt)):(this.boundingBox.expandByPoint(_n.min),this.boundingBox.expandByPoint(_n.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('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 vi);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){let i=this.boundingSphere.center;if(_n.setFromBufferAttribute(e),t)for(let r=0,o=t.length;r<o;r++){let a=t[r];Ar.setFromBufferAttribute(a),this.morphTargetsRelative?(Gt.addVectors(_n.min,Ar.min),_n.expandByPoint(Gt),Gt.addVectors(_n.max,Ar.max),_n.expandByPoint(Gt)):(_n.expandByPoint(Ar.min),_n.expandByPoint(Ar.max))}_n.getCenter(i);let s=0;for(let r=0,o=e.count;r<o;r++)Gt.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(Gt));if(t)for(let r=0,o=t.length;r<o;r++){let a=t[r],c=this.morphTargetsRelative;for(let l=0,h=a.count;l<h;l++)Gt.fromBufferAttribute(a,l),c&&(Ns.fromBufferAttribute(e,l),Gt.add(Ns)),s=Math.max(s,i.distanceToSquared(Gt))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Ge('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){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,s=t.normal,r=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==i.count)&&(o=new Ft(new Float32Array(4*i.count),4),this.setAttribute("tangent",o));let a=[],c=[];for(let x=0;x<i.count;x++)a[x]=new N,c[x]=new N;let l=new N,h=new N,f=new N,u=new le,d=new le,m=new le,v=new N,g=new N;function p(x,E,I){l.fromBufferAttribute(i,x),h.fromBufferAttribute(i,E),f.fromBufferAttribute(i,I),u.fromBufferAttribute(r,x),d.fromBufferAttribute(r,E),m.fromBufferAttribute(r,I),h.sub(l),f.sub(l),d.sub(u),m.sub(u);let D=1/(d.x*m.y-m.x*d.y);isFinite(D)&&(v.copy(h).multiplyScalar(m.y).addScaledVector(f,-d.y).multiplyScalar(D),g.copy(f).multiplyScalar(d.x).addScaledVector(h,-m.x).multiplyScalar(D),a[x].add(v),a[E].add(v),a[I].add(v),c[x].add(g),c[E].add(g),c[I].add(g))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let x=0,E=S.length;x<E;++x){let I=S[x],D=I.start,O=I.count;for(let V=D,R=D+O;V<R;V+=3)p(e.getX(V+0),e.getX(V+1),e.getX(V+2))}let T=new N,y=new N,w=new N,b=new N;function C(x){w.fromBufferAttribute(s,x),b.copy(w);let E=a[x];T.copy(E),T.sub(w.multiplyScalar(w.dot(E))).normalize(),y.crossVectors(b,E);let D=y.dot(c[x])<0?-1:1;o.setXYZW(x,T.x,T.y,T.z,D)}for(let x=0,E=S.length;x<E;++x){let I=S[x],D=I.start,O=I.count;for(let V=D,R=D+O;V<R;V+=3)C(e.getX(V+0)),C(e.getX(V+1)),C(e.getX(V+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==t.count)i=new Ft(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let u=0,d=i.count;u<d;u++)i.setXYZ(u,0,0,0);let s=new N,r=new N,o=new N,a=new N,c=new N,l=new N,h=new N,f=new N;if(e)for(let u=0,d=e.count;u<d;u+=3){let m=e.getX(u+0),v=e.getX(u+1),g=e.getX(u+2);s.fromBufferAttribute(t,m),r.fromBufferAttribute(t,v),o.fromBufferAttribute(t,g),h.subVectors(o,r),f.subVectors(s,r),h.cross(f),a.fromBufferAttribute(i,m),c.fromBufferAttribute(i,v),l.fromBufferAttribute(i,g),a.add(h),c.add(h),l.add(h),i.setXYZ(m,a.x,a.y,a.z),i.setXYZ(v,c.x,c.y,c.z),i.setXYZ(g,l.x,l.y,l.z)}else for(let u=0,d=t.count;u<d;u+=3)s.fromBufferAttribute(t,u+0),r.fromBufferAttribute(t,u+1),o.fromBufferAttribute(t,u+2),h.subVectors(o,r),f.subVectors(s,r),h.cross(f),i.setXYZ(u+0,h.x,h.y,h.z),i.setXYZ(u+1,h.x,h.y,h.z),i.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Gt.fromBufferAttribute(e,t),Gt.normalize(),e.setXYZ(t,Gt.x,Gt.y,Gt.z)}toNonIndexed(){function e(a,c){let l=a.array,h=a.itemSize,f=a.normalized,u=new l.constructor(c.length*h),d=0,m=0;for(let v=0,g=c.length;v<g;v++){a.isInterleavedBufferAttribute?d=c[v]*a.data.stride+a.offset:d=c[v]*h;for(let p=0;p<h;p++)u[m++]=l[d++]}return new Ft(u,h,f)}if(this.index===null)return Be("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new n,i=this.index.array,s=this.attributes;for(let a in s){let c=s[a],l=e(c,i);t.setAttribute(a,l)}let r=this.morphAttributes;for(let a in r){let c=[],l=r[a];for(let h=0,f=l.length;h<f;h++){let u=l[h],d=e(u,i);c.push(d)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,c=o.length;a<c;a++){let l=o[a];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.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!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 i=this.attributes;for(let c in i){let l=i[c];e.data.attributes[c]=l.toJSON(e.data)}let s={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let f=0,u=l.length;f<u;f++){let d=l[f];h.push(d.toJSON(e.data))}h.length>0&&(s[c]=h,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.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 i=e.index;i!==null&&this.setIndex(i.clone());let s=e.attributes;for(let l in s){let h=s[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],f=r[l];for(let u=0,d=f.length;u<d;u++)h.push(f[u].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let l=0,h=o.length;l<h;l++){let f=o[l];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.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._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}};var ih=new N,dg=new N,fg=new Ye,Fn=class{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let s=ih.subVectors(i,t).cross(dg.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){let s=e.delta(ih),r=this.normal.dot(s);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/r;return i===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(s,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||fg.getNormalMatrix(e),s=this.coplanarPoint(ih).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}},pg=0,yi=class extends Qn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pg++}),this.uuid=ir(),this.name="",this.type="Material",this.blending=Qs,this.side=Tn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=co,this.blendDst=er,this.blendEquation=us,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xe(0,0,0),this.blendAlpha=0,this.depthFunc=ks,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ff,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Sa,this.stencilZFail=Sa,this.stencilZPass=Sa,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 i=e[t];if(i===void 0){Be(`Material: parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){Be(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector2&&i&&i.isVector2||s&&s.isEuler&&i&&i.isEuler||s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,i.blending=this.blending,i.side=this.side,i.shadowSide=this.shadowSide,i.vertexColors=this.vertexColors,i.opacity=this.opacity,i.transparent=this.transparent,i.blendSrc=this.blendSrc,i.blendDst=this.blendDst,i.blendEquation=this.blendEquation,i.blendSrcAlpha=this.blendSrcAlpha,i.blendDstAlpha=this.blendDstAlpha,i.blendEquationAlpha=this.blendEquationAlpha,i.blendColor=this.blendColor.getHex(),i.blendAlpha=this.blendAlpha,i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.clipIntersection=this.clipIntersection,i.clipShadows=this.clipShadows,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,i.stencilWrite=this.stencilWrite,i.polygonOffset=this.polygonOffset,i.polygonOffsetFactor=this.polygonOffsetFactor,i.polygonOffsetUnits=this.polygonOffsetUnits,i.dithering=this.dithering,i.alphaTest=this.alphaTest,i.alphaHash=this.alphaHash,i.alphaToCoverage=this.alphaToCoverage,i.premultipliedAlpha=this.premultipliedAlpha,i.forceSinglePass=this.forceSinglePass,i.allowOverride=this.allowOverride,i.visible=this.visible,i.toneMapped=this.toneMapped,i.name=this.name,this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(i.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(i.clippingPlanes=this.clippingPlanes.map(r=>r.toJSON())),this.rotation!==void 0&&(i.rotation=this.rotation),this.depthPacking!==void 0&&(i.depthPacking=this.depthPacking),this.linewidth!==void 0&&(i.linewidth=this.linewidth),this.linecap!==void 0&&(i.linecap=this.linecap),this.linejoin!==void 0&&(i.linejoin=this.linejoin),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.wireframe!==void 0&&(i.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(i.flatShading=this.flatShading),this.fog!==void 0&&(i.fog=this.fog),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){let o=[];for(let a in r){let c=r[a];delete c.metadata,o.push(c)}return o}if(t){let r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Xe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(i=>new Fn().fromJSON(i))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),this.normalScale=new le().fromArray(i)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new le().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.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 mi=new N,sh=new N,ta=new N,na=new N,Gr=class{constructor(e=new N,t=new N(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,mi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=mi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mi.copy(this.origin).addScaledVector(this.direction,t),mi.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){sh.copy(e).add(t).multiplyScalar(.5),ta.copy(t).sub(e).normalize(),na.copy(this.origin).sub(sh);let r=e.distanceTo(t)*.5,o=-this.direction.dot(ta),a=na.dot(this.direction),c=-na.dot(ta),l=na.lengthSq(),h=Math.abs(1-o*o),f,u,d,m;if(h>0)if(f=o*c-a,u=o*a-c,m=r*h,f>=0)if(u>=-m)if(u<=m){let v=1/h;f*=v,u*=v,d=f*(f+o*u+2*a)+u*(o*f+u+2*c)+l}else u=r,f=Math.max(0,-(o*u+a)),d=-f*f+u*(u+2*c)+l;else u=-r,f=Math.max(0,-(o*u+a)),d=-f*f+u*(u+2*c)+l;else u<=-m?(f=Math.max(0,-(-o*r+a)),u=f>0?-r:Math.min(Math.max(-r,-c),r),d=-f*f+u*(u+2*c)+l):u<=m?(f=0,u=Math.min(Math.max(-r,-c),r),d=u*(u+2*c)+l):(f=Math.max(0,-(o*r+a)),u=f>0?r:Math.min(Math.max(-r,-c),r),d=-f*f+u*(u+2*c)+l);else u=o>0?-r:r,f=Math.max(0,-(o*u+a)),d=-f*f+u*(u+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,f),s&&s.copy(sh).addScaledVector(ta,u),d}intersectSphere(e,t){if(e.radius<0)return null;mi.subVectors(e.center,this.origin);let i=mi.dot(this.direction),s=mi.dot(mi)-i*i,r=e.radius*e.radius;if(s>r)return null;let o=Math.sqrt(r-s),a=i-o,c=i+o;return c<0?null:a<0?this.at(c,t):this.at(a,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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,c,l=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,u=this.origin;return l>=0?(i=(e.min.x-u.x)*l,s=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,s=(e.min.x-u.x)*l),h>=0?(r=(e.min.y-u.y)*h,o=(e.max.y-u.y)*h):(r=(e.max.y-u.y)*h,o=(e.min.y-u.y)*h),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o<s||isNaN(s))&&(s=o),f>=0?(a=(e.min.z-u.z)*f,c=(e.max.z-u.z)*f):(a=(e.max.z-u.z)*f,c=(e.min.z-u.z)*f),i>c||a>s)||((a>i||i!==i)&&(i=a),(c<s||s!==s)&&(s=c),s<0)?null:this.at(i>=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,mi)!==null}intersectTriangle(e,t,i,s,r){let o=this.origin,a=this.direction,c=a.x,l=a.y,h=a.z,f=e.x-o.x,u=e.y-o.y,d=e.z-o.z,m=t.x-o.x,v=t.y-o.y,g=t.z-o.z,p=i.x-o.x,S=i.y-o.y,T=i.z-o.z,y=Math.abs(c),w=Math.abs(l),b=Math.abs(h),C,x,E,I,D,O,V,R,P,k,X,te;if(y>=w&&y>=b?(E=c,O=f,P=m,te=p,c>=0?(C=l,x=h,I=u,D=d,V=v,R=g,k=S,X=T):(C=h,x=l,I=d,D=u,V=g,R=v,k=T,X=S)):w>=b?(E=l,O=u,P=v,te=S,l>=0?(C=h,x=c,I=d,D=f,V=g,R=m,k=T,X=p):(C=c,x=h,I=f,D=d,V=m,R=g,k=p,X=T)):(E=h,O=d,P=g,te=T,h>=0?(C=c,x=l,I=f,D=u,V=m,R=v,k=p,X=S):(C=l,x=c,I=u,D=f,V=v,R=m,k=S,X=p)),E===0)return null;let q=C/E,Z=x/E,j=1/E,Re=I-q*O,be=D-Z*O,Ke=V-q*P,Ze=R-Z*P,et=k-q*te,J=X-Z*te,ne=et*Ze-J*Ke,ye=Re*J-be*et,Ve=Ke*be-Ze*Re;if(s){if(ne<0||ye<0||Ve<0)return null}else if((ne<0||ye<0||Ve<0)&&(ne>0||ye>0||Ve>0))return null;let Ee=ne+ye+Ve;if(Ee===0)return null;let He=j*(ne*O+ye*P+Ve*te);return(Ee>0?He<0:He>0)?null:this.at(He/Ee,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)}},Ni=class extends yi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(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 xi,this.combine=Ch,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}},Md=new ht,rs=new Gr,ia=new vi,Sd=new N,sa=new N,ra=new N,oa=new N,rh=new N,aa=new N,bd=new N,ca=new N,Rt=class extends Zt{constructor(e=new Ot,t=new Ni){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,i=Object.keys(t);if(i.length>0){let s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,t){let i=this.geometry,s=i.attributes.position,r=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(s,e);let a=this.morphTargetInfluences;if(r&&a){aa.set(0,0,0);for(let c=0,l=r.length;c<l;c++){let h=a[c],f=r[c];h!==0&&(rh.fromBufferAttribute(f,e),o?aa.addScaledVector(rh,h):aa.addScaledVector(rh.sub(t),h))}t.add(aa)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let i=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),ia.copy(i.boundingSphere),ia.applyMatrix4(r),rs.copy(e.ray).recast(e.near),!(ia.containsPoint(rs.origin)===!1&&(rs.intersectSphere(ia,Sd)===null||rs.origin.distanceToSquared(Sd)>(e.far-e.near)**2))&&(Md.copy(r).invert(),rs.copy(e.ray).applyMatrix4(Md),!(i.boundingBox!==null&&rs.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,rs)))}_computeIntersections(e,t,i){let s,r=this.geometry,o=this.material,a=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,f=r.attributes.normal,u=r.groups,d=r.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,v=u.length;m<v;m++){let g=u[m],p=o[g.materialIndex],S=Math.max(g.start,d.start),T=Math.min(a.count,Math.min(g.start+g.count,d.start+d.count));for(let y=S,w=T;y<w;y+=3){let b=a.getX(y),C=a.getX(y+1),x=a.getX(y+2);s=la(this,p,e,i,l,h,f,b,C,x),s&&(s.faceIndex=Math.floor(y/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{let m=Math.max(0,d.start),v=Math.min(a.count,d.start+d.count);for(let g=m,p=v;g<p;g+=3){let S=a.getX(g),T=a.getX(g+1),y=a.getX(g+2);s=la(this,o,e,i,l,h,f,S,T,y),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}else if(c!==void 0)if(Array.isArray(o))for(let m=0,v=u.length;m<v;m++){let g=u[m],p=o[g.materialIndex],S=Math.max(g.start,d.start),T=Math.min(c.count,Math.min(g.start+g.count,d.start+d.count));for(let y=S,w=T;y<w;y+=3){let b=y,C=y+1,x=y+2;s=la(this,p,e,i,l,h,f,b,C,x),s&&(s.faceIndex=Math.floor(y/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{let m=Math.max(0,d.start),v=Math.min(c.count,d.start+d.count);for(let g=m,p=v;g<p;g+=3){let S=g,T=g+1,y=g+2;s=la(this,o,e,i,l,h,f,S,T,y),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}}};function mg(n,e,t,i,s,r,o,a){let c;if(e.side===$t?c=i.intersectTriangle(o,r,s,!0,a):c=i.intersectTriangle(s,r,o,e.side===Tn,a),c===null)return null;ca.copy(a),ca.applyMatrix4(n.matrixWorld);let l=t.ray.origin.distanceTo(ca);return l<t.near||l>t.far?null:{distance:l,point:ca.clone(),object:n}}function la(n,e,t,i,s,r,o,a,c,l){n.getVertexPosition(a,sa),n.getVertexPosition(c,ra),n.getVertexPosition(l,oa);let h=mg(n,e,t,i,sa,ra,oa,bd);if(h){let f=new N;gi.getBarycoord(bd,sa,ra,oa,f),s&&(h.uv=gi.getInterpolatedAttribute(s,a,c,l,f,new le)),r&&(h.uv1=gi.getInterpolatedAttribute(r,a,c,l,f,new le)),o&&(h.normal=gi.getInterpolatedAttribute(o,a,c,l,f,new N),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));let u={a,b:c,c:l,normal:new N,materialIndex:0};gi.getNormal(sa,ra,oa,u.normal),h.face=u,h.barycoord=f}return h}var Hr=class extends rn{constructor(e=null,t=1,i=1,s,r,o,a,c,l=Ht,h=Ht,f,u){super(null,o,a,c,l,h,s,r,f,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ui=class extends Ft{constructor(e,t,i,s=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},Us=new ht,wd=new ht,ha=[],Ed=new ei,gg=new ht,Cr=new Rt,Rr=new vi,cs=class extends Rt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ui(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<i;s++)this.setMatrixAt(s,gg)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ei),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Us),Ed.copy(e.boundingBox).applyMatrix4(Us),this.boundingBox.union(Ed)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new vi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Us),Rr.copy(e.boundingSphere).applyMatrix4(Us),this.boundingSphere.union(Rr)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){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 i=t.morphTargetInfluences,s=this.morphTexture.source.data.data,r=i.length+1,o=e*r+1;for(let a=0;a<i.length;a++)i[a]=s[o+a]}raycast(e,t){let i=this.matrixWorld,s=this.count;if(Cr.geometry=this.geometry,Cr.material=this.material,Cr.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Rr.copy(this.boundingSphere),Rr.applyMatrix4(i),e.ray.intersectsSphere(Rr)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,Us),wd.multiplyMatrices(i,Us),Cr.matrixWorld=wd,Cr.raycast(e,ha);for(let o=0,a=ha.length;o<a;o++){let c=ha[o];c.instanceId=r,c.object=this,t.push(c)}ha.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Ui(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 i=t.morphTargetInfluences,s=i.length+1;this.morphTexture===null&&(this.morphTexture=new Hr(new Float32Array(s*this.count),s,this.count,vc,Cn));let r=this.morphTexture.source.data.data,o=0;for(let l=0;l<i.length;l++)o+=i[l];let a=this.geometry.morphTargetsRelative?1:1-o,c=s*e;return r[c]=a,r.set(i,c+1),this}updateMorphTargets(){}dispose(){super.dispose(),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},os=new vi,_g=new le(.5,.5),ua=new N,qs=class{constructor(e=new Fn,t=new Fn,i=new Fn,s=new Fn,r=new Fn,o=new Fn){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=On,i=!1){let s=this.planes,r=e.elements,o=r[0],a=r[1],c=r[2],l=r[3],h=r[4],f=r[5],u=r[6],d=r[7],m=r[8],v=r[9],g=r[10],p=r[11],S=r[12],T=r[13],y=r[14],w=r[15];if(s[0].setComponents(l-o,d-h,p-m,w-S).normalize(),s[1].setComponents(l+o,d+h,p+m,w+S).normalize(),s[2].setComponents(l+a,d+f,p+v,w+T).normalize(),s[3].setComponents(l-a,d-f,p-v,w-T).normalize(),i)s[4].setComponents(c,u,g,y).normalize(),s[5].setComponents(l-c,d-u,p-g,w-y).normalize();else if(s[4].setComponents(l-c,d-u,p-g,w-y).normalize(),t===On)s[5].setComponents(l+c,d+u,p+g,w+y).normalize();else if(t===Vs)s[5].setComponents(c,u,g,y).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(),os.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),os.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(os)}intersectsSprite(e){os.center.set(0,0,0);let t=_g.distanceTo(e.center);return os.radius=.7071067811865476+t,os.applyMatrix4(e.matrixWorld),this.intersectsSphere(os)}intersectsSphere(e){let t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let s=t[i];if(ua.x=s.normal.x>0?e.max.x:e.min.x,ua.y=s.normal.y>0?e.max.y:e.min.y,ua.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(ua)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var Ys=class extends yi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xe(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}},Ba=new N,za=new N,Td=new ht,Ir=new Gr,da=new vi,oh=new N,Ad=new N,ka=class extends Zt{constructor(e=new Ot,t=new Ys){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,i=[0];for(let s=1,r=t.count;s<r;s++)Ba.fromBufferAttribute(t,s-1),za.fromBufferAttribute(t,s),i[s]=i[s-1],i[s]+=Ba.distanceTo(za);e.setAttribute("lineDistance",new vt(i,1))}else Be("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let i=this.geometry,s=this.matrixWorld,r=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),da.copy(i.boundingSphere),da.applyMatrix4(s),da.radius+=r,e.ray.intersectsSphere(da)===!1)return;Td.copy(s).invert(),Ir.copy(e.ray).applyMatrix4(Td);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,h=i.index,u=i.attributes.position;if(h!==null){let d=Math.max(0,o.start),m=Math.min(h.count,o.start+o.count);for(let v=d,g=m-1;v<g;v+=l){let p=h.getX(v),S=h.getX(v+1),T=fa(this,e,Ir,c,p,S,v);T&&t.push(T)}if(this.isLineLoop){let v=h.getX(m-1),g=h.getX(d),p=fa(this,e,Ir,c,v,g,m-1);p&&t.push(p)}}else{let d=Math.max(0,o.start),m=Math.min(u.count,o.start+o.count);for(let v=d,g=m-1;v<g;v+=l){let p=fa(this,e,Ir,c,v,v+1,v);p&&t.push(p)}if(this.isLineLoop){let v=fa(this,e,Ir,c,m-1,d,m-1);v&&t.push(v)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}};function fa(n,e,t,i,s,r,o){let a=n.geometry.attributes.position;if(Ba.fromBufferAttribute(a,s),za.fromBufferAttribute(a,r),t.distanceSqToSegment(Ba,za,oh,Ad)>i)return;oh.applyMatrix4(n.matrixWorld);let l=e.ray.origin.distanceTo(oh);if(!(l<e.near||l>e.far))return{distance:l,point:Ad.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}var Cd=new N,Rd=new N,Wr=class extends ka{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,i=[];for(let s=0,r=t.count;s<r;s+=2)Cd.fromBufferAttribute(t,s),Rd.fromBufferAttribute(t,s+1),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+Cd.distanceTo(Rd);e.setAttribute("lineDistance",new vt(i,1))}else Be("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var Xr=class extends rn{constructor(e=[],t=Gi,i,s,r,o,a,c,l,h){super(e,t,i,s,r,o,a,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},qr=class extends rn{constructor(e,t,i,s,r,o,a,c,l){super(e,t,i,s,r,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}};var Fi=class extends rn{constructor(e,t,i=kn,s,r,o,a=Ht,c=Ht,l,h=jn,f=1){if(h!==jn&&h!==Wi)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let u={width:e,height:t,depth:f};super(u,s,r,o,a,c,h,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Hs(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},Va=class extends Fi{constructor(e,t=kn,i=Gi,s,r,o=Ht,a=Ht,c,l=jn){let h={width:e,height:e,depth:1},f=[h,h,h,h,h,h];super(e,e,t,i,s,r,o,a,c,l),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Yr=class extends rn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Bn=class n extends Ot{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};let a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);let c=[],l=[],h=[],f=[],u=0,d=0;m("z","y","x",-1,-1,i,t,e,o,r,0),m("z","y","x",1,-1,i,t,-e,o,r,1),m("x","z","y",1,1,e,i,t,s,o,2),m("x","z","y",1,-1,e,i,-t,s,o,3),m("x","y","z",1,-1,e,t,i,s,r,4),m("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(c),this.setAttribute("position",new vt(l,3)),this.setAttribute("normal",new vt(h,3)),this.setAttribute("uv",new vt(f,2));function m(v,g,p,S,T,y,w,b,C,x,E){let I=y/C,D=w/x,O=y/2,V=w/2,R=b/2,P=C+1,k=x+1,X=0,te=0,q=new N;for(let Z=0;Z<k;Z++){let j=Z*D-V;for(let Re=0;Re<P;Re++){let be=Re*I-O;q[v]=be*S,q[g]=j*T,q[p]=R,l.push(q.x,q.y,q.z),q[v]=0,q[g]=0,q[p]=b>0?1:-1,h.push(q.x,q.y,q.z),f.push(Re/C),f.push(1-Z/x),X+=1}}for(let Z=0;Z<x;Z++)for(let j=0;j<C;j++){let Re=u+j+P*Z,be=u+j+P*(Z+1),Ke=u+(j+1)+P*(Z+1),Ze=u+(j+1)+P*Z;c.push(Re,be,Ze),c.push(be,Ke,Ze),te+=6}a.addGroup(d,te,E),d+=te,u+=X}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var En=class n extends Ot{constructor(e=1,t=1,i=1,s=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:s,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};let l=this;s=Math.floor(s),r=Math.floor(r);let h=[],f=[],u=[],d=[],m=0,v=[],g=i/2,p=0;S(),o===!1&&(e>0&&T(!0),t>0&&T(!1)),this.setIndex(h),this.setAttribute("position",new vt(f,3)),this.setAttribute("normal",new vt(u,3)),this.setAttribute("uv",new vt(d,2));function S(){let y=new N,w=new N,b=0,C=(t-e)/i;for(let x=0;x<=r;x++){let E=[],I=x/r,D=I*(t-e)+e;for(let O=0;O<=s;O++){let V=O/s,R=V*c+a,P=Math.sin(R),k=Math.cos(R);w.x=D*P,w.y=-I*i+g,w.z=D*k,f.push(w.x,w.y,w.z),y.set(P,C,k).normalize(),u.push(y.x,y.y,y.z),d.push(V,1-I),E.push(m++)}v.push(E)}for(let x=0;x<s;x++)for(let E=0;E<r;E++){let I=v[E][x],D=v[E+1][x],O=v[E+1][x+1],V=v[E][x+1];(e>0||E!==0)&&(h.push(I,D,V),b+=3),(t>0||E!==r-1)&&(h.push(D,O,V),b+=3)}l.addGroup(p,b,0),p+=b}function T(y){let w=m,b=new le,C=new N,x=0,E=y===!0?e:t,I=y===!0?1:-1;for(let O=1;O<=s;O++)f.push(0,g*I,0),u.push(0,I,0),d.push(.5,.5),m++;let D=m;for(let O=0;O<=s;O++){let R=O/s*c+a,P=Math.cos(R),k=Math.sin(R);C.x=E*k,C.y=g*I,C.z=E*P,f.push(C.x,C.y,C.z),u.push(0,I,0),b.x=P*.5+.5,b.y=k*.5*I+.5,d.push(b.x,b.y),m++}for(let O=0;O<s;O++){let V=w+O,R=D+O;y===!0?h.push(R,R+1,V):h.push(R+1,R,V),x+=3}l.addGroup(p,x,y===!0?1:2),p+=x}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var pa=new N,ma=new N,ah=new N,ga=new gi,Zr=class extends Ot{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){let s=Math.pow(10,4),r=Math.cos(ba*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,l=[0,0,0],h=["a","b","c"],f=new Array(3),u={},d=[];for(let m=0;m<c;m+=3){o?(l[0]=o.getX(m),l[1]=o.getX(m+1),l[2]=o.getX(m+2)):(l[0]=m,l[1]=m+1,l[2]=m+2);let{a:v,b:g,c:p}=ga;if(v.fromBufferAttribute(a,l[0]),g.fromBufferAttribute(a,l[1]),p.fromBufferAttribute(a,l[2]),ga.getNormal(ah),f[0]=`${Math.round(v.x*s)},${Math.round(v.y*s)},${Math.round(v.z*s)}`,f[1]=`${Math.round(g.x*s)},${Math.round(g.y*s)},${Math.round(g.z*s)}`,f[2]=`${Math.round(p.x*s)},${Math.round(p.y*s)},${Math.round(p.z*s)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let S=0;S<3;S++){let T=(S+1)%3,y=f[S],w=f[T],b=ga[h[S]],C=ga[h[T]],x=`${y}_${w}`,E=`${w}_${y}`;E in u&&u[E]?(ah.dot(u[E].normal)<=r&&(d.push(b.x,b.y,b.z),d.push(C.x,C.y,C.z)),u[E]=null):x in u||(u[x]={index0:l[S],index1:l[T],normal:ah.clone()})}}for(let m in u)if(u[m]){let{index0:v,index1:g}=u[m];pa.fromBufferAttribute(a,v),ma.fromBufferAttribute(a,g),d.push(pa.x,pa.y,pa.z),d.push(ma.x,ma.y,ma.z)}this.setAttribute("position",new vt(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},xn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Be("Curve: .getPoint() not implemented.")}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let i=this.getLengths(),s=0,r=i.length,o;t?o=t:o=e*i[r-1];let a=0,c=r-1,l;for(;a<=c;)if(s=Math.floor(a+(c-a)/2),l=i[s]-o,l<0)a=s+1;else if(l>0)c=s-1;else{c=s;break}if(s=c,i[s]===o)return s/(r-1);let h=i[s],u=i[s+1]-h,d=(o-h)/u;return(s+d)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);let o=this.getPoint(s),a=this.getPoint(r),c=t||(o.isVector2?new le:new N);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){let i=new N,s=[],r=[],o=[],a=new N,c=new ht;for(let d=0;d<=e;d++){let m=d/e;s[d]=this.getTangentAt(m,new N)}r[0]=new N,o[0]=new N;let l=Number.MAX_VALUE,h=Math.abs(s[0].x),f=Math.abs(s[0].y),u=Math.abs(s[0].z);h<=l&&(l=h,i.set(1,0,0)),f<=l&&(l=f,i.set(0,1,0)),u<=l&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let d=1;d<=e;d++){if(r[d]=r[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(s[d-1],s[d]),a.length()>Number.EPSILON){a.normalize();let m=Math.acos(tt(s[d-1].dot(s[d]),-1,1));r[d].applyMatrix4(c.makeRotationAxis(a,m))}o[d].crossVectors(s[d],r[d])}if(t===!0){let d=Math.acos(tt(r[0].dot(r[e]),-1,1));d/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(d=-d);for(let m=1;m<=e;m++)r[m].applyMatrix4(c.makeRotationAxis(s[m],d*m)),o[m].crossVectors(s[m],r[m])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Zs=class extends xn{constructor(e=0,t=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new le){let i=t,s=Math.PI*2,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(o?r=0:r=s),this.aClockwise===!0&&!o&&(r===s?r=-s:r=r-s);let a=this.aStartAngle+e*r,c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let h=Math.cos(this.aRotation),f=Math.sin(this.aRotation),u=c-this.aX,d=l-this.aY;c=u*h-d*f+this.aX,l=u*f+d*h+this.aY}return i.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},Ga=class extends Zs{constructor(e,t,i,s,r,o){super(e,t,i,i,s,r,o),this.isArcCurve=!0,this.type="ArcCurve"}};function Wh(){let n=0,e=0,t=0,i=0;function s(r,o,a,c){n=r,e=a,t=-3*r+3*o-2*a-c,i=2*r-2*o+a+c}return{initCatmullRom:function(r,o,a,c,l){s(o,a,l*(a-r),l*(c-o))},initNonuniformCatmullRom:function(r,o,a,c,l,h,f){let u=(o-r)/l-(a-r)/(l+h)+(a-o)/h,d=(a-o)/h-(c-o)/(h+f)+(c-a)/f;u*=h,d*=h,s(o,a,u,d)},calc:function(r){let o=r*r,a=o*r;return n+e*r+t*o+i*a}}}var Id=new N,Pd=new N,ch=new Wh,lh=new Wh,hh=new Wh,Ha=class extends xn{constructor(e=[],t=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=s}getPoint(e,t=new N){let i=t,s=this.points,r=s.length,o=(r-(this.closed?0:1))*e,a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let l,h;this.closed||a>0?l=s[(a-1)%r]:(Pd.subVectors(s[0],s[1]).add(s[0]),l=Pd);let f=s[a%r],u=s[(a+1)%r];if(this.closed||a+2<r?h=s[(a+2)%r]:(Id.subVectors(s[r-1],s[r-2]).add(s[r-1]),h=Id),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,m=Math.pow(l.distanceToSquared(f),d),v=Math.pow(f.distanceToSquared(u),d),g=Math.pow(u.distanceToSquared(h),d);v<1e-4&&(v=1),m<1e-4&&(m=v),g<1e-4&&(g=v),ch.initNonuniformCatmullRom(l.x,f.x,u.x,h.x,m,v,g),lh.initNonuniformCatmullRom(l.y,f.y,u.y,h.y,m,v,g),hh.initNonuniformCatmullRom(l.z,f.z,u.z,h.z,m,v,g)}else this.curveType==="catmullrom"&&(ch.initCatmullRom(l.x,f.x,u.x,h.x,this.tension),lh.initCatmullRom(l.y,f.y,u.y,h.y,this.tension),hh.initCatmullRom(l.z,f.z,u.z,h.z,this.tension));return i.set(ch.calc(c),lh.calc(c),hh.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let s=e.points[t];this.points.push(s.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let s=this.points[t];e.points.push(s.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let s=e.points[t];this.points.push(new N().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function Ld(n,e,t,i,s){let r=(i-e)*.5,o=(s-t)*.5,a=n*n,c=n*a;return(2*t-2*i+r+o)*c+(-3*t+3*i-2*r-o)*a+r*n+t}function xg(n,e){let t=1-n;return t*t*e}function vg(n,e){return 2*(1-n)*n*e}function yg(n,e){return n*n*e}function Lr(n,e,t,i){return xg(n,e)+vg(n,t)+yg(n,i)}function Mg(n,e){let t=1-n;return t*t*t*e}function Sg(n,e){let t=1-n;return 3*t*t*n*e}function bg(n,e){return 3*(1-n)*n*n*e}function wg(n,e){return n*n*n*e}function Dr(n,e,t,i,s){return Mg(n,e)+Sg(n,t)+bg(n,i)+wg(n,s)}var $r=class extends xn{constructor(e=new le,t=new le,i=new le,s=new le){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=s}getPoint(e,t=new le){let i=t,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(Dr(e,s.x,r.x,o.x,a.x),Dr(e,s.y,r.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Wa=class extends xn{constructor(e=new N,t=new N,i=new N,s=new N){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=s}getPoint(e,t=new N){let i=t,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(Dr(e,s.x,r.x,o.x,a.x),Dr(e,s.y,r.y,o.y,a.y),Dr(e,s.z,r.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Jr=class extends xn{constructor(e=new le,t=new le){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new le){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new le){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Xa=class extends xn{constructor(e=new N,t=new N){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new N){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new N){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Kr=class extends xn{constructor(e=new le,t=new le,i=new le){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new le){let i=t,s=this.v0,r=this.v1,o=this.v2;return i.set(Lr(e,s.x,r.x,o.x),Lr(e,s.y,r.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},qa=class extends xn{constructor(e=new N,t=new N,i=new N){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new N){let i=t,s=this.v0,r=this.v1,o=this.v2;return i.set(Lr(e,s.x,r.x,o.x),Lr(e,s.y,r.y,o.y),Lr(e,s.z,r.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},jr=class extends xn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new le){let i=t,s=this.points,r=(s.length-1)*e,o=Math.floor(r),a=r-o,c=s[o===0?o:o-1],l=s[o],h=s[o>s.length-2?s.length-1:o+1],f=s[o>s.length-3?s.length-1:o+2];return i.set(Ld(a,c.x,l.x,h.x,f.x),Ld(a,c.y,l.y,h.y,f.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let s=e.points[t];this.points.push(s.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let s=this.points[t];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let s=e.points[t];this.points.push(new le().fromArray(s))}return this}},_h=Object.freeze({__proto__:null,ArcCurve:Ga,CatmullRomCurve3:Ha,CubicBezierCurve:$r,CubicBezierCurve3:Wa,EllipseCurve:Zs,LineCurve:Jr,LineCurve3:Xa,QuadraticBezierCurve:Kr,QuadraticBezierCurve3:qa,SplineCurve:jr}),Ya=class extends xn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new _h[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=i){let o=s[r]-i,a=this.curves[r],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}r++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let i=0,s=this.curves.length;i<s;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let s=0,r=this.curves;s<r.length;s++){let o=r[s],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){let h=c[l];i&&i.equals(h)||(t.push(h),i=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let s=e.curves[t];this.curves.push(s.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let s=this.curves[t];e.curves.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let s=e.curves[t];this.curves.push(new _h[s.type]().fromJSON(s))}return this}},ti=class extends Ya{constructor(e){super(),this.type="Path",this.currentPoint=new le,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new Jr(this.currentPoint.clone(),new le(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,s){let r=new Kr(this.currentPoint.clone(),new le(e,t),new le(i,s));return this.curves.push(r),this.currentPoint.set(i,s),this}bezierCurveTo(e,t,i,s,r,o){let a=new $r(this.currentPoint.clone(),new le(e,t),new le(i,s),new le(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new jr(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,s,r,o){let a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,i,s,r,o),this}absarc(e,t,i,s,r,o){return this.absellipse(e,t,i,i,s,r,o),this}ellipse(e,t,i,s,r,o,a,c){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,i,s,r,o,a,c),this}absellipse(e,t,i,s,r,o,a,c){let l=new Zs(e,t,i,s,r,o,a,c);if(this.curves.length>0){let f=l.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},on=class extends ti{constructor(e){super(e),this.uuid=ir(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,s=this.holes.length;i<s;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let s=e.holes[t];this.holes.push(s.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let s=this.holes[t];e.holes.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let s=e.holes[t];this.holes.push(new ti().fromJSON(s))}return this}};function Eg(n,e,t=2){let i=e&&e.length,s=i?e[0]*t:n.length,r=Tf(n,0,s,t,!0),o=[];if(!r||r.next===r.prev)return o;let a,c,l;if(i&&(r=Ig(n,e,r,t)),n.length>80*t){a=n[0],c=n[1];let h=a,f=c;for(let u=t;u<s;u+=t){let d=n[u],m=n[u+1];d<a&&(a=d),m<c&&(c=m),d>h&&(h=d),m>f&&(f=m)}l=Math.max(h-a,f-c),l=l!==0?32767/l:0}return Qr(r,o,t,a,c,l,0),o}function Tf(n,e,t,i,s){let r;if(s===Vg(n,e,t,i)>0)for(let o=e;o<t;o+=i)r=Dd(o/i|0,n[o],n[o+1],r);else for(let o=t-i;o>=e;o-=i)r=Dd(o/i|0,n[o],n[o+1],r);return r&&$s(r,r.next)&&(to(r),r=r.next),r}function ls(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&($s(t,t.next)||Ct(t.prev,t,t.next)===0)){if(to(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Qr(n,e,t,i,s,r,o){if(!n)return;!o&&r&&Ug(n,i,s,r);let a=n;for(;n.prev!==n.next;){let c=n.prev,l=n.next;if(r?Ag(n,i,s,r):Tg(n)){e.push(c.i,n.i,l.i),to(n),n=l.next,a=l.next;continue}if(n=l,n===a){o?o===1?(n=Cg(ls(n),e),Qr(n,e,t,i,s,r,2)):o===2&&Rg(n,e,t,i,s,r):Qr(ls(n),e,t,i,s,r,1);break}}}function Tg(n){let e=n.prev,t=n,i=n.next;if(Ct(e,t,i)>=0)return!1;let s=e.x,r=t.x,o=i.x,a=e.y,c=t.y,l=i.y,h=Math.min(s,r,o),f=Math.min(a,c,l),u=Math.max(s,r,o),d=Math.max(a,c,l),m=i.next;for(;m!==e;){if(m.x>=h&&m.x<=u&&m.y>=f&&m.y<=d&&Pr(s,a,r,c,o,l,m.x,m.y)&&Ct(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Ag(n,e,t,i){let s=n.prev,r=n,o=n.next;if(Ct(s,r,o)>=0)return!1;let a=s.x,c=r.x,l=o.x,h=s.y,f=r.y,u=o.y,d=Math.min(a,c,l),m=Math.min(h,f,u),v=Math.max(a,c,l),g=Math.max(h,f,u),p=xh(d,m,e,t,i),S=xh(v,g,e,t,i),T=n.prevZ,y=n.nextZ;for(;T&&T.z>=p&&y&&y.z<=S;){if(T.x>=d&&T.x<=v&&T.y>=m&&T.y<=g&&T!==s&&T!==o&&Pr(a,h,c,f,l,u,T.x,T.y)&&Ct(T.prev,T,T.next)>=0||(T=T.prevZ,y.x>=d&&y.x<=v&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&Pr(a,h,c,f,l,u,y.x,y.y)&&Ct(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;T&&T.z>=p;){if(T.x>=d&&T.x<=v&&T.y>=m&&T.y<=g&&T!==s&&T!==o&&Pr(a,h,c,f,l,u,T.x,T.y)&&Ct(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;y&&y.z<=S;){if(y.x>=d&&y.x<=v&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&Pr(a,h,c,f,l,u,y.x,y.y)&&Ct(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Cg(n,e){let t=n;do{let i=t.prev,s=t.next.next;!$s(i,s)&&Cf(i,t,t.next,s)&&eo(i,s)&&eo(s,i)&&(e.push(i.i,t.i,s.i),to(t),to(t.next),t=n=s),t=t.next}while(t!==n);return ls(t)}function Rg(n,e,t,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Bg(o,a)){let c=Rf(o,a);o=ls(o,o.next),c=ls(c,c.next),Qr(o,e,t,i,s,r,0),Qr(c,e,t,i,s,r,0);return}a=a.next}o=o.next}while(o!==n)}function Ig(n,e,t,i){let s=[];for(let r=0,o=e.length;r<o;r++){let a=e[r]*i,c=r<o-1?e[r+1]*i:n.length,l=Tf(n,a,c,i,!1);l===l.next&&(l.steiner=!0),s.push(Og(l))}s.sort(Pg);for(let r=0;r<s.length;r++)t=Lg(s[r],t);return t}function Pg(n,e){let t=n.x-e.x;if(t===0&&(t=n.y-e.y,t===0)){let i=(n.next.y-n.y)/(n.next.x-n.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=i-s}return t}function Lg(n,e){let t=Dg(n,e);if(!t)return e;let i=Rf(t,n);return ls(i,i.next),ls(t,t.next)}function Dg(n,e){let t=e,i=n.x,s=n.y,r=-1/0,o;if($s(n,t))return t;do{if($s(n,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){let f=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=i&&f>r&&(r=f,o=t.x<t.next.x?t:t.next,f===i))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,c=o.x,l=o.y,h=1/0;t=o;do{if(i>=t.x&&t.x>=c&&i!==t.x&&Af(s<l?i:r,s,c,l,s<l?r:i,s,t.x,t.y)){let f=Math.abs(s-t.y)/(i-t.x);eo(t,n)&&(f<h||f===h&&(t.x>o.x||t.x===o.x&&Ng(o,t)))&&(o=t,h=f)}t=t.next}while(t!==a);return o}function Ng(n,e){return Ct(n.prev,n,e.prev)<0&&Ct(e.next,n,n.next)<0}function Ug(n,e,t,i){let s=n;do s.z===0&&(s.z=xh(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,Fg(s)}function Fg(n){let e,t=1;do{let i=n,s;n=null;let r=null;for(e=0;i;){e++;let o=i,a=0;for(let l=0;l<t&&(a++,o=o.nextZ,!!o);l++);let c=t;for(;a>0||c>0&&o;)a!==0&&(c===0||!o||i.z<=o.z)?(s=i,i=i.nextZ,a--):(s=o,o=o.nextZ,c--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;i=o}r.nextZ=null,t*=2}while(e>1);return n}function xh(n,e,t,i,s){return n=(n-t)*s|0,e=(e-i)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function Og(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Af(n,e,t,i,s,r,o,a){return(s-o)*(e-a)>=(n-o)*(r-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(s-o)*(i-a)}function Pr(n,e,t,i,s,r,o,a){return!(n===o&&e===a)&&Af(n,e,t,i,s,r,o,a)}function Bg(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!zg(n,e)&&(eo(n,e)&&eo(e,n)&&kg(n,e)&&(Ct(n.prev,n,e.prev)||Ct(n,e.prev,e))||$s(n,e)&&Ct(n.prev,n,n.next)>0&&Ct(e.prev,e,e.next)>0)}function Ct(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function $s(n,e){return n.x===e.x&&n.y===e.y}function Cf(n,e,t,i){let s=xa(Ct(n,e,t)),r=xa(Ct(n,e,i)),o=xa(Ct(t,i,n)),a=xa(Ct(t,i,e));return!!(s!==r&&o!==a||s===0&&_a(n,t,e)||r===0&&_a(n,i,e)||o===0&&_a(t,n,i)||a===0&&_a(t,e,i))}function _a(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function xa(n){return n>0?1:n<0?-1:0}function zg(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Cf(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function eo(n,e){return Ct(n.prev,n,n.next)<0?Ct(n,e,n.next)>=0&&Ct(n,n.prev,e)>=0:Ct(n,e,n.prev)<0||Ct(n,n.next,e)<0}function kg(n,e){let t=n,i=!1,s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function Rf(n,e){let t=vh(n.i,n.x,n.y),i=vh(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function Dd(n,e,t,i){let s=vh(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function to(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function vh(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Vg(n,e,t,i){let s=0;for(let r=e,o=t-i;r<t;r+=i)s+=(n[o]-n[r])*(n[r+1]+n[o+1]),o=r;return s}var yh=class{static triangulate(e,t,i=2){return Eg(e,t,i)}},Kn=class n{static area(e){let t=e.length,i=0;for(let s=t-1,r=0;r<t;s=r++)i+=e[s].x*e[r].y-e[r].x*e[s].y;return i*.5}static isClockWise(e){return n.area(e)<0}static triangulateShape(e,t){let i=[],s=[],r=[];Nd(e),Ud(i,e);let o=e.length;t.forEach(Nd);for(let c=0;c<t.length;c++)s.push(o),o+=t[c].length,Ud(i,t[c]);let a=yh.triangulate(i,s);for(let c=0;c<a.length;c+=3)r.push(a.slice(c,c+3));return r}};function Nd(n){let e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function Ud(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}var Oi=class n extends Ot{constructor(e=new on([new le(.5,.5),new le(-.5,.5),new le(-.5,-.5),new le(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let i=this,s=[],r=[];for(let a=0,c=e.length;a<c;a++){let l=e[a];o(l)}this.setAttribute("position",new vt(s,3)),this.setAttribute("uv",new vt(r,2)),this.computeVertexNormals();function o(a){let c=[],l=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,u=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:d-.1,v=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3,p=t.extrudePath,S=t.UVGenerator!==void 0?t.UVGenerator:Gg,T,y=!1,w,b,C,x;if(p){T=p.getSpacedPoints(h),y=!0,u=!1;let ie=p.isCatmullRomCurve3?p.closed:!1;w=p.computeFrenetFrames(h,ie),b=new N,C=new N,x=new N}u||(g=0,d=0,m=0,v=0);let E=a.extractPoints(l),I=E.shape,D=E.holes;if(!Kn.isClockWise(I)){I=I.reverse();for(let ie=0,re=D.length;ie<re;ie++){let ae=D[ie];Kn.isClockWise(ae)&&(D[ie]=ae.reverse())}}function V(ie){let ae=10000000000000001e-36,ce=ie[0];for(let de=1;de<=ie.length;de++){let ze=de%ie.length,Oe=ie[ze],We=Oe.x-ce.x,$e=Oe.y-ce.y,L=We*We+$e*$e,ut=Math.max(Math.abs(Oe.x),Math.abs(Oe.y),Math.abs(ce.x),Math.abs(ce.y)),it=ae*ut*ut;if(L<=it){ie.splice(ze,1),de--;continue}ce=Oe}}V(I),D.forEach(V);let R=D.length,P=I;for(let ie=0;ie<R;ie++){let re=D[ie];I=I.concat(re)}function k(ie,re,ae){return re||Ge("ExtrudeGeometry: vec does not exist"),ie.clone().addScaledVector(re,ae)}let X=I.length;function te(ie,re,ae){let ce,de,ze,Oe=ie.x-re.x,We=ie.y-re.y,$e=ae.x-ie.x,L=ae.y-ie.y,ut=Oe*Oe+We*We,it=Oe*L-We*$e;if(Math.abs(it)>Number.EPSILON){let A=Math.sqrt(ut),_=Math.sqrt($e*$e+L*L),B=re.x-We/A,W=re.y+Oe/A,$=ae.x-L/_,he=ae.y+$e/_,ue=(($-B)*L-(he-W)*$e)/(Oe*L-We*$e);ce=B+Oe*ue-ie.x,de=W+We*ue-ie.y;let K=ce*ce+de*de;if(K<=2)return new le(ce,de);ze=Math.sqrt(K/2)}else{let A=!1;Oe>Number.EPSILON?$e>Number.EPSILON&&(A=!0):Oe<-Number.EPSILON?$e<-Number.EPSILON&&(A=!0):Math.sign(We)===Math.sign(L)&&(A=!0),A?(ce=-We,de=Oe,ze=Math.sqrt(ut)):(ce=Oe,de=We,ze=Math.sqrt(ut/2))}return new le(ce/ze,de/ze)}let q=[];for(let ie=0,re=P.length,ae=re-1,ce=ie+1;ie<re;ie++,ae++,ce++)ae===re&&(ae=0),ce===re&&(ce=0),q[ie]=te(P[ie],P[ae],P[ce]);let Z=[],j,Re=q.concat();for(let ie=0,re=R;ie<re;ie++){let ae=D[ie];j=[];for(let ce=0,de=ae.length,ze=de-1,Oe=ce+1;ce<de;ce++,ze++,Oe++)ze===de&&(ze=0),Oe===de&&(Oe=0),j[ce]=te(ae[ce],ae[ze],ae[Oe]);Z.push(j),Re=Re.concat(j)}let be;if(g===0)be=Kn.triangulateShape(P,D);else{let ie=[],re=[];for(let ae=0;ae<g;ae++){let ce=ae/g,de=d*Math.cos(ce*Math.PI/2),ze=m*Math.sin(ce*Math.PI/2)+v;for(let Oe=0,We=P.length;Oe<We;Oe++){let $e=k(P[Oe],q[Oe],ze);ye($e.x,$e.y,-de),ce===0&&ie.push($e)}for(let Oe=0,We=R;Oe<We;Oe++){let $e=D[Oe];j=Z[Oe];let L=[];for(let ut=0,it=$e.length;ut<it;ut++){let A=k($e[ut],j[ut],ze);ye(A.x,A.y,-de),ce===0&&L.push(A)}ce===0&&re.push(L)}}be=Kn.triangulateShape(ie,re)}let Ke=be.length,Ze=m+v;for(let ie=0;ie<X;ie++){let re=u?k(I[ie],Re[ie],Ze):I[ie];y?(C.copy(w.normals[0]).multiplyScalar(re.x),b.copy(w.binormals[0]).multiplyScalar(re.y),x.copy(T[0]).add(C).add(b),ye(x.x,x.y,x.z)):ye(re.x,re.y,0)}for(let ie=1;ie<=h;ie++)for(let re=0;re<X;re++){let ae=u?k(I[re],Re[re],Ze):I[re];y?(C.copy(w.normals[ie]).multiplyScalar(ae.x),b.copy(w.binormals[ie]).multiplyScalar(ae.y),x.copy(T[ie]).add(C).add(b),ye(x.x,x.y,x.z)):ye(ae.x,ae.y,f/h*ie)}for(let ie=g-1;ie>=0;ie--){let re=ie/g,ae=d*Math.cos(re*Math.PI/2),ce=m*Math.sin(re*Math.PI/2)+v;for(let de=0,ze=P.length;de<ze;de++){let Oe=k(P[de],q[de],ce);ye(Oe.x,Oe.y,f+ae)}for(let de=0,ze=D.length;de<ze;de++){let Oe=D[de];j=Z[de];for(let We=0,$e=Oe.length;We<$e;We++){let L=k(Oe[We],j[We],ce);y?ye(L.x,L.y+T[h-1].y,T[h-1].x+ae):ye(L.x,L.y,f+ae)}}}et(),J();function et(){let ie=s.length/3;if(u){let re=0,ae=X*re;for(let ce=0;ce<Ke;ce++){let de=be[ce];Ve(de[2]+ae,de[1]+ae,de[0]+ae)}re=h+g*2,ae=X*re;for(let ce=0;ce<Ke;ce++){let de=be[ce];Ve(de[0]+ae,de[1]+ae,de[2]+ae)}}else{for(let re=0;re<Ke;re++){let ae=be[re];Ve(ae[2],ae[1],ae[0])}for(let re=0;re<Ke;re++){let ae=be[re];Ve(ae[0]+X*h,ae[1]+X*h,ae[2]+X*h)}}i.addGroup(ie,s.length/3-ie,0)}function J(){let ie=s.length/3,re=0;ne(P,re),re+=P.length;for(let ae=0,ce=D.length;ae<ce;ae++){let de=D[ae];ne(de,re),re+=de.length}i.addGroup(ie,s.length/3-ie,1)}function ne(ie,re){let ae=ie.length;for(;--ae>=0;){let ce=ae,de=ae-1;de<0&&(de=ie.length-1);for(let ze=0,Oe=h+g*2;ze<Oe;ze++){let We=X*ze,$e=X*(ze+1),L=re+ce+We,ut=re+de+We,it=re+de+$e,A=re+ce+$e;Ee(L,ut,it,A)}}}function ye(ie,re,ae){c.push(ie),c.push(re),c.push(ae)}function Ve(ie,re,ae){He(ie),He(re),He(ae);let ce=s.length/3,de=S.generateTopUV(i,s,ce-3,ce-2,ce-1);gt(de[0]),gt(de[1]),gt(de[2])}function Ee(ie,re,ae,ce){He(ie),He(re),He(ce),He(re),He(ae),He(ce);let de=s.length/3,ze=S.generateSideWallUV(i,s,de-6,de-3,de-2,de-1);gt(ze[0]),gt(ze[1]),gt(ze[3]),gt(ze[1]),gt(ze[2]),gt(ze[3])}function He(ie){s.push(c[ie*3+0]),s.push(c[ie*3+1]),s.push(c[ie*3+2])}function gt(ie){r.push(ie.x),r.push(ie.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return Hg(t,i,e)}static fromJSON(e,t){let i=[];for(let r=0,o=e.shapes.length;r<o;r++){let a=t[e.shapes[r]];i.push(a)}let s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new _h[s.type]().fromJSON(s)),new n(i,e.options)}},Gg={generateTopUV:function(n,e,t,i,s){let r=e[t*3],o=e[t*3+1],a=e[i*3],c=e[i*3+1],l=e[s*3],h=e[s*3+1];return[new le(r,o),new le(a,c),new le(l,h)]},generateSideWallUV:function(n,e,t,i,s,r){let o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[i*3],h=e[i*3+1],f=e[i*3+2],u=e[s*3],d=e[s*3+1],m=e[s*3+2],v=e[r*3],g=e[r*3+1],p=e[r*3+2];return Math.abs(a-h)<Math.abs(o-l)?[new le(o,1-c),new le(l,1-f),new le(u,1-m),new le(v,1-p)]:[new le(a,1-c),new le(h,1-f),new le(d,1-m),new le(g,1-p)]}};function Hg(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,s=n.length;i<s;i++){let r=n[i];t.shapes.push(r.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Bi=class n extends Ot{constructor(e=[new le(0,-.5),new le(.5,0),new le(0,.5)],t=12,i=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:s},t=Math.floor(t),s=tt(s,0,Math.PI*2);let r=[],o=[],a=[],c=[],l=[],h=1/t,f=new N,u=new le,d=new N,m=new N,v=new N,g=0,p=0;for(let S=0;S<=e.length-1;S++)switch(S){case 0:g=e[S+1].x-e[S].x,p=e[S+1].y-e[S].y,d.x=p*1,d.y=-g,d.z=p*0,v.copy(d),d.normalize(),c.push(d.x,d.y,d.z);break;case e.length-1:c.push(v.x,v.y,v.z);break;default:g=e[S+1].x-e[S].x,p=e[S+1].y-e[S].y,d.x=p*1,d.y=-g,d.z=p*0,m.copy(d),d.x+=v.x,d.y+=v.y,d.z+=v.z,d.normalize(),c.push(d.x,d.y,d.z),v.copy(m)}for(let S=0;S<=t;S++){let T=i+S*h*s,y=Math.sin(T),w=Math.cos(T);for(let b=0;b<=e.length-1;b++){f.x=e[b].x*y,f.y=e[b].y,f.z=e[b].x*w,o.push(f.x,f.y,f.z),u.x=S/t,u.y=b/(e.length-1),a.push(u.x,u.y);let C=c[3*b+0]*y,x=c[3*b+1],E=c[3*b+0]*w;l.push(C,x,E)}}for(let S=0;S<t;S++)for(let T=0;T<e.length-1;T++){let y=T+S*e.length,w=y,b=y+e.length,C=y+e.length+1,x=y+1;r.push(w,b,x),r.push(C,x,b)}this.setIndex(r),this.setAttribute("position",new vt(o,3)),this.setAttribute("uv",new vt(a,2)),this.setAttribute("normal",new vt(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.points,e.segments,e.phiStart,e.phiLength)}};var vn=class n extends Ot{constructor(e=1,t=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:s};let r=e/2,o=t/2,a=Math.floor(i),c=Math.floor(s),l=a+1,h=c+1,f=e/a,u=t/c,d=[],m=[],v=[],g=[];for(let p=0;p<h;p++){let S=p*u-o;for(let T=0;T<l;T++){let y=T*f-r;m.push(y,-S,0),v.push(0,0,1),g.push(T/a),g.push(1-p/c)}}for(let p=0;p<c;p++)for(let S=0;S<a;S++){let T=S+l*p,y=S+l*(p+1),w=S+1+l*(p+1),b=S+1+l*p;d.push(T,y,b),d.push(y,w,b)}this.setIndex(d),this.setAttribute("position",new vt(m,3)),this.setAttribute("normal",new vt(v,3)),this.setAttribute("uv",new vt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}};var no=class n extends Ot{constructor(e=new on([new le(0,.5),new le(-.5,-.5),new le(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let i=[],s=[],r=[],o=[],a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let h=0;h<e.length;h++)l(e[h]),this.addGroup(a,c,h),a+=c,c=0;this.setIndex(i),this.setAttribute("position",new vt(s,3)),this.setAttribute("normal",new vt(r,3)),this.setAttribute("uv",new vt(o,2));function l(h){let f=s.length/3,u=h.extractPoints(t),d=u.shape,m=u.holes;Kn.isClockWise(d)===!1&&(d=d.reverse());for(let g=0,p=m.length;g<p;g++){let S=m[g];Kn.isClockWise(S)===!0&&(m[g]=S.reverse())}let v=Kn.triangulateShape(d,m);for(let g=0,p=m.length;g<p;g++){let S=m[g];d=d.concat(S)}for(let g=0,p=d.length;g<p;g++){let S=d[g];s.push(S.x,S.y,0),r.push(0,0,1),o.push(S.x,S.y)}for(let g=0,p=v.length;g<p;g++){let S=v[g],T=S[0]+f,y=S[1]+f,w=S[2]+f;i.push(T,y,w),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return Wg(t,e)}static fromJSON(e,t){let i=[];for(let s=0,r=e.shapes.length;s<r;s++){let o=t[e.shapes[s]];i.push(o)}return new n(i,e.curveSegments)}};function Wg(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){let s=n[t];e.shapes.push(s.uuid)}else e.shapes.push(n.uuid);return e}function fs(n){let e={};for(let t in n){e[t]={};for(let i in n[t]){let s=n[t][i];if(Fd(s))s.isRenderTargetTexture?(Be("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=s.clone();else if(Array.isArray(s))if(Fd(s[0])){let r=[];for(let o=0,a=s.length;o<a;o++)r[o]=s[o].clone();e[t][i]=r}else e[t][i]=s.slice();else e[t][i]=s}}return e}function tn(n){let e={};for(let t=0;t<n.length;t++){let i=fs(n[t]);for(let s in i)e[s]=i[s]}return e}function Fd(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function Xg(n){let e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function Xh(n){let e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ot.workingColorSpace}var If={clone:fs,merge:tn},qg=`void main() {
357 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
358}`,Yg=`void main() {
359 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
360}`,yn=class extends yi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=qg,this.fragmentShader=Yg,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=fs(e.uniforms),this.uniformsGroups=Xg(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 s in this.uniforms){let o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let i in e.uniforms){let s=e.uniforms[i];switch(this.uniforms[i]={},s.type){case"t":this.uniforms[i].value=t[s.value]||null;break;case"c":this.uniforms[i].value=new Xe().setHex(s.value);break;case"v2":this.uniforms[i].value=new le().fromArray(s.value);break;case"v3":this.uniforms[i].value=new N().fromArray(s.value);break;case"v4":this.uniforms[i].value=new At().fromArray(s.value);break;case"m3":this.uniforms[i].value=new Ye().fromArray(s.value);break;case"m4":this.uniforms[i].value=new ht().fromArray(s.value);break;default:this.uniforms[i].value=s.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let i in e.extensions)this.extensions[i]=e.extensions[i];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},Za=class extends yn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},Js=class extends yi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Xe(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 Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qc,this.normalScale=new le(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 xi,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}};var $a=class extends yi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=uf,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}},Ja=class extends yi{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 Fs(n,e){return!n||n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function uh(n){return n!==void 0&&n.inTangents!==void 0&&n.outTangents!==void 0}var zi=class{constructor(e,t,i,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,s=t[i],r=t[i-1];n:{e:{let o;t:{i:if(!(e<s)){for(let a=i+2;;){if(s===void 0){if(e<r)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(r=s,s=t[++i],e<s)break e}o=t.length;break t}if(!(e>=r)){let a=t[1];e<a&&(i=2,r=a);for(let c=i-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===c)break;if(s=r,r=t[--i-1],e>=r)break e}o=i,i=0;break t}break n}for(;i<o;){let a=i+o>>>1;e<t[a]?o=a:i=a+1}if(s=t[i],r=t[i-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,s)}return this.interpolate_(i,r,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=e*s;for(let o=0;o!==s;++o)t[o]=i[r+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},Ka=class extends zi{constructor(e,t,i,s){super(e,t,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ph,endingEnd:ph}}intervalChanged_(e,t,i){let s=this.parameterPositions,r=e-2,o=e+1,a=s[r],c=s[o];if(a===void 0)switch(this.getSettings_().endingStart){case mh:r=e,a=2*t-i;break;case gh:r=s.length-2,a=t+s[r]-s[r+1];break;default:r=e,a=i}if(c===void 0)switch(this.getSettings_().endingEnd){case mh:o=e,c=2*i-t;break;case gh:o=1,c=i+s[1]-s[0];break;default:o=e-1,c=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-i),this._offsetPrev=r*h,this._offsetNext=o*h}interpolate_(e,t,i,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=this._offsetPrev,f=this._offsetNext,u=this._weightPrev,d=this._weightNext,m=(i-t)/(s-t),v=m*m,g=v*m,p=-u*g+2*u*v-u*m,S=(1+u)*g+(-1.5-2*u)*v+(-.5+u)*m+1,T=(-1-d)*g+(1.5+d)*v+.5*m,y=d*g-d*v;for(let w=0;w!==a;++w)r[w]=p*o[h+w]+S*o[l+w]+T*o[c+w]+y*o[f+w];return r}},ja=class extends zi{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=(i-t)/(s-t),f=1-h;for(let u=0;u!==a;++u)r[u]=o[l+u]*f+o[c+u]*h;return r}},Qa=class extends zi{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e){return this.copySampleValue_(e-1)}},ec=class extends zi{interpolate_(e,t,i,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=this.inTangents,f=this.outTangents;if(!h||!f){let m=(i-t)/(s-t),v=1-m;for(let g=0;g!==a;++g)r[g]=o[l+g]*v+o[c+g]*m;return r}let u=a*2,d=e-1;for(let m=0;m!==a;++m){let v=o[l+m],g=o[c+m],p=d*u+m*2,S=f[p],T=f[p+1],y=e*u+m*2,w=h[y],b=h[y+1],C=$g(i,t,S,w,s);r[m]=Pf(C,v,T,b,g)}return r}};function Pf(n,e,t,i,s){let r=1-n;return r*r*r*e+3*r*r*n*t+3*r*n*n*i+n*n*n*s}function Zg(n,e,t,i,s){let r=1-n;return 3*r*r*(t-e)+6*r*n*(i-t)+3*n*n*(s-i)}function $g(n,e,t,i,s){let r=(n-e)/(s-e);for(let o=0;o<8;o++){let a=Pf(r,e,t,i,s)-n;if(Math.abs(a)<1e-10)break;let c=Zg(r,e,t,i,s);if(Math.abs(c)<1e-10)break;r=Math.max(0,Math.min(1,r-a/c))}return r}var Mn=class{constructor(e,t,i,s){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Fs(t,this.TimeBufferType),this.values=Fs(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:Fs(e.times,Array),values:Fs(e.values,Array)};let s=e.getInterpolation();s!==e.DefaultInterpolation&&(i.interpolation=s),uh(e.settings)&&(i.settings={inTangents:Fs(e.settings.inTangents,Array),outTangents:Fs(e.settings.outTangents,Array)})}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new Qa(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ja(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ka(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new ec(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case Nr:t=this.InterpolantFactoryMethodDiscrete;break;case Da:t=this.InterpolantFactoryMethodLinear;break;case Ma:t=this.InterpolantFactoryMethodSmooth;break;case fh:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return Be("KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Nr;case this.InterpolantFactoryMethodLinear:return Da;case this.InterpolantFactoryMethodSmooth:return Ma;case this.InterpolantFactoryMethodBezier:return fh}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,s=t.length;i!==s;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,s=t.length;i!==s;++i)t[i]*=e;uh(this.settings)&&(Od(this.settings.inTangents,e),Od(this.settings.outTangents,e))}return this}trim(e,t){let i=this.times,s=i.length,r=0,o=s-1;for(;r!==s&&i[r]<e;)++r;for(;o!==-1&&i[o]>t;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);let a=this.getValueSize();this.times=i.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,s=this.values,r=i.length;r===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){let c=i[a];if(typeof c=="number"&&isNaN(c)){Ge("KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){Ge("KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(s!==void 0&&Km(s))for(let a=0,c=s.length;a!==c;++a){let l=s[a];if(isNaN(l)){Ge("KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===Ma,r=e.length-1,o=1;for(let a=1;a<r;++a){let c=!1,l=e[a],h=e[a+1];if(l!==h&&(a!==1||l!==e[0]))if(s)c=!0;else{let f=a*i,u=f-i,d=f+i;for(let m=0;m!==i;++m){let v=t[f+m];if(v!==t[u+m]||v!==t[d+m]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];let f=a*i,u=o*i;for(let d=0;d!==i;++d)t[u+d]=t[f+d]}++o}}if(r>0){e[o]=e[r];for(let a=r*i,c=o*i,l=0;l!==i;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,uh(this.settings)&&(s.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),s}};function Od(n,e){for(let t=0,i=n.length;t!==i;t+=2)n[t]*=e}Mn.prototype.ValueTypeName="";Mn.prototype.TimeBufferType=Float32Array;Mn.prototype.ValueBufferType=Float32Array;Mn.prototype.DefaultInterpolation=Da;var ki=class extends Mn{constructor(e,t,i){super(e,t,i)}};ki.prototype.ValueTypeName="bool";ki.prototype.ValueBufferType=Array;ki.prototype.DefaultInterpolation=Nr;ki.prototype.InterpolantFactoryMethodLinear=void 0;ki.prototype.InterpolantFactoryMethodSmooth=void 0;var tc=class extends Mn{constructor(e,t,i,s){super(e,t,i,s)}};tc.prototype.ValueTypeName="color";var nc=class extends Mn{constructor(e,t,i,s){super(e,t,i,s)}};nc.prototype.ValueTypeName="number";var ic=class extends zi{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(i-t)/(s-t),l=e*a;for(let h=l+a;l!==h;l+=4)un.slerpFlat(r,0,o,l-a,o,l,c);return r}},io=class extends Mn{constructor(e,t,i,s){super(e,t,i,s)}InterpolantFactoryMethodLinear(e){return new ic(this.times,this.values,this.getValueSize(),e)}};io.prototype.ValueTypeName="quaternion";io.prototype.InterpolantFactoryMethodSmooth=void 0;var Vi=class extends Mn{constructor(e,t,i){super(e,t,i)}};Vi.prototype.ValueTypeName="string";Vi.prototype.ValueBufferType=Array;Vi.prototype.DefaultInterpolation=Nr;Vi.prototype.InterpolantFactoryMethodLinear=void 0;Vi.prototype.InterpolantFactoryMethodSmooth=void 0;var sc=class extends Mn{constructor(e,t,i,s){super(e,t,i,s)}};sc.prototype.ValueTypeName="vector";var rc=class{constructor(e,t,i){let s=this,r=!1,o=0,a=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(h){a++,r===!1&&s.onStart!==void 0&&s.onStart(h,o,a),r=!0},this.itemEnd=function(h){o++,s.onProgress!==void 0&&s.onProgress(h,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return h=h.normalize("NFC"),c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,f){return l.push(h,f),this},this.removeHandler=function(h){let f=l.indexOf(h);return f!==-1&&l.splice(f,2),this},this.getHandler=function(h){for(let f=0,u=l.length;f<u;f+=2){let d=l[f],m=l[f+1];if(d.global&&(d.lastIndex=0),d.test(h))return m}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Lf=new rc,oc=class{constructor(e){this.manager=e!==void 0?e:Lf,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 i=this;return new Promise(function(s,r){i.load(e,s,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};oc.DEFAULT_MATERIAL_NAME="__DEFAULT";var so=class extends Zt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Xe(e),this.intensity=t}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}},ro=class extends so{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Zt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Xe(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}},dh=new ht,Bd=new N,zd=new N,ac=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 le(512,512),this.mapType=fn,this.map=null,this.mapPass=null,this.matrix=new ht,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qs,this._frameExtents=new le(1,1),this._viewportCount=1,this._viewports=[new At(0,0,1,1)]}getViewportCount(){return this._viewportCount}getCamera(){return this.camera}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera;Bd.setFromMatrixPosition(e.matrixWorld),t.position.copy(Bd),zd.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(zd),t.updateMatrixWorld(),this._updateMatrix(t,this.matrix,this._frustum)}_updateMatrix(e,t,i,s){dh.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),i.setFromProjectionMatrix(dh,e.coordinateSystem,e.reversedDepth);let r=this._frameExtents,o=s?s.z/r.x:1,a=s?s.w/r.y:1,c=s?s.x/r.x:0,l=s?s.y/r.y:0;e.coordinateSystem===Vs||e.reversedDepth?t.set(.5*o,0,0,.5*o+c,0,.5*a,0,.5*a+l,0,0,1,0,0,0,0,1):t.set(.5*o,0,0,.5*o+c,0,.5*a,0,.5*a+l,0,0,.5,.5,0,0,0,1),t.multiply(dh)}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 e.intensity=this.intensity,e.bias=this.bias,e.normalBias=this.normalBias,e.radius=this.radius,e.blurSamples=this.blurSamples,e.mapSize=this.mapSize.toArray(),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},va=new N,ya=new un,$n=new N,oo=class extends Zt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ht,this.projectionMatrix=new ht,this.projectionMatrixInverse=new ht,this.coordinateSystem=On,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(va,ya,$n),$n.x===1&&$n.y===1&&$n.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(va,ya,$n.set(1,1,1)).invert()}updateWorldMatrix(e,t,i=!1){super.updateWorldMatrix(e,t,i),this.matrixWorld.decompose(va,ya,$n),$n.x===1&&$n.y===1&&$n.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(va,ya,$n.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Di=new N,kd=new le,Vd=new le,en=class extends oo{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Na*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(ba*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Na*2*Math.atan(Math.tan(ba*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Di.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Di.x,Di.y).multiplyScalar(-e/Di.z),Di.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Di.x,Di.y).multiplyScalar(-e/Di.z)}getViewSize(e,t){return this.getViewBounds(e,kd,Vd),t.subVectors(Vd,kd)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(ba*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s,o=this.view;if(this.view!==null&&this.view.enabled){let c=o.fullWidth,l=o.fullHeight;r+=o.offsetX*s/c,t-=o.offsetY*i/l,s*=o.width/c,i*=o.height/l}let a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,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}};var Ks=class extends oo{constructor(e=-1,t=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=i-e,o=i+e,a=s+t,c=s-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,o=r+l*this.view.width,a-=h*this.view.offsetY,c=a-h*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,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}},Mh=class extends ac{constructor(){super(new Ks(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},ao=class extends so{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Zt.DEFAULT_UP),this.updateMatrix(),this.target=new Zt,this.shadow=new Mh}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 Os=-90,Bs=1,cc=class extends Zt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new en(Os,Bs,e,t);s.layers=this.layers,this.add(s);let r=new en(Os,Bs,e,t);r.layers=this.layers,this.add(r);let o=new en(Os,Bs,e,t);o.layers=this.layers,this.add(o);let a=new en(Os,Bs,e,t);a.layers=this.layers,this.add(a);let c=new en(Os,Bs,e,t);c.layers=this.layers,this.add(c);let l=new en(Os,Bs,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,c]=t;for(let l of t)this.remove(l);if(e===On)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Vs)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,o,a,c,l,h]=this.children,f=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;let v=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(i,0,s),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(i,1,s),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,2,s),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,3,s),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(i,4,s),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),i.texture.generateMipmaps=v,e.setRenderTarget(i,5,s),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(f,u,d),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}},lc=class extends en{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}};var qh="\\[\\]\\.:\\/",Jg=new RegExp("["+qh+"]","g"),Yh="[^"+qh+"]",Kg="[^"+qh.replace("\\.","")+"]",jg=/((?:WC+[\/:])*)/.source.replace("WC",Yh),Qg=/(WCOD+)?/.source.replace("WCOD",Kg),e0=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Yh),t0=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Yh),n0=new RegExp("^"+jg+Qg+e0+t0+"$"),i0=["material","materials","bones","map"],Sh=class{constructor(e,t,i){let s=i||Tt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},Tt=class n{constructor(e,t,i){this.path=t,this.parsedPath=i||n.parseTrackName(t),this.node=n.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new n.Composite(e,t,i):new n(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Jg,"")}static parseTrackName(e){let t=n0.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=i.nodeName.substring(s+1);i0.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(r){for(let o=0;o<r.length;o++){let a=r[o];if(a.name===t||a.uuid===t)return a;let c=i(a.children);if(c)return c}return null},s=i(e.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)e[t++]=i[s]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,s=t.propertyName,r=t.propertyIndex;if(e||(e=n.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Be("PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let l=t.objectIndex;switch(i){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("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){Ge("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){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(l!==void 0){if(e[l]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let o=e[s];if(o===void 0){let l=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+l+"."+s+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("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=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=s;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Tt.Composite=Sh;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 OS=new Float32Array(1);var Qh=class Qh{constructor(e,t,i,s){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,s){let r=this.elements;return r[0]=e,r[2]=t,r[1]=i,r[3]=s,this}};Qh.prototype.isMatrix2=!0;var bh=Qh;function Zh(n,e,t,i){let s=s0(i);switch(t){case kh:return n*e;case vc:return n*e/s.components*s.byteLength;case yc:return n*e/s.components*s.byteLength;case Xi:return n*e*2/s.components*s.byteLength;case Mc:return n*e*2/s.components*s.byteLength;case Vh:return n*e*3/s.components*s.byteLength;case Rn:return n*e*4/s.components*s.byteLength;case Sc:return n*e*4/s.components*s.byteLength;case fo:case po:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case mo:case go:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case wc:case Tc:return Math.max(n,16)*Math.max(e,8)/4;case bc:case Ec:return Math.max(n,8)*Math.max(e,8)/2;case Ac:case Cc:case Ic:case Pc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Rc:case _o:case Lc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Dc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Nc:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Uc:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Fc:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Oc:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Bc:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case zc:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case kc:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Vc:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Gc:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Hc:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Wc:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Xc:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case qc:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Yc:case Zc:case $c:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Jc:case Kc:return Math.ceil(n/4)*Math.ceil(e/4)*8;case xo:case jc:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function s0(n){switch(n){case fn:case Fh:return{byteLength:1,components:1};case tr:case Oh:case Vn:return{byteLength:2,components:1};case _c:case xc:return{byteLength:2,components:4};case kn:case gc:case Cn:return{byteLength:4,components:1};case Bh:case zh:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"186"}}));typeof window<"u"&&(window.__THREE__?Be("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="186");function ep(){let n=null,e=!1,t=null,i=null;function s(r,o){i=n.requestAnimationFrame(s),t(r,o)}return{start:function(){e!==!0&&t!==null&&n!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n!==null&&n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function u0(n){let e=new WeakMap;function t(a,c){let l=a.array,h=a.usage,f=l.byteLength,u=n.createBuffer();n.bindBuffer(c,u),n.bufferData(c,l,h),a.onUploadCallback();let d;if(l instanceof Float32Array)d=n.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)d=n.HALF_FLOAT;else if(l instanceof Uint16Array)a.isFloat16BufferAttribute?d=n.HALF_FLOAT:d=n.UNSIGNED_SHORT;else if(l instanceof Int16Array)d=n.SHORT;else if(l instanceof Uint32Array)d=n.UNSIGNED_INT;else if(l instanceof Int32Array)d=n.INT;else if(l instanceof Int8Array)d=n.BYTE;else if(l instanceof Uint8Array)d=n.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)d=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:u,type:d,bytesPerElement:l.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,c,l){let h=c.array,f=c.updateRanges;if(n.bindBuffer(l,a),f.length===0)n.bufferSubData(l,0,h);else{f.sort((d,m)=>d.start-m.start);let u=0;for(let d=1;d<f.length;d++){let m=f[u],v=f[d];v.start<=m.start+m.count+1?m.count=Math.max(m.count,v.start+v.count-m.start):(++u,f[u]=v)}f.length=u+1;for(let d=0,m=f.length;d<m;d++){let v=f[d];n.bufferSubData(l,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count)}c.clearUpdateRanges()}c.onUploadCallback()}function s(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function r(a){a.isInterleavedBufferAttribute&&(a=a.data);let c=e.get(a);c&&(n.deleteBuffer(c.buffer),e.delete(a))}function o(a,c){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let h=e.get(a);(!h||h.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let l=e.get(a);if(l===void 0)e.set(a,t(a,c));else if(l.version<a.version){if(l.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(l.buffer,a,c),l.version=a.version}}return{get:s,remove:r,update:o}}var d0=`#ifdef USE_ALPHAHASH
361 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
362#endif`,f0=`#ifdef USE_ALPHAHASH
363 const float ALPHA_HASH_SCALE = 0.05;
364 float hash2D( vec2 value ) {
365 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
366 }
367 float hash3D( vec3 value ) {
368 return hash2D( vec2( hash2D( value.xy ), value.z ) );
369 }
370 float getAlphaHashThreshold( vec3 position ) {
371 float maxDeriv = max(
372 length( dFdx( position.xyz ) ),
373 length( dFdy( position.xyz ) )
374 );
375 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
376 vec2 pixScales = vec2(
377 exp2( floor( log2( pixScale ) ) ),
378 exp2( ceil( log2( pixScale ) ) )
379 );
380 vec2 alpha = vec2(
381 hash3D( floor( pixScales.x * position.xyz ) ),
382 hash3D( floor( pixScales.y * position.xyz ) )
383 );
384 float lerpFactor = fract( log2( pixScale ) );
385 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
386 float a = min( lerpFactor, 1.0 - lerpFactor );
387 vec3 cases = vec3(
388 x * x / ( 2.0 * a * ( 1.0 - a ) ),
389 ( x - 0.5 * a ) / ( 1.0 - a ),
390 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
391 );
392 float threshold = ( x < ( 1.0 - a ) )
393 ? ( ( x < a ) ? cases.x : cases.y )
394 : cases.z;
395 return clamp( threshold , 1.0e-6, 1.0 );
396 }
397#endif`,p0=`#ifdef USE_ALPHAMAP
398 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
399#endif`,m0=`#ifdef USE_ALPHAMAP
400 uniform sampler2D alphaMap;
401#endif`,g0=`#ifdef USE_ALPHATEST
402 #ifdef ALPHA_TO_COVERAGE
403 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
404 if ( diffuseColor.a == 0.0 ) discard;
405 #else
406 if ( diffuseColor.a < alphaTest ) discard;
407 #endif
408#endif`,_0=`#ifdef USE_ALPHATEST
409 uniform float alphaTest;
410#endif`,x0=`#ifdef USE_AOMAP
411 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
412 reflectedLight.indirectDiffuse *= ambientOcclusion;
413 #if defined( USE_CLEARCOAT )
414 clearcoatSpecularIndirect *= ambientOcclusion;
415 #endif
416 #if defined( USE_SHEEN )
417 sheenSpecularIndirect *= ambientOcclusion;
418 #endif
419 #if defined( USE_ENVMAP ) && defined( STANDARD )
420 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
421 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
422 #endif
423#endif`,v0=`#ifdef USE_AOMAP
424 uniform sampler2D aoMap;
425 uniform float aoMapIntensity;
426#endif`,y0=`#ifdef USE_BATCHING
427 #if ! defined( GL_ANGLE_multi_draw )
428 #define gl_DrawID _gl_DrawID
429 uniform int _gl_DrawID;
430 #endif
431 uniform highp sampler2D batchingTexture;
432 uniform highp usampler2D batchingIdTexture;
433 mat4 getBatchingMatrix( const in float i ) {
434 int size = textureSize( batchingTexture, 0 ).x;
435 int j = int( i ) * 4;
436 int x = j % size;
437 int y = j / size;
438 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
439 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
440 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
441 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
442 return mat4( v1, v2, v3, v4 );
443 }
444 float getIndirectIndex( const in int i ) {
445 int size = textureSize( batchingIdTexture, 0 ).x;
446 int x = i % size;
447 int y = i / size;
448 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
449 }
450#endif
451#ifdef USE_BATCHING_COLOR
452 uniform sampler2D batchingColorTexture;
453 vec4 getBatchingColor( const in float i ) {
454 int size = textureSize( batchingColorTexture, 0 ).x;
455 int j = int( i );
456 int x = j % size;
457 int y = j / size;
458 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
459 }
460#endif`,M0=`#ifdef USE_BATCHING
461 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
462#endif`,S0=`vec3 transformed = vec3( position );
463#ifdef USE_ALPHAHASH
464 vPosition = vec3( position );
465#endif`,b0=`vec3 objectNormal = vec3( normal );
466#ifdef USE_TANGENT
467 vec3 objectTangent = vec3( tangent.xyz );
468#endif`,w0=`float G_BlinnPhong_Implicit( ) {
469 return 0.25;
470}
471float D_BlinnPhong( const in float shininess, const in float dotNH ) {
472 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
473}
474vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
475 vec3 halfDir = normalize( lightDir + viewDir );
476 float dotNH = saturate( dot( normal, halfDir ) );
477 float dotVH = saturate( dot( viewDir, halfDir ) );
478 vec3 F = F_Schlick( specularColor, 1.0, dotVH );
479 float G = G_BlinnPhong_Implicit( );
480 float D = D_BlinnPhong( shininess, dotNH );
481 return F * ( G * D );
482} // validated`,E0=`#ifdef USE_IRIDESCENCE
483 const mat3 XYZ_TO_REC709 = mat3(
484 3.2404542, -0.9692660, 0.0556434,
485 -1.5371385, 1.8760108, -0.2040259,
486 -0.4985314, 0.0415560, 1.0572252
487 );
488 vec3 Fresnel0ToIor( vec3 fresnel0 ) {
489 vec3 sqrtF0 = sqrt( fresnel0 );
490 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
491 }
492 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
493 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
494 }
495 float IorToFresnel0( float transmittedIor, float incidentIor ) {
496 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
497 }
498 vec3 evalSensitivity( float OPD, vec3 shift ) {
499 float phase = 2.0 * PI * OPD * 1.0e-9;
500 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
501 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
502 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
503 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
504 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 ) );
505 xyz /= 1.0685e-7;
506 vec3 rgb = XYZ_TO_REC709 * xyz;
507 return rgb;
508 }
509 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
510 vec3 I;
511 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
512 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
513 float cosTheta2Sq = 1.0 - sinTheta2Sq;
514 if ( cosTheta2Sq < 0.0 ) {
515 return vec3( 1.0 );
516 }
517 float cosTheta2 = sqrt( cosTheta2Sq );
518 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
519 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
520 float T121 = 1.0 - R12;
521 float phi12 = 0.0;
522 if ( iridescenceIOR < outsideIOR ) phi12 = PI;
523 float phi21 = PI - phi12;
524 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
525 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
526 vec3 phi23 = vec3( 0.0 );
527 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
528 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
529 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
530 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
531 vec3 phi = vec3( phi21 ) + phi23;
532 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
533 vec3 r123 = sqrt( R123 );
534 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
535 vec3 C0 = R12 + Rs;
536 I = C0;
537 vec3 Cm = Rs - T121;
538 for ( int m = 1; m <= 2; ++ m ) {
539 Cm *= r123;
540 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
541 I += Cm * Sm;
542 }
543 return max( I, vec3( 0.0 ) );
544 }
545#endif`,T0=`#ifdef USE_BUMPMAP
546 uniform sampler2D bumpMap;
547 uniform float bumpScale;
548 vec2 dHdxy_fwd() {
549 vec2 dSTdx = dFdx( vBumpMapUv );
550 vec2 dSTdy = dFdy( vBumpMapUv );
551 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
552 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
553 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
554 return vec2( dBx, dBy );
555 }
556 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
557 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
558 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
559 vec3 vN = surf_norm;
560 vec3 R1 = cross( vSigmaY, vN );
561 vec3 R2 = cross( vN, vSigmaX );
562 float fDet = dot( vSigmaX, R1 ) * faceDirection;
563 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
564 return normalize( abs( fDet ) * surf_norm - vGrad );
565 }
566#endif`,A0=`#if NUM_CLIPPING_PLANES > 0
567 vec4 plane;
568 #ifdef ALPHA_TO_COVERAGE
569 float distanceToPlane, distanceGradient;
570 float clipOpacity = 1.0;
571 #pragma unroll_loop_start
572 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
573 plane = clippingPlanes[ i ];
574 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
575 distanceGradient = fwidth( distanceToPlane ) / 2.0;
576 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
577 if ( clipOpacity == 0.0 ) discard;
578 }
579 #pragma unroll_loop_end
580 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
581 float unionClipOpacity = 1.0;
582 #pragma unroll_loop_start
583 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
584 plane = clippingPlanes[ i ];
585 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
586 distanceGradient = fwidth( distanceToPlane ) / 2.0;
587 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
588 }
589 #pragma unroll_loop_end
590 clipOpacity *= 1.0 - unionClipOpacity;
591 #endif
592 diffuseColor.a *= clipOpacity;
593 if ( diffuseColor.a == 0.0 ) discard;
594 #else
595 #pragma unroll_loop_start
596 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
597 plane = clippingPlanes[ i ];
598 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
599 }
600 #pragma unroll_loop_end
601 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
602 bool clipped = true;
603 #pragma unroll_loop_start
604 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
605 plane = clippingPlanes[ i ];
606 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
607 }
608 #pragma unroll_loop_end
609 if ( clipped ) discard;
610 #endif
611 #endif
612#endif`,C0=`#if NUM_CLIPPING_PLANES > 0
613 varying vec3 vClipPosition;
614 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
615#endif`,R0=`#if NUM_CLIPPING_PLANES > 0
616 varying vec3 vClipPosition;
617#endif`,I0=`#if NUM_CLIPPING_PLANES > 0
618 vClipPosition = - mvPosition.xyz;
619#endif`,P0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
620 diffuseColor *= vColor;
621#endif`,L0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
622 varying vec4 vColor;
623#endif`,D0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
624 varying vec4 vColor;
625#endif`,N0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
626 vColor = vec4( 1.0 );
627#endif
628#ifdef USE_COLOR_ALPHA
629 vColor *= color;
630#elif defined( USE_COLOR )
631 vColor.rgb *= color;
632#endif
633#ifdef USE_INSTANCING_COLOR
634 vColor.rgb *= instanceColor.rgb;
635#endif
636#ifdef USE_BATCHING_COLOR
637 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
638#endif`,U0=`#define PI 3.141592653589793
639#define PI2 6.283185307179586
640#define PI_HALF 1.5707963267948966
641#define RECIPROCAL_PI 0.3183098861837907
642#define RECIPROCAL_PI2 0.15915494309189535
643#define EPSILON 1e-6
644#ifndef saturate
645#define saturate( a ) clamp( a, 0.0, 1.0 )
646#endif
647#define whiteComplement( a ) ( 1.0 - saturate( a ) )
648float pow2( const in float x ) { return x*x; }
649vec3 pow2( const in vec3 x ) { return x*x; }
650float pow3( const in float x ) { return x*x*x; }
651float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
652float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
653float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
654highp float rand( const in vec2 uv ) {
655 const highp float a = 12.9898, b = 78.233, c = 43758.5453;
656 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
657 return fract( sin( sn ) * c );
658}
659#ifdef HIGH_PRECISION
660 float precisionSafeLength( vec3 v ) { return length( v ); }
661#else
662 float precisionSafeLength( vec3 v ) {
663 float maxComponent = max3( abs( v ) );
664 return length( v / maxComponent ) * maxComponent;
665 }
666#endif
667struct IncidentLight {
668 vec3 color;
669 vec3 direction;
670 bool visible;
671};
672struct ReflectedLight {
673 vec3 directDiffuse;
674 vec3 directSpecular;
675 vec3 indirectDiffuse;
676 vec3 indirectSpecular;
677};
678#ifdef USE_ALPHAHASH
679 varying vec3 vPosition;
680#endif
681vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
682 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
683}
684#define inverseTransformDirection transformDirectionByInverseViewMatrix
685vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
686 return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
687}
688vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
689 return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );
690}
691bool isPerspectiveMatrix( mat4 m ) {
692 return m[ 2 ][ 3 ] == - 1.0;
693}
694vec2 equirectUv( in vec3 dir ) {
695 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
696 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
697 return vec2( u, v );
698}
699vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
700 return RECIPROCAL_PI * diffuseColor;
701}
702vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
703 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
704 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
705}
706float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
707 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
708 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
709} // validated`,F0=`#ifdef ENVMAP_TYPE_CUBE_UV
710 #define cubeUV_minMipLevel 4.0
711 #define cubeUV_minTileSize 16.0
712 float getFace( vec3 direction ) {
713 vec3 absDirection = abs( direction );
714 float face = - 1.0;
715 if ( absDirection.x > absDirection.z ) {
716 if ( absDirection.x > absDirection.y )
717 face = direction.x > 0.0 ? 0.0 : 3.0;
718 else
719 face = direction.y > 0.0 ? 1.0 : 4.0;
720 } else {
721 if ( absDirection.z > absDirection.y )
722 face = direction.z > 0.0 ? 2.0 : 5.0;
723 else
724 face = direction.y > 0.0 ? 1.0 : 4.0;
725 }
726 return face;
727 }
728 vec2 getUV( vec3 direction, float face ) {
729 vec2 uv;
730 if ( face == 0.0 ) {
731 uv = vec2( direction.z, direction.y ) / abs( direction.x );
732 } else if ( face == 1.0 ) {
733 uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
734 } else if ( face == 2.0 ) {
735 uv = vec2( - direction.x, direction.y ) / abs( direction.z );
736 } else if ( face == 3.0 ) {
737 uv = vec2( - direction.z, direction.y ) / abs( direction.x );
738 } else if ( face == 4.0 ) {
739 uv = vec2( - direction.x, direction.z ) / abs( direction.y );
740 } else {
741 uv = vec2( direction.x, direction.y ) / abs( direction.z );
742 }
743 return 0.5 * ( uv + 1.0 );
744 }
745 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
746 float face = getFace( direction );
747 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
748 mipInt = max( mipInt, cubeUV_minMipLevel );
749 float faceSize = exp2( mipInt );
750 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
751 if ( face > 2.0 ) {
752 uv.y += faceSize;
753 face -= 3.0;
754 }
755 uv.x += face * faceSize;
756 uv.x += filterInt * 3.0 * cubeUV_minTileSize;
757 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
758 uv.x *= CUBEUV_TEXEL_WIDTH;
759 uv.y *= CUBEUV_TEXEL_HEIGHT;
760 #ifdef texture2DGradEXT
761 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
762 #else
763 return texture2D( envMap, uv ).rgb;
764 #endif
765 }
766 #define cubeUV_r0 1.0
767 #define cubeUV_m0 - 2.0
768 #define cubeUV_r1 0.8
769 #define cubeUV_m1 - 1.0
770 #define cubeUV_r4 0.4
771 #define cubeUV_m4 2.0
772 #define cubeUV_r5 0.305
773 #define cubeUV_m5 3.0
774 #define cubeUV_r6 0.21
775 #define cubeUV_m6 4.0
776 float roughnessToMip( float roughness ) {
777 float mip = 0.0;
778 if ( roughness >= cubeUV_r1 ) {
779 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
780 } else if ( roughness >= cubeUV_r4 ) {
781 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
782 } else if ( roughness >= cubeUV_r5 ) {
783 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
784 } else if ( roughness >= cubeUV_r6 ) {
785 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
786 } else {
787 mip = - 2.0 * log2( 1.16 * roughness ); }
788 return mip;
789 }
790 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
791 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
792 float mipF = fract( mip );
793 float mipInt = floor( mip );
794 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
795 if ( mipF == 0.0 ) {
796 return vec4( color0, 1.0 );
797 } else {
798 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
799 return vec4( mix( color0, color1, mipF ), 1.0 );
800 }
801 }
802#endif`,O0=`vec3 transformedNormal = objectNormal;
803#ifdef USE_TANGENT
804 vec3 transformedTangent = objectTangent;
805#endif
806#ifdef USE_BATCHING
807 mat3 bm = mat3( batchingMatrix );
808 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
809 transformedNormal = bm * transformedNormal;
810 #ifdef USE_TANGENT
811 transformedTangent = bm * transformedTangent;
812 #endif
813#endif
814#ifdef USE_INSTANCING
815 mat3 im = mat3( instanceMatrix );
816 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
817 transformedNormal = im * transformedNormal;
818 #ifdef USE_TANGENT
819 transformedTangent = im * transformedTangent;
820 #endif
821#endif
822transformedNormal = normalMatrix * transformedNormal;
823#ifdef FLIP_SIDED
824 transformedNormal = - transformedNormal;
825#endif
826#ifdef USE_TANGENT
827 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
828#endif`,B0=`#ifdef USE_DISPLACEMENTMAP
829 uniform sampler2D displacementMap;
830 uniform float displacementScale;
831 uniform float displacementBias;
832#endif`,z0=`#ifdef USE_DISPLACEMENTMAP
833 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
834#endif`,k0=`#ifdef USE_EMISSIVEMAP
835 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
836 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
837 emissiveColor = sRGBTransferEOTF( emissiveColor );
838 #endif
839 totalEmissiveRadiance *= emissiveColor.rgb;
840#endif`,V0=`#ifdef USE_EMISSIVEMAP
841 uniform sampler2D emissiveMap;
842#endif`,G0="gl_FragColor = linearToOutputTexel( gl_FragColor );",H0=`vec4 LinearTransferOETF( in vec4 value ) {
843 return value;
844}
845vec4 sRGBTransferEOTF( in vec4 value ) {
846 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 );
847}
848vec4 sRGBTransferOETF( in vec4 value ) {
849 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 );
850}`,W0=`#ifdef USE_ENVMAP
851 #ifdef ENV_WORLDPOS
852 vec3 cameraToFrag;
853 if ( isOrthographic ) {
854 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
855 } else {
856 cameraToFrag = normalize( vWorldPosition - cameraPosition );
857 }
858 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
859 #ifdef ENVMAP_MODE_REFLECTION
860 vec3 reflectVec = reflect( cameraToFrag, worldNormal );
861 #else
862 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
863 #endif
864 #else
865 vec3 reflectVec = vReflect;
866 #endif
867 #ifdef ENVMAP_TYPE_CUBE
868 vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
869 #ifdef ENVMAP_BLENDING_MULTIPLY
870 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
871 #elif defined( ENVMAP_BLENDING_MIX )
872 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
873 #elif defined( ENVMAP_BLENDING_ADD )
874 outgoingLight += envColor.xyz * specularStrength * reflectivity;
875 #endif
876 #endif
877#endif`,X0=`#ifdef USE_ENVMAP
878 uniform float envMapIntensity;
879 uniform mat3 envMapRotation;
880 #ifdef ENVMAP_TYPE_CUBE
881 uniform samplerCube envMap;
882 #else
883 uniform sampler2D envMap;
884 #endif
885#endif`,q0=`#ifdef USE_ENVMAP
886 uniform float reflectivity;
887 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
888 #define ENV_WORLDPOS
889 #endif
890 #ifdef ENV_WORLDPOS
891 varying vec3 vWorldPosition;
892 uniform float refractionRatio;
893 #else
894 varying vec3 vReflect;
895 #endif
896#endif`,Y0=`#ifdef USE_ENVMAP
897 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
898 #define ENV_WORLDPOS
899 #endif
900 #ifdef ENV_WORLDPOS
901
902 varying vec3 vWorldPosition;
903 #else
904 varying vec3 vReflect;
905 uniform float refractionRatio;
906 #endif
907#endif`,Z0=`#ifdef USE_ENVMAP
908 #ifdef ENV_WORLDPOS
909 vWorldPosition = worldPosition.xyz;
910 #else
911 vec3 cameraToVertex;
912 if ( isOrthographic ) {
913 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
914 } else {
915 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
916 }
917 vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
918 #ifdef ENVMAP_MODE_REFLECTION
919 vReflect = reflect( cameraToVertex, worldNormal );
920 #else
921 vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
922 #endif
923 #endif
924#endif`,$0=`#ifdef USE_FOG
925 vFogDepth = - mvPosition.z;
926#endif`,J0=`#ifdef USE_FOG
927 varying float vFogDepth;
928#endif`,K0=`#ifdef USE_FOG
929 #ifdef FOG_EXP2
930 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
931 #else
932 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
933 #endif
934 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
935#endif`,j0=`#ifdef USE_FOG
936 uniform vec3 fogColor;
937 varying float vFogDepth;
938 #ifdef FOG_EXP2
939 uniform float fogDensity;
940 #else
941 uniform float fogNear;
942 uniform float fogFar;
943 #endif
944#endif`,Q0=`#ifdef USE_GRADIENTMAP
945 uniform sampler2D gradientMap;
946#endif
947vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
948 float dotNL = dot( normal, lightDirection );
949 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
950 #ifdef USE_GRADIENTMAP
951 return vec3( texture2D( gradientMap, coord ).r );
952 #else
953 vec2 fw = fwidth( coord ) * 0.5;
954 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
955 #endif
956}`,e_=`#ifdef USE_LIGHTMAP
957 uniform sampler2D lightMap;
958 uniform float lightMapIntensity;
959#endif`,t_=`LambertMaterial material;
960material.diffuseColor = diffuseColor.rgb;
961material.specularStrength = specularStrength;`,n_=`varying vec3 vViewPosition;
962struct LambertMaterial {
963 vec3 diffuseColor;
964 float specularStrength;
965};
966void 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 ) {
967 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
968 vec3 irradiance = dotNL * directLight.color;
969 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
970}
971void 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 ) {
972 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
973}
974#define RE_Direct RE_Direct_Lambert
975#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,i_=`uniform bool receiveShadow;
976uniform vec3 ambientLightColor;
977#if defined( USE_LIGHT_PROBES )
978 uniform vec3 lightProbe[ 9 ];
979#endif
980vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
981 float x = normal.x, y = normal.y, z = normal.z;
982 vec3 result = shCoefficients[ 0 ] * 0.886227;
983 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
984 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
985 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
986 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
987 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
988 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
989 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
990 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
991 return result;
992}
993vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
994 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
995 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
996 return irradiance;
997}
998vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
999 vec3 irradiance = ambientLightColor;
1000 return irradiance;
1001}
1002float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
1003 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
1004 if ( cutoffDistance > 0.0 ) {
1005 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
1006 }
1007 return distanceFalloff;
1008}
1009float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
1010 return smoothstep( coneCosine, penumbraCosine, angleCosine );
1011}
1012#if NUM_SUN_LIGHTS > 0
1013 struct SunLight {
1014 vec3 direction;
1015 vec3 color;
1016 };
1017 uniform SunLight sunLights[ NUM_SUN_LIGHTS ];
1018 void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {
1019 light.color = sunLight.color;
1020 light.direction = sunLight.direction;
1021 light.visible = true;
1022 }
1023#endif
1024#if NUM_DIR_LIGHTS > 0
1025 struct DirectionalLight {
1026 vec3 direction;
1027 vec3 color;
1028 };
1029 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
1030 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
1031 light.color = directionalLight.color;
1032 light.direction = directionalLight.direction;
1033 light.visible = true;
1034 }
1035#endif
1036#if NUM_POINT_LIGHTS > 0
1037 struct PointLight {
1038 vec3 position;
1039 vec3 color;
1040 float distance;
1041 float decay;
1042 };
1043 uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
1044 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
1045 vec3 lVector = pointLight.position - geometryPosition;
1046 light.direction = normalize( lVector );
1047 float lightDistance = length( lVector );
1048 light.color = pointLight.color;
1049 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
1050 light.visible = ( light.color != vec3( 0.0 ) );
1051 }
1052#endif
1053#if NUM_SPOT_LIGHTS > 0
1054 struct SpotLight {
1055 vec3 position;
1056 vec3 direction;
1057 vec3 color;
1058 float distance;
1059 float decay;
1060 float coneCos;
1061 float penumbraCos;
1062 };
1063 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
1064 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
1065 vec3 lVector = spotLight.position - geometryPosition;
1066 light.direction = normalize( lVector );
1067 float angleCos = dot( light.direction, spotLight.direction );
1068 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
1069 if ( spotAttenuation > 0.0 ) {
1070 float lightDistance = length( lVector );
1071 light.color = spotLight.color * spotAttenuation;
1072 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
1073 light.visible = ( light.color != vec3( 0.0 ) );
1074 } else {
1075 light.color = vec3( 0.0 );
1076 light.visible = false;
1077 }
1078 }
1079#endif
1080#if NUM_RECT_AREA_LIGHTS > 0
1081 struct RectAreaLight {
1082 vec3 color;
1083 vec3 position;
1084 vec3 halfWidth;
1085 vec3 halfHeight;
1086 };
1087 uniform sampler2D ltc_1; uniform sampler2D ltc_2;
1088 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
1089#endif
1090#if NUM_HEMI_LIGHTS > 0
1091 struct HemisphereLight {
1092 vec3 direction;
1093 vec3 skyColor;
1094 vec3 groundColor;
1095 };
1096 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
1097 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
1098 float dotNL = dot( normal, hemiLight.direction );
1099 float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
1100 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
1101 return irradiance;
1102 }
1103#endif
1104#include <lightprobes_pars_fragment>`,s_=`#ifdef USE_ENVMAP
1105 vec3 getIBLIrradiance( const in vec3 normal ) {
1106 #ifdef ENVMAP_TYPE_CUBE_UV
1107 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
1108 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
1109 return PI * envMapColor.rgb * envMapIntensity;
1110 #else
1111 return vec3( 0.0 );
1112 #endif
1113 }
1114 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
1115 #ifdef ENVMAP_TYPE_CUBE_UV
1116 vec3 reflectVec = reflect( - viewDir, normal );
1117 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
1118 reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
1119 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
1120 return envMapColor.rgb * envMapIntensity;
1121 #else
1122 return vec3( 0.0 );
1123 #endif
1124 }
1125 #ifdef USE_RETROREFLECTION
1126 vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
1127 #ifdef ENVMAP_TYPE_CUBE_UV
1128 vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );
1129 retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );
1130 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );
1131 return envMapColor.rgb * envMapIntensity;
1132 #else
1133 return vec3( 0.0 );
1134 #endif
1135 }
1136 #endif
1137 #ifdef USE_ANISOTROPY
1138 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
1139 #ifdef ENVMAP_TYPE_CUBE_UV
1140 vec3 bentNormal = cross( bitangent, viewDir );
1141 bentNormal = normalize( cross( bentNormal, bitangent ) );
1142 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
1143 return getIBLRadiance( viewDir, bentNormal, roughness );
1144 #else
1145 return vec3( 0.0 );
1146 #endif
1147 }
1148 #ifdef USE_RETROREFLECTION
1149 vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
1150 #ifdef ENVMAP_TYPE_CUBE_UV
1151 vec3 bentNormal = cross( bitangent, viewDir );
1152 bentNormal = normalize( cross( bentNormal, bitangent ) );
1153 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
1154 return getIBLRetroRadiance( viewDir, bentNormal, roughness );
1155 #else
1156 return vec3( 0.0 );
1157 #endif
1158 }
1159 #endif
1160 #endif
1161#endif`,r_=`ToonMaterial material;
1162material.diffuseColor = diffuseColor.rgb;`,o_=`varying vec3 vViewPosition;
1163struct ToonMaterial {
1164 vec3 diffuseColor;
1165};
1166void 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 ) {
1167 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
1168 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1169}
1170void 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 ) {
1171 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1172}
1173#define RE_Direct RE_Direct_Toon
1174#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,a_=`BlinnPhongMaterial material;
1175material.diffuseColor = diffuseColor.rgb;
1176material.specularColor = specular;
1177material.specularShininess = shininess;
1178material.specularStrength = specularStrength;`,c_=`varying vec3 vViewPosition;
1179struct BlinnPhongMaterial {
1180 vec3 diffuseColor;
1181 vec3 specularColor;
1182 float specularShininess;
1183 float specularStrength;
1184};
1185void 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 ) {
1186 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1187 vec3 irradiance = dotNL * directLight.color;
1188 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1189 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
1190}
1191void 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 ) {
1192 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1193}
1194#define RE_Direct RE_Direct_BlinnPhong
1195#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,l_=`PhysicalMaterial material;
1196material.diffuseColor = diffuseColor.rgb;
1197material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
1198material.metalness = metalnessFactor;
1199vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
1200float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
1201material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
1202material.roughness = min( material.roughness, 1.0 );
1203#ifdef IOR
1204 material.ior = ior;
1205 #ifdef USE_SPECULAR
1206 float specularIntensityFactor = specularIntensity;
1207 vec3 specularColorFactor = specularColor;
1208 #ifdef USE_SPECULAR_COLORMAP
1209 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
1210 #endif
1211 #ifdef USE_SPECULAR_INTENSITYMAP
1212 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
1213 #endif
1214 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
1215 #else
1216 float specularIntensityFactor = 1.0;
1217 vec3 specularColorFactor = vec3( 1.0 );
1218 material.specularF90 = 1.0;
1219 #endif
1220 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
1221 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
1222#else
1223 material.specularColor = vec3( 0.04 );
1224 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
1225 material.specularF90 = 1.0;
1226#endif
1227#ifdef USE_CLEARCOAT
1228 material.clearcoat = clearcoat;
1229 material.clearcoatRoughness = clearcoatRoughness;
1230 material.clearcoatF0 = vec3( 0.04 );
1231 material.clearcoatF90 = 1.0;
1232 #ifdef USE_CLEARCOATMAP
1233 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
1234 #endif
1235 #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1236 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
1237 #endif
1238 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
1239 material.clearcoatRoughness += geometryRoughness;
1240 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
1241#endif
1242#ifdef USE_DISPERSION
1243 material.dispersion = dispersion;
1244#endif
1245#ifdef USE_RETROREFLECTION
1246 material.retroreflectivity = retroreflectivity;
1247#endif
1248#ifdef USE_IRIDESCENCE
1249 material.iridescence = iridescence;
1250 material.iridescenceIOR = iridescenceIOR;
1251 #ifdef USE_IRIDESCENCEMAP
1252 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
1253 #endif
1254 #ifdef USE_IRIDESCENCE_THICKNESSMAP
1255 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
1256 #else
1257 material.iridescenceThickness = iridescenceThicknessMaximum;
1258 #endif
1259#endif
1260#ifdef USE_SHEEN
1261 material.sheenColor = sheenColor;
1262 #ifdef USE_SHEEN_COLORMAP
1263 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
1264 #endif
1265 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
1266 #ifdef USE_SHEEN_ROUGHNESSMAP
1267 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
1268 #endif
1269#endif
1270#ifdef USE_ANISOTROPY
1271 #ifdef USE_ANISOTROPYMAP
1272 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
1273 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
1274 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
1275 #else
1276 vec2 anisotropyV = anisotropyVector;
1277 #endif
1278 material.anisotropy = length( anisotropyV );
1279 if( material.anisotropy == 0.0 ) {
1280 anisotropyV = vec2( 1.0, 0.0 );
1281 } else {
1282 anisotropyV /= material.anisotropy;
1283 material.anisotropy = saturate( material.anisotropy );
1284 }
1285 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
1286 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
1287 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
1288#endif`,h_=`uniform sampler2D dfgLUT;
1289struct PhysicalMaterial {
1290 vec3 diffuseColor;
1291 vec3 diffuseContribution;
1292 vec3 specularColor;
1293 vec3 specularColorBlended;
1294 float roughness;
1295 float metalness;
1296 float specularF90;
1297 float dispersion;
1298 vec2 dfg;
1299 vec3 multiScatteringCompensation;
1300 #ifdef USE_RETROREFLECTION
1301 float retroreflectivity;
1302 #endif
1303 #ifdef USE_CLEARCOAT
1304 float clearcoat;
1305 float clearcoatRoughness;
1306 vec3 clearcoatF0;
1307 float clearcoatF90;
1308 #endif
1309 #ifdef USE_IRIDESCENCE
1310 float iridescence;
1311 float iridescenceIOR;
1312 float iridescenceThickness;
1313 vec3 iridescenceFresnel;
1314 vec3 iridescenceF0Dielectric;
1315 vec3 iridescenceF0Metallic;
1316 #endif
1317 #ifdef USE_SHEEN
1318 vec3 sheenColor;
1319 float sheenRoughness;
1320 #endif
1321 #ifdef IOR
1322 float ior;
1323 #endif
1324 #ifdef USE_TRANSMISSION
1325 float transmission;
1326 float transmissionAlpha;
1327 float thickness;
1328 float attenuationDistance;
1329 vec3 attenuationColor;
1330 #endif
1331 #ifdef USE_ANISOTROPY
1332 float anisotropy;
1333 float alphaT;
1334 vec3 anisotropyT;
1335 vec3 anisotropyB;
1336 #endif
1337};
1338vec3 clearcoatSpecularDirect = vec3( 0.0 );
1339vec3 clearcoatSpecularIndirect = vec3( 0.0 );
1340vec3 sheenSpecularDirect = vec3( 0.0 );
1341vec3 sheenSpecularIndirect = vec3(0.0 );
1342vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
1343 float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
1344 float x2 = x * x;
1345 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
1346 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1347}
1348float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1349 float a2 = pow2( alpha );
1350 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1351 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1352 return 0.5 / max( gv + gl, EPSILON );
1353}
1354float D_GGX( const in float alpha, const in float dotNH ) {
1355 float a2 = pow2( alpha );
1356 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1357 return RECIPROCAL_PI * a2 / pow2( denom );
1358}
1359#ifdef USE_ANISOTROPY
1360 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 ) {
1361 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1362 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1363 return 0.5 / max( gv + gl, EPSILON );
1364 }
1365 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1366 float a2 = alphaT * alphaB;
1367 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1368 highp float v2 = dot( v, v );
1369 float w2 = a2 / v2;
1370 return RECIPROCAL_PI * a2 * pow2 ( w2 );
1371 }
1372#endif
1373#ifdef USE_CLEARCOAT
1374 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1375 vec3 f0 = material.clearcoatF0;
1376 float f90 = material.clearcoatF90;
1377 float roughness = material.clearcoatRoughness;
1378 float alpha = pow2( roughness );
1379 vec3 halfDir = normalize( lightDir + viewDir );
1380 float dotNL = saturate( dot( normal, lightDir ) );
1381 float dotNV = saturate( dot( normal, viewDir ) );
1382 float dotNH = saturate( dot( normal, halfDir ) );
1383 float dotVH = saturate( dot( viewDir, halfDir ) );
1384 vec3 F = F_Schlick( f0, f90, dotVH );
1385 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1386 float D = D_GGX( alpha, dotNH );
1387 return F * ( V * D );
1388 }
1389#endif
1390vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1391 vec3 f0 = material.specularColorBlended;
1392 float f90 = material.specularF90;
1393 float roughness = material.roughness;
1394 float alpha = pow2( roughness );
1395 vec3 halfDir = normalize( lightDir + viewDir );
1396 float dotNL = saturate( dot( normal, lightDir ) );
1397 float dotNV = saturate( dot( normal, viewDir ) );
1398 float dotNH = saturate( dot( normal, halfDir ) );
1399 float dotVH = saturate( dot( viewDir, halfDir ) );
1400 vec3 F = F_Schlick( f0, f90, dotVH );
1401 #ifdef USE_IRIDESCENCE
1402 F = mix( F, material.iridescenceFresnel, material.iridescence );
1403 #endif
1404 #ifdef USE_ANISOTROPY
1405 float dotTL = dot( material.anisotropyT, lightDir );
1406 float dotTV = dot( material.anisotropyT, viewDir );
1407 float dotTH = dot( material.anisotropyT, halfDir );
1408 float dotBL = dot( material.anisotropyB, lightDir );
1409 float dotBV = dot( material.anisotropyB, viewDir );
1410 float dotBH = dot( material.anisotropyB, halfDir );
1411 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1412 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1413 #else
1414 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1415 float D = D_GGX( alpha, dotNH );
1416 #endif
1417 return F * ( V * D );
1418}
1419vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1420 const float LUT_SIZE = 64.0;
1421 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1422 const float LUT_BIAS = 0.5 / LUT_SIZE;
1423 float dotNV = saturate( dot( N, V ) );
1424 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1425 uv = uv * LUT_SCALE + LUT_BIAS;
1426 return uv;
1427}
1428float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1429 float l = length( f );
1430 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1431}
1432vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1433 float x = dot( v1, v2 );
1434 float y = abs( x );
1435 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1436 float b = 3.4175940 + ( 4.1616724 + y ) * y;
1437 float v = a / b;
1438 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1439 return cross( v1, v2 ) * theta_sintheta;
1440}
1441vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1442 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1443 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1444 vec3 lightNormal = cross( v1, v2 );
1445 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1446 vec3 T1, T2;
1447 T1 = normalize( V - N * dot( V, N ) );
1448 T2 = - cross( N, T1 );
1449 mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1450 vec3 coords[ 4 ];
1451 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1452 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1453 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1454 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1455 coords[ 0 ] = normalize( coords[ 0 ] );
1456 coords[ 1 ] = normalize( coords[ 1 ] );
1457 coords[ 2 ] = normalize( coords[ 2 ] );
1458 coords[ 3 ] = normalize( coords[ 3 ] );
1459 vec3 vectorFormFactor = vec3( 0.0 );
1460 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1461 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1462 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1463 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1464 float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1465 return vec3( result );
1466}
1467#if defined( USE_SHEEN )
1468float D_Charlie( float roughness, float dotNH ) {
1469 float alpha = pow2( roughness );
1470 float invAlpha = 1.0 / alpha;
1471 float cos2h = dotNH * dotNH;
1472 float sin2h = max( 1.0 - cos2h, 0.0078125 );
1473 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1474}
1475float V_Neubelt( float dotNV, float dotNL ) {
1476 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1477}
1478vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1479 vec3 halfDir = normalize( lightDir + viewDir );
1480 float dotNL = saturate( dot( normal, lightDir ) );
1481 float dotNV = saturate( dot( normal, viewDir ) );
1482 float dotNH = saturate( dot( normal, halfDir ) );
1483 float D = D_Charlie( sheenRoughness, dotNH );
1484 float V = V_Neubelt( dotNV, dotNL );
1485 return sheenColor * ( D * V );
1486}
1487#endif
1488float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1489 float dotNV = saturate( dot( normal, viewDir ) );
1490 float r2 = roughness * roughness;
1491 float rInv = 1.0 / ( roughness + 0.1 );
1492 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1493 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1494 float DG = exp( a * dotNV + b );
1495 return saturate( DG );
1496}
1497vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1498 float dotNV = saturate( dot( normal, viewDir ) );
1499 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1500 return specularColor * fab.x + specularF90 * fab.y;
1501}
1502#ifdef USE_IRIDESCENCE
1503void computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {
1504#else
1505void computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {
1506#endif
1507 #ifdef USE_IRIDESCENCE
1508 vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1509 #else
1510 vec3 Fr = specularColor;
1511 #endif
1512 vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1513 float Ess = fab.x + fab.y;
1514 float Ems = 1.0 - Ess;
1515 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1516 singleScatter += FssEss;
1517 multiScatter += Fms * Ems;
1518}
1519#if NUM_RECT_AREA_LIGHTS > 0
1520 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 ) {
1521 vec3 normal = geometryNormal;
1522 vec3 viewDir = geometryViewDir;
1523 vec3 position = geometryPosition;
1524 vec3 lightPos = rectAreaLight.position;
1525 vec3 halfWidth = rectAreaLight.halfWidth;
1526 vec3 halfHeight = rectAreaLight.halfHeight;
1527 vec3 lightColor = rectAreaLight.color;
1528 float roughness = material.roughness;
1529 vec3 rectCoords[ 4 ];
1530 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1531 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1532 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1533 vec2 uv = LTC_Uv( normal, viewDir, roughness );
1534 vec4 t1 = texture2D( ltc_1, uv );
1535 vec4 t2 = texture2D( ltc_2, uv );
1536 mat3 mInv = mat3(
1537 vec3( t1.x, 0, t1.y ),
1538 vec3( 0, 1, 0 ),
1539 vec3( t1.z, 0, t1.w )
1540 );
1541 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1542 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1543 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1544 #ifdef USE_CLEARCOAT
1545 vec3 Ncc = geometryClearcoatNormal;
1546 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1547 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1548 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1549 mat3 mInvClearcoat = mat3(
1550 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1551 vec3( 0, 1, 0 ),
1552 vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1553 );
1554 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1555 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1556 #endif
1557 }
1558#endif
1559void 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 ) {
1560 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1561 vec3 irradiance = dotNL * directLight.color;
1562 #ifdef USE_CLEARCOAT
1563 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1564 vec3 ccIrradiance = dotNLcc * directLight.color;
1565 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1566 #endif
1567 #ifdef USE_SHEEN
1568
1569 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1570
1571 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1572 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1573
1574 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1575
1576 irradiance *= sheenEnergyComp;
1577
1578 #endif
1579 vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1580 #ifdef USE_RETROREFLECTION
1581 vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );
1582 vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );
1583 specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );
1584 #endif
1585 reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;
1586 vec3 halfDir = normalize( directLight.direction + geometryViewDir );
1587 float dotVH = saturate( dot( geometryViewDir, halfDir ) );
1588 vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );
1589 #ifdef USE_RETROREFLECTION
1590 vec3 retroHalfDir = normalize( directLight.direction + retroViewDir );
1591 float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );
1592 vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );
1593 F = mix( F, retroF, saturate( material.retroreflectivity ) );
1594 #endif
1595 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );
1596}
1597void 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 ) {
1598 vec3 singleScattering = vec3( 0.0 );
1599 vec3 multiScattering = vec3( 0.0 );
1600 #ifdef USE_IRIDESCENCE
1601 computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );
1602 #else
1603 computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );
1604 #endif
1605 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
1606 #ifdef USE_SHEEN
1607 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1608 sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;
1609 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1610 diffuse *= sheenEnergyComp;
1611 #endif
1612 reflectedLight.indirectDiffuse += diffuse;
1613}
1614void 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) {
1615 #ifdef USE_CLEARCOAT
1616 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1617 #endif
1618 #ifdef USE_SHEEN
1619 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1620 #endif
1621 vec3 singleScatteringDielectric = vec3( 0.0 );
1622 vec3 multiScatteringDielectric = vec3( 0.0 );
1623 vec3 singleScatteringMetallic = vec3( 0.0 );
1624 vec3 multiScatteringMetallic = vec3( 0.0 );
1625 #ifdef USE_IRIDESCENCE
1626 computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );
1627 computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );
1628 #else
1629 computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );
1630 computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );
1631 #endif
1632 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1633 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1634 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1635 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1636 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1637 vec3 indirectSpecular = radiance * singleScattering;
1638 indirectSpecular += multiScattering * cosineWeightedIrradiance;
1639 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1640 #ifdef USE_SHEEN
1641 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1642 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1643 indirectSpecular *= sheenEnergyComp;
1644 indirectDiffuse *= sheenEnergyComp;
1645 #endif
1646 reflectedLight.indirectSpecular += indirectSpecular;
1647 reflectedLight.indirectDiffuse += indirectDiffuse;
1648}
1649#define RE_Direct RE_Direct_Physical
1650#define RE_Direct_RectArea RE_Direct_RectArea_Physical
1651#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
1652#define RE_IndirectSpecular RE_IndirectSpecular_Physical
1653float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1654 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1655}`,u_=`
1656vec3 geometryPosition = - vViewPosition;
1657vec3 geometryNormal = normal;
1658vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1659vec3 geometryClearcoatNormal = vec3( 0.0 );
1660#ifdef USE_CLEARCOAT
1661 geometryClearcoatNormal = clearcoatNormal;
1662#endif
1663#ifdef USE_IRIDESCENCE
1664 float dotNVi = saturate( dot( normal, geometryViewDir ) );
1665 if ( material.iridescenceThickness == 0.0 ) {
1666 material.iridescence = 0.0;
1667 } else {
1668 material.iridescence = saturate( material.iridescence );
1669 }
1670 if ( material.iridescence > 0.0 ) {
1671 vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1672 vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1673 material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );
1674 material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );
1675 material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );
1676 }
1677#endif
1678#ifdef STANDARD
1679 float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );
1680 material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;
1681 #if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )
1682 float EssMs = material.dfg.x + material.dfg.y;
1683 material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );
1684 #endif
1685#endif
1686IncidentLight directLight;
1687#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1688 PointLight pointLight;
1689 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1690 PointLightShadow pointLightShadow;
1691 #endif
1692 #pragma unroll_loop_start
1693 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1694 pointLight = pointLights[ i ];
1695 getPointLightInfo( pointLight, geometryPosition, directLight );
1696 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1697 pointLightShadow = pointLightShadows[ i ];
1698 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1699 #endif
1700 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1701 }
1702 #pragma unroll_loop_end
1703#endif
1704#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1705 SpotLight spotLight;
1706 vec4 spotColor;
1707 vec3 spotLightCoord;
1708 bool inSpotLightMap;
1709 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1710 SpotLightShadow spotLightShadow;
1711 #endif
1712 #pragma unroll_loop_start
1713 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1714 spotLight = spotLights[ i ];
1715 getSpotLightInfo( spotLight, geometryPosition, directLight );
1716 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1717 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1718 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1719 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1720 #else
1721 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1722 #endif
1723 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1724 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1725 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1726 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1727 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1728 #endif
1729 #undef SPOT_LIGHT_MAP_INDEX
1730 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1731 spotLightShadow = spotLightShadows[ i ];
1732 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1733 #endif
1734 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1735 }
1736 #pragma unroll_loop_end
1737#endif
1738#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )
1739 SunLight sunLight;
1740 #if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0
1741 SunLightShadow sunLightShadow;
1742 #endif
1743 #pragma unroll_loop_start
1744 for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {
1745 sunLight = sunLights[ i ];
1746 getSunLightInfo( sunLight, directLight );
1747 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )
1748 sunLightShadow = sunLightShadows[ i ];
1749 directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;
1750 #endif
1751 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1752 }
1753 #pragma unroll_loop_end
1754#endif
1755#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1756 DirectionalLight directionalLight;
1757 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1758 DirectionalLightShadow directionalLightShadow;
1759 #endif
1760 #pragma unroll_loop_start
1761 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1762 directionalLight = directionalLights[ i ];
1763 getDirectionalLightInfo( directionalLight, directLight );
1764 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1765 directionalLightShadow = directionalLightShadows[ i ];
1766 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1767 #endif
1768 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1769 }
1770 #pragma unroll_loop_end
1771#endif
1772#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1773 RectAreaLight rectAreaLight;
1774 #pragma unroll_loop_start
1775 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1776 rectAreaLight = rectAreaLights[ i ];
1777 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1778 }
1779 #pragma unroll_loop_end
1780#endif
1781#if defined( RE_IndirectDiffuse )
1782 vec3 iblIrradiance = vec3( 0.0 );
1783 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1784 #if defined( USE_LIGHT_PROBES )
1785 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1786 #endif
1787 #if ( NUM_HEMI_LIGHTS > 0 )
1788 #pragma unroll_loop_start
1789 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1790 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1791 }
1792 #pragma unroll_loop_end
1793 #endif
1794 #ifdef USE_LIGHT_PROBES_GRID
1795 vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1796 vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
1797 irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1798 #endif
1799#endif
1800#if defined( RE_IndirectSpecular )
1801 vec3 radiance = vec3( 0.0 );
1802 vec3 clearcoatRadiance = vec3( 0.0 );
1803#endif`,d_=`#if defined( RE_IndirectDiffuse )
1804 #ifdef USE_LIGHTMAP
1805 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1806 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1807 irradiance += lightMapIrradiance;
1808 #endif
1809 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1810 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1811 iblIrradiance += getIBLIrradiance( geometryNormal );
1812 #endif
1813 #endif
1814#endif
1815#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1816 #ifdef USE_ANISOTROPY
1817 vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1818 #else
1819 vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1820 #endif
1821 #ifdef USE_RETROREFLECTION
1822 #ifdef USE_ANISOTROPY
1823 vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1824 #else
1825 vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );
1826 #endif
1827 iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );
1828 #endif
1829 radiance += iblRadiance;
1830 #ifdef USE_CLEARCOAT
1831 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1832 #endif
1833#endif`,f_=`#if defined( RE_IndirectDiffuse )
1834 #if defined( LAMBERT ) || defined( PHONG )
1835 irradiance += iblIrradiance;
1836 #endif
1837 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1838#endif
1839#if defined( RE_IndirectSpecular )
1840 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1841#endif`,p_=`#ifdef USE_LIGHT_PROBES_GRID
1842uniform highp sampler3D probesSH;
1843uniform vec3 probesMin;
1844uniform vec3 probesMax;
1845uniform vec3 probesResolution;
1846vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1847 vec3 res = probesResolution;
1848 vec3 gridRange = probesMax - probesMin;
1849 vec3 resMinusOne = res - 1.0;
1850 vec3 probeSpacing = gridRange / resMinusOne;
1851 vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1852 vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1853 uvw = uvw * resMinusOne / res + 0.5 / res;
1854 float nz = res.z;
1855 float paddedSlices = nz + 2.0;
1856 float atlasDepth = 7.0 * paddedSlices;
1857 float uvZBase = uvw.z * nz + 1.0;
1858 vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );
1859 vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );
1860 vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );
1861 vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );
1862 vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );
1863 vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );
1864 vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );
1865 vec3 c0 = s0.xyz;
1866 vec3 c1 = vec3( s0.w, s1.xy );
1867 vec3 c2 = vec3( s1.zw, s2.x );
1868 vec3 c3 = s2.yzw;
1869 vec3 c4 = s3.xyz;
1870 vec3 c5 = vec3( s3.w, s4.xy );
1871 vec3 c6 = vec3( s4.zw, s5.x );
1872 vec3 c7 = s5.yzw;
1873 vec3 c8 = s6.xyz;
1874 float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1875 vec3 result = c0 * 0.886227;
1876 result += c1 * 2.0 * 0.511664 * y;
1877 result += c2 * 2.0 * 0.511664 * z;
1878 result += c3 * 2.0 * 0.511664 * x;
1879 result += c4 * 2.0 * 0.429043 * x * y;
1880 result += c5 * 2.0 * 0.429043 * y * z;
1881 result += c6 * ( 0.743125 * z * z - 0.247708 );
1882 result += c7 * 2.0 * 0.429043 * x * z;
1883 result += c8 * 0.429043 * ( x * x - y * y );
1884 return max( result, vec3( 0.0 ) );
1885}
1886#endif`,m_=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1887 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1888#endif`,g_=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1889 uniform float logDepthBufFC;
1890 varying float vFragDepth;
1891 varying float vIsPerspective;
1892#endif`,__=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1893 varying float vFragDepth;
1894 varying float vIsPerspective;
1895#endif`,x_=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1896 vFragDepth = 1.0 + gl_Position.w;
1897 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1898#endif`,v_=`#ifdef USE_MAP
1899 vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1900 #ifdef DECODE_VIDEO_TEXTURE
1901 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1902 #endif
1903 diffuseColor *= sampledDiffuseColor;
1904#endif`,y_=`#ifdef USE_MAP
1905 uniform sampler2D map;
1906#endif`,M_=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1907 #if defined( USE_POINTS_UV )
1908 vec2 uv = vUv;
1909 #else
1910 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1911 #endif
1912#endif
1913#ifdef USE_MAP
1914 diffuseColor *= texture2D( map, uv );
1915#endif
1916#ifdef USE_ALPHAMAP
1917 diffuseColor.a *= texture2D( alphaMap, uv ).g;
1918#endif`,S_=`#if defined( USE_POINTS_UV )
1919 varying vec2 vUv;
1920#else
1921 #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1922 uniform mat3 uvTransform;
1923 #endif
1924#endif
1925#ifdef USE_MAP
1926 uniform sampler2D map;
1927#endif
1928#ifdef USE_ALPHAMAP
1929 uniform sampler2D alphaMap;
1930#endif`,b_=`float metalnessFactor = metalness;
1931#ifdef USE_METALNESSMAP
1932 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1933 metalnessFactor *= texelMetalness.b;
1934#endif`,w_=`#ifdef USE_METALNESSMAP
1935 uniform sampler2D metalnessMap;
1936#endif`,E_=`#ifdef USE_INSTANCING_MORPH
1937 float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1938 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1939 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1940 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1941 }
1942#endif`,T_=`#if defined( USE_MORPHCOLORS )
1943 vColor *= morphTargetBaseInfluence;
1944 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1945 #if defined( USE_COLOR_ALPHA )
1946 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1947 #elif defined( USE_COLOR )
1948 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1949 #endif
1950 }
1951#endif`,A_=`#ifdef USE_MORPHNORMALS
1952 objectNormal *= morphTargetBaseInfluence;
1953 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1954 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1955 }
1956#endif`,C_=`#ifdef USE_MORPHTARGETS
1957 #ifndef USE_INSTANCING_MORPH
1958 uniform float morphTargetBaseInfluence;
1959 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1960 #endif
1961 uniform sampler2DArray morphTargetsTexture;
1962 uniform ivec2 morphTargetsTextureSize;
1963 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1964 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1965 int y = texelIndex / morphTargetsTextureSize.x;
1966 int x = texelIndex - y * morphTargetsTextureSize.x;
1967 ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1968 return texelFetch( morphTargetsTexture, morphUV, 0 );
1969 }
1970#endif`,R_=`#ifdef USE_MORPHTARGETS
1971 transformed *= morphTargetBaseInfluence;
1972 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1973 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1974 }
1975#endif`,I_=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1976#ifdef FLAT_SHADED
1977 vec3 fdx = dFdx( vViewPosition );
1978 vec3 fdy = dFdy( vViewPosition );
1979 vec3 normal = normalize( cross( fdx, fdy ) );
1980#else
1981 vec3 normal = normalize( vNormal );
1982 #ifdef DOUBLE_SIDED
1983 normal *= faceDirection;
1984 #endif
1985#endif
1986#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1987 #ifdef USE_TANGENT
1988 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1989 #else
1990 mat3 tbn = getTangentFrame( - vViewPosition, normal,
1991 #if defined( USE_NORMALMAP )
1992 vNormalMapUv
1993 #elif defined( USE_CLEARCOAT_NORMALMAP )
1994 vClearcoatNormalMapUv
1995 #else
1996 vUv
1997 #endif
1998 );
1999 #endif
2000 #ifdef DOUBLE_SIDED
2001 tbn[0] *= faceDirection;
2002 tbn[1] *= faceDirection;
2003 #endif
2004#endif
2005#ifdef USE_CLEARCOAT_NORMALMAP
2006 #ifdef USE_TANGENT
2007 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
2008 #else
2009 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
2010 #endif
2011 #ifdef DOUBLE_SIDED
2012 tbn2[0] *= faceDirection;
2013 tbn2[1] *= faceDirection;
2014 #endif
2015#endif
2016vec3 nonPerturbedNormal = normal;`,P_=`#ifdef USE_NORMALMAP_OBJECTSPACE
2017 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
2018 #ifdef FLIP_SIDED
2019 normal = - normal;
2020 #endif
2021 #ifdef DOUBLE_SIDED
2022 normal = normal * faceDirection;
2023 #endif
2024 normal = normalize( normalMatrix * normal );
2025#elif defined( USE_NORMALMAP_TANGENTSPACE )
2026 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
2027 #if defined( USE_PACKED_NORMALMAP )
2028 mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
2029 #endif
2030 mapN.xy *= normalScale;
2031 normal = normalize( tbn * mapN );
2032#elif defined( USE_BUMPMAP )
2033 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
2034#endif`,L_=`#ifndef FLAT_SHADED
2035 varying vec3 vNormal;
2036 #ifdef USE_TANGENT
2037 varying vec3 vTangent;
2038 varying vec3 vBitangent;
2039 #endif
2040#endif`,D_=`#ifndef FLAT_SHADED
2041 varying vec3 vNormal;
2042 #ifdef USE_TANGENT
2043 varying vec3 vTangent;
2044 varying vec3 vBitangent;
2045 #endif
2046#endif`,N_=`#ifndef FLAT_SHADED
2047 vNormal = normalize( transformedNormal );
2048 #ifdef USE_TANGENT
2049 vTangent = normalize( transformedTangent );
2050 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2051 #ifdef FLIP_SIDED
2052 vBitangent = - vBitangent;
2053 #endif
2054 #endif
2055#endif`,U_=`#ifdef USE_NORMALMAP
2056 uniform sampler2D normalMap;
2057 uniform vec2 normalScale;
2058#endif
2059#ifdef USE_NORMALMAP_OBJECTSPACE
2060 uniform mat3 normalMatrix;
2061#endif
2062#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
2063 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
2064 vec3 q0 = dFdx( eye_pos.xyz );
2065 vec3 q1 = dFdy( eye_pos.xyz );
2066 vec2 st0 = dFdx( uv.st );
2067 vec2 st1 = dFdy( uv.st );
2068 vec3 N = surf_norm;
2069 vec3 q1perp = cross( q1, N );
2070 vec3 q0perp = cross( N, q0 );
2071 vec3 T = q1perp * st0.x + q0perp * st1.x;
2072 vec3 B = q1perp * st0.y + q0perp * st1.y;
2073 float det = max( dot( T, T ), dot( B, B ) );
2074 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
2075 return mat3( T * scale, B * scale, N );
2076 }
2077#endif`,F_=`#ifdef USE_CLEARCOAT
2078 vec3 clearcoatNormal = nonPerturbedNormal;
2079#endif`,O_=`#ifdef USE_CLEARCOAT_NORMALMAP
2080 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
2081 clearcoatMapN.xy *= clearcoatNormalScale;
2082 clearcoatNormal = normalize( tbn2 * clearcoatMapN );
2083#endif`,B_=`#ifdef USE_CLEARCOATMAP
2084 uniform sampler2D clearcoatMap;
2085#endif
2086#ifdef USE_CLEARCOAT_NORMALMAP
2087 uniform sampler2D clearcoatNormalMap;
2088 uniform vec2 clearcoatNormalScale;
2089#endif
2090#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2091 uniform sampler2D clearcoatRoughnessMap;
2092#endif`,z_=`#ifdef USE_IRIDESCENCEMAP
2093 uniform sampler2D iridescenceMap;
2094#endif
2095#ifdef USE_IRIDESCENCE_THICKNESSMAP
2096 uniform sampler2D iridescenceThicknessMap;
2097#endif`,k_=`#ifdef OPAQUE
2098diffuseColor.a = 1.0;
2099#endif
2100#ifdef USE_TRANSMISSION
2101diffuseColor.a *= material.transmissionAlpha;
2102#endif
2103gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,V_=`vec3 packNormalToRGB( const in vec3 normal ) {
2104 return normalize( normal ) * 0.5 + 0.5;
2105}
2106vec3 unpackRGBToNormal( const in vec3 rgb ) {
2107 return 2.0 * rgb.xyz - 1.0;
2108}
2109const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
2110const float Inv255 = 1. / 255.;
2111const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
2112const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
2113const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
2114const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
2115vec4 packDepthToRGBA( const in float v ) {
2116 if( v <= 0.0 )
2117 return vec4( 0., 0., 0., 0. );
2118 if( v >= 1.0 )
2119 return vec4( 1., 1., 1., 1. );
2120 float vuf;
2121 float af = modf( v * PackFactors.a, vuf );
2122 float bf = modf( vuf * ShiftRight8, vuf );
2123 float gf = modf( vuf * ShiftRight8, vuf );
2124 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
2125}
2126vec3 packDepthToRGB( const in float v ) {
2127 if( v <= 0.0 )
2128 return vec3( 0., 0., 0. );
2129 if( v >= 1.0 )
2130 return vec3( 1., 1., 1. );
2131 float vuf;
2132 float bf = modf( v * PackFactors.b, vuf );
2133 float gf = modf( vuf * ShiftRight8, vuf );
2134 return vec3( vuf * Inv255, gf * PackUpscale, bf );
2135}
2136vec2 packDepthToRG( const in float v ) {
2137 if( v <= 0.0 )
2138 return vec2( 0., 0. );
2139 if( v >= 1.0 )
2140 return vec2( 1., 1. );
2141 float vuf;
2142 float gf = modf( v * 256., vuf );
2143 return vec2( vuf * Inv255, gf );
2144}
2145float unpackRGBAToDepth( const in vec4 v ) {
2146 return dot( v, UnpackFactors4 );
2147}
2148float unpackRGBToDepth( const in vec3 v ) {
2149 return dot( v, UnpackFactors3 );
2150}
2151float unpackRGToDepth( const in vec2 v ) {
2152 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
2153}
2154vec4 pack2HalfToRGBA( const in vec2 v ) {
2155 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
2156 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
2157}
2158vec2 unpackRGBATo2Half( const in vec4 v ) {
2159 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
2160}
2161float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
2162 return ( viewZ + near ) / ( near - far );
2163}
2164float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
2165 #ifdef USE_REVERSED_DEPTH_BUFFER
2166
2167 return depth * ( far - near ) - far;
2168 #else
2169 return depth * ( near - far ) - near;
2170 #endif
2171}
2172float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
2173 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
2174}
2175float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
2176
2177 #ifdef USE_REVERSED_DEPTH_BUFFER
2178 return ( near * far ) / ( ( near - far ) * depth - near );
2179 #else
2180 return ( near * far ) / ( ( far - near ) * depth - far );
2181 #endif
2182}`,G_=`#ifdef PREMULTIPLIED_ALPHA
2183 gl_FragColor.rgb *= gl_FragColor.a;
2184#endif`,H_=`vec4 mvPosition = vec4( transformed, 1.0 );
2185#ifdef USE_BATCHING
2186 mvPosition = batchingMatrix * mvPosition;
2187#endif
2188#ifdef USE_INSTANCING
2189 mvPosition = instanceMatrix * mvPosition;
2190#endif
2191mvPosition = modelViewMatrix * mvPosition;
2192gl_Position = projectionMatrix * mvPosition;`,W_=`#ifdef DITHERING
2193 gl_FragColor.rgb = dithering( gl_FragColor.rgb );
2194#endif`,X_=`#ifdef DITHERING
2195 vec3 dithering( vec3 color ) {
2196 float grid_position = rand( gl_FragCoord.xy );
2197 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
2198 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
2199 return color + dither_shift_RGB;
2200 }
2201#endif`,q_=`float roughnessFactor = roughness;
2202#ifdef USE_ROUGHNESSMAP
2203 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
2204 roughnessFactor *= texelRoughness.g;
2205#endif`,Y_=`#ifdef USE_ROUGHNESSMAP
2206 uniform sampler2D roughnessMap;
2207#endif`,Z_=`#if NUM_SPOT_LIGHT_COORDS > 0
2208 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2209#endif
2210#if NUM_SPOT_LIGHT_MAPS > 0
2211 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
2212#endif
2213#ifdef USE_SHADOWMAP
2214 #if NUM_SUN_LIGHT_SHADOWS > 0
2215 #define SUN_LIGHT_CASCADES 2
2216 #if defined( SHADOWMAP_TYPE_PCF )
2217 uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
2218 #else
2219 uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
2220 #endif
2221 uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
2222 uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
2223 varying vec4 vSunShadowWorldPosition;
2224 varying vec3 vSunShadowWorldNormal;
2225 struct SunLightShadow {
2226 float shadowIntensity;
2227 float shadowBias;
2228 float shadowNormalBias;
2229 float shadowRadius;
2230 vec2 shadowMapSize;
2231 };
2232 uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];
2233 #endif
2234 #if NUM_DIR_LIGHT_SHADOWS > 0
2235 #if defined( SHADOWMAP_TYPE_PCF )
2236 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
2237 #else
2238 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
2239 #endif
2240 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2241 struct DirectionalLightShadow {
2242 float shadowIntensity;
2243 float shadowBias;
2244 float shadowNormalBias;
2245 float shadowRadius;
2246 vec2 shadowMapSize;
2247 };
2248 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2249 #endif
2250 #if NUM_SPOT_LIGHT_SHADOWS > 0
2251 #if defined( SHADOWMAP_TYPE_PCF )
2252 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
2253 #else
2254 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
2255 #endif
2256 struct SpotLightShadow {
2257 float shadowIntensity;
2258 float shadowBias;
2259 float shadowNormalBias;
2260 float shadowRadius;
2261 vec2 shadowMapSize;
2262 };
2263 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2264 #endif
2265 #if NUM_POINT_LIGHT_SHADOWS > 0
2266 #if defined( SHADOWMAP_TYPE_PCF )
2267 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
2268 #elif defined( SHADOWMAP_TYPE_BASIC )
2269 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
2270 #endif
2271 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2272 struct PointLightShadow {
2273 float shadowIntensity;
2274 float shadowBias;
2275 float shadowNormalBias;
2276 float shadowRadius;
2277 vec2 shadowMapSize;
2278 float shadowCameraNear;
2279 float shadowCameraFar;
2280 };
2281 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2282 #endif
2283 #if defined( SHADOWMAP_TYPE_PCF )
2284 float interleavedGradientNoise( vec2 position ) {
2285 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
2286 }
2287 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
2288 const float goldenAngle = 2.399963229728653;
2289 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
2290 float theta = float( sampleIndex ) * goldenAngle + phi;
2291 return vec2( cos( theta ), sin( theta ) ) * r;
2292 }
2293 #endif
2294 #if defined( SHADOWMAP_TYPE_PCF )
2295 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2296 float shadow = 1.0;
2297 shadowCoord.xyz /= shadowCoord.w;
2298 shadowCoord.z += shadowBias;
2299 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2300 bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2301 if ( frustumTest ) {
2302 vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
2303 float radius = shadowRadius * texelSize.x;
2304 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2305 shadow = (
2306 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
2307 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
2308 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
2309 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
2310 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
2311 ) * 0.2;
2312 }
2313 return mix( 1.0, shadow, shadowIntensity );
2314 }
2315 #elif defined( SHADOWMAP_TYPE_VSM )
2316 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2317 float shadow = 1.0;
2318 shadowCoord.xyz /= shadowCoord.w;
2319 #ifdef USE_REVERSED_DEPTH_BUFFER
2320 shadowCoord.z -= shadowBias;
2321 #else
2322 shadowCoord.z += shadowBias;
2323 #endif
2324 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2325 bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2326 if ( frustumTest ) {
2327 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
2328 float mean = distribution.x;
2329 float variance = distribution.y * distribution.y;
2330 #ifdef USE_REVERSED_DEPTH_BUFFER
2331 float hard_shadow = step( mean, shadowCoord.z );
2332 #else
2333 float hard_shadow = step( shadowCoord.z, mean );
2334 #endif
2335
2336 if ( hard_shadow == 1.0 ) {
2337 shadow = 1.0;
2338 } else {
2339 variance = max( variance, 0.0000001 );
2340 float d = shadowCoord.z - mean;
2341 float p_max = variance / ( variance + d * d );
2342 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
2343 shadow = max( hard_shadow, p_max );
2344 }
2345 }
2346 return mix( 1.0, shadow, shadowIntensity );
2347 }
2348 #else
2349 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2350 float shadow = 1.0;
2351 shadowCoord.xyz /= shadowCoord.w;
2352 #ifdef USE_REVERSED_DEPTH_BUFFER
2353 shadowCoord.z -= shadowBias;
2354 #else
2355 shadowCoord.z += shadowBias;
2356 #endif
2357 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2358 bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2359 if ( frustumTest ) {
2360 float depth = texture2D( shadowMap, shadowCoord.xy ).r;
2361 #ifdef USE_REVERSED_DEPTH_BUFFER
2362 shadow = step( depth, shadowCoord.z );
2363 #else
2364 shadow = step( shadowCoord.z, depth );
2365 #endif
2366 }
2367 return mix( 1.0, shadow, shadowIntensity );
2368 }
2369 #endif
2370 #if NUM_SUN_LIGHT_SHADOWS > 0
2371 float getSunShadow(
2372 #if defined( SHADOWMAP_TYPE_PCF )
2373 sampler2DShadow shadowMap,
2374 #else
2375 sampler2D shadowMap,
2376 #endif
2377 SunLightShadow sunLightShadow,
2378 int shadowIndex
2379 ) {
2380 vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );
2381 float viewDepth = vSunShadowWorldPosition.w;
2382 int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;
2383 float shadow = 1.0;
2384 for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {
2385 vec4 cascade = sunShadowCascade[ cascadeOffset + i ];
2386 if ( viewDepth >= cascade.x && viewDepth < cascade.y ) {
2387 float cascadeShadow = getShadow(
2388 shadowMap,
2389 sunLightShadow.shadowMapSize,
2390 sunLightShadow.shadowIntensity,
2391 sunLightShadow.shadowBias,
2392 sunLightShadow.shadowRadius,
2393 sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition
2394 );
2395 shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );
2396 }
2397 }
2398 return shadow;
2399 }
2400 #endif
2401 #if NUM_POINT_LIGHT_SHADOWS > 0
2402 #if defined( SHADOWMAP_TYPE_PCF )
2403 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2404 float shadow = 1.0;
2405 vec3 lightToPosition = shadowCoord.xyz;
2406 vec3 bd3D = normalize( lightToPosition );
2407 vec3 absVec = abs( lightToPosition );
2408 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2409 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2410 #ifdef USE_REVERSED_DEPTH_BUFFER
2411 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2412 dp -= shadowBias;
2413 #else
2414 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2415 dp += shadowBias;
2416 #endif
2417 float texelSize = shadowRadius / shadowMapSize.x;
2418 vec3 absDir = abs( bd3D );
2419 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
2420 tangent = normalize( cross( bd3D, tangent ) );
2421 vec3 bitangent = cross( bd3D, tangent );
2422 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2423 vec2 sample0 = vogelDiskSample( 0, 5, phi );
2424 vec2 sample1 = vogelDiskSample( 1, 5, phi );
2425 vec2 sample2 = vogelDiskSample( 2, 5, phi );
2426 vec2 sample3 = vogelDiskSample( 3, 5, phi );
2427 vec2 sample4 = vogelDiskSample( 4, 5, phi );
2428 shadow = (
2429 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
2430 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
2431 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
2432 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
2433 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
2434 ) * 0.2;
2435 }
2436 return mix( 1.0, shadow, shadowIntensity );
2437 }
2438 #elif defined( SHADOWMAP_TYPE_BASIC )
2439 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2440 float shadow = 1.0;
2441 vec3 lightToPosition = shadowCoord.xyz;
2442 vec3 absVec = abs( lightToPosition );
2443 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2444 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2445 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2446 dp += shadowBias;
2447 vec3 bd3D = normalize( lightToPosition );
2448 float depth = textureCube( shadowMap, bd3D ).r;
2449 #ifdef USE_REVERSED_DEPTH_BUFFER
2450 depth = 1.0 - depth;
2451 #endif
2452 shadow = step( dp, depth );
2453 }
2454 return mix( 1.0, shadow, shadowIntensity );
2455 }
2456 #endif
2457 #endif
2458#endif`,$_=`#if NUM_SPOT_LIGHT_COORDS > 0
2459 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2460 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2461#endif
2462#ifdef USE_SHADOWMAP
2463 #if NUM_SUN_LIGHT_SHADOWS > 0
2464 varying vec4 vSunShadowWorldPosition;
2465 varying vec3 vSunShadowWorldNormal;
2466 #endif
2467 #if NUM_DIR_LIGHT_SHADOWS > 0
2468 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
2469 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2470 struct DirectionalLightShadow {
2471 float shadowIntensity;
2472 float shadowBias;
2473 float shadowNormalBias;
2474 float shadowRadius;
2475 vec2 shadowMapSize;
2476 };
2477 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2478 #endif
2479 #if NUM_SPOT_LIGHT_SHADOWS > 0
2480 struct SpotLightShadow {
2481 float shadowIntensity;
2482 float shadowBias;
2483 float shadowNormalBias;
2484 float shadowRadius;
2485 vec2 shadowMapSize;
2486 };
2487 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2488 #endif
2489 #if NUM_POINT_LIGHT_SHADOWS > 0
2490 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2491 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2492 struct PointLightShadow {
2493 float shadowIntensity;
2494 float shadowBias;
2495 float shadowNormalBias;
2496 float shadowRadius;
2497 vec2 shadowMapSize;
2498 float shadowCameraNear;
2499 float shadowCameraFar;
2500 };
2501 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2502 #endif
2503#endif`,J_=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2504 #ifdef HAS_NORMAL
2505 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
2506 #else
2507 vec3 shadowWorldNormal = vec3( 0.0 );
2508 #endif
2509 vec4 shadowWorldPosition;
2510#endif
2511#if defined( USE_SHADOWMAP )
2512 #if NUM_SUN_LIGHT_SHADOWS > 0
2513 vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );
2514 vSunShadowWorldNormal = shadowWorldNormal;
2515 #endif
2516 #if NUM_DIR_LIGHT_SHADOWS > 0
2517 #pragma unroll_loop_start
2518 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2519 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2520 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2521 }
2522 #pragma unroll_loop_end
2523 #endif
2524 #if NUM_POINT_LIGHT_SHADOWS > 0
2525 #pragma unroll_loop_start
2526 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2527 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2528 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2529 }
2530 #pragma unroll_loop_end
2531 #endif
2532#endif
2533#if NUM_SPOT_LIGHT_COORDS > 0
2534 #pragma unroll_loop_start
2535 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2536 shadowWorldPosition = worldPosition;
2537 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2538 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2539 #endif
2540 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2541 }
2542 #pragma unroll_loop_end
2543#endif`,K_=`float getShadowMask() {
2544 float shadow = 1.0;
2545 #ifdef USE_SHADOWMAP
2546 #if NUM_SUN_LIGHT_SHADOWS > 0
2547 SunLightShadow sunLight;
2548 #pragma unroll_loop_start
2549 for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {
2550 sunLight = sunLightShadows[ i ];
2551 shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;
2552 }
2553 #pragma unroll_loop_end
2554 #endif
2555 #if NUM_DIR_LIGHT_SHADOWS > 0
2556 DirectionalLightShadow directionalLight;
2557 #pragma unroll_loop_start
2558 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2559 directionalLight = directionalLightShadows[ i ];
2560 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2561 }
2562 #pragma unroll_loop_end
2563 #endif
2564 #if NUM_SPOT_LIGHT_SHADOWS > 0
2565 SpotLightShadow spotLight;
2566 #pragma unroll_loop_start
2567 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2568 spotLight = spotLightShadows[ i ];
2569 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2570 }
2571 #pragma unroll_loop_end
2572 #endif
2573 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2574 PointLightShadow pointLight;
2575 #pragma unroll_loop_start
2576 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2577 pointLight = pointLightShadows[ i ];
2578 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2579 }
2580 #pragma unroll_loop_end
2581 #endif
2582 #endif
2583 return shadow;
2584}`,j_=`#ifdef USE_SKINNING
2585 mat4 boneMatX = getBoneMatrix( skinIndex.x );
2586 mat4 boneMatY = getBoneMatrix( skinIndex.y );
2587 mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2588 mat4 boneMatW = getBoneMatrix( skinIndex.w );
2589#endif`,Q_=`#ifdef USE_SKINNING
2590 uniform mat4 bindMatrix;
2591 uniform mat4 bindMatrixInverse;
2592 uniform highp sampler2D boneTexture;
2593 mat4 getBoneMatrix( const in float i ) {
2594 int size = textureSize( boneTexture, 0 ).x;
2595 int j = int( i ) * 4;
2596 int x = j % size;
2597 int y = j / size;
2598 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2599 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2600 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2601 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2602 return mat4( v1, v2, v3, v4 );
2603 }
2604#endif`,ex=`#ifdef USE_SKINNING
2605 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2606 vec4 skinned = vec4( 0.0 );
2607 skinned += boneMatX * skinVertex * skinWeight.x;
2608 skinned += boneMatY * skinVertex * skinWeight.y;
2609 skinned += boneMatZ * skinVertex * skinWeight.z;
2610 skinned += boneMatW * skinVertex * skinWeight.w;
2611 transformed = ( bindMatrixInverse * skinned ).xyz;
2612#endif`,tx=`#ifdef USE_SKINNING
2613 mat4 skinMatrix = mat4( 0.0 );
2614 skinMatrix += skinWeight.x * boneMatX;
2615 skinMatrix += skinWeight.y * boneMatY;
2616 skinMatrix += skinWeight.z * boneMatZ;
2617 skinMatrix += skinWeight.w * boneMatW;
2618 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2619 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2620 #ifdef USE_TANGENT
2621 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2622 #endif
2623#endif`,nx=`float specularStrength;
2624#ifdef USE_SPECULARMAP
2625 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2626 specularStrength = texelSpecular.r;
2627#else
2628 specularStrength = 1.0;
2629#endif`,ix=`#ifdef USE_SPECULARMAP
2630 uniform sampler2D specularMap;
2631#endif`,sx=`#if defined( TONE_MAPPING )
2632 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2633#endif`,rx=`#ifndef saturate
2634#define saturate( a ) clamp( a, 0.0, 1.0 )
2635#endif
2636uniform float toneMappingExposure;
2637vec3 LinearToneMapping( vec3 color ) {
2638 return saturate( toneMappingExposure * color );
2639}
2640vec3 ReinhardToneMapping( vec3 color ) {
2641 color *= toneMappingExposure;
2642 return saturate( color / ( vec3( 1.0 ) + color ) );
2643}
2644vec3 CineonToneMapping( vec3 color ) {
2645 color *= toneMappingExposure;
2646 color = max( vec3( 0.0 ), color - 0.004 );
2647 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2648}
2649vec3 RRTAndODTFit( vec3 v ) {
2650 vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2651 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2652 return a / b;
2653}
2654vec3 ACESFilmicToneMapping( vec3 color ) {
2655 const mat3 ACESInputMat = mat3(
2656 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
2657 vec3( 0.04823, 0.01566, 0.83777 )
2658 );
2659 const mat3 ACESOutputMat = mat3(
2660 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
2661 vec3( -0.07367, -0.00605, 1.07602 )
2662 );
2663 color *= toneMappingExposure / 0.6;
2664 color = ACESInputMat * color;
2665 color = RRTAndODTFit( color );
2666 color = ACESOutputMat * color;
2667 return saturate( color );
2668}
2669const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2670 vec3( 1.6605, - 0.1246, - 0.0182 ),
2671 vec3( - 0.5876, 1.1329, - 0.1006 ),
2672 vec3( - 0.0728, - 0.0083, 1.1187 )
2673);
2674const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2675 vec3( 0.6274, 0.0691, 0.0164 ),
2676 vec3( 0.3293, 0.9195, 0.0880 ),
2677 vec3( 0.0433, 0.0113, 0.8956 )
2678);
2679vec3 agxDefaultContrastApprox( vec3 x ) {
2680 vec3 x2 = x * x;
2681 vec3 x4 = x2 * x2;
2682 return + 15.5 * x4 * x2
2683 - 40.14 * x4 * x
2684 + 31.96 * x4
2685 - 6.868 * x2 * x
2686 + 0.4298 * x2
2687 + 0.1191 * x
2688 - 0.00232;
2689}
2690vec3 AgXToneMapping( vec3 color ) {
2691 const mat3 AgXInsetMatrix = mat3(
2692 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2693 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2694 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2695 );
2696 const mat3 AgXOutsetMatrix = mat3(
2697 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2698 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2699 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2700 );
2701 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
2702 color *= toneMappingExposure;
2703 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2704 color = AgXInsetMatrix * color;
2705 color = max( color, 1e-10 ); color = log2( color );
2706 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2707 color = clamp( color, 0.0, 1.0 );
2708 color = agxDefaultContrastApprox( color );
2709 color = AgXOutsetMatrix * color;
2710 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2711 color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2712 color = clamp( color, 0.0, 1.0 );
2713 return color;
2714}
2715vec3 NeutralToneMapping( vec3 color ) {
2716 const float StartCompression = 0.8 - 0.04;
2717 const float Desaturation = 0.15;
2718 color *= toneMappingExposure;
2719 float x = min( color.r, min( color.g, color.b ) );
2720 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2721 color -= offset;
2722 float peak = max( color.r, max( color.g, color.b ) );
2723 if ( peak < StartCompression ) return color;
2724 float d = 1. - StartCompression;
2725 float newPeak = 1. - d * d / ( peak + d - StartCompression );
2726 color *= newPeak / peak;
2727 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2728 return mix( color, vec3( newPeak ), g );
2729}
2730vec3 CustomToneMapping( vec3 color ) { return color; }`,ox=`#ifdef USE_TRANSMISSION
2731 material.transmission = transmission;
2732 material.transmissionAlpha = 1.0;
2733 material.thickness = thickness;
2734 material.attenuationDistance = attenuationDistance;
2735 material.attenuationColor = attenuationColor;
2736 #ifdef USE_TRANSMISSIONMAP
2737 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2738 #endif
2739 #ifdef USE_THICKNESSMAP
2740 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2741 #endif
2742 vec3 pos = vWorldPosition;
2743 vec3 v = normalize( cameraPosition - pos );
2744 vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );
2745 vec4 transmitted = getIBLVolumeRefraction(
2746 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2747 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2748 material.attenuationColor, material.attenuationDistance );
2749 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2750 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2751#endif`,ax=`#ifdef USE_TRANSMISSION
2752 uniform float transmission;
2753 uniform float thickness;
2754 uniform float attenuationDistance;
2755 uniform vec3 attenuationColor;
2756 #ifdef USE_TRANSMISSIONMAP
2757 uniform sampler2D transmissionMap;
2758 #endif
2759 #ifdef USE_THICKNESSMAP
2760 uniform sampler2D thicknessMap;
2761 #endif
2762 uniform vec2 transmissionSamplerSize;
2763 uniform sampler2D transmissionSamplerMap;
2764 uniform mat4 modelMatrix;
2765 uniform mat4 projectionMatrix;
2766 varying vec3 vWorldPosition;
2767 float w0( float a ) {
2768 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2769 }
2770 float w1( float a ) {
2771 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
2772 }
2773 float w2( float a ){
2774 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2775 }
2776 float w3( float a ) {
2777 return ( 1.0 / 6.0 ) * ( a * a * a );
2778 }
2779 float g0( float a ) {
2780 return w0( a ) + w1( a );
2781 }
2782 float g1( float a ) {
2783 return w2( a ) + w3( a );
2784 }
2785 float h0( float a ) {
2786 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2787 }
2788 float h1( float a ) {
2789 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2790 }
2791 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2792 uv = uv * texelSize.zw + 0.5;
2793 vec2 iuv = floor( uv );
2794 vec2 fuv = fract( uv );
2795 float g0x = g0( fuv.x );
2796 float g1x = g1( fuv.x );
2797 float h0x = h0( fuv.x );
2798 float h1x = h1( fuv.x );
2799 float h0y = h0( fuv.y );
2800 float h1y = h1( fuv.y );
2801 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2802 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2803 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2804 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2805 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2806 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2807 }
2808 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2809 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2810 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2811 vec2 fLodSizeInv = 1.0 / fLodSize;
2812 vec2 cLodSizeInv = 1.0 / cLodSize;
2813 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2814 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2815 return mix( fSample, cSample, fract( lod ) );
2816 }
2817 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2818 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2819 vec3 modelScale;
2820 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2821 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2822 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2823 return normalize( refractionVector ) * thickness * modelScale;
2824 }
2825 float applyIorToRoughness( const in float roughness, const in float ior ) {
2826 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2827 }
2828 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2829 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2830 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2831 }
2832 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2833 if ( isinf( attenuationDistance ) ) {
2834 return vec3( 1.0 );
2835 } else {
2836 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2837 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
2838 }
2839 }
2840 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2841 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2842 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2843 const in vec3 attenuationColor, const in float attenuationDistance ) {
2844 vec4 transmittedLight;
2845 vec3 transmittance;
2846 #ifdef USE_DISPERSION
2847 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2848 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2849 for ( int i = 0; i < 3; i ++ ) {
2850 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2851 vec3 refractedRayExit = position + transmissionRay;
2852 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2853 vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2854 refractionCoords += 1.0;
2855 refractionCoords /= 2.0;
2856 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2857 transmittedLight[ i ] = transmissionSample[ i ];
2858 transmittedLight.a += transmissionSample.a;
2859 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2860 }
2861 transmittedLight.a /= 3.0;
2862 #else
2863 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2864 vec3 refractedRayExit = position + transmissionRay;
2865 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2866 vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2867 refractionCoords += 1.0;
2868 refractionCoords /= 2.0;
2869 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2870 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2871 #endif
2872 vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2873 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2874 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2875 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2876 }
2877#endif`,cx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2878 varying vec2 vUv;
2879#endif
2880#ifdef USE_MAP
2881 varying vec2 vMapUv;
2882#endif
2883#ifdef USE_ALPHAMAP
2884 varying vec2 vAlphaMapUv;
2885#endif
2886#ifdef USE_LIGHTMAP
2887 varying vec2 vLightMapUv;
2888#endif
2889#ifdef USE_AOMAP
2890 varying vec2 vAoMapUv;
2891#endif
2892#ifdef USE_BUMPMAP
2893 varying vec2 vBumpMapUv;
2894#endif
2895#ifdef USE_NORMALMAP
2896 varying vec2 vNormalMapUv;
2897#endif
2898#ifdef USE_EMISSIVEMAP
2899 varying vec2 vEmissiveMapUv;
2900#endif
2901#ifdef USE_METALNESSMAP
2902 varying vec2 vMetalnessMapUv;
2903#endif
2904#ifdef USE_ROUGHNESSMAP
2905 varying vec2 vRoughnessMapUv;
2906#endif
2907#ifdef USE_ANISOTROPYMAP
2908 varying vec2 vAnisotropyMapUv;
2909#endif
2910#ifdef USE_CLEARCOATMAP
2911 varying vec2 vClearcoatMapUv;
2912#endif
2913#ifdef USE_CLEARCOAT_NORMALMAP
2914 varying vec2 vClearcoatNormalMapUv;
2915#endif
2916#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2917 varying vec2 vClearcoatRoughnessMapUv;
2918#endif
2919#ifdef USE_IRIDESCENCEMAP
2920 varying vec2 vIridescenceMapUv;
2921#endif
2922#ifdef USE_IRIDESCENCE_THICKNESSMAP
2923 varying vec2 vIridescenceThicknessMapUv;
2924#endif
2925#ifdef USE_SHEEN_COLORMAP
2926 varying vec2 vSheenColorMapUv;
2927#endif
2928#ifdef USE_SHEEN_ROUGHNESSMAP
2929 varying vec2 vSheenRoughnessMapUv;
2930#endif
2931#ifdef USE_SPECULARMAP
2932 varying vec2 vSpecularMapUv;
2933#endif
2934#ifdef USE_SPECULAR_COLORMAP
2935 varying vec2 vSpecularColorMapUv;
2936#endif
2937#ifdef USE_SPECULAR_INTENSITYMAP
2938 varying vec2 vSpecularIntensityMapUv;
2939#endif
2940#ifdef USE_TRANSMISSIONMAP
2941 uniform mat3 transmissionMapTransform;
2942 varying vec2 vTransmissionMapUv;
2943#endif
2944#ifdef USE_THICKNESSMAP
2945 uniform mat3 thicknessMapTransform;
2946 varying vec2 vThicknessMapUv;
2947#endif`,lx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2948 varying vec2 vUv;
2949#endif
2950#ifdef USE_MAP
2951 uniform mat3 mapTransform;
2952 varying vec2 vMapUv;
2953#endif
2954#ifdef USE_ALPHAMAP
2955 uniform mat3 alphaMapTransform;
2956 varying vec2 vAlphaMapUv;
2957#endif
2958#ifdef USE_LIGHTMAP
2959 uniform mat3 lightMapTransform;
2960 varying vec2 vLightMapUv;
2961#endif
2962#ifdef USE_AOMAP
2963 uniform mat3 aoMapTransform;
2964 varying vec2 vAoMapUv;
2965#endif
2966#ifdef USE_BUMPMAP
2967 uniform mat3 bumpMapTransform;
2968 varying vec2 vBumpMapUv;
2969#endif
2970#ifdef USE_NORMALMAP
2971 uniform mat3 normalMapTransform;
2972 varying vec2 vNormalMapUv;
2973#endif
2974#ifdef USE_DISPLACEMENTMAP
2975 uniform mat3 displacementMapTransform;
2976 varying vec2 vDisplacementMapUv;
2977#endif
2978#ifdef USE_EMISSIVEMAP
2979 uniform mat3 emissiveMapTransform;
2980 varying vec2 vEmissiveMapUv;
2981#endif
2982#ifdef USE_METALNESSMAP
2983 uniform mat3 metalnessMapTransform;
2984 varying vec2 vMetalnessMapUv;
2985#endif
2986#ifdef USE_ROUGHNESSMAP
2987 uniform mat3 roughnessMapTransform;
2988 varying vec2 vRoughnessMapUv;
2989#endif
2990#ifdef USE_ANISOTROPYMAP
2991 uniform mat3 anisotropyMapTransform;
2992 varying vec2 vAnisotropyMapUv;
2993#endif
2994#ifdef USE_CLEARCOATMAP
2995 uniform mat3 clearcoatMapTransform;
2996 varying vec2 vClearcoatMapUv;
2997#endif
2998#ifdef USE_CLEARCOAT_NORMALMAP
2999 uniform mat3 clearcoatNormalMapTransform;
3000 varying vec2 vClearcoatNormalMapUv;
3001#endif
3002#ifdef USE_CLEARCOAT_ROUGHNESSMAP
3003 uniform mat3 clearcoatRoughnessMapTransform;
3004 varying vec2 vClearcoatRoughnessMapUv;
3005#endif
3006#ifdef USE_SHEEN_COLORMAP
3007 uniform mat3 sheenColorMapTransform;
3008 varying vec2 vSheenColorMapUv;
3009#endif
3010#ifdef USE_SHEEN_ROUGHNESSMAP
3011 uniform mat3 sheenRoughnessMapTransform;
3012 varying vec2 vSheenRoughnessMapUv;
3013#endif
3014#ifdef USE_IRIDESCENCEMAP
3015 uniform mat3 iridescenceMapTransform;
3016 varying vec2 vIridescenceMapUv;
3017#endif
3018#ifdef USE_IRIDESCENCE_THICKNESSMAP
3019 uniform mat3 iridescenceThicknessMapTransform;
3020 varying vec2 vIridescenceThicknessMapUv;
3021#endif
3022#ifdef USE_SPECULARMAP
3023 uniform mat3 specularMapTransform;
3024 varying vec2 vSpecularMapUv;
3025#endif
3026#ifdef USE_SPECULAR_COLORMAP
3027 uniform mat3 specularColorMapTransform;
3028 varying vec2 vSpecularColorMapUv;
3029#endif
3030#ifdef USE_SPECULAR_INTENSITYMAP
3031 uniform mat3 specularIntensityMapTransform;
3032 varying vec2 vSpecularIntensityMapUv;
3033#endif
3034#ifdef USE_TRANSMISSIONMAP
3035 uniform mat3 transmissionMapTransform;
3036 varying vec2 vTransmissionMapUv;
3037#endif
3038#ifdef USE_THICKNESSMAP
3039 uniform mat3 thicknessMapTransform;
3040 varying vec2 vThicknessMapUv;
3041#endif`,hx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
3042 vUv = vec3( uv, 1 ).xy;
3043#endif
3044#ifdef USE_MAP
3045 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
3046#endif
3047#ifdef USE_ALPHAMAP
3048 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
3049#endif
3050#ifdef USE_LIGHTMAP
3051 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
3052#endif
3053#ifdef USE_AOMAP
3054 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
3055#endif
3056#ifdef USE_BUMPMAP
3057 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
3058#endif
3059#ifdef USE_NORMALMAP
3060 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
3061#endif
3062#ifdef USE_DISPLACEMENTMAP
3063 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
3064#endif
3065#ifdef USE_EMISSIVEMAP
3066 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
3067#endif
3068#ifdef USE_METALNESSMAP
3069 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
3070#endif
3071#ifdef USE_ROUGHNESSMAP
3072 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
3073#endif
3074#ifdef USE_ANISOTROPYMAP
3075 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
3076#endif
3077#ifdef USE_CLEARCOATMAP
3078 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
3079#endif
3080#ifdef USE_CLEARCOAT_NORMALMAP
3081 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
3082#endif
3083#ifdef USE_CLEARCOAT_ROUGHNESSMAP
3084 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
3085#endif
3086#ifdef USE_IRIDESCENCEMAP
3087 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
3088#endif
3089#ifdef USE_IRIDESCENCE_THICKNESSMAP
3090 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
3091#endif
3092#ifdef USE_SHEEN_COLORMAP
3093 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
3094#endif
3095#ifdef USE_SHEEN_ROUGHNESSMAP
3096 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
3097#endif
3098#ifdef USE_SPECULARMAP
3099 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
3100#endif
3101#ifdef USE_SPECULAR_COLORMAP
3102 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
3103#endif
3104#ifdef USE_SPECULAR_INTENSITYMAP
3105 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
3106#endif
3107#ifdef USE_TRANSMISSIONMAP
3108 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
3109#endif
3110#ifdef USE_THICKNESSMAP
3111 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
3112#endif`,ux=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
3113 vec4 worldPosition = vec4( transformed, 1.0 );
3114 #ifdef USE_BATCHING
3115 worldPosition = batchingMatrix * worldPosition;
3116 #endif
3117 #ifdef USE_INSTANCING
3118 worldPosition = instanceMatrix * worldPosition;
3119 #endif
3120 worldPosition = modelMatrix * worldPosition;
3121#endif`,dx=`varying vec2 vUv;
3122uniform mat3 uvTransform;
3123void main() {
3124 vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3125 gl_Position = vec4( position.xy, 1.0, 1.0 );
3126}`,fx=`uniform sampler2D t2D;
3127uniform float backgroundIntensity;
3128varying vec2 vUv;
3129void main() {
3130 vec4 texColor = texture2D( t2D, vUv );
3131 #ifdef DECODE_VIDEO_TEXTURE
3132 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 );
3133 #endif
3134 texColor.rgb *= backgroundIntensity;
3135 gl_FragColor = texColor;
3136 #include <tonemapping_fragment>
3137 #include <colorspace_fragment>
3138}`,px=`varying vec3 vWorldDirection;
3139#include <common>
3140void main() {
3141 vWorldDirection = transformDirection( position, modelMatrix );
3142 #include <begin_vertex>
3143 #include <project_vertex>
3144 gl_Position.z = gl_Position.w;
3145}`,mx=`#ifdef ENVMAP_TYPE_CUBE
3146 uniform samplerCube envMap;
3147#elif defined( ENVMAP_TYPE_CUBE_UV )
3148 uniform sampler2D envMap;
3149#endif
3150uniform float backgroundBlurriness;
3151uniform float backgroundIntensity;
3152uniform mat3 backgroundRotation;
3153varying vec3 vWorldDirection;
3154#include <cube_uv_reflection_fragment>
3155void main() {
3156 #ifdef ENVMAP_TYPE_CUBE
3157 vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
3158 #elif defined( ENVMAP_TYPE_CUBE_UV )
3159 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
3160 #else
3161 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3162 #endif
3163 texColor.rgb *= backgroundIntensity;
3164 gl_FragColor = texColor;
3165 #include <tonemapping_fragment>
3166 #include <colorspace_fragment>
3167}`,gx=`varying vec3 vWorldDirection;
3168#include <common>
3169void main() {
3170 vWorldDirection = transformDirection( position, modelMatrix );
3171 #include <begin_vertex>
3172 #include <project_vertex>
3173 gl_Position.z = gl_Position.w;
3174}`,_x=`uniform samplerCube tCube;
3175uniform float tFlip;
3176uniform float opacity;
3177varying vec3 vWorldDirection;
3178void main() {
3179 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
3180 gl_FragColor = texColor;
3181 gl_FragColor.a *= opacity;
3182 #include <tonemapping_fragment>
3183 #include <colorspace_fragment>
3184}`,xx=`#include <common>
3185#include <batching_pars_vertex>
3186#include <uv_pars_vertex>
3187#include <displacementmap_pars_vertex>
3188#include <morphtarget_pars_vertex>
3189#include <skinning_pars_vertex>
3190#include <logdepthbuf_pars_vertex>
3191#include <clipping_planes_pars_vertex>
3192varying vec2 vHighPrecisionZW;
3193void main() {
3194 #include <uv_vertex>
3195 #include <batching_vertex>
3196 #include <skinbase_vertex>
3197 #include <morphinstance_vertex>
3198 #ifdef USE_DISPLACEMENTMAP
3199 #include <beginnormal_vertex>
3200 #include <morphnormal_vertex>
3201 #include <skinnormal_vertex>
3202 #endif
3203 #include <begin_vertex>
3204 #include <morphtarget_vertex>
3205 #include <skinning_vertex>
3206 #include <displacementmap_vertex>
3207 #include <project_vertex>
3208 #include <logdepthbuf_vertex>
3209 #include <clipping_planes_vertex>
3210 vHighPrecisionZW = gl_Position.zw;
3211}`,vx=`#if DEPTH_PACKING == 3200
3212 uniform float opacity;
3213#endif
3214#include <common>
3215#include <packing>
3216#include <uv_pars_fragment>
3217#include <map_pars_fragment>
3218#include <alphamap_pars_fragment>
3219#include <alphatest_pars_fragment>
3220#include <alphahash_pars_fragment>
3221#include <logdepthbuf_pars_fragment>
3222#include <clipping_planes_pars_fragment>
3223varying vec2 vHighPrecisionZW;
3224void main() {
3225 vec4 diffuseColor = vec4( 1.0 );
3226 #include <clipping_planes_fragment>
3227 #if DEPTH_PACKING == 3200
3228 diffuseColor.a = opacity;
3229 #endif
3230 #include <map_fragment>
3231 #include <alphamap_fragment>
3232 #include <alphatest_fragment>
3233 #include <alphahash_fragment>
3234 #include <logdepthbuf_fragment>
3235 #ifdef USE_REVERSED_DEPTH_BUFFER
3236 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
3237 #else
3238 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
3239 #endif
3240 #if DEPTH_PACKING == 3200
3241 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
3242 #elif DEPTH_PACKING == 3201
3243 gl_FragColor = packDepthToRGBA( fragCoordZ );
3244 #elif DEPTH_PACKING == 3202
3245 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
3246 #elif DEPTH_PACKING == 3203
3247 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
3248 #endif
3249}`,yx=`#define DISTANCE
3250varying vec3 vWorldPosition;
3251#include <common>
3252#include <batching_pars_vertex>
3253#include <uv_pars_vertex>
3254#include <displacementmap_pars_vertex>
3255#include <morphtarget_pars_vertex>
3256#include <skinning_pars_vertex>
3257#include <clipping_planes_pars_vertex>
3258void main() {
3259 #include <uv_vertex>
3260 #include <batching_vertex>
3261 #include <skinbase_vertex>
3262 #include <morphinstance_vertex>
3263 #ifdef USE_DISPLACEMENTMAP
3264 #include <beginnormal_vertex>
3265 #include <morphnormal_vertex>
3266 #include <skinnormal_vertex>
3267 #endif
3268 #include <begin_vertex>
3269 #include <morphtarget_vertex>
3270 #include <skinning_vertex>
3271 #include <displacementmap_vertex>
3272 #include <project_vertex>
3273 #include <worldpos_vertex>
3274 #include <clipping_planes_vertex>
3275 vWorldPosition = worldPosition.xyz;
3276}`,Mx=`#define DISTANCE
3277uniform vec3 referencePosition;
3278uniform float nearDistance;
3279uniform float farDistance;
3280varying vec3 vWorldPosition;
3281#include <common>
3282#include <uv_pars_fragment>
3283#include <map_pars_fragment>
3284#include <alphamap_pars_fragment>
3285#include <alphatest_pars_fragment>
3286#include <alphahash_pars_fragment>
3287#include <clipping_planes_pars_fragment>
3288void main() {
3289 vec4 diffuseColor = vec4( 1.0 );
3290 #include <clipping_planes_fragment>
3291 #include <map_fragment>
3292 #include <alphamap_fragment>
3293 #include <alphatest_fragment>
3294 #include <alphahash_fragment>
3295 float dist = length( vWorldPosition - referencePosition );
3296 dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
3297 dist = saturate( dist );
3298 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
3299}`,Sx=`varying vec3 vWorldDirection;
3300#include <common>
3301void main() {
3302 vWorldDirection = transformDirection( position, modelMatrix );
3303 #include <begin_vertex>
3304 #include <project_vertex>
3305}`,bx=`uniform sampler2D tEquirect;
3306varying vec3 vWorldDirection;
3307#include <common>
3308void main() {
3309 vec3 direction = normalize( vWorldDirection );
3310 vec2 sampleUV = equirectUv( direction );
3311 gl_FragColor = texture2D( tEquirect, sampleUV );
3312 #include <tonemapping_fragment>
3313 #include <colorspace_fragment>
3314}`,wx=`uniform float scale;
3315attribute float lineDistance;
3316varying float vLineDistance;
3317#include <common>
3318#include <uv_pars_vertex>
3319#include <color_pars_vertex>
3320#include <fog_pars_vertex>
3321#include <morphtarget_pars_vertex>
3322#include <logdepthbuf_pars_vertex>
3323#include <clipping_planes_pars_vertex>
3324void main() {
3325 vLineDistance = scale * lineDistance;
3326 #include <uv_vertex>
3327 #include <color_vertex>
3328 #include <morphinstance_vertex>
3329 #include <morphcolor_vertex>
3330 #include <begin_vertex>
3331 #include <morphtarget_vertex>
3332 #include <project_vertex>
3333 #include <logdepthbuf_vertex>
3334 #include <clipping_planes_vertex>
3335 #include <fog_vertex>
3336}`,Ex=`uniform vec3 diffuse;
3337uniform float opacity;
3338uniform float dashSize;
3339uniform float totalSize;
3340varying float vLineDistance;
3341#include <common>
3342#include <color_pars_fragment>
3343#include <uv_pars_fragment>
3344#include <map_pars_fragment>
3345#include <fog_pars_fragment>
3346#include <logdepthbuf_pars_fragment>
3347#include <clipping_planes_pars_fragment>
3348void main() {
3349 vec4 diffuseColor = vec4( diffuse, opacity );
3350 #include <clipping_planes_fragment>
3351 if ( mod( vLineDistance, totalSize ) > dashSize ) {
3352 discard;
3353 }
3354 vec3 outgoingLight = vec3( 0.0 );
3355 #include <logdepthbuf_fragment>
3356 #include <map_fragment>
3357 #include <color_fragment>
3358 outgoingLight = diffuseColor.rgb;
3359 #include <opaque_fragment>
3360 #include <tonemapping_fragment>
3361 #include <colorspace_fragment>
3362 #include <fog_fragment>
3363 #include <premultiplied_alpha_fragment>
3364}`,Tx=`#include <common>
3365#include <batching_pars_vertex>
3366#include <uv_pars_vertex>
3367#include <envmap_pars_vertex>
3368#include <color_pars_vertex>
3369#include <fog_pars_vertex>
3370#include <morphtarget_pars_vertex>
3371#include <skinning_pars_vertex>
3372#include <logdepthbuf_pars_vertex>
3373#include <clipping_planes_pars_vertex>
3374void main() {
3375 #include <uv_vertex>
3376 #include <color_vertex>
3377 #include <morphinstance_vertex>
3378 #include <morphcolor_vertex>
3379 #include <batching_vertex>
3380 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
3381 #include <beginnormal_vertex>
3382 #include <morphnormal_vertex>
3383 #include <skinbase_vertex>
3384 #include <skinnormal_vertex>
3385 #include <defaultnormal_vertex>
3386 #endif
3387 #include <begin_vertex>
3388 #include <morphtarget_vertex>
3389 #include <skinning_vertex>
3390 #include <project_vertex>
3391 #include <logdepthbuf_vertex>
3392 #include <clipping_planes_vertex>
3393 #include <worldpos_vertex>
3394 #include <envmap_vertex>
3395 #include <fog_vertex>
3396}`,Ax=`uniform vec3 diffuse;
3397uniform float opacity;
3398#ifndef FLAT_SHADED
3399 varying vec3 vNormal;
3400#endif
3401#include <common>
3402#include <dithering_pars_fragment>
3403#include <color_pars_fragment>
3404#include <uv_pars_fragment>
3405#include <map_pars_fragment>
3406#include <alphamap_pars_fragment>
3407#include <alphatest_pars_fragment>
3408#include <alphahash_pars_fragment>
3409#include <aomap_pars_fragment>
3410#include <lightmap_pars_fragment>
3411#include <envmap_common_pars_fragment>
3412#include <envmap_pars_fragment>
3413#include <fog_pars_fragment>
3414#include <specularmap_pars_fragment>
3415#include <logdepthbuf_pars_fragment>
3416#include <clipping_planes_pars_fragment>
3417void main() {
3418 vec4 diffuseColor = vec4( diffuse, opacity );
3419 #include <clipping_planes_fragment>
3420 #include <logdepthbuf_fragment>
3421 #include <map_fragment>
3422 #include <color_fragment>
3423 #include <alphamap_fragment>
3424 #include <alphatest_fragment>
3425 #include <alphahash_fragment>
3426 #include <specularmap_fragment>
3427 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3428 #ifdef USE_LIGHTMAP
3429 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
3430 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
3431 #else
3432 reflectedLight.indirectDiffuse += vec3( 1.0 );
3433 #endif
3434 #include <aomap_fragment>
3435 reflectedLight.indirectDiffuse *= diffuseColor.rgb;
3436 vec3 outgoingLight = reflectedLight.indirectDiffuse;
3437 #include <envmap_fragment>
3438 #include <opaque_fragment>
3439 #include <tonemapping_fragment>
3440 #include <colorspace_fragment>
3441 #include <fog_fragment>
3442 #include <premultiplied_alpha_fragment>
3443 #include <dithering_fragment>
3444}`,Cx=`#define LAMBERT
3445varying vec3 vViewPosition;
3446#include <common>
3447#include <batching_pars_vertex>
3448#include <uv_pars_vertex>
3449#include <displacementmap_pars_vertex>
3450#include <envmap_pars_vertex>
3451#include <color_pars_vertex>
3452#include <fog_pars_vertex>
3453#include <normal_pars_vertex>
3454#include <morphtarget_pars_vertex>
3455#include <skinning_pars_vertex>
3456#include <shadowmap_pars_vertex>
3457#include <logdepthbuf_pars_vertex>
3458#include <clipping_planes_pars_vertex>
3459void main() {
3460 #include <uv_vertex>
3461 #include <color_vertex>
3462 #include <morphinstance_vertex>
3463 #include <morphcolor_vertex>
3464 #include <batching_vertex>
3465 #include <beginnormal_vertex>
3466 #include <morphnormal_vertex>
3467 #include <skinbase_vertex>
3468 #include <skinnormal_vertex>
3469 #include <defaultnormal_vertex>
3470 #include <normal_vertex>
3471 #include <begin_vertex>
3472 #include <morphtarget_vertex>
3473 #include <skinning_vertex>
3474 #include <displacementmap_vertex>
3475 #include <project_vertex>
3476 #include <logdepthbuf_vertex>
3477 #include <clipping_planes_vertex>
3478 vViewPosition = - mvPosition.xyz;
3479 #include <worldpos_vertex>
3480 #include <envmap_vertex>
3481 #include <shadowmap_vertex>
3482 #include <fog_vertex>
3483}`,Rx=`#define LAMBERT
3484uniform vec3 diffuse;
3485uniform vec3 emissive;
3486uniform float opacity;
3487#include <common>
3488#include <dithering_pars_fragment>
3489#include <color_pars_fragment>
3490#include <uv_pars_fragment>
3491#include <map_pars_fragment>
3492#include <alphamap_pars_fragment>
3493#include <alphatest_pars_fragment>
3494#include <alphahash_pars_fragment>
3495#include <aomap_pars_fragment>
3496#include <lightmap_pars_fragment>
3497#include <emissivemap_pars_fragment>
3498#include <cube_uv_reflection_fragment>
3499#include <envmap_common_pars_fragment>
3500#include <envmap_pars_fragment>
3501#include <envmap_physical_pars_fragment>
3502#include <fog_pars_fragment>
3503#include <bsdfs>
3504#include <lights_pars_begin>
3505#include <normal_pars_fragment>
3506#include <lights_lambert_pars_fragment>
3507#include <shadowmap_pars_fragment>
3508#include <bumpmap_pars_fragment>
3509#include <normalmap_pars_fragment>
3510#include <specularmap_pars_fragment>
3511#include <logdepthbuf_pars_fragment>
3512#include <clipping_planes_pars_fragment>
3513void main() {
3514 vec4 diffuseColor = vec4( diffuse, opacity );
3515 #include <clipping_planes_fragment>
3516 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3517 vec3 totalEmissiveRadiance = emissive;
3518 #include <logdepthbuf_fragment>
3519 #include <map_fragment>
3520 #include <color_fragment>
3521 #include <alphamap_fragment>
3522 #include <alphatest_fragment>
3523 #include <alphahash_fragment>
3524 #include <specularmap_fragment>
3525 #include <normal_fragment_begin>
3526 #include <normal_fragment_maps>
3527 #include <emissivemap_fragment>
3528 #include <lights_lambert_fragment>
3529 #include <lights_fragment_begin>
3530 #include <lights_fragment_maps>
3531 #include <lights_fragment_end>
3532 #include <aomap_fragment>
3533 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3534 #include <envmap_fragment>
3535 #include <opaque_fragment>
3536 #include <tonemapping_fragment>
3537 #include <colorspace_fragment>
3538 #include <fog_fragment>
3539 #include <premultiplied_alpha_fragment>
3540 #include <dithering_fragment>
3541}`,Ix=`#define MATCAP
3542varying vec3 vViewPosition;
3543#include <common>
3544#include <batching_pars_vertex>
3545#include <uv_pars_vertex>
3546#include <color_pars_vertex>
3547#include <displacementmap_pars_vertex>
3548#include <fog_pars_vertex>
3549#include <normal_pars_vertex>
3550#include <morphtarget_pars_vertex>
3551#include <skinning_pars_vertex>
3552#include <logdepthbuf_pars_vertex>
3553#include <clipping_planes_pars_vertex>
3554void main() {
3555 #include <uv_vertex>
3556 #include <color_vertex>
3557 #include <morphinstance_vertex>
3558 #include <morphcolor_vertex>
3559 #include <batching_vertex>
3560 #include <beginnormal_vertex>
3561 #include <morphnormal_vertex>
3562 #include <skinbase_vertex>
3563 #include <skinnormal_vertex>
3564 #include <defaultnormal_vertex>
3565 #include <normal_vertex>
3566 #include <begin_vertex>
3567 #include <morphtarget_vertex>
3568 #include <skinning_vertex>
3569 #include <displacementmap_vertex>
3570 #include <project_vertex>
3571 #include <logdepthbuf_vertex>
3572 #include <clipping_planes_vertex>
3573 #include <fog_vertex>
3574 vViewPosition = - mvPosition.xyz;
3575}`,Px=`#define MATCAP
3576uniform vec3 diffuse;
3577uniform float opacity;
3578uniform sampler2D matcap;
3579varying vec3 vViewPosition;
3580#include <common>
3581#include <dithering_pars_fragment>
3582#include <color_pars_fragment>
3583#include <uv_pars_fragment>
3584#include <map_pars_fragment>
3585#include <alphamap_pars_fragment>
3586#include <alphatest_pars_fragment>
3587#include <alphahash_pars_fragment>
3588#include <fog_pars_fragment>
3589#include <normal_pars_fragment>
3590#include <bumpmap_pars_fragment>
3591#include <normalmap_pars_fragment>
3592#include <logdepthbuf_pars_fragment>
3593#include <clipping_planes_pars_fragment>
3594void main() {
3595 vec4 diffuseColor = vec4( diffuse, opacity );
3596 #include <clipping_planes_fragment>
3597 #include <logdepthbuf_fragment>
3598 #include <map_fragment>
3599 #include <color_fragment>
3600 #include <alphamap_fragment>
3601 #include <alphatest_fragment>
3602 #include <alphahash_fragment>
3603 #include <normal_fragment_begin>
3604 #include <normal_fragment_maps>
3605 vec3 viewDir = normalize( vViewPosition );
3606 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3607 vec3 y = cross( viewDir, x );
3608 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3609 #ifdef USE_MATCAP
3610 vec4 matcapColor = texture2D( matcap, uv );
3611 #else
3612 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3613 #endif
3614 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3615 #include <opaque_fragment>
3616 #include <tonemapping_fragment>
3617 #include <colorspace_fragment>
3618 #include <fog_fragment>
3619 #include <premultiplied_alpha_fragment>
3620 #include <dithering_fragment>
3621}`,Lx=`#define NORMAL
3622#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3623 varying vec3 vViewPosition;
3624#endif
3625#include <common>
3626#include <batching_pars_vertex>
3627#include <uv_pars_vertex>
3628#include <displacementmap_pars_vertex>
3629#include <normal_pars_vertex>
3630#include <morphtarget_pars_vertex>
3631#include <skinning_pars_vertex>
3632#include <logdepthbuf_pars_vertex>
3633#include <clipping_planes_pars_vertex>
3634void main() {
3635 #include <uv_vertex>
3636 #include <batching_vertex>
3637 #include <beginnormal_vertex>
3638 #include <morphinstance_vertex>
3639 #include <morphnormal_vertex>
3640 #include <skinbase_vertex>
3641 #include <skinnormal_vertex>
3642 #include <defaultnormal_vertex>
3643 #include <normal_vertex>
3644 #include <begin_vertex>
3645 #include <morphtarget_vertex>
3646 #include <skinning_vertex>
3647 #include <displacementmap_vertex>
3648 #include <project_vertex>
3649 #include <logdepthbuf_vertex>
3650 #include <clipping_planes_vertex>
3651#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3652 vViewPosition = - mvPosition.xyz;
3653#endif
3654}`,Dx=`#define NORMAL
3655uniform float opacity;
3656#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3657 varying vec3 vViewPosition;
3658#endif
3659#include <uv_pars_fragment>
3660#include <normal_pars_fragment>
3661#include <bumpmap_pars_fragment>
3662#include <normalmap_pars_fragment>
3663#include <logdepthbuf_pars_fragment>
3664#include <clipping_planes_pars_fragment>
3665void main() {
3666 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3667 #include <clipping_planes_fragment>
3668 #include <logdepthbuf_fragment>
3669 #include <normal_fragment_begin>
3670 #include <normal_fragment_maps>
3671 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3672 #ifdef OPAQUE
3673 gl_FragColor.a = 1.0;
3674 #endif
3675}`,Nx=`#define PHONG
3676varying vec3 vViewPosition;
3677#include <common>
3678#include <batching_pars_vertex>
3679#include <uv_pars_vertex>
3680#include <displacementmap_pars_vertex>
3681#include <envmap_pars_vertex>
3682#include <color_pars_vertex>
3683#include <fog_pars_vertex>
3684#include <normal_pars_vertex>
3685#include <morphtarget_pars_vertex>
3686#include <skinning_pars_vertex>
3687#include <shadowmap_pars_vertex>
3688#include <logdepthbuf_pars_vertex>
3689#include <clipping_planes_pars_vertex>
3690void main() {
3691 #include <uv_vertex>
3692 #include <color_vertex>
3693 #include <morphcolor_vertex>
3694 #include <batching_vertex>
3695 #include <beginnormal_vertex>
3696 #include <morphinstance_vertex>
3697 #include <morphnormal_vertex>
3698 #include <skinbase_vertex>
3699 #include <skinnormal_vertex>
3700 #include <defaultnormal_vertex>
3701 #include <normal_vertex>
3702 #include <begin_vertex>
3703 #include <morphtarget_vertex>
3704 #include <skinning_vertex>
3705 #include <displacementmap_vertex>
3706 #include <project_vertex>
3707 #include <logdepthbuf_vertex>
3708 #include <clipping_planes_vertex>
3709 vViewPosition = - mvPosition.xyz;
3710 #include <worldpos_vertex>
3711 #include <envmap_vertex>
3712 #include <shadowmap_vertex>
3713 #include <fog_vertex>
3714}`,Ux=`#define PHONG
3715uniform vec3 diffuse;
3716uniform vec3 emissive;
3717uniform vec3 specular;
3718uniform float shininess;
3719uniform float opacity;
3720#include <common>
3721#include <dithering_pars_fragment>
3722#include <color_pars_fragment>
3723#include <uv_pars_fragment>
3724#include <map_pars_fragment>
3725#include <alphamap_pars_fragment>
3726#include <alphatest_pars_fragment>
3727#include <alphahash_pars_fragment>
3728#include <aomap_pars_fragment>
3729#include <lightmap_pars_fragment>
3730#include <emissivemap_pars_fragment>
3731#include <cube_uv_reflection_fragment>
3732#include <envmap_common_pars_fragment>
3733#include <envmap_pars_fragment>
3734#include <envmap_physical_pars_fragment>
3735#include <fog_pars_fragment>
3736#include <bsdfs>
3737#include <lights_pars_begin>
3738#include <normal_pars_fragment>
3739#include <lights_phong_pars_fragment>
3740#include <shadowmap_pars_fragment>
3741#include <bumpmap_pars_fragment>
3742#include <normalmap_pars_fragment>
3743#include <specularmap_pars_fragment>
3744#include <logdepthbuf_pars_fragment>
3745#include <clipping_planes_pars_fragment>
3746void main() {
3747 vec4 diffuseColor = vec4( diffuse, opacity );
3748 #include <clipping_planes_fragment>
3749 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3750 vec3 totalEmissiveRadiance = emissive;
3751 #include <logdepthbuf_fragment>
3752 #include <map_fragment>
3753 #include <color_fragment>
3754 #include <alphamap_fragment>
3755 #include <alphatest_fragment>
3756 #include <alphahash_fragment>
3757 #include <specularmap_fragment>
3758 #include <normal_fragment_begin>
3759 #include <normal_fragment_maps>
3760 #include <emissivemap_fragment>
3761 #include <lights_phong_fragment>
3762 #include <lights_fragment_begin>
3763 #include <lights_fragment_maps>
3764 #include <lights_fragment_end>
3765 #include <aomap_fragment>
3766 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3767 #include <envmap_fragment>
3768 #include <opaque_fragment>
3769 #include <tonemapping_fragment>
3770 #include <colorspace_fragment>
3771 #include <fog_fragment>
3772 #include <premultiplied_alpha_fragment>
3773 #include <dithering_fragment>
3774}`,Fx=`#define STANDARD
3775varying vec3 vViewPosition;
3776#ifdef USE_TRANSMISSION
3777 varying vec3 vWorldPosition;
3778#endif
3779#include <common>
3780#include <batching_pars_vertex>
3781#include <uv_pars_vertex>
3782#include <displacementmap_pars_vertex>
3783#include <color_pars_vertex>
3784#include <fog_pars_vertex>
3785#include <normal_pars_vertex>
3786#include <morphtarget_pars_vertex>
3787#include <skinning_pars_vertex>
3788#include <shadowmap_pars_vertex>
3789#include <logdepthbuf_pars_vertex>
3790#include <clipping_planes_pars_vertex>
3791void main() {
3792 #include <uv_vertex>
3793 #include <color_vertex>
3794 #include <morphinstance_vertex>
3795 #include <morphcolor_vertex>
3796 #include <batching_vertex>
3797 #include <beginnormal_vertex>
3798 #include <morphnormal_vertex>
3799 #include <skinbase_vertex>
3800 #include <skinnormal_vertex>
3801 #include <defaultnormal_vertex>
3802 #include <normal_vertex>
3803 #include <begin_vertex>
3804 #include <morphtarget_vertex>
3805 #include <skinning_vertex>
3806 #include <displacementmap_vertex>
3807 #include <project_vertex>
3808 #include <logdepthbuf_vertex>
3809 #include <clipping_planes_vertex>
3810 vViewPosition = - mvPosition.xyz;
3811 #include <worldpos_vertex>
3812 #include <shadowmap_vertex>
3813 #include <fog_vertex>
3814#ifdef USE_TRANSMISSION
3815 vWorldPosition = worldPosition.xyz;
3816#endif
3817}`,Ox=`#define STANDARD
3818#ifdef PHYSICAL
3819 #define IOR
3820 #define USE_SPECULAR
3821#endif
3822uniform vec3 diffuse;
3823uniform vec3 emissive;
3824uniform float roughness;
3825uniform float metalness;
3826uniform float opacity;
3827#ifdef IOR
3828 uniform float ior;
3829#endif
3830#ifdef USE_SPECULAR
3831 uniform float specularIntensity;
3832 uniform vec3 specularColor;
3833 #ifdef USE_SPECULAR_COLORMAP
3834 uniform sampler2D specularColorMap;
3835 #endif
3836 #ifdef USE_SPECULAR_INTENSITYMAP
3837 uniform sampler2D specularIntensityMap;
3838 #endif
3839#endif
3840#ifdef USE_CLEARCOAT
3841 uniform float clearcoat;
3842 uniform float clearcoatRoughness;
3843#endif
3844#ifdef USE_DISPERSION
3845 uniform float dispersion;
3846#endif
3847#ifdef USE_RETROREFLECTION
3848 uniform float retroreflectivity;
3849#endif
3850#ifdef USE_IRIDESCENCE
3851 uniform float iridescence;
3852 uniform float iridescenceIOR;
3853 uniform float iridescenceThicknessMinimum;
3854 uniform float iridescenceThicknessMaximum;
3855#endif
3856#ifdef USE_SHEEN
3857 uniform vec3 sheenColor;
3858 uniform float sheenRoughness;
3859 #ifdef USE_SHEEN_COLORMAP
3860 uniform sampler2D sheenColorMap;
3861 #endif
3862 #ifdef USE_SHEEN_ROUGHNESSMAP
3863 uniform sampler2D sheenRoughnessMap;
3864 #endif
3865#endif
3866#ifdef USE_ANISOTROPY
3867 uniform vec2 anisotropyVector;
3868 #ifdef USE_ANISOTROPYMAP
3869 uniform sampler2D anisotropyMap;
3870 #endif
3871#endif
3872varying vec3 vViewPosition;
3873#include <common>
3874#include <dithering_pars_fragment>
3875#include <color_pars_fragment>
3876#include <uv_pars_fragment>
3877#include <map_pars_fragment>
3878#include <alphamap_pars_fragment>
3879#include <alphatest_pars_fragment>
3880#include <alphahash_pars_fragment>
3881#include <aomap_pars_fragment>
3882#include <lightmap_pars_fragment>
3883#include <emissivemap_pars_fragment>
3884#include <iridescence_fragment>
3885#include <cube_uv_reflection_fragment>
3886#include <envmap_common_pars_fragment>
3887#include <envmap_physical_pars_fragment>
3888#include <fog_pars_fragment>
3889#include <lights_pars_begin>
3890#include <normal_pars_fragment>
3891#include <lights_physical_pars_fragment>
3892#include <transmission_pars_fragment>
3893#include <shadowmap_pars_fragment>
3894#include <bumpmap_pars_fragment>
3895#include <normalmap_pars_fragment>
3896#include <clearcoat_pars_fragment>
3897#include <iridescence_pars_fragment>
3898#include <roughnessmap_pars_fragment>
3899#include <metalnessmap_pars_fragment>
3900#include <logdepthbuf_pars_fragment>
3901#include <clipping_planes_pars_fragment>
3902void main() {
3903 vec4 diffuseColor = vec4( diffuse, opacity );
3904 #include <clipping_planes_fragment>
3905 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3906 vec3 totalEmissiveRadiance = emissive;
3907 #include <logdepthbuf_fragment>
3908 #include <map_fragment>
3909 #include <color_fragment>
3910 #include <alphamap_fragment>
3911 #include <alphatest_fragment>
3912 #include <alphahash_fragment>
3913 #include <roughnessmap_fragment>
3914 #include <metalnessmap_fragment>
3915 #include <normal_fragment_begin>
3916 #include <normal_fragment_maps>
3917 #include <clearcoat_normal_fragment_begin>
3918 #include <clearcoat_normal_fragment_maps>
3919 #include <emissivemap_fragment>
3920 #include <lights_physical_fragment>
3921 #include <lights_fragment_begin>
3922 #include <lights_fragment_maps>
3923 #include <lights_fragment_end>
3924 #include <aomap_fragment>
3925 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3926 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3927 #include <transmission_fragment>
3928 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3929 #ifdef USE_SHEEN
3930
3931 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3932
3933 #endif
3934 #ifdef USE_CLEARCOAT
3935 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3936 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3937 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3938 #endif
3939 #include <opaque_fragment>
3940 #include <tonemapping_fragment>
3941 #include <colorspace_fragment>
3942 #include <fog_fragment>
3943 #include <premultiplied_alpha_fragment>
3944 #include <dithering_fragment>
3945}`,Bx=`#define TOON
3946varying vec3 vViewPosition;
3947#include <common>
3948#include <batching_pars_vertex>
3949#include <uv_pars_vertex>
3950#include <displacementmap_pars_vertex>
3951#include <color_pars_vertex>
3952#include <fog_pars_vertex>
3953#include <normal_pars_vertex>
3954#include <morphtarget_pars_vertex>
3955#include <skinning_pars_vertex>
3956#include <shadowmap_pars_vertex>
3957#include <logdepthbuf_pars_vertex>
3958#include <clipping_planes_pars_vertex>
3959void main() {
3960 #include <uv_vertex>
3961 #include <color_vertex>
3962 #include <morphinstance_vertex>
3963 #include <morphcolor_vertex>
3964 #include <batching_vertex>
3965 #include <beginnormal_vertex>
3966 #include <morphnormal_vertex>
3967 #include <skinbase_vertex>
3968 #include <skinnormal_vertex>
3969 #include <defaultnormal_vertex>
3970 #include <normal_vertex>
3971 #include <begin_vertex>
3972 #include <morphtarget_vertex>
3973 #include <skinning_vertex>
3974 #include <displacementmap_vertex>
3975 #include <project_vertex>
3976 #include <logdepthbuf_vertex>
3977 #include <clipping_planes_vertex>
3978 vViewPosition = - mvPosition.xyz;
3979 #include <worldpos_vertex>
3980 #include <shadowmap_vertex>
3981 #include <fog_vertex>
3982}`,zx=`#define TOON
3983uniform vec3 diffuse;
3984uniform vec3 emissive;
3985uniform float opacity;
3986#include <common>
3987#include <dithering_pars_fragment>
3988#include <color_pars_fragment>
3989#include <uv_pars_fragment>
3990#include <map_pars_fragment>
3991#include <alphamap_pars_fragment>
3992#include <alphatest_pars_fragment>
3993#include <alphahash_pars_fragment>
3994#include <aomap_pars_fragment>
3995#include <lightmap_pars_fragment>
3996#include <emissivemap_pars_fragment>
3997#include <gradientmap_pars_fragment>
3998#include <fog_pars_fragment>
3999#include <bsdfs>
4000#include <lights_pars_begin>
4001#include <normal_pars_fragment>
4002#include <lights_toon_pars_fragment>
4003#include <shadowmap_pars_fragment>
4004#include <bumpmap_pars_fragment>
4005#include <normalmap_pars_fragment>
4006#include <logdepthbuf_pars_fragment>
4007#include <clipping_planes_pars_fragment>
4008void main() {
4009 vec4 diffuseColor = vec4( diffuse, opacity );
4010 #include <clipping_planes_fragment>
4011 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
4012 vec3 totalEmissiveRadiance = emissive;
4013 #include <logdepthbuf_fragment>
4014 #include <map_fragment>
4015 #include <color_fragment>
4016 #include <alphamap_fragment>
4017 #include <alphatest_fragment>
4018 #include <alphahash_fragment>
4019 #include <normal_fragment_begin>
4020 #include <normal_fragment_maps>
4021 #include <emissivemap_fragment>
4022 #include <lights_toon_fragment>
4023 #include <lights_fragment_begin>
4024 #include <lights_fragment_maps>
4025 #include <lights_fragment_end>
4026 #include <aomap_fragment>
4027 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
4028 #include <opaque_fragment>
4029 #include <tonemapping_fragment>
4030 #include <colorspace_fragment>
4031 #include <fog_fragment>
4032 #include <premultiplied_alpha_fragment>
4033 #include <dithering_fragment>
4034}`,kx=`uniform float size;
4035uniform float scale;
4036#include <common>
4037#include <color_pars_vertex>
4038#include <fog_pars_vertex>
4039#include <morphtarget_pars_vertex>
4040#include <logdepthbuf_pars_vertex>
4041#include <clipping_planes_pars_vertex>
4042#ifdef USE_POINTS_UV
4043 varying vec2 vUv;
4044 uniform mat3 uvTransform;
4045#endif
4046void main() {
4047 #ifdef USE_POINTS_UV
4048 vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
4049 #endif
4050 #include <color_vertex>
4051 #include <morphinstance_vertex>
4052 #include <morphcolor_vertex>
4053 #include <begin_vertex>
4054 #include <morphtarget_vertex>
4055 #include <project_vertex>
4056 gl_PointSize = size;
4057 #ifdef USE_SIZEATTENUATION
4058 bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4059 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
4060 #endif
4061 #include <logdepthbuf_vertex>
4062 #include <clipping_planes_vertex>
4063 #include <worldpos_vertex>
4064 #include <fog_vertex>
4065}`,Vx=`uniform vec3 diffuse;
4066uniform float opacity;
4067#include <common>
4068#include <color_pars_fragment>
4069#include <map_particle_pars_fragment>
4070#include <alphatest_pars_fragment>
4071#include <alphahash_pars_fragment>
4072#include <fog_pars_fragment>
4073#include <logdepthbuf_pars_fragment>
4074#include <clipping_planes_pars_fragment>
4075void main() {
4076 vec4 diffuseColor = vec4( diffuse, opacity );
4077 #include <clipping_planes_fragment>
4078 vec3 outgoingLight = vec3( 0.0 );
4079 #include <logdepthbuf_fragment>
4080 #include <map_particle_fragment>
4081 #include <color_fragment>
4082 #include <alphatest_fragment>
4083 #include <alphahash_fragment>
4084 outgoingLight = diffuseColor.rgb;
4085 #include <opaque_fragment>
4086 #include <tonemapping_fragment>
4087 #include <colorspace_fragment>
4088 #include <fog_fragment>
4089 #include <premultiplied_alpha_fragment>
4090}`,Gx=`#include <common>
4091#include <batching_pars_vertex>
4092#include <fog_pars_vertex>
4093#include <morphtarget_pars_vertex>
4094#include <skinning_pars_vertex>
4095#include <logdepthbuf_pars_vertex>
4096#include <shadowmap_pars_vertex>
4097void main() {
4098 #include <batching_vertex>
4099 #include <beginnormal_vertex>
4100 #include <morphinstance_vertex>
4101 #include <morphnormal_vertex>
4102 #include <skinbase_vertex>
4103 #include <skinnormal_vertex>
4104 #include <defaultnormal_vertex>
4105 #include <begin_vertex>
4106 #include <morphtarget_vertex>
4107 #include <skinning_vertex>
4108 #include <project_vertex>
4109 #include <logdepthbuf_vertex>
4110 #include <worldpos_vertex>
4111 #include <shadowmap_vertex>
4112 #include <fog_vertex>
4113}`,Hx=`uniform vec3 color;
4114uniform float opacity;
4115#include <common>
4116#include <fog_pars_fragment>
4117#include <bsdfs>
4118#include <lights_pars_begin>
4119#include <logdepthbuf_pars_fragment>
4120#include <shadowmap_pars_fragment>
4121#include <shadowmask_pars_fragment>
4122void main() {
4123 #include <logdepthbuf_fragment>
4124 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
4125 #include <tonemapping_fragment>
4126 #include <colorspace_fragment>
4127 #include <fog_fragment>
4128 #include <premultiplied_alpha_fragment>
4129}`,Wx=`uniform float rotation;
4130uniform vec2 center;
4131#include <common>
4132#include <uv_pars_vertex>
4133#include <fog_pars_vertex>
4134#include <logdepthbuf_pars_vertex>
4135#include <clipping_planes_pars_vertex>
4136void main() {
4137 #include <uv_vertex>
4138 vec4 mvPosition = modelViewMatrix[ 3 ];
4139 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
4140 #ifndef USE_SIZEATTENUATION
4141 bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4142 if ( isPerspective ) scale *= - mvPosition.z;
4143 #endif
4144 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
4145 vec2 rotatedPosition;
4146 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
4147 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
4148 mvPosition.xy += rotatedPosition;
4149 gl_Position = projectionMatrix * mvPosition;
4150 #include <logdepthbuf_vertex>
4151 #include <clipping_planes_vertex>
4152 #include <fog_vertex>
4153}`,Xx=`uniform vec3 diffuse;
4154uniform float opacity;
4155#include <common>
4156#include <uv_pars_fragment>
4157#include <map_pars_fragment>
4158#include <alphamap_pars_fragment>
4159#include <alphatest_pars_fragment>
4160#include <alphahash_pars_fragment>
4161#include <fog_pars_fragment>
4162#include <logdepthbuf_pars_fragment>
4163#include <clipping_planes_pars_fragment>
4164void main() {
4165 vec4 diffuseColor = vec4( diffuse, opacity );
4166 #include <clipping_planes_fragment>
4167 vec3 outgoingLight = vec3( 0.0 );
4168 #include <logdepthbuf_fragment>
4169 #include <map_fragment>
4170 #include <alphamap_fragment>
4171 #include <alphatest_fragment>
4172 #include <alphahash_fragment>
4173 outgoingLight = diffuseColor.rgb;
4174 #include <opaque_fragment>
4175 #include <tonemapping_fragment>
4176 #include <colorspace_fragment>
4177 #include <fog_fragment>
4178}`,Qe={alphahash_fragment:d0,alphahash_pars_fragment:f0,alphamap_fragment:p0,alphamap_pars_fragment:m0,alphatest_fragment:g0,alphatest_pars_fragment:_0,aomap_fragment:x0,aomap_pars_fragment:v0,batching_pars_vertex:y0,batching_vertex:M0,begin_vertex:S0,beginnormal_vertex:b0,bsdfs:w0,iridescence_fragment:E0,bumpmap_pars_fragment:T0,clipping_planes_fragment:A0,clipping_planes_pars_fragment:C0,clipping_planes_pars_vertex:R0,clipping_planes_vertex:I0,color_fragment:P0,color_pars_fragment:L0,color_pars_vertex:D0,color_vertex:N0,common:U0,cube_uv_reflection_fragment:F0,defaultnormal_vertex:O0,displacementmap_pars_vertex:B0,displacementmap_vertex:z0,emissivemap_fragment:k0,emissivemap_pars_fragment:V0,colorspace_fragment:G0,colorspace_pars_fragment:H0,envmap_fragment:W0,envmap_common_pars_fragment:X0,envmap_pars_fragment:q0,envmap_pars_vertex:Y0,envmap_physical_pars_fragment:s_,envmap_vertex:Z0,fog_vertex:$0,fog_pars_vertex:J0,fog_fragment:K0,fog_pars_fragment:j0,gradientmap_pars_fragment:Q0,lightmap_pars_fragment:e_,lights_lambert_fragment:t_,lights_lambert_pars_fragment:n_,lights_pars_begin:i_,lights_toon_fragment:r_,lights_toon_pars_fragment:o_,lights_phong_fragment:a_,lights_phong_pars_fragment:c_,lights_physical_fragment:l_,lights_physical_pars_fragment:h_,lights_fragment_begin:u_,lights_fragment_maps:d_,lights_fragment_end:f_,lightprobes_pars_fragment:p_,logdepthbuf_fragment:m_,logdepthbuf_pars_fragment:g_,logdepthbuf_pars_vertex:__,logdepthbuf_vertex:x_,map_fragment:v_,map_pars_fragment:y_,map_particle_fragment:M_,map_particle_pars_fragment:S_,metalnessmap_fragment:b_,metalnessmap_pars_fragment:w_,morphinstance_vertex:E_,morphcolor_vertex:T_,morphnormal_vertex:A_,morphtarget_pars_vertex:C_,morphtarget_vertex:R_,normal_fragment_begin:I_,normal_fragment_maps:P_,normal_pars_fragment:L_,normal_pars_vertex:D_,normal_vertex:N_,normalmap_pars_fragment:U_,clearcoat_normal_fragment_begin:F_,clearcoat_normal_fragment_maps:O_,clearcoat_pars_fragment:B_,iridescence_pars_fragment:z_,opaque_fragment:k_,packing:V_,premultiplied_alpha_fragment:G_,project_vertex:H_,dithering_fragment:W_,dithering_pars_fragment:X_,roughnessmap_fragment:q_,roughnessmap_pars_fragment:Y_,shadowmap_pars_fragment:Z_,shadowmap_pars_vertex:$_,shadowmap_vertex:J_,shadowmask_pars_fragment:K_,skinbase_vertex:j_,skinning_pars_vertex:Q_,skinning_vertex:ex,skinnormal_vertex:tx,specularmap_fragment:nx,specularmap_pars_fragment:ix,tonemapping_fragment:sx,tonemapping_pars_fragment:rx,transmission_fragment:ox,transmission_pars_fragment:ax,uv_pars_fragment:cx,uv_pars_vertex:lx,uv_vertex:hx,worldpos_vertex:ux,background_vert:dx,background_frag:fx,backgroundCube_vert:px,backgroundCube_frag:mx,cube_vert:gx,cube_frag:_x,depth_vert:xx,depth_frag:vx,distance_vert:yx,distance_frag:Mx,equirect_vert:Sx,equirect_frag:bx,linedashed_vert:wx,linedashed_frag:Ex,meshbasic_vert:Tx,meshbasic_frag:Ax,meshlambert_vert:Cx,meshlambert_frag:Rx,meshmatcap_vert:Ix,meshmatcap_frag:Px,meshnormal_vert:Lx,meshnormal_frag:Dx,meshphong_vert:Nx,meshphong_frag:Ux,meshphysical_vert:Fx,meshphysical_frag:Ox,meshtoon_vert:Bx,meshtoon_frag:zx,points_vert:kx,points_frag:Vx,shadow_vert:Gx,shadow_frag:Hx,sprite_vert:Wx,sprite_frag:Xx},ve={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ye}},envmap:{envMap:{value:null},envMapRotation:{value:new Ye},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ye}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ye}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ye},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ye},normalScale:{value:new le(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ye},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ye}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ye}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ye}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{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 N},probesMax:{value:new N},probesResolution:{value:new N}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0},uvTransform:{value:new Ye}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new le(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}}},si={basic:{uniforms:tn([ve.common,ve.specularmap,ve.envmap,ve.aomap,ve.lightmap,ve.fog]),vertexShader:Qe.meshbasic_vert,fragmentShader:Qe.meshbasic_frag},lambert:{uniforms:tn([ve.common,ve.specularmap,ve.envmap,ve.aomap,ve.lightmap,ve.emissivemap,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.fog,ve.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:Qe.meshlambert_vert,fragmentShader:Qe.meshlambert_frag},phong:{uniforms:tn([ve.common,ve.specularmap,ve.envmap,ve.aomap,ve.lightmap,ve.emissivemap,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.fog,ve.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphong_vert,fragmentShader:Qe.meshphong_frag},standard:{uniforms:tn([ve.common,ve.envmap,ve.aomap,ve.lightmap,ve.emissivemap,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.roughnessmap,ve.metalnessmap,ve.fog,ve.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag},toon:{uniforms:tn([ve.common,ve.aomap,ve.lightmap,ve.emissivemap,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.gradientmap,ve.fog,ve.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Qe.meshtoon_vert,fragmentShader:Qe.meshtoon_frag},matcap:{uniforms:tn([ve.common,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.fog,{matcap:{value:null}}]),vertexShader:Qe.meshmatcap_vert,fragmentShader:Qe.meshmatcap_frag},points:{uniforms:tn([ve.points,ve.fog]),vertexShader:Qe.points_vert,fragmentShader:Qe.points_frag},dashed:{uniforms:tn([ve.common,ve.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qe.linedashed_vert,fragmentShader:Qe.linedashed_frag},depth:{uniforms:tn([ve.common,ve.displacementmap]),vertexShader:Qe.depth_vert,fragmentShader:Qe.depth_frag},normal:{uniforms:tn([ve.common,ve.bumpmap,ve.normalmap,ve.displacementmap,{opacity:{value:1}}]),vertexShader:Qe.meshnormal_vert,fragmentShader:Qe.meshnormal_frag},sprite:{uniforms:tn([ve.sprite,ve.fog]),vertexShader:Qe.sprite_vert,fragmentShader:Qe.sprite_frag},background:{uniforms:{uvTransform:{value:new Ye},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qe.background_vert,fragmentShader:Qe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ye}},vertexShader:Qe.backgroundCube_vert,fragmentShader:Qe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qe.cube_vert,fragmentShader:Qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe.equirect_vert,fragmentShader:Qe.equirect_frag},distance:{uniforms:tn([ve.common,ve.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qe.distance_vert,fragmentShader:Qe.distance_frag},shadow:{uniforms:tn([ve.lights,ve.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Qe.shadow_vert,fragmentShader:Qe.shadow_frag}};si.physical={uniforms:tn([si.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ye},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ye},clearcoatNormalScale:{value:new le(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ye},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ye},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ye},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ye},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ye},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ye},transmissionSamplerSize:{value:new le},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ye},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ye},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ye},anisotropyVector:{value:new le},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ye}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag};var il={r:0,b:0,g:0},qx=new ht,tp=new Ye;tp.set(-1,0,0,0,1,0,0,0,1);function Yx(n,e,t,i,s,r){let o=new Xe(0),a=s===!0?0:1,c,l,h=null,f=0,u=null;function d(S){let T=S.isScene===!0?S.background:null;if(T&&T.isTexture){let y=S.backgroundBlurriness>0;T=e.get(T,y)}return T}function m(S){let T=!1,y=d(S);y===null?g(o,a):y&&y.isColor&&(g(y,1),T=!0);let w=n.xr.getEnvironmentBlendMode();w==="additive"?t.buffers.color.setClear(0,0,0,1,r):w==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(n.autoClear||T)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function v(S,T){let y=d(T);y&&(y.isCubeTexture||y.mapping===ho)?(l===void 0&&(l=new Rt(new Bn(1,1,1),new yn({name:"BackgroundCubeMaterial",uniforms:fs(si.backgroundCube.uniforms),vertexShader:si.backgroundCube.vertexShader,fragmentShader:si.backgroundCube.fragmentShader,side:$t,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,b,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=y,l.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(qx.makeRotationFromEuler(T.backgroundRotation)).transpose(),y.isCubeTexture&&y.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(tp),l.material.toneMapped=ot.getTransfer(y.colorSpace)!==pt,(h!==y||f!==y.version||u!==n.toneMapping)&&(l.material.needsUpdate=!0,h=y,f=y.version,u=n.toneMapping),l.layers.enableAll(),S.unshift(l,l.geometry,l.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new Rt(new vn(2,2),new yn({name:"BackgroundMaterial",uniforms:fs(si.background.uniforms),vertexShader:si.background.vertexShader,fragmentShader:si.background.fragmentShader,side:Tn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=ot.getTransfer(y.colorSpace)!==pt,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||f!==y.version||u!==n.toneMapping)&&(c.material.needsUpdate=!0,h=y,f=y.version,u=n.toneMapping),c.layers.enableAll(),S.unshift(c,c.geometry,c.material,0,0,null))}function g(S,T){S.getRGB(il,Xh(n)),t.buffers.color.setClear(il.r,il.g,il.b,T,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 o},setClearColor:function(S,T=1){o.set(S),a=T,g(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(S){a=S,g(o,a)},render:m,addToRenderList:v,dispose:p}}function Zx(n,e){let t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},s=u(null),r=s,o=!1;function a(D,O,V,R,P){let k=!1,X=f(D,R,V,O);r!==X&&(r=X,l(r.object)),k=d(D,R,V,P),k&&m(D,R,V,P),P!==null&&e.update(P,n.ELEMENT_ARRAY_BUFFER),(k||o)&&(o=!1,y(D,O,V,R),P!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(P).buffer))}function c(){return n.createVertexArray()}function l(D){return n.bindVertexArray(D)}function h(D){return n.deleteVertexArray(D)}function f(D,O,V,R){let P=R.wireframe===!0,k=i[O.id];k===void 0&&(k={},i[O.id]=k);let X=D.isInstancedMesh===!0?D.id:0,te=k[X];te===void 0&&(te={},k[X]=te);let q=te[V.id];q===void 0&&(q={},te[V.id]=q);let Z=q[P];return Z===void 0&&(Z=u(c()),q[P]=Z),Z}function u(D){let O=[],V=[],R=[];for(let P=0;P<t;P++)O[P]=0,V[P]=0,R[P]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:V,attributeDivisors:R,object:D,attributes:{},index:null}}function d(D,O,V,R){let P=r.attributes,k=O.attributes,X=0,te=V.getAttributes();for(let q in te)if(te[q].location>=0){let j=P[q],Re=k[q];if(Re===void 0&&(q==="instanceMatrix"&&D.instanceMatrix&&(Re=D.instanceMatrix),q==="instanceColor"&&D.instanceColor&&(Re=D.instanceColor)),j===void 0||j.attribute!==Re||Re&&j.data!==Re.data)return!0;X++}return r.attributesNum!==X||r.index!==R}function m(D,O,V,R){let P={},k=O.attributes,X=0,te=V.getAttributes();for(let q in te)if(te[q].location>=0){let j=k[q];j===void 0&&(q==="instanceMatrix"&&D.instanceMatrix&&(j=D.instanceMatrix),q==="instanceColor"&&D.instanceColor&&(j=D.instanceColor));let Re={};Re.attribute=j,j&&j.data&&(Re.data=j.data),P[q]=Re,X++}r.attributes=P,r.attributesNum=X,r.index=R}function v(){let D=r.newAttributes;for(let O=0,V=D.length;O<V;O++)D[O]=0}function g(D){p(D,0)}function p(D,O){let V=r.newAttributes,R=r.enabledAttributes,P=r.attributeDivisors;V[D]=1,R[D]===0&&(n.enableVertexAttribArray(D),R[D]=1),P[D]!==O&&(n.vertexAttribDivisor(D,O),P[D]=O)}function S(){let D=r.newAttributes,O=r.enabledAttributes;for(let V=0,R=O.length;V<R;V++)O[V]!==D[V]&&(n.disableVertexAttribArray(V),O[V]=0)}function T(D,O,V,R,P,k,X){X===!0?n.vertexAttribIPointer(D,O,V,P,k):n.vertexAttribPointer(D,O,V,R,P,k)}function y(D,O,V,R){v();let P=R.attributes,k=V.getAttributes(),X=O.defaultAttributeValues;for(let te in k){let q=k[te];if(q.location>=0){let Z=P[te];if(Z===void 0&&(te==="instanceMatrix"&&D.instanceMatrix&&(Z=D.instanceMatrix),te==="instanceColor"&&D.instanceColor&&(Z=D.instanceColor)),Z!==void 0){let j=Z.normalized,Re=Z.itemSize,be=e.get(Z);if(be===void 0)continue;let Ke=be.buffer,Ze=be.type,et=be.bytesPerElement,J=Ze===n.INT||Ze===n.UNSIGNED_INT||Z.gpuType===gc;if(Z.isInterleavedBufferAttribute){let ne=Z.data,ye=ne.stride,Ve=Z.offset;if(ne.isInstancedInterleavedBuffer){for(let Ee=0;Ee<q.locationSize;Ee++)p(q.location+Ee,ne.meshPerAttribute);D.isInstancedMesh!==!0&&R._maxInstanceCount===void 0&&(R._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Ee=0;Ee<q.locationSize;Ee++)g(q.location+Ee);n.bindBuffer(n.ARRAY_BUFFER,Ke);for(let Ee=0;Ee<q.locationSize;Ee++)T(q.location+Ee,Re/q.locationSize,Ze,j,ye*et,(Ve+Re/q.locationSize*Ee)*et,J)}else{if(Z.isInstancedBufferAttribute){for(let ne=0;ne<q.locationSize;ne++)p(q.location+ne,Z.meshPerAttribute);D.isInstancedMesh!==!0&&R._maxInstanceCount===void 0&&(R._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let ne=0;ne<q.locationSize;ne++)g(q.location+ne);n.bindBuffer(n.ARRAY_BUFFER,Ke);for(let ne=0;ne<q.locationSize;ne++)T(q.location+ne,Re/q.locationSize,Ze,j,Re*et,Re/q.locationSize*ne*et,J)}}else if(X!==void 0){let j=X[te];if(j!==void 0)switch(j.length){case 2:n.vertexAttrib2fv(q.location,j);break;case 3:n.vertexAttrib3fv(q.location,j);break;case 4:n.vertexAttrib4fv(q.location,j);break;default:n.vertexAttrib1fv(q.location,j)}}}}S()}function w(){E();for(let D in i){let O=i[D];for(let V in O){let R=O[V];for(let P in R){let k=R[P];for(let X in k)h(k[X].object),delete k[X];delete R[P]}}delete i[D]}}function b(D){if(i[D.id]===void 0)return;let O=i[D.id];for(let V in O){let R=O[V];for(let P in R){let k=R[P];for(let X in k)h(k[X].object),delete k[X];delete R[P]}}delete i[D.id]}function C(D){for(let O in i){let V=i[O];for(let R in V){let P=V[R];if(P[D.id]===void 0)continue;let k=P[D.id];for(let X in k)h(k[X].object),delete k[X];delete P[D.id]}}}function x(D){for(let O in i){let V=i[O],R=D.isInstancedMesh===!0?D.id:0,P=V[R];if(P!==void 0){for(let k in P){let X=P[k];for(let te in X)h(X[te].object),delete X[te];delete P[k]}delete V[R],Object.keys(V).length===0&&delete i[O]}}}function E(){I(),o=!0,r!==s&&(r=s,l(r.object))}function I(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:E,resetDefaultState:I,dispose:w,releaseStatesOfGeometry:b,releaseStatesOfObject:x,releaseStatesOfProgram:C,initAttributes:v,enableAttribute:g,disableUnusedAttributes:S}}function $x(n,e,t){let i;function s(c){i=c}function r(c,l){n.drawArrays(i,c,l),t.update(l,i,1)}function o(c,l,h){h!==0&&(n.drawArraysInstanced(i,c,l,h),t.update(l,i,h))}function a(c,l,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,l,0,h);let u=0;for(let d=0;d<h;d++)u+=l[d];t.update(u,i,1)}this.setMode=s,this.render=r,this.renderInstances=o,this.renderMultiDraw=a}function Jx(n,e,t,i){let s;function r(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){let C=e.get("EXT_texture_filter_anisotropic");s=n.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function o(C){return!(C!==Rn&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(C){let x=C===Vn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==fn&&C!==Cn&&!x&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE))}function c(C){if(C==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp",h=c(l);h!==l&&(Be("WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);let f=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&Be("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let d=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),p=n.getParameter(n.MAX_VERTEX_ATTRIBS),S=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),T=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=n.getParameter(n.MAX_SAMPLES),b=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:f,reversedDepthBuffer:u,maxTextures:d,maxVertexTextures:m,maxTextureSize:v,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:S,maxVaryings:T,maxFragmentUniforms:y,maxSamples:w,samples:b}}function Kx(n){let e=this,t=null,i=0,s=!1,r=!1,o=new Fn,a=new Ye,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,u){let d=f.length!==0||u||i!==0||s;return s=u,i=f.length,d},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(f,u){t=h(f,u,0)},this.setState=function(f,u,d){let m=f.clippingPlanes,v=f.clipIntersection,g=f.clipShadows,p=n.get(f);if(!s||m===null||m.length===0||r&&!g)r?h(null):l();else{let S=r?0:i,T=S*4,y=p.clippingState||null;c.value=y,y=h(m,u,T,d);for(let w=0;w!==T;++w)y[w]=t[w];p.clippingState=y,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=S}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(f,u,d,m){let v=f!==null?f.length:0,g=null;if(v!==0){if(g=c.value,m!==!0||g===null){let p=d+v*4,S=u.matrixWorldInverse;a.getNormalMatrix(S),(g===null||g.length<p)&&(g=new Float32Array(p));for(let T=0,y=d;T!==v;++T,y+=4)o.copy(f[T]).applyMatrix4(S,a),o.normal.toArray(g,y),g[y+3]=o.constant}c.value=g,c.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,g}}var rr=4,jx=6,Qx=20,ev=256,vo=new Ks,Df=new Xe,eu=null,tu=0,nu=0,iu=!1,tv=new N,ps=new N,ar=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,s=100,r={}){let{size:o=256,position:a=tv}=r;eu=this._renderer.getRenderTarget(),tu=this._renderer.getActiveCubeFace(),nu=this._renderer.getActiveMipmapLevel(),iu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,i,s,c,a),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=Ff(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Uf(),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(eu,tu,nu),this._renderer.xr.enabled=iu,e.scissorTest=!1,sr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Gi||e.mapping===ds?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),eu=this._renderer.getRenderTarget(),tu=this._renderer.getActiveCubeFace(),nu=this._renderer.getActiveMipmapLevel(),iu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Yt,minFilter:Yt,generateMipmaps:!1,type:Vn,format:Rn,colorSpace:Ur,depthBuffer:!1},s=Nf(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Nf(e,t,i);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=nv(r)),this._blurMaterial=sv(r,e,t),this._ggxMaterial=iv(r,e,t)}return s}_compileMaterial(e){let t=new Rt(new Ot,e);this._renderer.compile(t,vo)}_sceneToCubeUV(e,t,i,s,r){let c=new en(90,1,t,i),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],f=this._renderer,u=f.autoClear,d=f.toneMapping;f.getClearColor(Df),f.toneMapping=zn,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(s),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Rt(new Bn,new Ni({name:"PMREM.Background",side:$t,depthWrite:!1,depthTest:!1})));let v=this._backgroundBox,g=v.material,p=!1,S=e.background;S?S.isColor&&(g.color.copy(S),e.background=null,p=!0):(g.color.copy(Df),p=!0);for(let T=0;T<6;T++){let y=T%3;y===0?(c.up.set(0,l[T],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+h[T],r.y,r.z)):y===1?(c.up.set(0,0,l[T]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+h[T],r.z)):(c.up.set(0,l[T],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+h[T]));let w=this._cubeSize;sr(s,y*w,T>2?w:0,w,w),f.setRenderTarget(s),p&&f.render(v,c),f.render(e,c)}f.toneMapping=d,f.autoClear=u,e.background=S}_textureToCubeUV(e,t){let i=this._renderer,s=e.mapping===Gi||e.mapping===ds;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ff()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Uf());let r=s?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=r;let a=r.uniforms;a.envMap.value=e;let c=this._cubeSize;sr(t,0,0,3*c,2*c),i.setRenderTarget(t),i.render(o,vo)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;r<s;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=i}_applyGGXFilter(e,t,i){let s=this._renderer,r=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[i];a.material=o;let c=o.uniforms,l=i/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),f=Math.sqrt(l*l-h*h),u=l*1.25,d=f*u,{_lodMax:m}=this,v=this._sizeLods[i],g=3*v*(i>m-rr?i-m+rr:0),p=4*(this._cubeSize-v);c.envMap.value=e.texture,c.roughness.value=d,c.mipInt.value=m-t,sr(r,g,p,3*v,2*v),s.setRenderTarget(r),s.render(a,vo),c.envMap.value=r.texture,c.roughness.value=0,c.mipInt.value=m-i,sr(e,g,p,3*v,2*v),s.setRenderTarget(e),s.render(a,vo)}_blur(e,t,i,s){let r=this._pingPongRenderTarget,o=Math.min(s,Math.PI)/Math.SQRT2;this._blurPass(e,r,t,i,o),this._blurPass(r,e,i,i,o)}_blurPass(e,t,i,s,r){let o=this._renderer,a=this._blurMaterial,c=this._lodMeshes[s];c.material=a;let l=a.uniforms;l.envMap.value=e.texture,l.sigma.value=r,l.mipInt.value=this._lodMax-i;let h=this._sizeLods[s],f=3*h*(s>this._lodMax-rr?s-this._lodMax+rr:0),u=4*(this._cubeSize-h);sr(t,f,u,3*h,2*h),o.setRenderTarget(t),o.render(c,vo)}};function nv(n){let e=[],t=[],i=n,s=n-rr+1+jx;for(let r=0;r<s;r++){let o=Math.pow(2,i);e.push(o);let a=1/(o-2),c=-a,l=1+a,h=[c,c,l,c,l,l,c,c,l,l,c,l],f=6,u=6,d=3,m=new Float32Array(d*u*f),v=new Float32Array(d*u*f);for(let p=0;p<f;p++){let S=p%3*2/3-1,T=p>2?0:-1,y=[S,T,0,S+2/3,T,0,S+2/3,T+1,0,S,T,0,S+2/3,T+1,0,S,T+1,0];m.set(y,d*u*p);for(let w=0;w<u;w++){let b=h[w*2]*2-1,C=h[w*2+1]*2-1;p===0?ps.set(1,C,b):p===1?ps.set(-b,1,-C):p===2?ps.set(-b,C,1):p===3?ps.set(-1,C,-b):p===4?ps.set(-b,-1,C):ps.set(b,C,-1),ps.toArray(v,(p*u+w)*d)}}let g=new Ot;g.setAttribute("position",new Ft(m,d)),g.setAttribute("outputDirection",new Ft(v,d)),t.push(new Rt(g,null)),i>rr&&i--}return{lodMeshes:t,sizeLods:e}}function Nf(n,e,t){let i=new dn(n,e,t);return i.texture.mapping=ho,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function sr(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function iv(n,e,t){return new yn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:ev,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:al(),fragmentShader:`
4179
4180 precision highp float;
4181 precision highp int;
4182
4183 varying vec3 vOutputDirection;
4184
4185 uniform sampler2D envMap;
4186 uniform float roughness;
4187 uniform float mipInt;
4188
4189 #define ENVMAP_TYPE_CUBE_UV
4190 #include <cube_uv_reflection_fragment>
4191
4192 #define PI 3.14159265359
4193
4194 // Van der Corput radical inverse
4195 float radicalInverse_VdC(uint bits) {
4196 bits = (bits << 16u) | (bits >> 16u);
4197 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
4198 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
4199 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
4200 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
4201 return float(bits) * 2.3283064365386963e-10; // / 0x100000000
4202 }
4203
4204 // Hammersley sequence
4205 vec2 hammersley(uint i, uint N) {
4206 return vec2(float(i) / float(N), radicalInverse_VdC(i));
4207 }
4208
4209 // GGX VNDF importance sampling (Eric Heitz 2018)
4210 // "Sampling the GGX Distribution of Visible Normals"
4211 // https://jcgt.org/published/0007/04/01/
4212 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
4213 float alpha = roughness * roughness;
4214
4215 // Section 4.1: Orthonormal basis
4216 vec3 T1 = vec3(1.0, 0.0, 0.0);
4217 vec3 T2 = cross(V, T1);
4218
4219 // Section 4.2: Parameterization of projected area
4220 float r = sqrt(Xi.x);
4221 float phi = 2.0 * PI * Xi.y;
4222 float t1 = r * cos(phi);
4223 float t2 = r * sin(phi);
4224 float s = 0.5 * (1.0 + V.z);
4225 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
4226
4227 // Section 4.3: Reprojection onto hemisphere
4228 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
4229
4230 // Section 3.4: Transform back to ellipsoid configuration
4231 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
4232 }
4233
4234 void main() {
4235 vec3 N = normalize(vOutputDirection);
4236 vec3 V = N; // Assume view direction equals normal for pre-filtering
4237
4238 vec3 prefilteredColor = vec3(0.0);
4239 float totalWeight = 0.0;
4240
4241 // For very low roughness, just sample the environment directly
4242 if (roughness < 0.001) {
4243 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
4244 return;
4245 }
4246
4247 // Tangent space basis for VNDF sampling
4248 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
4249 vec3 tangent = normalize(cross(up, N));
4250 vec3 bitangent = cross(N, tangent);
4251
4252 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
4253 vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
4254
4255 // For PMREM, V = N, so in tangent space V is always (0, 0, 1)
4256 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
4257
4258 // Transform H back to world space
4259 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
4260 vec3 L = normalize(2.0 * dot(V, H) * H - V);
4261
4262 float NdotL = max(dot(N, L), 0.0);
4263
4264 if(NdotL > 0.0) {
4265 // Sample environment at fixed mip level
4266 // VNDF importance sampling handles the distribution filtering
4267 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
4268
4269 // Weight by NdotL for the split-sum approximation
4270 // VNDF PDF naturally accounts for the visible microfacet distribution
4271 prefilteredColor += sampleColor * NdotL;
4272 totalWeight += NdotL;
4273 }
4274 }
4275
4276 if (totalWeight > 0.0) {
4277 prefilteredColor = prefilteredColor / totalWeight;
4278 }
4279
4280 gl_FragColor = vec4(prefilteredColor, 1.0);
4281 }
4282 `,blending:ni,depthTest:!1,depthWrite:!1})}function sv(n,e,t){return new yn({name:"SphericalGaussianBlur",defines:{SAMPLES:Qx,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:al(),fragmentShader:`
4283
4284 precision highp float;
4285 precision highp int;
4286
4287 varying vec3 vOutputDirection;
4288
4289 uniform sampler2D envMap;
4290 uniform float sigma;
4291 uniform float mipInt;
4292
4293 #define ENVMAP_TYPE_CUBE_UV
4294 #include <cube_uv_reflection_fragment>
4295
4296 #define PI 3.14159265359
4297 #define GOLDEN_ANGLE 2.39996322973
4298
4299 void main() {
4300
4301 if ( sigma == 0.0 ) {
4302
4303 gl_FragColor = vec4( bilinearCubeUV( envMap, vOutputDirection, mipInt ), 1.0 );
4304 return;
4305
4306 }
4307
4308 vec3 outputDirection = normalize( vOutputDirection );
4309
4310 vec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );
4311 vec3 tangent = normalize( cross( up, outputDirection ) );
4312 vec3 bitangent = cross( outputDirection, tangent );
4313
4314 // Truncate the kernel at three standard deviations or at the antipode.
4315 float thetaMax = min( 3.0 * sigma, PI );
4316 float truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) );
4317
4318 vec3 accumColor = vec3( 0.0 );
4319 float accumWeight = 0.0;
4320
4321 for ( int i = 0; i < SAMPLES; i ++ ) {
4322
4323 // Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral.
4324 float stratum = ( float( i ) + 0.5 ) / float( SAMPLES );
4325 float theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) );
4326 float phi = float( i ) * GOLDEN_ANGLE;
4327
4328 vec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent;
4329 vec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset;
4330
4331 // Correct the planar sample density to solid angle.
4332 float weight = sin( theta ) / theta;
4333
4334 accumColor += weight * bilinearCubeUV( envMap, sampleDirection, mipInt );
4335 accumWeight += weight;
4336
4337 }
4338
4339 gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
4340
4341 }
4342 `,blending:ni,depthTest:!1,depthWrite:!1})}function Uf(){return new yn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:al(),fragmentShader:`
4343
4344 precision mediump float;
4345 precision mediump int;
4346
4347 varying vec3 vOutputDirection;
4348
4349 uniform sampler2D envMap;
4350
4351 #include <common>
4352
4353 void main() {
4354
4355 vec3 outputDirection = normalize( vOutputDirection );
4356 vec2 uv = equirectUv( outputDirection );
4357
4358 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
4359
4360 }
4361 `,blending:ni,depthTest:!1,depthWrite:!1})}function Ff(){return new yn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:al(),fragmentShader:`
4362
4363 precision mediump float;
4364 precision mediump int;
4365
4366 uniform float flipEnvMap;
4367
4368 varying vec3 vOutputDirection;
4369
4370 uniform samplerCube envMap;
4371
4372 void main() {
4373
4374 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
4375
4376 }
4377 `,blending:ni,depthTest:!1,depthWrite:!1})}function al(){return`
4378
4379 precision mediump float;
4380 precision mediump int;
4381
4382 attribute vec3 outputDirection;
4383
4384 varying vec3 vOutputDirection;
4385
4386 void main() {
4387
4388 vOutputDirection = outputDirection;
4389 gl_Position = vec4( position, 1.0 );
4390
4391 }
4392 `}var rl=class extends dn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new Xr(s),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 i={uniforms:{tEquirect:{value:null}},vertexShader:`
4393
4394 varying vec3 vWorldDirection;
4395
4396 vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
4397
4398 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
4399
4400 }
4401
4402 void main() {
4403
4404 vWorldDirection = transformDirection( position, modelMatrix );
4405
4406 #include <begin_vertex>
4407 #include <project_vertex>
4408
4409 }
4410 `,fragmentShader:`
4411
4412 uniform sampler2D tEquirect;
4413
4414 varying vec3 vWorldDirection;
4415
4416 #include <common>
4417
4418 void main() {
4419
4420 vec3 direction = normalize( vWorldDirection );
4421
4422 vec2 sampleUV = equirectUv( direction );
4423
4424 gl_FragColor = texture2D( tEquirect, sampleUV );
4425
4426 }
4427 `},s=new Bn(5,5,5),r=new yn({name:"CubemapFromEquirect",uniforms:fs(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:$t,blending:ni});r.uniforms.tEquirect.value=t;let o=new Rt(s,r),a=t.minFilter;return t.minFilter===Hi&&(t.minFilter=Yt),new cc(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,i=!0,s=!0){let r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}};function rv(n){let e=new WeakMap,t=new WeakMap,i=null;function s(u,d=!1){return u==null?null:d?o(u):r(u)}function r(u){if(u&&u.isTexture){let d=u.mapping;if(d===fc||d===pc)if(e.has(u)){let m=e.get(u).texture;return a(m,u.mapping)}else{let m=u.image;if(m&&m.height>0){let v=new rl(m.height);return v.fromEquirectangularTexture(n,u),e.set(u,v),u.addEventListener("dispose",l),a(v.texture,u.mapping)}else return null}}return u}function o(u){if(u&&u.isTexture){let d=u.mapping,m=d===fc||d===pc,v=d===Gi||d===ds;if(m||v){let g=t.get(u),p=g!==void 0?g.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==p)return i===null&&(i=new ar(n)),g=m?i.fromEquirectangular(u,g):i.fromCubemap(u,g),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),g.texture;if(g!==void 0)return g.texture;{let S=u.image;return m&&S&&S.height>0||v&&S&&c(S)?(i===null&&(i=new ar(n)),g=m?i.fromEquirectangular(u):i.fromCubemap(u),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),u.addEventListener("dispose",h),g.texture):null}}}return u}function a(u,d){return d===fc?u.mapping=Gi:d===pc&&(u.mapping=ds),u}function c(u){let d=0,m=6;for(let v=0;v<m;v++)u[v]!==void 0&&d++;return d===m}function l(u){let d=u.target;d.removeEventListener("dispose",l);let m=e.get(d);m!==void 0&&(e.delete(d),m.dispose())}function h(u){let d=u.target;d.removeEventListener("dispose",h);let m=t.get(d);m!==void 0&&(t.delete(d),m.dispose())}function f(){e=new WeakMap,t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:s,dispose:f}}function ov(n){let e={};function t(i){if(e[i]!==void 0)return e[i];let s=n.getExtension(i);return e[i]=s,s}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){let s=t(i);return s===null&&as("WebGLRenderer: "+i+" extension not supported."),s}}}function av(n,e,t,i){let s={},r=new WeakMap;function o(f){let u=f.target;u.index!==null&&e.remove(u.index);for(let m in u.attributes)e.remove(u.attributes[m]);u.removeEventListener("dispose",o),delete s[u.id];let d=r.get(u);d&&(e.remove(d),r.delete(u)),i.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function a(f,u){return s[u.id]===!0||(u.addEventListener("dispose",o),s[u.id]=!0,t.memory.geometries++),u}function c(f){let u=f.attributes;for(let d in u)e.update(u[d],n.ARRAY_BUFFER)}function l(f){let u=[],d=f.index,m=f.attributes.position,v=0;if(m===void 0)return;if(d!==null){let S=d.array;v=d.version;for(let T=0,y=S.length;T<y;T+=3){let w=S[T+0],b=S[T+1],C=S[T+2];u.push(w,b,b,C,C,w)}}else{let S=m.array;v=m.version;for(let T=0,y=S.length/3-1;T<y;T+=3){let w=T+0,b=T+1,C=T+2;u.push(w,b,b,C,C,w)}}let g=new(m.count>=65535?Vr:kr)(u,1);g.version=v;let p=r.get(f);p&&e.remove(p),r.set(f,g)}function h(f){let u=r.get(f);if(u){let d=f.index;d!==null&&u.version<d.version&&l(f)}else l(f);return r.get(f)}return{get:a,update:c,getWireframeAttribute:h}}function cv(n,e,t){let i;function s(f){i=f}let r,o;function a(f){r=f.type,o=f.bytesPerElement}function c(f,u){n.drawElements(i,u,r,f*o),t.update(u,i,1)}function l(f,u,d){d!==0&&(n.drawElementsInstanced(i,u,r,f*o,d),t.update(u,i,d))}function h(f,u,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,u,0,r,f,0,d);let v=0;for(let g=0;g<d;g++)v+=u[g];t.update(v,i,1)}this.setMode=s,this.setIndex=a,this.render=c,this.renderInstances=l,this.renderMultiDraw=h}function lv(n){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(r,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(r/3);break;case n.LINES:t.lines+=a*(r/2);break;case n.LINE_STRIP:t.lines+=a*(r-1);break;case n.LINE_LOOP:t.lines+=a*r;break;case n.POINTS:t.points+=a*r;break;default:Ge("WebGLInfo: Unknown draw mode:",o);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:i}}function hv(n,e,t){let i=new WeakMap,s=new At;function r(o,a,c){let l=o.morphTargetInfluences,h=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=h!==void 0?h.length:0,u=i.get(a);if(u===void 0||u.count!==f){let E=function(){C.dispose(),i.delete(a),a.removeEventListener("dispose",E)};u!==void 0&&u.texture.dispose();let d=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,v=a.morphAttributes.color!==void 0,g=a.morphAttributes.position||[],p=a.morphAttributes.normal||[],S=a.morphAttributes.color||[],T=0;d===!0&&(T=1),m===!0&&(T=2),v===!0&&(T=3);let y=a.attributes.position.count*T,w=1;y>e.maxTextureSize&&(w=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);let b=new Float32Array(y*w*4*f),C=new Br(b,y,w,f);C.type=Cn,C.needsUpdate=!0;let x=T*4;for(let I=0;I<f;I++){let D=g[I],O=p[I],V=S[I],R=y*w*4*I;for(let P=0;P<D.count;P++){let k=P*x;d===!0&&(s.fromBufferAttribute(D,P),b[R+k+0]=s.x,b[R+k+1]=s.y,b[R+k+2]=s.z,b[R+k+3]=0),m===!0&&(s.fromBufferAttribute(O,P),b[R+k+4]=s.x,b[R+k+5]=s.y,b[R+k+6]=s.z,b[R+k+7]=0),v===!0&&(s.fromBufferAttribute(V,P),b[R+k+8]=s.x,b[R+k+9]=s.y,b[R+k+10]=s.z,b[R+k+11]=V.itemSize===4?s.w:1)}}u={count:f,texture:C,size:new le(y,w)},i.set(a,u),a.addEventListener("dispose",E)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let d=0;for(let v=0;v<l.length;v++)d+=l[v];let m=a.morphTargetsRelative?1:1-d;c.getUniforms().setValue(n,"morphTargetBaseInfluence",m),c.getUniforms().setValue(n,"morphTargetInfluences",l)}c.getUniforms().setValue(n,"morphTargetsTexture",u.texture,t),c.getUniforms().setValue(n,"morphTargetsTextureSize",u.size)}return{update:r}}function uv(n,e,t,i,s){let r=new WeakMap;function o(l){let h=s.render.frame,f=l.geometry,u=e.get(l,f);if(r.get(u)!==h&&(e.update(u),r.set(u,h)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),r.get(l)!==h&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,h))),l.isSkinnedMesh){let d=l.skeleton;r.get(d)!==h&&(d.update(),r.set(d,h))}return u}function a(){r=new WeakMap}function c(l){let h=l.target;h.removeEventListener("dispose",c),i.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:o,dispose:a}}var dv={[Rh]:"LINEAR_TONE_MAPPING",[Ih]:"REINHARD_TONE_MAPPING",[Ph]:"CINEON_TONE_MAPPING",[Lh]:"ACES_FILMIC_TONE_MAPPING",[Nh]:"AGX_TONE_MAPPING",[lo]:"NEUTRAL_TONE_MAPPING",[Dh]:"CUSTOM_TONE_MAPPING"};function fv(n,e,t,i,s,r){let o=new dn(e,t,{type:n,depthBuffer:s,stencilBuffer:r,samples:i?4:0,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),a=null,c=null,l=new Ot;l.setAttribute("position",new vt([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new vt([0,2,0,0,2,0],2));let h=new Za({uniforms:{tDiffuse:{value:null}},vertexShader:`
4428 precision highp float;
4429
4430 uniform mat4 modelViewMatrix;
4431 uniform mat4 projectionMatrix;
4432
4433 attribute vec3 position;
4434 attribute vec2 uv;
4435
4436 varying vec2 vUv;
4437
4438 void main() {
4439 vUv = uv;
4440 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4441 }`,fragmentShader:`
4442 precision highp float;
4443
4444 uniform sampler2D tDiffuse;
4445
4446 varying vec2 vUv;
4447
4448 #include <tonemapping_pars_fragment>
4449 #include <colorspace_pars_fragment>
4450
4451 void main() {
4452 gl_FragColor = texture2D( tDiffuse, vUv );
4453
4454 #ifdef LINEAR_TONE_MAPPING
4455 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
4456 #elif defined( REINHARD_TONE_MAPPING )
4457 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
4458 #elif defined( CINEON_TONE_MAPPING )
4459 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
4460 #elif defined( ACES_FILMIC_TONE_MAPPING )
4461 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
4462 #elif defined( AGX_TONE_MAPPING )
4463 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
4464 #elif defined( NEUTRAL_TONE_MAPPING )
4465 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
4466 #elif defined( CUSTOM_TONE_MAPPING )
4467 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4468 #endif
4469
4470 #ifdef SRGB_TRANSFER
4471 gl_FragColor = sRGBTransferOETF( gl_FragColor );
4472 #endif
4473 }`,depthTest:!1,depthWrite:!1}),f=new Rt(l,h),u=new Ks(-1,1,1,-1,0,1),d=null,m=null,v=!1,g,p=null,S=[],T=!1;this.setSize=function(y,w){o.setSize(y,w),a!==null&&a.setSize(y,w),c!==null&&c.setSize(y,w);for(let b=0;b<S.length;b++){let C=S[b];C.setSize&&C.setSize(y,w)}},this.setEffects=function(y){S=y,T=S.length>0&&S[0].isRenderPass===!0;let w=o.width,b=o.height;S.length>0&&a===null&&(a=new dn(w,b,{type:Vn,depthBuffer:!1,stencilBuffer:!1}),c=new dn(w,b,{type:Vn,depthBuffer:!1,stencilBuffer:!1}));for(let C=0;C<S.length;C++){let x=S[C];x.setSize&&x.setSize(w,b)}},this.begin=function(y,w){if(v||y.toneMapping===zn&&S.length===0)return!1;if(p=w,w!==null){let b=w.width,C=w.height;(o.width!==b||o.height!==C)&&this.setSize(b,C)}return T===!1&&y.setRenderTarget(o),g=y.toneMapping,y.toneMapping=zn,!0},this.hasRenderPass=function(){return T},this.end=function(y,w){y.toneMapping=g,v=!0;let b=o,C=a;for(let x=0;x<S.length;x++){let E=S[x];E.enabled!==!1&&(E.render(y,C,b,w),E.needsSwap!==!1&&(b=C,C=C===a?c:a))}if(d!==y.outputColorSpace||m!==y.toneMapping){d=y.outputColorSpace,m=y.toneMapping,h.defines={},ot.getTransfer(d)===pt&&(h.defines.SRGB_TRANSFER="");let x=dv[m];x&&(h.defines[x]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=b.texture,y.setRenderTarget(p),y.render(f,u),p=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){o.dispose(),a!==null&&a.dispose(),c!==null&&c.dispose(),l.dispose(),h.dispose()}}var np=new rn,ou=new Fi(1,1),ip=new Br,sp=new Oa,rp=new Xr,Of=[],Bf=[],zf=new Float32Array(16),kf=new Float32Array(9),Vf=new Float32Array(4);function cr(n,e,t){let i=n[0];if(i<=0||i>0)return n;let s=e*t,r=Of[s];if(r===void 0&&(r=new Float32Array(s),Of[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function zt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function kt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function cl(n,e){let t=Bf[e];t===void 0&&(t=new Int32Array(e),Bf[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function pv(n,e){let t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function mv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(zt(t,e))return;n.uniform2fv(this.addr,e),kt(t,e)}}function gv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(zt(t,e))return;n.uniform3fv(this.addr,e),kt(t,e)}}function _v(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(zt(t,e))return;n.uniform4fv(this.addr,e),kt(t,e)}}function xv(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(zt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),kt(t,e)}else{if(zt(t,i))return;Vf.set(i),n.uniformMatrix2fv(this.addr,!1,Vf),kt(t,i)}}function vv(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(zt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),kt(t,e)}else{if(zt(t,i))return;kf.set(i),n.uniformMatrix3fv(this.addr,!1,kf),kt(t,i)}}function yv(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(zt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),kt(t,e)}else{if(zt(t,i))return;zf.set(i),n.uniformMatrix4fv(this.addr,!1,zf),kt(t,i)}}function Mv(n,e){let t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function Sv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(zt(t,e))return;n.uniform2iv(this.addr,e),kt(t,e)}}function bv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(zt(t,e))return;n.uniform3iv(this.addr,e),kt(t,e)}}function wv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(zt(t,e))return;n.uniform4iv(this.addr,e),kt(t,e)}}function Ev(n,e){let t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function Tv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(zt(t,e))return;n.uniform2uiv(this.addr,e),kt(t,e)}}function Av(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(zt(t,e))return;n.uniform3uiv(this.addr,e),kt(t,e)}}function Cv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(zt(t,e))return;n.uniform4uiv(this.addr,e),kt(t,e)}}function Rv(n,e,t){let i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s);let r;this.type===n.SAMPLER_2D_SHADOW?(ou.compareFunction=t.isReversedDepthBuffer()?tl:el,r=ou):r=np,t.setTexture2D(e||r,s)}function Iv(n,e,t){let i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.setTexture3D(e||sp,s)}function Pv(n,e,t){let i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.setTextureCube(e||rp,s)}function Lv(n,e,t){let i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.setTexture2DArray(e||ip,s)}function Dv(n){switch(n){case 5126:return pv;case 35664:return mv;case 35665:return gv;case 35666:return _v;case 35674:return xv;case 35675:return vv;case 35676:return yv;case 5124:case 35670:return Mv;case 35667:case 35671:return Sv;case 35668:case 35672:return bv;case 35669:case 35673:return wv;case 5125:return Ev;case 36294:return Tv;case 36295:return Av;case 36296:return Cv;case 35678:case 36198:case 36298:case 36306:case 35682:return Rv;case 35679:case 36299:case 36307:return Iv;case 35680:case 36300:case 36308:case 36293:return Pv;case 36289:case 36303:case 36311:case 36292:return Lv}}function Nv(n,e){n.uniform1fv(this.addr,e)}function Uv(n,e){let t=cr(e,this.size,2);n.uniform2fv(this.addr,t)}function Fv(n,e){let t=cr(e,this.size,3);n.uniform3fv(this.addr,t)}function Ov(n,e){let t=cr(e,this.size,4);n.uniform4fv(this.addr,t)}function Bv(n,e){let t=cr(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function zv(n,e){let t=cr(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function kv(n,e){let t=cr(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function Vv(n,e){n.uniform1iv(this.addr,e)}function Gv(n,e){n.uniform2iv(this.addr,e)}function Hv(n,e){n.uniform3iv(this.addr,e)}function Wv(n,e){n.uniform4iv(this.addr,e)}function Xv(n,e){n.uniform1uiv(this.addr,e)}function qv(n,e){n.uniform2uiv(this.addr,e)}function Yv(n,e){n.uniform3uiv(this.addr,e)}function Zv(n,e){n.uniform4uiv(this.addr,e)}function $v(n,e,t){let i=this.cache,s=e.length,r=cl(t,s);zt(i,r)||(n.uniform1iv(this.addr,r),kt(i,r));let o;this.type===n.SAMPLER_2D_SHADOW?o=ou:o=np;for(let a=0;a!==s;++a)t.setTexture2D(e[a]||o,r[a])}function Jv(n,e,t){let i=this.cache,s=e.length,r=cl(t,s);zt(i,r)||(n.uniform1iv(this.addr,r),kt(i,r));for(let o=0;o!==s;++o)t.setTexture3D(e[o]||sp,r[o])}function Kv(n,e,t){let i=this.cache,s=e.length,r=cl(t,s);zt(i,r)||(n.uniform1iv(this.addr,r),kt(i,r));for(let o=0;o!==s;++o)t.setTextureCube(e[o]||rp,r[o])}function jv(n,e,t){let i=this.cache,s=e.length,r=cl(t,s);zt(i,r)||(n.uniform1iv(this.addr,r),kt(i,r));for(let o=0;o!==s;++o)t.setTexture2DArray(e[o]||ip,r[o])}function Qv(n){switch(n){case 5126:return Nv;case 35664:return Uv;case 35665:return Fv;case 35666:return Ov;case 35674:return Bv;case 35675:return zv;case 35676:return kv;case 5124:case 35670:return Vv;case 35667:case 35671:return Gv;case 35668:case 35672:return Hv;case 35669:case 35673:return Wv;case 5125:return Xv;case 36294:return qv;case 36295:return Yv;case 36296:return Zv;case 35678:case 36198:case 36298:case 36306:case 35682:return $v;case 35679:case 36299:case 36307:return Jv;case 35680:case 36300:case 36308:case 36293:return Kv;case 36289:case 36303:case 36311:case 36292:return jv}}var au=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=Dv(t.type)}},cu=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Qv(t.type)}},lu=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let s=this.seq;for(let r=0,o=s.length;r!==o;++r){let a=s[r];a.setValue(e,t[a.id],i)}}},su=/(\w+)(\])?(\[|\.)?/g;function Gf(n,e){n.seq.push(e),n.map[e.id]=e}function ey(n,e,t){let i=n.name,s=i.length;for(su.lastIndex=0;;){let r=su.exec(i),o=su.lastIndex,a=r[1],c=r[2]==="]",l=r[3];if(c&&(a=a|0),l===void 0||l==="["&&o+2===s){Gf(t,l===void 0?new au(a,n,e):new cu(a,n,e));break}else{let f=t.map[a];f===void 0&&(f=new lu(a),Gf(t,f)),t=f}}}var or=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<i;++o){let a=e.getActiveUniform(t,o),c=e.getUniformLocation(t,a.name);ey(a,c,this)}let s=[],r=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?s.push(o):r.push(o);s.length>0&&(this.seq=s.concat(r))}setValue(e,t,i,s){let r=this.map[t];r!==void 0&&r.setValue(e,i,s)}setOptional(e,t,i){let s=t[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,t,i,s){for(let r=0,o=t.length;r!==o;++r){let a=t[r],c=i[a.id];c.needsUpdate!==!1&&a.setValue(e,c.value,s)}}static seqWithValue(e,t){let i=[];for(let s=0,r=e.length;s!==r;++s){let o=e[s];o.id in t&&i.push(o)}return i}};function Hf(n,e,t){let i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}var ty=37297,ny=0;function iy(n,e){let t=n.split(`
4474`),i=[],s=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let o=s;o<r;o++){let a=o+1;i.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return i.join(`
4475`)}var Wf=new Ye;function sy(n){ot._getMatrix(Wf,ot.workingColorSpace,n);let e=`mat3( ${Wf.elements.map(t=>t.toFixed(4))} )`;switch(ot.getTransfer(n)){case Fr:return[e,"LinearTransferOETF"];case pt:return[e,"sRGBTransferOETF"];default:return Be("WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function Xf(n,e,t){let i=n.getShaderParameter(e,n.COMPILE_STATUS),r=(n.getShaderInfoLog(e)||"").trim();if(i&&r==="")return"";let o=/ERROR: 0:(\d+)/.exec(r);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`
4476
4477`+r+`
4478
4479`+iy(n.getShaderSource(e),a)}else return r}function ry(n,e){let t=sy(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4480`)}var oy={[Rh]:"Linear",[Ih]:"Reinhard",[Ph]:"Cineon",[Lh]:"ACESFilmic",[Nh]:"AgX",[lo]:"Neutral",[Dh]:"Custom"};function ay(n,e){let t=oy[e];return t===void 0?(Be("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var sl=new N;function cy(){ot.getLuminanceCoefficients(sl);let n=sl.x.toFixed(4),e=sl.y.toFixed(4),t=sl.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
4481`)}function ly(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Mo).join(`
4482`)}function hy(n){let e=[];for(let t in n){let i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
4483`)}function uy(n,e){let t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let r=n.getActiveAttrib(e,s),o=r.name,a=1;r.type===n.FLOAT_MAT2&&(a=2),r.type===n.FLOAT_MAT3&&(a=3),r.type===n.FLOAT_MAT4&&(a=4),t[o]={type:r.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function Mo(n){return n!==""}function qf(n,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_SUN_LIGHTS/g,e.numSunLights).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_SUN_LIGHT_SHADOWS/g,e.numSunLightShadows).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 Yf(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var dy=/^[ \t]*#include +<([\w\d./]+)>/gm;function hu(n){return n.replace(dy,py)}var fy=new Map;function py(n,e){let t=Qe[e];if(t===void 0){let i=fy.get(e);if(i!==void 0)t=Qe[i],Be('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return hu(t)}var my=/#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 Zf(n){return n.replace(my,gy)}function gy(n,e,t,i){let s="";for(let r=parseInt(e);r<parseInt(t);r++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function $f(n){let e=`precision ${n.precision} float;
4484 precision ${n.precision} int;
4485 precision ${n.precision} sampler2D;
4486 precision ${n.precision} samplerCube;
4487 precision ${n.precision} sampler3D;
4488 precision ${n.precision} sampler2DArray;
4489 precision ${n.precision} sampler2DShadow;
4490 precision ${n.precision} samplerCubeShadow;
4491 precision ${n.precision} sampler2DArrayShadow;
4492 precision ${n.precision} isampler2D;
4493 precision ${n.precision} isampler3D;
4494 precision ${n.precision} isamplerCube;
4495 precision ${n.precision} isampler2DArray;
4496 precision ${n.precision} usampler2D;
4497 precision ${n.precision} usampler3D;
4498 precision ${n.precision} usamplerCube;
4499 precision ${n.precision} usampler2DArray;
4500 `;return n.precision==="highp"?e+=`
4501#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
4502#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
4503#define LOW_PRECISION`),e}var _y={[hs]:"SHADOWMAP_TYPE_PCF",[js]:"SHADOWMAP_TYPE_VSM"};function xy(n){return _y[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var vy={[Gi]:"ENVMAP_TYPE_CUBE",[ds]:"ENVMAP_TYPE_CUBE",[ho]:"ENVMAP_TYPE_CUBE_UV"};function yy(n){return n.envMap===!1?"ENVMAP_TYPE_CUBE":vy[n.envMapMode]||"ENVMAP_TYPE_CUBE"}var My={[ds]:"ENVMAP_MODE_REFRACTION"};function Sy(n){return n.envMap===!1?"ENVMAP_MODE_REFLECTION":My[n.envMapMode]||"ENVMAP_MODE_REFLECTION"}var by={[Ch]:"ENVMAP_BLENDING_MULTIPLY",[cf]:"ENVMAP_BLENDING_MIX",[lf]:"ENVMAP_BLENDING_ADD"};function wy(n){return n.envMap===!1?"ENVMAP_BLENDING_NONE":by[n.combine]||"ENVMAP_BLENDING_NONE"}function Ey(n){let e=n.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function Ty(n,e,t,i){let s=n.getContext(),r=t.defines,o=t.vertexShader,a=t.fragmentShader,c=xy(t),l=yy(t),h=Sy(t),f=wy(t),u=Ey(t),d=ly(t),m=hy(r),v=s.createProgram(),g,p,S=t.glslVersion?"#version "+t.glslVersion+`
4504`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Mo).join(`
4505`),g.length>0&&(g+=`
4506`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Mo).join(`
4507`),p.length>0&&(p+=`
4508`)):(g=[$f(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+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",`
4509`].filter(Mo).join(`
4510`),p=[$f(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+f:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.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.retroreflection?"#define USE_RETROREFLECTION":"",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!==zn?"#define TONE_MAPPING":"",t.toneMapping!==zn?Qe.tonemapping_pars_fragment:"",t.toneMapping!==zn?ay("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Qe.colorspace_pars_fragment,ry("linearToOutputTexel",t.outputColorSpace),cy(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4511`].filter(Mo).join(`
4512`)),o=hu(o),o=qf(o,t),o=Yf(o,t),a=hu(a),a=qf(a,t),a=Yf(a,t),o=Zf(o),a=Zf(a),t.isRawShaderMaterial!==!0&&(S=`#version 300 es
4513`,g=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4514`)+`
4515`+g,p=["#define varying in",t.glslVersion===Gh?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Gh?"":"#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(`
4516`)+`
4517`+p);let T=S+g+o,y=S+p+a,w=Hf(s,s.VERTEX_SHADER,T),b=Hf(s,s.FRAGMENT_SHADER,y);s.attachShader(v,w),s.attachShader(v,b),t.index0AttributeName!==void 0?s.bindAttribLocation(v,0,t.index0AttributeName):t.hasPositionAttribute===!0&&s.bindAttribLocation(v,0,"position"),s.linkProgram(v);function C(D){if(n.debug.checkShaderErrors){let O=s.getProgramInfoLog(v)||"",V=s.getShaderInfoLog(w)||"",R=s.getShaderInfoLog(b)||"",P=O.trim(),k=V.trim(),X=R.trim(),te=!0,q=!0;if(s.getProgramParameter(v,s.LINK_STATUS)===!1)if(te=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(s,v,w,b);else{let Z=Xf(s,w,"vertex"),j=Xf(s,b,"fragment");Ge("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(v,s.VALIDATE_STATUS)+`
4518
4519Material Name: `+D.name+`
4520Material Type: `+D.type+`
4521
4522Program Info Log: `+P+`
4523`+Z+`
4524`+j)}else P!==""?Be("WebGLProgram: Program Info Log:",P):(k===""||X==="")&&(q=!1);q&&(D.diagnostics={runnable:te,programLog:P,vertexShader:{log:k,prefix:g},fragmentShader:{log:X,prefix:p}})}s.deleteShader(w),s.deleteShader(b),x=new or(s,v),E=uy(s,v)}let x;this.getUniforms=function(){return x===void 0&&C(this),x};let E;this.getAttributes=function(){return E===void 0&&C(this),E};let I=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return I===!1&&(I=s.getProgramParameter(v,ty)),I},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=ny++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=w,this.fragmentShader=b,this}var Ay=0,uu=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,i){let s=this._getShaderCacheForMaterial(e);return s.has(t)===!1&&(s.add(t),t.usedTimes++),s.has(i)===!1&&(s.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new du(e),t.set(e,i)),i}},du=class{constructor(e){this.id=Ay++,this.code=e,this.usedTimes=0}};function Cy(n){return n===Xi||n===_o||n===xo}function Ry(n,e,t,i,s,r){let o=new zr,a=new uu,c=new Set,l=[],h=new Map,f=i.logarithmicDepthBuffer,u=i.precision,d={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 m(x){return c.add(x),x===0?"uv":`uv${x}`}function v(x,E,I,D,O,V){let R=D.fog,P=O.geometry,k=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?D.environment:null,X=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,te=e.get(x.envMap||k,X),q=te&&te.mapping===ho?te.image.height:null,Z=d[x.type];x.precision!==null&&(u=i.getMaxPrecision(x.precision),u!==x.precision&&Be("WebGLProgram.getParameters:",x.precision,"not supported, using",u,"instead."));let j=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,Re=j!==void 0?j.length:0,be=0;P.morphAttributes.position!==void 0&&(be=1),P.morphAttributes.normal!==void 0&&(be=2),P.morphAttributes.color!==void 0&&(be=3);let Ke,Ze,et,J;if(Z){let Mt=si[Z];Ke=Mt.vertexShader,Ze=Mt.fragmentShader}else{Ke=x.vertexShader,Ze=x.fragmentShader;let Mt=a.getVertexShaderStage(x),dt=a.getFragmentShaderStage(x);a.update(x,Mt,dt),et=Mt.id,J=dt.id}let ne=n.getRenderTarget(),ye=n.state.buffers.depth.getReversed(),Ve=O.isInstancedMesh===!0,Ee=O.isBatchedMesh===!0,He=!!x.map,gt=!!x.matcap,ie=!!te,re=!!x.aoMap,ae=!!x.lightMap,ce=!!x.bumpMap&&x.wireframe===!1,de=!!x.normalMap,ze=!!x.displacementMap,Oe=!!x.emissiveMap,We=!!x.metalnessMap,$e=!!x.roughnessMap,L=x.anisotropy>0,ut=x.clearcoat>0,it=x.dispersion>0,A=x.retroreflectivity>0,_=x.iridescence>0,B=x.sheen>0,W=x.transmission>0,$=L&&!!x.anisotropyMap,he=ut&&!!x.clearcoatMap,ue=ut&&!!x.clearcoatNormalMap,K=ut&&!!x.clearcoatRoughnessMap,ee=_&&!!x.iridescenceMap,pe=_&&!!x.iridescenceThicknessMap,Ne=B&&!!x.sheenColorMap,xe=B&&!!x.sheenRoughnessMap,me=!!x.specularMap,Ue=!!x.specularColorMap,ke=!!x.specularIntensityMap,Je=W&&!!x.transmissionMap,F=W&&!!x.thicknessMap,ge=!!x.gradientMap,Q=!!x.alphaMap,_e=x.alphaTest>0,we=!!x.alphaHash,se=!!x.extensions,Fe=zn;x.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(Fe=n.toneMapping);let Le={shaderID:Z,shaderType:x.type,shaderName:x.name,vertexShader:Ke,fragmentShader:Ze,defines:x.defines,customVertexShaderID:et,customFragmentShaderID:J,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:u,batching:Ee,batchingColor:Ee&&O._colorsTexture!==null,instancing:Ve,instancingColor:Ve&&O.instanceColor!==null,instancingMorph:Ve&&O.morphTexture!==null,outputColorSpace:ne===null?n.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:ot.workingColorSpace,alphaToCoverage:!!x.alphaToCoverage,map:He,matcap:gt,envMap:ie,envMapMode:ie&&te.mapping,envMapCubeUVHeight:q,aoMap:re,lightMap:ae,bumpMap:ce,normalMap:de,displacementMap:ze,emissiveMap:Oe,normalMapObjectSpace:de&&x.normalMapType===df,normalMapTangentSpace:de&&x.normalMapType===Qc,packedNormalMap:de&&x.normalMapType===Qc&&Cy(x.normalMap.format),metalnessMap:We,roughnessMap:$e,anisotropy:L,anisotropyMap:$,clearcoat:ut,clearcoatMap:he,clearcoatNormalMap:ue,clearcoatRoughnessMap:K,dispersion:it,retroreflection:A,iridescence:_,iridescenceMap:ee,iridescenceThicknessMap:pe,sheen:B,sheenColorMap:Ne,sheenRoughnessMap:xe,specularMap:me,specularColorMap:Ue,specularIntensityMap:ke,transmission:W,transmissionMap:Je,thicknessMap:F,gradientMap:ge,opaque:x.transparent===!1&&x.blending===Qs&&x.alphaToCoverage===!1,alphaMap:Q,alphaTest:_e,alphaHash:we,combine:x.combine,mapUv:He&&m(x.map.channel),aoMapUv:re&&m(x.aoMap.channel),lightMapUv:ae&&m(x.lightMap.channel),bumpMapUv:ce&&m(x.bumpMap.channel),normalMapUv:de&&m(x.normalMap.channel),displacementMapUv:ze&&m(x.displacementMap.channel),emissiveMapUv:Oe&&m(x.emissiveMap.channel),metalnessMapUv:We&&m(x.metalnessMap.channel),roughnessMapUv:$e&&m(x.roughnessMap.channel),anisotropyMapUv:$&&m(x.anisotropyMap.channel),clearcoatMapUv:he&&m(x.clearcoatMap.channel),clearcoatNormalMapUv:ue&&m(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:K&&m(x.clearcoatRoughnessMap.channel),iridescenceMapUv:ee&&m(x.iridescenceMap.channel),iridescenceThicknessMapUv:pe&&m(x.iridescenceThicknessMap.channel),sheenColorMapUv:Ne&&m(x.sheenColorMap.channel),sheenRoughnessMapUv:xe&&m(x.sheenRoughnessMap.channel),specularMapUv:me&&m(x.specularMap.channel),specularColorMapUv:Ue&&m(x.specularColorMap.channel),specularIntensityMapUv:ke&&m(x.specularIntensityMap.channel),transmissionMapUv:Je&&m(x.transmissionMap.channel),thicknessMapUv:F&&m(x.thicknessMap.channel),alphaMapUv:Q&&m(x.alphaMap.channel),vertexTangents:!!P.attributes.tangent&&(de||L),vertexNormals:!!P.attributes.normal,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!P.attributes.color&&P.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!P.attributes.uv&&(He||Q),fog:!!R,useFog:x.fog===!0,fogExp2:!!R&&R.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||P.attributes.normal===void 0&&de===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:ye,skinning:O.isSkinnedMesh===!0,hasPositionAttribute:P.attributes.position!==void 0,morphTargets:P.morphAttributes.position!==void 0,morphNormals:P.morphAttributes.normal!==void 0,morphColors:P.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:be,numSunLights:E.sun.length,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numSunLightShadows:E.sunShadowMap.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numLightProbeGrids:V.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&I.length>0,shadowMapType:n.shadowMap.type,toneMapping:Fe,decodeVideoTexture:He&&x.map.isVideoTexture===!0&&ot.getTransfer(x.map.colorSpace)===pt,decodeVideoTextureEmissive:Oe&&x.emissiveMap.isVideoTexture===!0&&ot.getTransfer(x.emissiveMap.colorSpace)===pt,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===An,flipSided:x.side===$t,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:se&&x.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(se&&x.extensions.multiDraw===!0||Ee)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return Le.vertexUv1s=c.has(1),Le.vertexUv2s=c.has(2),Le.vertexUv3s=c.has(3),c.clear(),Le}function g(x){let E=[];if(x.shaderID?E.push(x.shaderID):(E.push(x.customVertexShaderID),E.push(x.customFragmentShaderID)),x.defines!==void 0)for(let I in x.defines)E.push(I),E.push(x.defines[I]);return x.isRawShaderMaterial===!1&&(p(E,x),S(E,x),E.push(n.outputColorSpace)),E.push(x.customProgramCacheKey),E.join()}function p(x,E){x.push(E.precision),x.push(E.outputColorSpace),x.push(E.envMapMode),x.push(E.envMapCubeUVHeight),x.push(E.mapUv),x.push(E.alphaMapUv),x.push(E.lightMapUv),x.push(E.aoMapUv),x.push(E.bumpMapUv),x.push(E.normalMapUv),x.push(E.displacementMapUv),x.push(E.emissiveMapUv),x.push(E.metalnessMapUv),x.push(E.roughnessMapUv),x.push(E.anisotropyMapUv),x.push(E.clearcoatMapUv),x.push(E.clearcoatNormalMapUv),x.push(E.clearcoatRoughnessMapUv),x.push(E.iridescenceMapUv),x.push(E.iridescenceThicknessMapUv),x.push(E.sheenColorMapUv),x.push(E.sheenRoughnessMapUv),x.push(E.specularMapUv),x.push(E.specularColorMapUv),x.push(E.specularIntensityMapUv),x.push(E.transmissionMapUv),x.push(E.thicknessMapUv),x.push(E.combine),x.push(E.fogExp2),x.push(E.sizeAttenuation),x.push(E.morphTargetsCount),x.push(E.morphAttributeCount),x.push(E.numSunLights),x.push(E.numDirLights),x.push(E.numPointLights),x.push(E.numSpotLights),x.push(E.numSpotLightMaps),x.push(E.numHemiLights),x.push(E.numRectAreaLights),x.push(E.numSunLightShadows),x.push(E.numDirLightShadows),x.push(E.numPointLightShadows),x.push(E.numSpotLightShadows),x.push(E.numSpotLightShadowsWithMaps),x.push(E.numLightProbes),x.push(E.shadowMapType),x.push(E.toneMapping),x.push(E.numClippingPlanes),x.push(E.numClipIntersection),x.push(E.depthPacking)}function S(x,E){o.disableAll(),E.instancing&&o.enable(0),E.instancingColor&&o.enable(1),E.instancingMorph&&o.enable(2),E.matcap&&o.enable(3),E.envMap&&o.enable(4),E.normalMapObjectSpace&&o.enable(5),E.normalMapTangentSpace&&o.enable(6),E.clearcoat&&o.enable(7),E.iridescence&&o.enable(8),E.alphaTest&&o.enable(9),E.vertexColors&&o.enable(10),E.vertexAlphas&&o.enable(11),E.vertexUv1s&&o.enable(12),E.vertexUv2s&&o.enable(13),E.vertexUv3s&&o.enable(14),E.vertexTangents&&o.enable(15),E.anisotropy&&o.enable(16),E.alphaHash&&o.enable(17),E.batching&&o.enable(18),E.dispersion&&o.enable(19),E.retroreflection&&o.enable(24),E.batchingColor&&o.enable(20),E.gradientMap&&o.enable(21),E.packedNormalMap&&o.enable(22),E.vertexNormals&&o.enable(23),x.push(o.mask),o.disableAll(),E.fog&&o.enable(0),E.useFog&&o.enable(1),E.flatShading&&o.enable(2),E.logarithmicDepthBuffer&&o.enable(3),E.reversedDepthBuffer&&o.enable(4),E.skinning&&o.enable(5),E.morphTargets&&o.enable(6),E.morphNormals&&o.enable(7),E.morphColors&&o.enable(8),E.premultipliedAlpha&&o.enable(9),E.shadowMapEnabled&&o.enable(10),E.doubleSided&&o.enable(11),E.flipSided&&o.enable(12),E.useDepthPacking&&o.enable(13),E.dithering&&o.enable(14),E.transmission&&o.enable(15),E.sheen&&o.enable(16),E.opaque&&o.enable(17),E.pointsUvs&&o.enable(18),E.decodeVideoTexture&&o.enable(19),E.decodeVideoTextureEmissive&&o.enable(20),E.alphaToCoverage&&o.enable(21),E.numLightProbeGrids>0&&o.enable(22),E.hasPositionAttribute&&o.enable(23),x.push(o.mask)}function T(x){let E=d[x.type],I;if(E){let D=si[E];I=If.clone(D.uniforms)}else I=x.uniforms;return I}function y(x,E){let I=h.get(E);return I!==void 0?++I.usedTimes:(I=new Ty(n,E,x,s),l.push(I),h.set(E,I)),I}function w(x){if(--x.usedTimes===0){let E=l.indexOf(x);l[E]=l[l.length-1],l.pop(),h.delete(x.cacheKey),x.destroy()}}function b(x){a.remove(x)}function C(){a.dispose()}return{getParameters:v,getProgramCacheKey:g,getUniforms:T,acquireProgram:y,releaseProgram:w,releaseShaderCache:b,programs:l,dispose:C}}function Iy(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function i(o){n.delete(o)}function s(o,a,c){n.get(o)[a]=c}function r(){n=new WeakMap}return{has:e,get:t,remove:i,update:s,dispose:r}}function Py(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function Jf(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Kf(){let n=[],e=0,t=[],i=[],s=[];function r(){e=0,t.length=0,i.length=0,s.length=0}function o(u){let d=0;return u.isInstancedMesh&&(d+=2),u.isSkinnedMesh&&(d+=1),d}function a(u,d,m,v,g,p){let S=n[e];return S===void 0?(S={id:u.id,object:u,geometry:d,material:m,materialVariant:o(u),groupOrder:v,renderOrder:u.renderOrder,z:g,group:p},n[e]=S):(S.id=u.id,S.object=u,S.geometry=d,S.material=m,S.materialVariant=o(u),S.groupOrder=v,S.renderOrder=u.renderOrder,S.z=g,S.group=p),e++,S}function c(u,d,m,v,g,p,S){S.reversedDepth===!0&&(g=-g);let T=a(u,d,m,v,g,p);m.transmission>0?i.push(T):m.transparent===!0?s.push(T):t.push(T)}function l(u,d,m,v,g,p){let S=a(u,d,m,v,g,p);m.transmission>0?i.unshift(S):m.transparent===!0?s.unshift(S):t.unshift(S)}function h(u,d){t.length>1&&t.sort(u||Py),i.length>1&&i.sort(d||Jf),s.length>1&&s.sort(d||Jf)}function f(){for(let u=e,d=n.length;u<d;u++){let m=n[u];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:i,transparent:s,init:r,push:c,unshift:l,finish:f,sort:h}}function Ly(){let n=new WeakMap;function e(i,s){let r=n.get(i),o;return r===void 0?(o=new Kf,n.set(i,[o])):s>=r.length?(o=new Kf,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function Dy(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={direction:new N,color:new Xe};break;case"SpotLight":t={position:new N,direction:new N,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new N,halfWidth:new N,halfHeight:new N};break}return n[e.id]=t,t}}}function Ny(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new le};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new le};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new le,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}var Uy=0;function Fy(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Oy(n){let e=new Dy,t=Ny(),i={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],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++)i.probe.push(new N);let s=new N,r=new ht,o=new ht;function a(l){let h=0,f=0,u=0;for(let O=0;O<9;O++)i.probe[O].set(0,0,0);let d=0,m=0,v=0,g=0,p=0,S=0,T=0,y=0,w=0,b=0,C=0,x=0,E=0,I=0;l.sort(Fy);for(let O=0,V=l.length;O<V;O++){let R=l[O],P=R.color,k=R.intensity,X=R.distance,te=null;if(R.shadow&&R.shadow.map&&(R.shadow.map.texture.format===Xi?te=R.shadow.map.texture:te=R.shadow.map.depthTexture||R.shadow.map.texture),R.isAmbientLight)h+=P.r*k,f+=P.g*k,u+=P.b*k;else if(R.isLightProbe){for(let q=0;q<9;q++)i.probe[q].addScaledVector(R.sh.coefficients[q],k);I++}else if(R.isSunLight){let q=e.get(R);if(q.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){let Z=R.shadow,j=t.get(R);j.shadowIntensity=Z.intensity,j.shadowBias=Z.bias,j.shadowNormalBias=Z.normalBias,j.shadowRadius=Z.radius,j.shadowMapSize.copy(Z.mapSize).multiply(Z.getFrameExtents()),i.sunShadow[m]=j,i.sunShadowMap[m]=te;let Re=Z.getViewportCount();for(let be=0;be<Re;be++)i.sunShadowMatrix[v+be]=Z.getMatrix(be),i.sunShadowCascade[v+be]=Z._cascadeData[be];v+=Re,m++}i.sun[d]=q,d++}else if(R.isDirectionalLight){let q=e.get(R);if(q.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){let Z=R.shadow,j=t.get(R);j.shadowIntensity=Z.intensity,j.shadowBias=Z.bias,j.shadowNormalBias=Z.normalBias,j.shadowRadius=Z.radius,j.shadowMapSize=Z.mapSize,i.directionalShadow[g]=j,i.directionalShadowMap[g]=te,i.directionalShadowMatrix[g]=R.shadow.matrix,w++}i.directional[g]=q,g++}else if(R.isSpotLight){let q=e.get(R);q.position.setFromMatrixPosition(R.matrixWorld),q.color.copy(P).multiplyScalar(k),q.distance=X,q.coneCos=Math.cos(R.angle),q.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),q.decay=R.decay,i.spot[S]=q;let Z=R.shadow;if(R.map&&(i.spotLightMap[x]=R.map,x++,Z.updateMatrices(R),R.castShadow&&E++),i.spotLightMatrix[S]=Z.matrix,R.castShadow){let j=t.get(R);j.shadowIntensity=Z.intensity,j.shadowBias=Z.bias,j.shadowNormalBias=Z.normalBias,j.shadowRadius=Z.radius,j.shadowMapSize=Z.mapSize,i.spotShadow[S]=j,i.spotShadowMap[S]=te,C++}S++}else if(R.isRectAreaLight){let q=e.get(R);q.color.copy(P).multiplyScalar(k),q.halfWidth.set(R.width*.5,0,0),q.halfHeight.set(0,R.height*.5,0),i.rectArea[T]=q,T++}else if(R.isPointLight){let q=e.get(R);if(q.color.copy(R.color).multiplyScalar(R.intensity),q.distance=R.distance,q.decay=R.decay,R.castShadow){let Z=R.shadow,j=t.get(R);j.shadowIntensity=Z.intensity,j.shadowBias=Z.bias,j.shadowNormalBias=Z.normalBias,j.shadowRadius=Z.radius,j.shadowMapSize=Z.mapSize,j.shadowCameraNear=Z.camera.near,j.shadowCameraFar=Z.camera.far,i.pointShadow[p]=j,i.pointShadowMap[p]=te,i.pointShadowMatrix[p]=R.shadow.matrix,b++}i.point[p]=q,p++}else if(R.isHemisphereLight){let q=e.get(R);q.skyColor.copy(R.color).multiplyScalar(k),q.groundColor.copy(R.groundColor).multiplyScalar(k),i.hemi[y]=q,y++}}T>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ve.LTC_FLOAT_1,i.rectAreaLTC2=ve.LTC_FLOAT_2):(i.rectAreaLTC1=ve.LTC_HALF_1,i.rectAreaLTC2=ve.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=f,i.ambient[2]=u;let D=i.hash;(D.sunLength!==d||D.directionalLength!==g||D.pointLength!==p||D.spotLength!==S||D.rectAreaLength!==T||D.hemiLength!==y||D.numSunShadows!==m||D.numDirectionalShadows!==w||D.numPointShadows!==b||D.numSpotShadows!==C||D.numSpotMaps!==x||D.numLightProbes!==I)&&(i.sun.length=d,i.directional.length=g,i.spot.length=S,i.rectArea.length=T,i.point.length=p,i.hemi.length=y,i.sunShadow.length=m,i.sunShadowMap.length=m,i.sunShadowMatrix.length=v,i.sunShadowCascade.length=v,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.directionalShadowMatrix.length=w,i.pointShadow.length=b,i.pointShadowMap.length=b,i.pointShadowMatrix.length=b,i.spotShadow.length=C,i.spotShadowMap.length=C,i.spotLightMatrix.length=C+x-E,i.spotLightMap.length=x,i.numSpotLightShadowsWithMaps=E,i.numLightProbes=I,D.sunLength=d,D.directionalLength=g,D.pointLength=p,D.spotLength=S,D.rectAreaLength=T,D.hemiLength=y,D.numSunShadows=m,D.numDirectionalShadows=w,D.numPointShadows=b,D.numSpotShadows=C,D.numSpotMaps=x,D.numLightProbes=I,i.version=Uy++)}function c(l,h){let f=0,u=0,d=0,m=0,v=0,g=0,p=h.matrixWorldInverse;for(let S=0,T=l.length;S<T;S++){let y=l[S];if(y.isSunLight){let w=i.sun[f];w.direction.setFromMatrixPosition(y.matrixWorld),w.direction.transformDirection(p),f++}else if(y.isDirectionalLight){let w=i.directional[u];w.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(p),u++}else if(y.isSpotLight){let w=i.spot[m];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(p),w.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(p),m++}else if(y.isRectAreaLight){let w=i.rectArea[v];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(p),o.identity(),r.copy(y.matrixWorld),r.premultiply(p),o.extractRotation(r),w.halfWidth.set(y.width*.5,0,0),w.halfHeight.set(0,y.height*.5,0),w.halfWidth.applyMatrix4(o),w.halfHeight.applyMatrix4(o),v++}else if(y.isPointLight){let w=i.point[d];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(p),d++}else if(y.isHemisphereLight){let w=i.hemi[g];w.direction.setFromMatrixPosition(y.matrixWorld),w.direction.transformDirection(p),g++}}}return{setup:a,setupView:c,state:i}}function jf(n){let e=new Oy(n),t=[],i=[],s=[];function r(u){f.camera=u,t.length=0,i.length=0,s.length=0}function o(u){t.push(u)}function a(u){i.push(u)}function c(u){s.push(u)}function l(){e.setup(t)}function h(u){e.setupView(t,u)}let f={lightsArray:t,shadowsArray:i,lightProbeGridArray:s,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:f,setupLights:l,setupLightsView:h,pushLight:o,pushShadow:a,pushLightProbeGrid:c}}function By(n){let e=new WeakMap;function t(s,r=0){let o=e.get(s),a;return o===void 0?(a=new jf(n),e.set(s,[a])):r>=o.length?(a=new jf(n),o.push(a)):a=o[r],a}function i(){e=new WeakMap}return{get:t,dispose:i}}var zy=`void main() {
4525 gl_Position = vec4( position, 1.0 );
4526}`,ky=`uniform sampler2D shadow_pass;
4527uniform vec2 resolution;
4528uniform float radius;
4529void main() {
4530 const float samples = float( VSM_SAMPLES );
4531 float mean = 0.0;
4532 float squared_mean = 0.0;
4533 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4534 float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4535 for ( float i = 0.0; i < samples; i ++ ) {
4536 float uvOffset = uvStart + i * uvStride;
4537 #ifdef HORIZONTAL_PASS
4538 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4539 mean += distribution.x;
4540 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4541 #else
4542 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4543 mean += depth;
4544 squared_mean += depth * depth;
4545 #endif
4546 }
4547 mean = mean / samples;
4548 squared_mean = squared_mean / samples;
4549 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4550 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4551}`,Vy=[new N(1,0,0),new N(-1,0,0),new N(0,1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1)],Gy=[new N(0,-1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1),new N(0,-1,0),new N(0,-1,0)],Qf=new ht,yo=new N,ru=new N;function Hy(n,e,t){let i=new qs,s=new le,r=new le,o=new At,a=new $a,c=new Ja,l={},h=t.maxTextureSize,f={[Tn]:$t,[$t]:Tn,[An]:An},u=new yn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new le},radius:{value:4}},vertexShader:zy,fragmentShader:ky}),d=u.clone();d.defines.HORIZONTAL_PASS=1;let m=new Ot;m.setAttribute("position",new Ft(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new Rt(m,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=hs;let p=this.type;this.render=function(b,C,x){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;this.type===Wd&&(Be("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=hs);let E=n.getRenderTarget(),I=n.getActiveCubeFace(),D=n.getActiveMipmapLevel(),O=n.state;O.setBlending(ni),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 V=p!==this.type;V&&C.traverse(function(R){R.material&&(Array.isArray(R.material)?R.material.forEach(P=>P.needsUpdate=!0):R.material.needsUpdate=!0)});for(let R=0,P=b.length;R<P;R++){let k=b[R],X=k.shadow;if(X===void 0){Be("WebGLShadowMap:",k,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;s.copy(X.mapSize);let te=X.getFrameExtents();s.multiply(te),r.copy(X.mapSize),(s.x>h||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/te.x),s.x=r.x*te.x,X.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/te.y),s.y=r.y*te.y,X.mapSize.y=r.y));let q=n.state.buffers.depth.getReversed();if(X.camera._reversedDepth=q,X.map===null||V===!0){if(X.map!==null&&(X.map.depthTexture!==null&&(X.map.depthTexture.dispose(),X.map.depthTexture=null),X.map.dispose()),this.type===js){if(k.isPointLight){Be("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}X.map=new dn(s.x,s.y,{format:Xi,type:Vn,minFilter:Yt,magFilter:Yt,generateMipmaps:!1}),X.map.texture.name=k.name+".shadowMap",X.map.depthTexture=new Fi(s.x,s.y,Cn),X.map.depthTexture.name=k.name+".shadowMapDepth",X.map.depthTexture.format=jn,X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=Ht,X.map.depthTexture.magFilter=Ht}else k.isPointLight?(X.map=new rl(s.x),X.map.depthTexture=new Va(s.x,kn)):(X.map=new dn(s.x,s.y),X.map.depthTexture=new Fi(s.x,s.y,kn)),X.map.depthTexture.name=k.name+".shadowMap",X.map.depthTexture.format=jn,this.type===hs?(X.map.depthTexture.compareFunction=q?tl:el,X.map.depthTexture.minFilter=Yt,X.map.depthTexture.magFilter=Yt):(X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=Ht,X.map.depthTexture.magFilter=Ht);X.camera.updateProjectionMatrix()}X.map.isWebGLCubeRenderTarget!==!0&&(X.map.width!==s.x||X.map.height!==s.y)&&X.map.setSize(s.x,s.y);let Z=X.map.isWebGLCubeRenderTarget?6:X.getViewportCount();k.isPointLight!==!0&&X.updateMatrices(k,x);for(let j=0;j<Z;j++){let Re=X.getCamera(j);if(k.isPointLight){let be=X.camera,Ke=X.matrix,Ze=k.distance||be.far;Ze!==be.far&&(be.far=Ze,be.updateProjectionMatrix()),yo.setFromMatrixPosition(k.matrixWorld),be.position.copy(yo),ru.copy(be.position),ru.add(Vy[j]),be.up.copy(Gy[j]),be.lookAt(ru),be.updateMatrixWorld(),Ke.makeTranslation(-yo.x,-yo.y,-yo.z),Qf.multiplyMatrices(be.projectionMatrix,be.matrixWorldInverse),X._frustum.setFromProjectionMatrix(Qf,be.coordinateSystem,be.reversedDepth)}if(X.map.isWebGLCubeRenderTarget)n.setRenderTarget(X.map,j),n.clear();else{j===0&&(n.setRenderTarget(X.map),n.clear());let be=X.getViewport(j);o.set(r.x*be.x,r.y*be.y,r.x*be.z,r.y*be.w),O.viewport(o)}i=X.getFrustum(j),y(C,x,Re,k,this.type)}X.isPointLightShadow!==!0&&this.type===js&&S(X,x),X.needsUpdate=!1}p=this.type,g.needsUpdate=!1,n.setRenderTarget(E,I,D)};function S(b,C){let x=e.update(v);u.defines.VSM_SAMPLES!==b.blurSamples&&(u.defines.VSM_SAMPLES=b.blurSamples,d.defines.VSM_SAMPLES=b.blurSamples,u.needsUpdate=!0,d.needsUpdate=!0),b.mapPass===null?b.mapPass=new dn(s.x,s.y,{format:Xi,type:Vn}):(b.mapPass.width!==b.map.width||b.mapPass.height!==b.map.height)&&b.mapPass.setSize(b.map.width,b.map.height),u.uniforms.shadow_pass.value=b.map.depthTexture,u.uniforms.resolution.value.set(b.map.width,b.map.height),u.uniforms.radius.value=b.radius,n.setRenderTarget(b.mapPass),n.clear(),n.renderBufferDirect(C,null,x,u,v,null),d.uniforms.shadow_pass.value=b.mapPass.texture,d.uniforms.resolution.value.set(b.map.width,b.map.height),d.uniforms.radius.value=b.radius,n.setRenderTarget(b.map),n.clear(),n.renderBufferDirect(C,null,x,d,v,null)}function T(b,C,x,E){let I=null,D=x.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(D!==void 0)I=D;else if(I=x.isPointLight===!0?c:a,n.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){let O=I.uuid,V=C.uuid,R=l[O];R===void 0&&(R={},l[O]=R);let P=R[V];P===void 0&&(P=I.clone(),R[V]=P,C.addEventListener("dispose",w)),I=P}if(I.visible=C.visible,I.wireframe=C.wireframe,E===js?I.side=C.shadowSide!==null?C.shadowSide:C.side:I.side=C.shadowSide!==null?C.shadowSide:f[C.side],I.alphaMap=C.alphaMap,I.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,I.map=C.map,I.clipShadows=C.clipShadows,I.clippingPlanes=C.clippingPlanes,I.clipIntersection=C.clipIntersection,I.displacementMap=C.displacementMap,I.displacementScale=C.displacementScale,I.displacementBias=C.displacementBias,I.wireframeLinewidth=C.wireframeLinewidth,I.linewidth=C.linewidth,x.isPointLight===!0&&I.isMeshDistanceMaterial===!0){let O=n.properties.get(I);O.light=x}return I}function y(b,C,x,E,I){if(b.visible===!1)return;if(b.layers.test(C.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&I===js)&&(!b.frustumCulled||b.intersectsFrustum(i))){b.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,b.matrixWorld);let V=e.update(b),R=b.material;if(Array.isArray(R)){let P=V.groups;for(let k=0,X=P.length;k<X;k++){let te=P[k],q=R[te.materialIndex];if(q&&q.visible){let Z=T(b,q,E,I);b.onBeforeShadow(n,b,C,x,V,Z,te),n.renderBufferDirect(x,null,V,Z,b,te),b.onAfterShadow(n,b,C,x,V,Z,te)}}}else if(R.visible){let P=T(b,R,E,I);b.onBeforeShadow(n,b,C,x,V,P,null),n.renderBufferDirect(x,null,V,P,b,null),b.onAfterShadow(n,b,C,x,V,P,null)}}let O=b.children;for(let V=0,R=O.length;V<R;V++)y(O[V],C,x,E,I)}function w(b){b.target.removeEventListener("dispose",w);for(let x in l){let E=l[x],I=b.target.uuid;I in E&&(E[I].dispose(),delete E[I])}}}function Wy(n,e){function t(){let F=!1,ge=new At,Q=null,_e=new At(0,0,0,0);return{setMask:function(we){Q!==we&&!F&&(n.colorMask(we,we,we,we),Q=we)},setLocked:function(we){F=we},setClear:function(we,se,Fe,Le,Mt){Mt===!0&&(we*=Le,se*=Le,Fe*=Le),ge.set(we,se,Fe,Le),_e.equals(ge)===!1&&(n.clearColor(we,se,Fe,Le),_e.copy(ge))},reset:function(){F=!1,Q=null,_e.set(-1,0,0,0)}}}function i(){let F=!1,ge=!1,Q=null,_e=null,we=null;return{setReversed:function(se){if(ge!==se){let Fe=e.get("EXT_clip_control");se?Fe.clipControlEXT(Fe.LOWER_LEFT_EXT,Fe.ZERO_TO_ONE_EXT):Fe.clipControlEXT(Fe.LOWER_LEFT_EXT,Fe.NEGATIVE_ONE_TO_ONE_EXT),ge=se;let Le=we;we=null,this.setClear(Le)}},getReversed:function(){return ge},setTest:function(se){se?ne(n.DEPTH_TEST):ye(n.DEPTH_TEST)},setMask:function(se){Q!==se&&!F&&(n.depthMask(se),Q=se)},setFunc:function(se){if(ge&&(se=wf[se]),_e!==se){switch(se){case wa:n.depthFunc(n.NEVER);break;case Ea:n.depthFunc(n.ALWAYS);break;case Ta:n.depthFunc(n.LESS);break;case ks:n.depthFunc(n.LEQUAL);break;case Aa:n.depthFunc(n.EQUAL);break;case Ca:n.depthFunc(n.GEQUAL);break;case Ra:n.depthFunc(n.GREATER);break;case Ia:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}_e=se}},setLocked:function(se){F=se},setClear:function(se){we!==se&&(we=se,ge&&(se=1-se),n.clearDepth(se))},reset:function(){F=!1,Q=null,_e=null,we=null,ge=!1}}}function s(){let F=!1,ge=null,Q=null,_e=null,we=null,se=null,Fe=null,Le=null,Mt=null;return{setTest:function(dt){F||(dt?ne(n.STENCIL_TEST):ye(n.STENCIL_TEST))},setMask:function(dt){ge!==dt&&!F&&(n.stencilMask(dt),ge=dt)},setFunc:function(dt,In,Hn){(Q!==dt||_e!==In||we!==Hn)&&(n.stencilFunc(dt,In,Hn),Q=dt,_e=In,we=Hn)},setOp:function(dt,In,Hn){(se!==dt||Fe!==In||Le!==Hn)&&(n.stencilOp(dt,In,Hn),se=dt,Fe=In,Le=Hn)},setLocked:function(dt){F=dt},setClear:function(dt){Mt!==dt&&(n.clearStencil(dt),Mt=dt)},reset:function(){F=!1,ge=null,Q=null,_e=null,we=null,se=null,Fe=null,Le=null,Mt=null}}}let r=new t,o=new i,a=new s,c=new WeakMap,l=new WeakMap,h={},f={},u={},d=new WeakMap,m=[],v=null,g=!1,p=null,S=null,T=null,y=null,w=null,b=null,C=null,x=new Xe(0,0,0),E=0,I=!1,D=null,O=null,V=null,R=null,P=null,k=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS),X=!1,te=0,q=n.getParameter(n.VERSION);q.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(q)[1]),X=te>=1):q.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),X=te>=2);let Z=null,j={},Re=n.getParameter(n.SCISSOR_BOX),be=n.getParameter(n.VIEWPORT),Ke=new At().fromArray(Re),Ze=new At().fromArray(be);function et(F,ge,Q,_e){let we=new Uint8Array(4),se=n.createTexture();n.bindTexture(F,se),n.texParameteri(F,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(F,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Fe=0;Fe<Q;Fe++)F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY?n.texImage3D(ge,0,n.RGBA,1,1,_e,0,n.RGBA,n.UNSIGNED_BYTE,we):n.texImage2D(ge+Fe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,we);return se}let J={};J[n.TEXTURE_2D]=et(n.TEXTURE_2D,n.TEXTURE_2D,1),J[n.TEXTURE_CUBE_MAP]=et(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),J[n.TEXTURE_2D_ARRAY]=et(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),J[n.TEXTURE_3D]=et(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),ne(n.DEPTH_TEST),o.setFunc(ks),ce(!1),de(wh),ne(n.CULL_FACE),re(ni);function ne(F){h[F]!==!0&&(n.enable(F),h[F]=!0)}function ye(F){h[F]!==!1&&(n.disable(F),h[F]=!1)}function Ve(F,ge){return u[F]!==ge?(n.bindFramebuffer(F,ge),u[F]=ge,F===n.DRAW_FRAMEBUFFER&&(u[n.FRAMEBUFFER]=ge),F===n.FRAMEBUFFER&&(u[n.DRAW_FRAMEBUFFER]=ge),!0):!1}function Ee(F,ge){let Q=m,_e=!1;if(F){Q=d.get(ge),Q===void 0&&(Q=[],d.set(ge,Q));let we=F.textures;if(Q.length!==we.length||Q[0]!==n.COLOR_ATTACHMENT0){for(let se=0,Fe=we.length;se<Fe;se++)Q[se]=n.COLOR_ATTACHMENT0+se;Q.length=we.length,_e=!0}}else Q[0]!==n.BACK&&(Q[0]=n.BACK,_e=!0);_e&&n.drawBuffers(Q)}function He(F){return v!==F?(n.useProgram(F),v=F,!0):!1}let gt={[us]:n.FUNC_ADD,[Xd]:n.FUNC_SUBTRACT,[qd]:n.FUNC_REVERSE_SUBTRACT};gt[Yd]=n.MIN,gt[Zd]=n.MAX;let ie={[$d]:n.ZERO,[dc]:n.ONE,[Jd]:n.SRC_COLOR,[co]:n.SRC_ALPHA,[nf]:n.SRC_ALPHA_SATURATE,[ef]:n.DST_COLOR,[jd]:n.DST_ALPHA,[Kd]:n.ONE_MINUS_SRC_COLOR,[er]:n.ONE_MINUS_SRC_ALPHA,[tf]:n.ONE_MINUS_DST_COLOR,[Qd]:n.ONE_MINUS_DST_ALPHA,[sf]:n.CONSTANT_COLOR,[rf]:n.ONE_MINUS_CONSTANT_COLOR,[of]:n.CONSTANT_ALPHA,[af]:n.ONE_MINUS_CONSTANT_ALPHA};function re(F,ge,Q,_e,we,se,Fe,Le,Mt,dt){if(F===ni){g===!0&&(ye(n.BLEND),g=!1);return}if(g===!1&&(ne(n.BLEND),g=!0),F!==uc){if(F!==p||dt!==I){if((S!==us||w!==us)&&(n.blendEquation(n.FUNC_ADD),S=us,w=us),dt)switch(F){case Qs:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Eh:n.blendFunc(n.ONE,n.ONE);break;case Th:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Ah:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:Ge("WebGLState: Invalid blending: ",F);break}else switch(F){case Qs:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Eh:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Th:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Ah:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",F);break}T=null,y=null,b=null,C=null,x.set(0,0,0),E=0,p=F,I=dt}return}we=we||ge,se=se||Q,Fe=Fe||_e,(ge!==S||we!==w)&&(n.blendEquationSeparate(gt[ge],gt[we]),S=ge,w=we),(Q!==T||_e!==y||se!==b||Fe!==C)&&(n.blendFuncSeparate(ie[Q],ie[_e],ie[se],ie[Fe]),T=Q,y=_e,b=se,C=Fe),(Le.equals(x)===!1||Mt!==E)&&(n.blendColor(Le.r,Le.g,Le.b,Mt),x.copy(Le),E=Mt),p=F,I=!1}function ae(F,ge){F.side===An?ye(n.CULL_FACE):ne(n.CULL_FACE);let Q=F.side===$t;ge&&(Q=!Q),ce(Q),F.blending===Qs&&F.transparent===!1?re(ni):re(F.blending,F.blendEquation,F.blendSrc,F.blendDst,F.blendEquationAlpha,F.blendSrcAlpha,F.blendDstAlpha,F.blendColor,F.blendAlpha,F.premultipliedAlpha),o.setFunc(F.depthFunc),o.setTest(F.depthTest),o.setMask(F.depthWrite),r.setMask(F.colorWrite);let _e=F.stencilWrite;a.setTest(_e),_e&&(a.setMask(F.stencilWriteMask),a.setFunc(F.stencilFunc,F.stencilRef,F.stencilFuncMask),a.setOp(F.stencilFail,F.stencilZFail,F.stencilZPass)),Oe(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),F.alphaToCoverage===!0?ne(n.SAMPLE_ALPHA_TO_COVERAGE):ye(n.SAMPLE_ALPHA_TO_COVERAGE)}function ce(F){D!==F&&(F?n.frontFace(n.CW):n.frontFace(n.CCW),D=F)}function de(F){F!==Gd?(ne(n.CULL_FACE),F!==O&&(F===wh?n.cullFace(n.BACK):F===Hd?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):ye(n.CULL_FACE),O=F}function ze(F){F!==V&&(X&&n.lineWidth(F),V=F)}function Oe(F,ge,Q){F?(ne(n.POLYGON_OFFSET_FILL),(R!==ge||P!==Q)&&(R=ge,P=Q,o.getReversed()&&(ge=-ge),n.polygonOffset(ge,Q))):ye(n.POLYGON_OFFSET_FILL)}function We(F){F?ne(n.SCISSOR_TEST):ye(n.SCISSOR_TEST)}function $e(F){F===void 0&&(F=n.TEXTURE0+k-1),Z!==F&&(n.activeTexture(F),Z=F)}function L(F,ge,Q){Q===void 0&&(Z===null?Q=n.TEXTURE0+k-1:Q=Z);let _e=j[Q];_e===void 0&&(_e={type:void 0,texture:void 0},j[Q]=_e),(_e.type!==F||_e.texture!==ge)&&(Z!==Q&&(n.activeTexture(Q),Z=Q),n.bindTexture(F,ge||J[F]),_e.type=F,_e.texture=ge)}function ut(){let F=j[Z];F!==void 0&&F.type!==void 0&&(n.bindTexture(F.type,null),F.type=void 0,F.texture=void 0)}function it(){try{n.compressedTexImage2D(...arguments)}catch(F){Ge("WebGLState:",F)}}function A(){try{n.compressedTexImage3D(...arguments)}catch(F){Ge("WebGLState:",F)}}function _(){try{n.texSubImage2D(...arguments)}catch(F){Ge("WebGLState:",F)}}function B(){try{n.texSubImage3D(...arguments)}catch(F){Ge("WebGLState:",F)}}function W(){try{n.compressedTexSubImage2D(...arguments)}catch(F){Ge("WebGLState:",F)}}function $(){try{n.compressedTexSubImage3D(...arguments)}catch(F){Ge("WebGLState:",F)}}function he(){try{n.texStorage2D(...arguments)}catch(F){Ge("WebGLState:",F)}}function ue(){try{n.texStorage3D(...arguments)}catch(F){Ge("WebGLState:",F)}}function K(){try{n.texImage2D(...arguments)}catch(F){Ge("WebGLState:",F)}}function ee(){try{n.texImage3D(...arguments)}catch(F){Ge("WebGLState:",F)}}function pe(F){return f[F]!==void 0?f[F]:n.getParameter(F)}function Ne(F,ge){f[F]!==ge&&(n.pixelStorei(F,ge),f[F]=ge)}function xe(F){Ke.equals(F)===!1&&(n.scissor(F.x,F.y,F.z,F.w),Ke.copy(F))}function me(F){Ze.equals(F)===!1&&(n.viewport(F.x,F.y,F.z,F.w),Ze.copy(F))}function Ue(F,ge){let Q=l.get(ge);Q===void 0&&(Q=new WeakMap,l.set(ge,Q));let _e=Q.get(F);_e===void 0&&(_e=n.getUniformBlockIndex(ge,F.name),Q.set(F,_e))}function ke(F,ge){let _e=l.get(ge).get(F);c.get(ge)!==_e&&(n.uniformBlockBinding(ge,_e,F.__bindingPointIndex),c.set(ge,_e))}function Je(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),o.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),n.pixelStorei(n.PACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL),n.pixelStorei(n.PACK_ROW_LENGTH,0),n.pixelStorei(n.PACK_SKIP_PIXELS,0),n.pixelStorei(n.PACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_ROW_LENGTH,0),n.pixelStorei(n.UNPACK_IMAGE_HEIGHT,0),n.pixelStorei(n.UNPACK_SKIP_PIXELS,0),n.pixelStorei(n.UNPACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_SKIP_IMAGES,0),h={},f={},Z=null,j={},u={},d=new WeakMap,m=[],v=null,g=!1,p=null,S=null,T=null,y=null,w=null,b=null,C=null,x=new Xe(0,0,0),E=0,I=!1,D=null,O=null,V=null,R=null,P=null,Ke.set(0,0,n.canvas.width,n.canvas.height),Ze.set(0,0,n.canvas.width,n.canvas.height),r.reset(),o.reset(),a.reset()}return{buffers:{color:r,depth:o,stencil:a},enable:ne,disable:ye,bindFramebuffer:Ve,drawBuffers:Ee,useProgram:He,setBlending:re,setMaterial:ae,setFlipSided:ce,setCullFace:de,setLineWidth:ze,setPolygonOffset:Oe,setScissorTest:We,activeTexture:$e,bindTexture:L,unbindTexture:ut,compressedTexImage2D:it,compressedTexImage3D:A,texImage2D:K,texImage3D:ee,pixelStorei:Ne,getParameter:pe,updateUBOMapping:Ue,uniformBlockBinding:ke,texStorage2D:he,texStorage3D:ue,texSubImage2D:_,texSubImage3D:B,compressedTexSubImage2D:W,compressedTexSubImage3D:$,scissor:xe,viewport:me,reset:Je}}function Xy(n,e,t,i,s,r,o){let a=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 le,h=new WeakMap,f=new Set,u,d=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(A,_){return m?new OffscreenCanvas(A,_):Or("canvas")}function g(A,_,B){let W=1,$=it(A);if(($.width>B||$.height>B)&&(W=B/Math.max($.width,$.height)),W<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){let he=Math.floor(W*$.width),ue=Math.floor(W*$.height);u===void 0&&(u=v(he,ue));let K=_?v(he,ue):u;return K.width=he,K.height=ue,K.getContext("2d").drawImage(A,0,0,he,ue),Be("WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+he+"x"+ue+")."),K}else return"data"in A&&Be("WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),A;return A}function p(A){return A.generateMipmaps}function S(A){n.generateMipmap(A)}function T(A){return A.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:A.isWebGL3DRenderTarget?n.TEXTURE_3D:A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function y(A,_,B,W,$,he=!1){if(A!==null){if(n[A]!==void 0)return n[A];Be("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let ue;W&&(ue=e.get("EXT_texture_norm16"),ue||Be("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let K=_;if(_===n.RED&&(B===n.FLOAT&&(K=n.R32F),B===n.HALF_FLOAT&&(K=n.R16F),B===n.UNSIGNED_BYTE&&(K=n.R8),B===n.UNSIGNED_SHORT&&ue&&(K=ue.R16_EXT),B===n.SHORT&&ue&&(K=ue.R16_SNORM_EXT)),_===n.RED_INTEGER&&(B===n.UNSIGNED_BYTE&&(K=n.R8UI),B===n.UNSIGNED_SHORT&&(K=n.R16UI),B===n.UNSIGNED_INT&&(K=n.R32UI),B===n.BYTE&&(K=n.R8I),B===n.SHORT&&(K=n.R16I),B===n.INT&&(K=n.R32I)),_===n.RG&&(B===n.FLOAT&&(K=n.RG32F),B===n.HALF_FLOAT&&(K=n.RG16F),B===n.UNSIGNED_BYTE&&(K=n.RG8),B===n.UNSIGNED_SHORT&&ue&&(K=ue.RG16_EXT),B===n.SHORT&&ue&&(K=ue.RG16_SNORM_EXT)),_===n.RG_INTEGER&&(B===n.UNSIGNED_BYTE&&(K=n.RG8UI),B===n.UNSIGNED_SHORT&&(K=n.RG16UI),B===n.UNSIGNED_INT&&(K=n.RG32UI),B===n.BYTE&&(K=n.RG8I),B===n.SHORT&&(K=n.RG16I),B===n.INT&&(K=n.RG32I)),_===n.RGB_INTEGER&&(B===n.UNSIGNED_BYTE&&(K=n.RGB8UI),B===n.UNSIGNED_SHORT&&(K=n.RGB16UI),B===n.UNSIGNED_INT&&(K=n.RGB32UI),B===n.BYTE&&(K=n.RGB8I),B===n.SHORT&&(K=n.RGB16I),B===n.INT&&(K=n.RGB32I)),_===n.RGBA_INTEGER&&(B===n.UNSIGNED_BYTE&&(K=n.RGBA8UI),B===n.UNSIGNED_SHORT&&(K=n.RGBA16UI),B===n.UNSIGNED_INT&&(K=n.RGBA32UI),B===n.BYTE&&(K=n.RGBA8I),B===n.SHORT&&(K=n.RGBA16I),B===n.INT&&(K=n.RGBA32I)),_===n.RGB&&(B===n.UNSIGNED_SHORT&&ue&&(K=ue.RGB16_EXT),B===n.SHORT&&ue&&(K=ue.RGB16_SNORM_EXT),B===n.UNSIGNED_INT_5_9_9_9_REV&&(K=n.RGB9_E5),B===n.UNSIGNED_INT_10F_11F_11F_REV&&(K=n.R11F_G11F_B10F)),_===n.RGBA){let ee=he?Fr:ot.getTransfer($);B===n.FLOAT&&(K=n.RGBA32F),B===n.HALF_FLOAT&&(K=n.RGBA16F),B===n.UNSIGNED_BYTE&&(K=ee===pt?n.SRGB8_ALPHA8:n.RGBA8),B===n.UNSIGNED_SHORT&&ue&&(K=ue.RGBA16_EXT),B===n.SHORT&&ue&&(K=ue.RGBA16_SNORM_EXT),B===n.UNSIGNED_SHORT_4_4_4_4&&(K=n.RGBA4),B===n.UNSIGNED_SHORT_5_5_5_1&&(K=n.RGB5_A1)}return(K===n.R16F||K===n.R32F||K===n.RG16F||K===n.RG32F||K===n.RGBA16F||K===n.RGBA32F)&&e.get("EXT_color_buffer_float"),K}function w(A,_){let B;return A?_===null||_===kn||_===nr?B=n.DEPTH24_STENCIL8:_===Cn?B=n.DEPTH32F_STENCIL8:_===tr&&(B=n.DEPTH24_STENCIL8,Be("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===kn||_===nr?B=n.DEPTH_COMPONENT24:_===Cn?B=n.DEPTH_COMPONENT32F:_===tr&&(B=n.DEPTH_COMPONENT16),B}function b(A,_){return p(A)===!0||A.isFramebufferTexture&&A.minFilter!==Ht&&A.minFilter!==Yt?Math.log2(Math.max(_.width,_.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?_.mipmaps.length:1}function C(A){let _=A.target;_.removeEventListener("dispose",C),E(_),_.isVideoTexture&&h.delete(_),_.isHTMLTexture&&f.delete(_)}function x(A){let _=A.target;_.removeEventListener("dispose",x),D(_)}function E(A){let _=i.get(A);if(_.__webglInit===void 0)return;let B=A.source,W=d.get(B);if(W){let $=W[_.__cacheKey];$.usedTimes--,$.usedTimes===0&&I(A),Object.keys(W).length===0&&d.delete(B)}i.remove(A)}function I(A){let _=i.get(A);n.deleteTexture(_.__webglTexture);let B=A.source,W=d.get(B);delete W[_.__cacheKey],o.memory.textures--}function D(A){let _=i.get(A);if(A.depthTexture&&(A.depthTexture.dispose(),i.remove(A.depthTexture)),A.isWebGLCubeRenderTarget)for(let W=0;W<6;W++){if(Array.isArray(_.__webglFramebuffer[W]))for(let $=0;$<_.__webglFramebuffer[W].length;$++)n.deleteFramebuffer(_.__webglFramebuffer[W][$]);else n.deleteFramebuffer(_.__webglFramebuffer[W]);_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer[W])}else{if(Array.isArray(_.__webglFramebuffer))for(let W=0;W<_.__webglFramebuffer.length;W++)n.deleteFramebuffer(_.__webglFramebuffer[W]);else n.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&n.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let W=0;W<_.__webglColorRenderbuffer.length;W++)_.__webglColorRenderbuffer[W]&&n.deleteRenderbuffer(_.__webglColorRenderbuffer[W]);_.__webglDepthRenderbuffer&&n.deleteRenderbuffer(_.__webglDepthRenderbuffer)}let B=A.textures;for(let W=0,$=B.length;W<$;W++){let he=i.get(B[W]);he.__webglTexture&&(n.deleteTexture(he.__webglTexture),o.memory.textures--),i.remove(B[W])}i.remove(A)}let O=0;function V(){O=0}function R(){return O}function P(A){O=A}function k(){let A=O;return A>=s.maxTextures&&Be("WebGLTextures: Trying to use "+(A+1)+" texture units while this GPU supports only "+s.maxTextures),O+=1,A}function X(A){let _=[];return _.push(A.wrapS),_.push(A.wrapT),_.push(A.wrapR||0),_.push(A.magFilter),_.push(A.minFilter),_.push(A.anisotropy),_.push(A.internalFormat),_.push(A.format),_.push(A.type),_.push(A.generateMipmaps),_.push(A.premultiplyAlpha),_.push(A.flipY),_.push(A.unpackAlignment),_.push(A.colorSpace),_.join()}function te(A,_){let B=i.get(A);if(A.isVideoTexture&&L(A),A.isRenderTargetTexture===!1&&A.isExternalTexture!==!0&&A.version>0&&B.__version!==A.version){let W=A.image;if(W===null)Be("WebGLRenderer: Texture marked for update but no image data found.");else if(W.complete===!1)Be("WebGLRenderer: Texture marked for update but image is incomplete");else{ye(B,A,_);return}}else A.isExternalTexture&&(B.__webglTexture=A.sourceTexture?A.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,B.__webglTexture,n.TEXTURE0+_)}function q(A,_){let B=i.get(A);if(A.isRenderTargetTexture===!1&&A.version>0&&B.__version!==A.version){ye(B,A,_);return}else A.isExternalTexture&&(B.__webglTexture=A.sourceTexture?A.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,B.__webglTexture,n.TEXTURE0+_)}function Z(A,_){let B=i.get(A);if(A.isRenderTargetTexture===!1&&A.version>0&&B.__version!==A.version){ye(B,A,_);return}t.bindTexture(n.TEXTURE_3D,B.__webglTexture,n.TEXTURE0+_)}function j(A,_){let B=i.get(A);if(A.isCubeDepthTexture!==!0&&A.version>0&&B.__version!==A.version){Ve(B,A,_);return}t.bindTexture(n.TEXTURE_CUBE_MAP,B.__webglTexture,n.TEXTURE0+_)}let Re={[Pa]:n.REPEAT,[Jn]:n.CLAMP_TO_EDGE,[La]:n.MIRRORED_REPEAT},be={[Ht]:n.NEAREST,[hf]:n.NEAREST_MIPMAP_NEAREST,[uo]:n.NEAREST_MIPMAP_LINEAR,[Yt]:n.LINEAR,[mc]:n.LINEAR_MIPMAP_NEAREST,[Hi]:n.LINEAR_MIPMAP_LINEAR},Ke={[pf]:n.NEVER,[vf]:n.ALWAYS,[mf]:n.LESS,[el]:n.LEQUAL,[gf]:n.EQUAL,[tl]:n.GEQUAL,[_f]:n.GREATER,[xf]:n.NOTEQUAL};function Ze(A,_){if(_.type===Cn&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===Yt||_.magFilter===mc||_.magFilter===uo||_.magFilter===Hi||_.minFilter===Yt||_.minFilter===mc||_.minFilter===uo||_.minFilter===Hi)&&Be("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(A,n.TEXTURE_WRAP_S,Re[_.wrapS]),n.texParameteri(A,n.TEXTURE_WRAP_T,Re[_.wrapT]),(A===n.TEXTURE_3D||A===n.TEXTURE_2D_ARRAY)&&n.texParameteri(A,n.TEXTURE_WRAP_R,Re[_.wrapR]),n.texParameteri(A,n.TEXTURE_MAG_FILTER,be[_.magFilter]),n.texParameteri(A,n.TEXTURE_MIN_FILTER,be[_.minFilter]),_.compareFunction&&(n.texParameteri(A,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(A,n.TEXTURE_COMPARE_FUNC,Ke[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===Ht||_.minFilter!==uo&&_.minFilter!==Hi||_.type===Cn&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||i.get(_).__currentAnisotropy){let B=e.get("EXT_texture_filter_anisotropic");n.texParameterf(A,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,s.getMaxAnisotropy())),i.get(_).__currentAnisotropy=_.anisotropy}}}function et(A,_){let B=!1;A.__webglInit===void 0&&(A.__webglInit=!0,_.addEventListener("dispose",C));let W=_.source,$=d.get(W);$===void 0&&($={},d.set(W,$));let he=X(_);if(he!==A.__cacheKey){$[he]===void 0&&($[he]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,B=!0),$[he].usedTimes++;let ue=$[A.__cacheKey];ue!==void 0&&($[A.__cacheKey].usedTimes--,ue.usedTimes===0&&I(_)),A.__cacheKey=he,A.__webglTexture=$[he].texture}return B}function J(A,_,B){return Math.floor(Math.floor(A/B)/_)}function ne(A,_,B,W){let he=A.updateRanges;if(he.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,_.width,_.height,B,W,_.data);else{he.sort((Ne,xe)=>Ne.start-xe.start);let ue=0;for(let Ne=1;Ne<he.length;Ne++){let xe=he[ue],me=he[Ne],Ue=xe.start+xe.count,ke=J(me.start,_.width,4),Je=J(xe.start,_.width,4);me.start<=Ue+1&&ke===Je&&J(me.start+me.count-1,_.width,4)===ke?xe.count=Math.max(xe.count,me.start+me.count-xe.start):(++ue,he[ue]=me)}he.length=ue+1;let K=t.getParameter(n.UNPACK_ROW_LENGTH),ee=t.getParameter(n.UNPACK_SKIP_PIXELS),pe=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,_.width);for(let Ne=0,xe=he.length;Ne<xe;Ne++){let me=he[Ne],Ue=Math.floor(me.start/4),ke=Math.ceil(me.count/4),Je=Ue%_.width,F=Math.floor(Ue/_.width),ge=ke,Q=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,Je),t.pixelStorei(n.UNPACK_SKIP_ROWS,F),t.texSubImage2D(n.TEXTURE_2D,0,Je,F,ge,Q,B,W,_.data)}A.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,K),t.pixelStorei(n.UNPACK_SKIP_PIXELS,ee),t.pixelStorei(n.UNPACK_SKIP_ROWS,pe)}}function ye(A,_,B){let W=n.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(W=n.TEXTURE_2D_ARRAY),_.isData3DTexture&&(W=n.TEXTURE_3D);let $=et(A,_),he=_.source;t.bindTexture(W,A.__webglTexture,n.TEXTURE0+B);let ue=i.get(he);if(he.version!==ue.__version||$===!0){if(t.activeTexture(n.TEXTURE0+B),(typeof ImageBitmap<"u"&&_.image instanceof ImageBitmap)===!1){let Q=ot.getPrimaries(ot.workingColorSpace),_e=_.colorSpace===Mi?null:ot.getPrimaries(_.colorSpace),we=_.colorSpace===Mi||Q===_e?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,we)}t.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment);let ee=g(_.image,!1,s.maxTextureSize);ee=ut(_,ee);let pe=r.convert(_.format,_.colorSpace),Ne=r.convert(_.type),xe=y(_.internalFormat,pe,Ne,_.normalized,_.colorSpace,_.isVideoTexture);Ze(W,_);let me,Ue=_.mipmaps,ke=_.isVideoTexture!==!0,Je=ue.__version===void 0||$===!0,F=he.dataReady,ge=b(_,ee);if(_.isDepthTexture)xe=w(_.format===Wi,_.type),Je&&(ke?t.texStorage2D(n.TEXTURE_2D,1,xe,ee.width,ee.height):t.texImage2D(n.TEXTURE_2D,0,xe,ee.width,ee.height,0,pe,Ne,null));else if(_.isDataTexture)if(Ue.length>0){ke&&Je&&t.texStorage2D(n.TEXTURE_2D,ge,xe,Ue[0].width,Ue[0].height);for(let Q=0,_e=Ue.length;Q<_e;Q++)me=Ue[Q],ke?F&&t.texSubImage2D(n.TEXTURE_2D,Q,0,0,me.width,me.height,pe,Ne,me.data):t.texImage2D(n.TEXTURE_2D,Q,xe,me.width,me.height,0,pe,Ne,me.data);_.generateMipmaps=!1}else ke?(Je&&t.texStorage2D(n.TEXTURE_2D,ge,xe,ee.width,ee.height),F&&ne(_,ee,pe,Ne)):t.texImage2D(n.TEXTURE_2D,0,xe,ee.width,ee.height,0,pe,Ne,ee.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){ke&&Je&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ge,xe,Ue[0].width,Ue[0].height,ee.depth);for(let Q=0,_e=Ue.length;Q<_e;Q++)if(me=Ue[Q],_.format!==Rn)if(pe!==null)if(ke){if(F)if(_.layerUpdates.size>0){let we=Zh(me.width,me.height,_.format,_.type);for(let se of _.layerUpdates){let Fe=me.data.subarray(se*we/me.data.BYTES_PER_ELEMENT,(se+1)*we/me.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Q,0,0,se,me.width,me.height,1,pe,Fe)}}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Q,0,0,0,me.width,me.height,ee.depth,pe,me.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Q,xe,me.width,me.height,ee.depth,0,me.data,0,0);else Be("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ke?F&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Q,0,0,0,me.width,me.height,ee.depth,pe,Ne,me.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Q,xe,me.width,me.height,ee.depth,0,pe,Ne,me.data);_.layerUpdates.size>0&&_.clearLayerUpdates()}else{ke&&Je&&t.texStorage2D(n.TEXTURE_2D,ge,xe,Ue[0].width,Ue[0].height);for(let Q=0,_e=Ue.length;Q<_e;Q++)me=Ue[Q],_.format!==Rn?pe!==null?ke?F&&t.compressedTexSubImage2D(n.TEXTURE_2D,Q,0,0,me.width,me.height,pe,me.data):t.compressedTexImage2D(n.TEXTURE_2D,Q,xe,me.width,me.height,0,me.data):Be("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ke?F&&t.texSubImage2D(n.TEXTURE_2D,Q,0,0,me.width,me.height,pe,Ne,me.data):t.texImage2D(n.TEXTURE_2D,Q,xe,me.width,me.height,0,pe,Ne,me.data)}else if(_.isDataArrayTexture)if(ke){if(Je&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ge,xe,ee.width,ee.height,ee.depth),F)if(_.layerUpdates.size>0){let Q=Zh(ee.width,ee.height,_.format,_.type);for(let _e of _.layerUpdates){let we=ee.data.subarray(_e*Q/ee.data.BYTES_PER_ELEMENT,(_e+1)*Q/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,_e,ee.width,ee.height,1,pe,Ne,we)}_.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,pe,Ne,ee.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,xe,ee.width,ee.height,ee.depth,0,pe,Ne,ee.data);else if(_.isData3DTexture)ke?(Je&&t.texStorage3D(n.TEXTURE_3D,ge,xe,ee.width,ee.height,ee.depth),F&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,pe,Ne,ee.data)):t.texImage3D(n.TEXTURE_3D,0,xe,ee.width,ee.height,ee.depth,0,pe,Ne,ee.data);else if(_.isFramebufferTexture){if(Je)if(ke)t.texStorage2D(n.TEXTURE_2D,ge,xe,ee.width,ee.height);else{let Q=ee.width,_e=ee.height;for(let we=0;we<ge;we++)t.texImage2D(n.TEXTURE_2D,we,xe,Q,_e,0,pe,Ne,null),Q>>=1,_e>>=1}}else if(_.isHTMLTexture){if("texElementImage2D"in n){let Q=n.canvas;if(Q.hasAttribute("layoutsubtree")||Q.setAttribute("layoutsubtree","true"),ee.parentNode!==Q){Q.appendChild(ee),f.add(_),Q.onpaint=_e=>{let we=_e.changedElements;for(let se of f)we.includes(se.image)&&(se.needsUpdate=!0)},Q.requestPaint();return}if(n.texElementImage2D.length===3)n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,ee);else{let we=n.RGBA,se=n.RGBA,Fe=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,0,we,se,Fe,ee)}n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}}else if(Ue.length>0){if(ke&&Je){let Q=it(Ue[0]);t.texStorage2D(n.TEXTURE_2D,ge,xe,Q.width,Q.height)}for(let Q=0,_e=Ue.length;Q<_e;Q++)me=Ue[Q],ke?F&&t.texSubImage2D(n.TEXTURE_2D,Q,0,0,pe,Ne,me):t.texImage2D(n.TEXTURE_2D,Q,xe,pe,Ne,me);_.generateMipmaps=!1}else if(ke){if(Je){let Q=it(ee);t.texStorage2D(n.TEXTURE_2D,ge,xe,Q.width,Q.height)}F&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,pe,Ne,ee)}else t.texImage2D(n.TEXTURE_2D,0,xe,pe,Ne,ee);p(_)&&S(W),ue.__version=he.version,_.onUpdate&&_.onUpdate(_)}A.__version=_.version}function Ve(A,_,B){if(_.image.length!==6)return;let W=et(A,_),$=_.source;t.bindTexture(n.TEXTURE_CUBE_MAP,A.__webglTexture,n.TEXTURE0+B);let he=i.get($);if($.version!==he.__version||W===!0){t.activeTexture(n.TEXTURE0+B);let ue=ot.getPrimaries(ot.workingColorSpace),K=_.colorSpace===Mi?null:ot.getPrimaries(_.colorSpace),ee=_.colorSpace===Mi||ue===K?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ee);let pe=_.isCompressedTexture||_.image[0].isCompressedTexture,Ne=_.image[0]&&_.image[0].isDataTexture,xe=[];for(let se=0;se<6;se++)!pe&&!Ne?xe[se]=g(_.image[se],!0,s.maxCubemapSize):xe[se]=Ne?_.image[se].image:_.image[se],xe[se]=ut(_,xe[se]);let me=xe[0],Ue=r.convert(_.format,_.colorSpace),ke=r.convert(_.type),Je=y(_.internalFormat,Ue,ke,_.normalized,_.colorSpace),F=_.isVideoTexture!==!0,ge=he.__version===void 0||W===!0,Q=$.dataReady,_e=b(_,me);Ze(n.TEXTURE_CUBE_MAP,_);let we;if(pe){F&&ge&&t.texStorage2D(n.TEXTURE_CUBE_MAP,_e,Je,me.width,me.height);for(let se=0;se<6;se++){we=xe[se].mipmaps;for(let Fe=0;Fe<we.length;Fe++){let Le=we[Fe];_.format!==Rn?Ue!==null?F?Q&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,Fe,0,0,Le.width,Le.height,Ue,Le.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,Fe,Je,Le.width,Le.height,0,Le.data):Be("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):F?Q&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,Fe,0,0,Le.width,Le.height,Ue,ke,Le.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,Fe,Je,Le.width,Le.height,0,Ue,ke,Le.data)}}}else{if(we=_.mipmaps,F&&ge){we.length>0&&_e++;let se=it(xe[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,_e,Je,se.width,se.height)}for(let se=0;se<6;se++)if(Ne){F?Q&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,0,0,0,xe[se].width,xe[se].height,Ue,ke,xe[se].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,0,Je,xe[se].width,xe[se].height,0,Ue,ke,xe[se].data);for(let Fe=0;Fe<we.length;Fe++){let Mt=we[Fe].image[se].image;F?Q&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,Fe+1,0,0,Mt.width,Mt.height,Ue,ke,Mt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,Fe+1,Je,Mt.width,Mt.height,0,Ue,ke,Mt.data)}}else{F?Q&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,0,0,0,Ue,ke,xe[se]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,0,Je,Ue,ke,xe[se]);for(let Fe=0;Fe<we.length;Fe++){let Le=we[Fe];F?Q&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,Fe+1,0,0,Ue,ke,Le.image[se]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+se,Fe+1,Je,Ue,ke,Le.image[se])}}}p(_)&&S(n.TEXTURE_CUBE_MAP),he.__version=$.version,_.onUpdate&&_.onUpdate(_)}A.__version=_.version}function Ee(A,_,B,W,$,he){let ue=r.convert(B.format,B.colorSpace),K=r.convert(B.type),ee=y(B.internalFormat,ue,K,B.normalized,B.colorSpace),pe=i.get(_),Ne=i.get(B);if(Ne.__renderTarget=_,!pe.__hasExternalTextures){let xe=Math.max(1,_.width>>he),me=Math.max(1,_.height>>he);$===n.TEXTURE_3D||$===n.TEXTURE_2D_ARRAY?t.texImage3D($,he,ee,xe,me,_.depth,0,ue,K,null):t.texImage2D($,he,ee,xe,me,0,ue,K,null)}t.bindFramebuffer(n.FRAMEBUFFER,A),$e(_)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,W,$,Ne.__webglTexture,0,We(_)):($===n.TEXTURE_2D||$>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,W,$,Ne.__webglTexture,he),t.bindFramebuffer(n.FRAMEBUFFER,null)}function He(A,_,B){if(n.bindRenderbuffer(n.RENDERBUFFER,A),_.depthBuffer){let W=_.depthTexture,$=W&&W.isDepthTexture?W.type:null,he=w(_.stencilBuffer,$),ue=_.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;$e(_)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,We(_),he,_.width,_.height):B?n.renderbufferStorageMultisample(n.RENDERBUFFER,We(_),he,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,he,_.width,_.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,A)}else{let W=_.textures;for(let $=0;$<W.length;$++){let he=W[$],ue=r.convert(he.format,he.colorSpace),K=r.convert(he.type),ee=y(he.internalFormat,ue,K,he.normalized,he.colorSpace);$e(_)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,We(_),ee,_.width,_.height):B?n.renderbufferStorageMultisample(n.RENDERBUFFER,We(_),ee,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,ee,_.width,_.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function gt(A,_,B){let W=_.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,A),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let $=i.get(_.depthTexture);if($.__renderTarget=_,(!$.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),W){if($.__webglInit===void 0&&($.__webglInit=!0,_.depthTexture.addEventListener("dispose",C)),$.__webglTexture===void 0){$.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,$.__webglTexture),Ze(n.TEXTURE_CUBE_MAP,_.depthTexture);let pe=r.convert(_.depthTexture.format),Ne=r.convert(_.depthTexture.type),xe;_.depthTexture.format===jn?xe=n.DEPTH_COMPONENT24:_.depthTexture.format===Wi&&(xe=n.DEPTH24_STENCIL8);for(let me=0;me<6;me++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,xe,_.width,_.height,0,pe,Ne,null)}}else te(_.depthTexture,0);let he=$.__webglTexture,ue=We(_),K=W?n.TEXTURE_CUBE_MAP_POSITIVE_X+B:n.TEXTURE_2D,ee=_.depthTexture.format===Wi?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(_.depthTexture.format===jn)$e(_)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ee,K,he,0,ue):n.framebufferTexture2D(n.FRAMEBUFFER,ee,K,he,0);else if(_.depthTexture.format===Wi)$e(_)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ee,K,he,0,ue):n.framebufferTexture2D(n.FRAMEBUFFER,ee,K,he,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function ie(A){let _=i.get(A),B=A.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==A.depthTexture){let W=A.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),W){let $=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,W.removeEventListener("dispose",$)};W.addEventListener("dispose",$),_.__depthDisposeCallback=$}_.__boundDepthTexture=W}if(A.depthTexture&&!_.__autoAllocateDepthBuffer)if(B)for(let W=0;W<6;W++)gt(_.__webglFramebuffer[W],A,W);else{let W=A.texture.mipmaps;W&&W.length>0?gt(_.__webglFramebuffer[0],A,0):gt(_.__webglFramebuffer,A,0)}else if(B){_.__webglDepthbuffer=[];for(let W=0;W<6;W++)if(t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[W]),_.__webglDepthbuffer[W]===void 0)_.__webglDepthbuffer[W]=n.createRenderbuffer(),He(_.__webglDepthbuffer[W],A,!1);else{let $=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,he=_.__webglDepthbuffer[W];n.bindRenderbuffer(n.RENDERBUFFER,he),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,he)}}else{let W=A.texture.mipmaps;if(W&&W.length>0?t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=n.createRenderbuffer(),He(_.__webglDepthbuffer,A,!1);else{let $=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,he=_.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,he),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,he)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function re(A,_,B){let W=i.get(A);_!==void 0&&Ee(W.__webglFramebuffer,A,A.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),B!==void 0&&ie(A)}function ae(A){let _=A.texture,B=i.get(A),W=i.get(_);A.addEventListener("dispose",x);let $=A.textures,he=A.isWebGLCubeRenderTarget===!0,ue=$.length>1;if(ue||(W.__webglTexture===void 0&&(W.__webglTexture=n.createTexture()),W.__version=_.version,o.memory.textures++),he){B.__webglFramebuffer=[];for(let K=0;K<6;K++)if(_.mipmaps&&_.mipmaps.length>0){B.__webglFramebuffer[K]=[];for(let ee=0;ee<_.mipmaps.length;ee++)B.__webglFramebuffer[K][ee]=n.createFramebuffer()}else B.__webglFramebuffer[K]=n.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){B.__webglFramebuffer=[];for(let K=0;K<_.mipmaps.length;K++)B.__webglFramebuffer[K]=n.createFramebuffer()}else B.__webglFramebuffer=n.createFramebuffer();if(ue)for(let K=0,ee=$.length;K<ee;K++){let pe=i.get($[K]);pe.__webglTexture===void 0&&(pe.__webglTexture=n.createTexture(),o.memory.textures++)}if(A.samples>0&&$e(A)===!1){B.__webglMultisampledFramebuffer=n.createFramebuffer(),B.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let K=0;K<$.length;K++){let ee=$[K];B.__webglColorRenderbuffer[K]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,B.__webglColorRenderbuffer[K]);let pe=r.convert(ee.format,ee.colorSpace),Ne=r.convert(ee.type),xe=y(ee.internalFormat,pe,Ne,ee.normalized,ee.colorSpace,A.isXRRenderTarget===!0),me=We(A);n.renderbufferStorageMultisample(n.RENDERBUFFER,me,xe,A.width,A.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+K,n.RENDERBUFFER,B.__webglColorRenderbuffer[K])}n.bindRenderbuffer(n.RENDERBUFFER,null),A.depthBuffer&&(B.__webglDepthRenderbuffer=n.createRenderbuffer(),He(B.__webglDepthRenderbuffer,A,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(he){t.bindTexture(n.TEXTURE_CUBE_MAP,W.__webglTexture),Ze(n.TEXTURE_CUBE_MAP,_);for(let K=0;K<6;K++)if(_.mipmaps&&_.mipmaps.length>0)for(let ee=0;ee<_.mipmaps.length;ee++)Ee(B.__webglFramebuffer[K][ee],A,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+K,ee);else Ee(B.__webglFramebuffer[K],A,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+K,0);p(_)&&S(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ue){for(let K=0,ee=$.length;K<ee;K++){let pe=$[K],Ne=i.get(pe),xe=n.TEXTURE_2D;(A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(xe=A.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(xe,Ne.__webglTexture),Ze(xe,pe),Ee(B.__webglFramebuffer,A,pe,n.COLOR_ATTACHMENT0+K,xe,0),p(pe)&&S(xe)}t.unbindTexture()}else{let K=n.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(K=A.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(K,W.__webglTexture),Ze(K,_),_.mipmaps&&_.mipmaps.length>0)for(let ee=0;ee<_.mipmaps.length;ee++)Ee(B.__webglFramebuffer[ee],A,_,n.COLOR_ATTACHMENT0,K,ee);else Ee(B.__webglFramebuffer,A,_,n.COLOR_ATTACHMENT0,K,0);p(_)&&S(K),t.unbindTexture()}A.depthBuffer&&ie(A)}function ce(A){let _=A.textures;for(let B=0,W=_.length;B<W;B++){let $=_[B];if(p($)){let he=T(A),ue=i.get($).__webglTexture;t.bindTexture(he,ue),S(he),t.unbindTexture()}}}let de=[],ze=[];function Oe(A){if(A.samples>0){if($e(A)===!1){let _=A.textures,B=A.width,W=A.height,$=n.COLOR_BUFFER_BIT,he=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ue=i.get(A),K=_.length>1;if(K)for(let pe=0;pe<_.length;pe++)t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+pe,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+pe,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,ue.__webglMultisampledFramebuffer);let ee=A.texture.mipmaps;ee&&ee.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglFramebuffer);for(let pe=0;pe<_.length;pe++){if(A.resolveDepthBuffer&&(A.depthBuffer&&($|=n.DEPTH_BUFFER_BIT),A.stencilBuffer&&A.resolveStencilBuffer&&($|=n.STENCIL_BUFFER_BIT)),K){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,ue.__webglColorRenderbuffer[pe]);let Ne=i.get(_[pe]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Ne,0)}n.blitFramebuffer(0,0,B,W,0,0,B,W,$,n.NEAREST),c===!0&&(de.length=0,ze.length=0,de.push(n.COLOR_ATTACHMENT0+pe),A.depthBuffer&&A.storeMultisampledDepthBuffer===!1&&(de.push(he),ze.push(he),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,ze)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,de))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),K)for(let pe=0;pe<_.length;pe++){t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+pe,n.RENDERBUFFER,ue.__webglColorRenderbuffer[pe]);let Ne=i.get(_[pe]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+pe,n.TEXTURE_2D,Ne,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglMultisampledFramebuffer)}else if(A.depthBuffer&&A.storeMultisampledDepthBuffer===!1&&c){let _=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[_])}}}function We(A){return Math.min(s.maxSamples,A.samples)}function $e(A){let _=i.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function L(A){let _=o.render.frame;h.get(A)!==_&&(h.set(A,_),A.update())}function ut(A,_){let B=A.colorSpace,W=A.format,$=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||B!==Ur&&B!==Mi&&(ot.getTransfer(B)===pt?(W!==Rn||$!==fn)&&Be("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",B)),_}function it(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(l.width=A.naturalWidth||A.width,l.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(l.width=A.displayWidth,l.height=A.displayHeight):(l.width=A.width,l.height=A.height),l}this.allocateTextureUnit=k,this.resetTextureUnits=V,this.getTextureUnits=R,this.setTextureUnits=P,this.setTexture2D=te,this.setTexture2DArray=q,this.setTexture3D=Z,this.setTextureCube=j,this.rebindTextures=re,this.setupRenderTarget=ae,this.updateRenderTargetMipmap=ce,this.updateMultisampleRenderTarget=Oe,this.setupDepthRenderbuffer=ie,this.setupFrameBufferTexture=Ee,this.useMultisampledRTT=$e,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qy(n,e){function t(i,s=Mi){let r,o=ot.getTransfer(s);if(i===fn)return n.UNSIGNED_BYTE;if(i===_c)return n.UNSIGNED_SHORT_4_4_4_4;if(i===xc)return n.UNSIGNED_SHORT_5_5_5_1;if(i===Bh)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===zh)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===Fh)return n.BYTE;if(i===Oh)return n.SHORT;if(i===tr)return n.UNSIGNED_SHORT;if(i===gc)return n.INT;if(i===kn)return n.UNSIGNED_INT;if(i===Cn)return n.FLOAT;if(i===Vn)return n.HALF_FLOAT;if(i===kh)return n.ALPHA;if(i===Vh)return n.RGB;if(i===Rn)return n.RGBA;if(i===jn)return n.DEPTH_COMPONENT;if(i===Wi)return n.DEPTH_STENCIL;if(i===vc)return n.RED;if(i===yc)return n.RED_INTEGER;if(i===Xi)return n.RG;if(i===Mc)return n.RG_INTEGER;if(i===Sc)return n.RGBA_INTEGER;if(i===fo||i===po||i===mo||i===go)if(o===pt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===fo)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===po)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===mo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===go)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===fo)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===po)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===mo)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===go)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===bc||i===wc||i===Ec||i===Tc)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===bc)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===wc)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ec)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Tc)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Ac||i===Cc||i===Rc||i===Ic||i===Pc||i===_o||i===Lc)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(i===Ac||i===Cc)return o===pt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===Rc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(i===Ic)return r.COMPRESSED_R11_EAC;if(i===Pc)return r.COMPRESSED_SIGNED_R11_EAC;if(i===_o)return r.COMPRESSED_RG11_EAC;if(i===Lc)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===Dc||i===Nc||i===Uc||i===Fc||i===Oc||i===Bc||i===zc||i===kc||i===Vc||i===Gc||i===Hc||i===Wc||i===Xc||i===qc)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(i===Dc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Nc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Uc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Fc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Oc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Bc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===zc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===kc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Vc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Gc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Hc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Wc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Xc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===qc)return o===pt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Yc||i===Zc||i===$c)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(i===Yc)return o===pt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Zc)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===$c)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Jc||i===Kc||i===xo||i===jc)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(i===Jc)return r.COMPRESSED_RED_RGTC1_EXT;if(i===Kc)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===xo)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===jc)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===nr?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}var Yy=`
4552void main() {
4553
4554 gl_Position = vec4( position, 1.0 );
4555
4556}`,Zy=`
4557uniform sampler2DArray depthColor;
4558uniform float depthWidth;
4559uniform float depthHeight;
4560
4561void main() {
4562
4563 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4564
4565 if ( coord.x >= 1.0 ) {
4566
4567 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4568
4569 } else {
4570
4571 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4572
4573 }
4574
4575}`,fu=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let i=new Yr(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,i=new yn({vertexShader:Yy,fragmentShader:Zy,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Rt(new vn(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},pu=class extends Qn{constructor(e,t){super();let i=this,s=null,r=1,o=null,a="local-floor",c=1,l=null,h=null,f=null,u=null,d=null,m=null,v=typeof XRWebGLBinding<"u",g=new fu,p={},S=t.getContextAttributes(),T=null,y=null,w=[],b=[],C=new le,x=null,E=null,I=new en;I.viewport=new At;let D=new en;D.viewport=new At;let O=[I,D],V=new lc,R=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let ne=w[J];return ne===void 0&&(ne=new Ws,w[J]=ne),ne.getTargetRaySpace()},this.getControllerGrip=function(J){let ne=w[J];return ne===void 0&&(ne=new Ws,w[J]=ne),ne.getGripSpace()},this.getHand=function(J){let ne=w[J];return ne===void 0&&(ne=new Ws,w[J]=ne),ne.getHandSpace()};function k(J){let ne=b.indexOf(J.inputSource);if(ne===-1)return;let ye=w[ne];ye!==void 0&&(ye.update(J.inputSource,J.frame,l||o),ye.dispatchEvent({type:J.type,data:J.inputSource}))}function X(){s.removeEventListener("select",k),s.removeEventListener("selectstart",k),s.removeEventListener("selectend",k),s.removeEventListener("squeeze",k),s.removeEventListener("squeezestart",k),s.removeEventListener("squeezeend",k),s.removeEventListener("end",X),s.removeEventListener("inputsourceschange",te);for(let J=0;J<w.length;J++){let ne=b[J];ne!==null&&(b[J]=null,w[J].disconnect(ne))}R=null,P=null,g.reset();for(let J in p)delete p[J];if(e.setRenderTarget(T),d=null,u=null,f=null,s=null,y=null,et.stop(),i.isPresenting=!1,e.setPixelRatio(x),e.setSize(C.width,C.height,!1),E!==null){let J=E.camera;J.fov=E.fov,J.zoom=E.zoom,J.updateProjectionMatrix(),E=null}i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){r=J,i.isPresenting===!0&&Be("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){a=J,i.isPresenting===!0&&Be("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(J){l=J},this.getBaseLayer=function(){return u!==null?u:d},this.getBinding=function(){return f===null&&v&&(f=new XRWebGLBinding(s,t)),f},this.getFrame=function(){return m},this.getSession=function(){return s},this.setSession=async function(J){if(s=J,s!==null){if(T=e.getRenderTarget(),s.addEventListener("select",k),s.addEventListener("selectstart",k),s.addEventListener("selectend",k),s.addEventListener("squeeze",k),s.addEventListener("squeezestart",k),s.addEventListener("squeezeend",k),s.addEventListener("end",X),s.addEventListener("inputsourceschange",te),S.xrCompatible!==!0&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(C),v&&"createProjectionLayer"in XRWebGLBinding.prototype){let ye=null,Ve=null,Ee=null;S.depth&&(Ee=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ye=S.stencil?Wi:jn,Ve=S.stencil?nr:kn);let He={colorFormat:t.RGBA8,depthFormat:Ee,scaleFactor:r};f=this.getBinding(),u=f.createProjectionLayer(He),s.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),y=new dn(u.textureWidth,u.textureHeight,{format:Rn,type:fn,depthTexture:new Fi(u.textureWidth,u.textureHeight,Ve,void 0,void 0,void 0,void 0,void 0,void 0,ye),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1,storeMultisampledDepthBuffer:u.ignoreDepthValues===!1,storeMultisampledStencilBuffer:u.ignoreDepthValues===!1})}else{let ye={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(s,t,ye),s.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),y=new dn(d.framebufferWidth,d.framebufferHeight,{format:Rn,type:fn,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await s.requestReferenceSpace(a),et.setContext(s),et.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function te(J){for(let ne=0;ne<J.removed.length;ne++){let ye=J.removed[ne],Ve=b.indexOf(ye);Ve>=0&&(b[Ve]=null,w[Ve].disconnect(ye))}for(let ne=0;ne<J.added.length;ne++){let ye=J.added[ne],Ve=b.indexOf(ye);if(Ve===-1){for(let He=0;He<w.length;He++)if(He>=b.length){b.push(ye),Ve=He;break}else if(b[He]===null){b[He]=ye,Ve=He;break}if(Ve===-1)break}let Ee=w[Ve];Ee&&Ee.connect(ye)}}let q=new N,Z=new N;function j(J,ne,ye){q.setFromMatrixPosition(ne.matrixWorld),Z.setFromMatrixPosition(ye.matrixWorld);let Ve=q.distanceTo(Z),Ee=ne.projectionMatrix.elements,He=ye.projectionMatrix.elements,gt=Ee[14]/(Ee[10]-1),ie=Ee[14]/(Ee[10]+1),re=(Ee[9]+1)/Ee[5],ae=(Ee[9]-1)/Ee[5],ce=(Ee[8]-1)/Ee[0],de=(He[8]+1)/He[0],ze=gt*ce,Oe=gt*de,We=Ve/(-ce+de),$e=We*-ce;if(ne.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX($e),J.translateZ(We),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),Ee[10]===-1)J.projectionMatrix.copy(ne.projectionMatrix),J.projectionMatrixInverse.copy(ne.projectionMatrixInverse);else{let L=gt+We,ut=ie+We,it=ze-$e,A=Oe+(Ve-$e),_=re*ie/ut*L,B=ae*ie/ut*L;J.projectionMatrix.makePerspective(it,A,_,B,L,ut),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function Re(J,ne){ne===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(ne.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(s===null)return;let ne=J.near,ye=J.far;g.texture!==null&&(g.depthNear>0&&(ne=g.depthNear),g.depthFar>0&&(ye=g.depthFar)),V.near=D.near=I.near=ne,V.far=D.far=I.far=ye,(R!==V.near||P!==V.far)&&(s.updateRenderState({depthNear:V.near,depthFar:V.far}),R=V.near,P=V.far),V.layers.mask=J.layers.mask|6,I.layers.mask=V.layers.mask&-5,D.layers.mask=V.layers.mask&-3;let Ve=J.parent,Ee=V.cameras;Re(V,Ve);for(let He=0;He<Ee.length;He++)Re(Ee[He],Ve);Ee.length===2?j(V,I,D):V.projectionMatrix.copy(I.projectionMatrix),E===null&&J.isPerspectiveCamera&&(E={camera:J,fov:J.fov,zoom:J.zoom}),be(J,V,Ve)};function be(J,ne,ye){ye===null?J.matrix.copy(ne.matrixWorld):(J.matrix.copy(ye.matrixWorld),J.matrix.invert(),J.matrix.multiply(ne.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(ne.projectionMatrix),J.projectionMatrixInverse.copy(ne.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=Na*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return V},this.getFoveation=function(){if(!(u===null&&d===null))return c},this.setFoveation=function(J){c=J,u!==null&&(u.fixedFoveation=J),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=J)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(V)},this.getCameraTexture=function(J){return p[J]};let Ke=null;function Ze(J,ne){if(h=ne.getViewerPose(l||o),m=ne,h!==null){let ye=h.views;d!==null&&(e.setRenderTargetFramebuffer(y,d.framebuffer),e.setRenderTarget(y));let Ve=!1;ye.length!==V.cameras.length&&(V.cameras.length=0,Ve=!0);for(let ie=0;ie<ye.length;ie++){let re=ye[ie],ae=null;if(d!==null)ae=d.getViewport(re);else{let de=f.getViewSubImage(u,re);ae=de.viewport,ie===0&&(e.setRenderTargetTextures(y,de.colorTexture,de.depthStencilTexture),e.setRenderTarget(y))}let ce=O[ie];ce===void 0&&(ce=new en,ce.layers.enable(ie),ce.viewport=new At,O[ie]=ce),ce.matrix.fromArray(re.transform.matrix),ce.matrix.decompose(ce.position,ce.quaternion,ce.scale),ce.projectionMatrix.fromArray(re.projectionMatrix),ce.projectionMatrixInverse.copy(ce.projectionMatrix).invert(),ce.viewport.set(ae.x,ae.y,ae.width,ae.height),ie===0&&(V.matrix.copy(ce.matrix),V.matrix.decompose(V.position,V.quaternion,V.scale)),Ve===!0&&V.cameras.push(ce)}let Ee=s.enabledFeatures;if(Ee&&Ee.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&v){f=i.getBinding();let ie=f.getDepthInformation(ye[0]);ie&&ie.isValid&&ie.texture&&g.init(ie,s.renderState)}if(Ee&&Ee.includes("camera-access")&&v){e.state.unbindTexture(),f=i.getBinding();for(let ie=0;ie<ye.length;ie++){let re=ye[ie].camera;if(re){let ae=p[re];ae||(ae=new Yr,p[re]=ae);let ce=f.getCameraImage(re);ae.sourceTexture=ce}}}}for(let ye=0;ye<w.length;ye++){let Ve=b[ye],Ee=w[ye];Ve!==null&&Ee!==void 0&&Ee.update(Ve,ne,l||o)}Ke&&Ke(J,ne),ne.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ne}),m=null}let et=new ep;et.setAnimationLoop(Ze),this.setAnimationLoop=function(J){Ke=J},this.dispose=function(){}}},$y=new ht,op=new Ye;op.set(-1,0,0,0,1,0,0,0,1);function Jy(n,e){function t(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function i(g,p){p.color.getRGB(g.fogColor.value,Xh(n)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function s(g,p,S,T,y){p.isNodeMaterial?p.uniformsNeedUpdate=!1:p.isMeshBasicMaterial?r(g,p):p.isMeshLambertMaterial?(r(g,p),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(r(g,p),f(g,p)):p.isMeshPhongMaterial?(r(g,p),h(g,p),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(r(g,p),u(g,p),p.isMeshPhysicalMaterial&&d(g,p,y)):p.isMeshMatcapMaterial?(r(g,p),m(g,p)):p.isMeshDepthMaterial?r(g,p):p.isMeshDistanceMaterial?(r(g,p),v(g,p)):p.isMeshNormalMaterial?r(g,p):p.isLineBasicMaterial?(o(g,p),p.isLineDashedMaterial&&a(g,p)):p.isPointsMaterial?c(g,p,S,T):p.isSpriteMaterial?l(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,t(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===$t&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,t(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===$t&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,t(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,t(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let S=e.get(p),T=S.envMap,y=S.envMapRotation;T&&(g.envMap.value=T,g.envMapRotation.value.setFromMatrix4($y.makeRotationFromEuler(y)).transpose(),T.isCubeTexture&&T.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(op),g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function c(g,p,S,T){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*S,g.scale.value=T*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function l(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function f(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function u(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function d(g,p,S){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===$t&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.retroreflectivity>0&&(g.retroreflectivity.value=p.retroreflectivity),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=S.texture,g.transmissionSamplerSize.value.set(S.width,S.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function v(g,p){let S=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(S.matrixWorld),g.nearDistance.value=S.shadow.camera.near,g.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function Ky(n,e,t,i){let s={},r={},o=[],a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function c(y,w){let b=w.program;i.uniformBlockBinding(y,b)}function l(y,w){let b=s[y.id];b===void 0&&(g(y),b=h(y),s[y.id]=b,y.addEventListener("dispose",S));let C=w.program;i.updateUBOMapping(y,C);let x=e.render.frame;r[y.id]!==x&&(u(y),r[y.id]=x)}function h(y){let w=f();y.__bindingPointIndex=w;let b=n.createBuffer(),C=y.__size,x=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,b),n.bufferData(n.UNIFORM_BUFFER,C,x),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,b),b}function f(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(y){let w=s[y.id],b=y.uniforms,C=y.__cache;n.bindBuffer(n.UNIFORM_BUFFER,w);for(let x=0,E=b.length;x<E;x++){let I=b[x];if(Array.isArray(I))for(let D=0,O=I.length;D<O;D++)d(I[D],x,D,C);else d(I,x,0,C)}n.bindBuffer(n.UNIFORM_BUFFER,null)}function d(y,w,b,C){if(v(y,w,b,C)===!0){let x=y.__offset,E=y.value;if(Array.isArray(E)){let I=0;for(let D=0;D<E.length;D++){let O=E[D],V=p(O);m(O,y.__data,I),typeof O!="number"&&typeof O!="boolean"&&!O.isMatrix3&&!ArrayBuffer.isView(O)&&(I+=V.storage/Float32Array.BYTES_PER_ELEMENT)}}else m(E,y.__data,0);n.bufferSubData(n.UNIFORM_BUFFER,x,y.__data)}}function m(y,w,b){typeof y=="number"||typeof y=="boolean"?w[0]=y:y.isMatrix3?(w[0]=y.elements[0],w[1]=y.elements[1],w[2]=y.elements[2],w[3]=0,w[4]=y.elements[3],w[5]=y.elements[4],w[6]=y.elements[5],w[7]=0,w[8]=y.elements[6],w[9]=y.elements[7],w[10]=y.elements[8],w[11]=0):ArrayBuffer.isView(y)?w.set(new y.constructor(y.buffer,y.byteOffset,w.length)):y.toArray(w,b)}function v(y,w,b,C){let x=y.value,E=w+"_"+b;if(C[E]===void 0)return typeof x=="number"||typeof x=="boolean"?C[E]=x:ArrayBuffer.isView(x)?C[E]=x.slice():C[E]=x.clone(),!0;{let I=C[E];if(typeof x=="number"||typeof x=="boolean"){if(I!==x)return C[E]=x,!0}else{if(ArrayBuffer.isView(x))return!0;if(I.equals(x)===!1)return I.copy(x),!0}}return!1}function g(y){let w=y.uniforms,b=0,C=16;for(let E=0,I=w.length;E<I;E++){let D=Array.isArray(w[E])?w[E]:[w[E]];for(let O=0,V=D.length;O<V;O++){let R=D[O],P=Array.isArray(R.value)?R.value:[R.value];for(let k=0,X=P.length;k<X;k++){let te=P[k],q=p(te),Z=b%C,j=Z%q.boundary,Re=Z+j;b+=j,Re!==0&&C-Re<q.storage&&(b+=C-Re),R.__data=new Float32Array(q.storage/Float32Array.BYTES_PER_ELEMENT),R.__offset=b,b+=q.storage}}}let x=b%C;return x>0&&(b+=C-x),y.__size=b,y.__cache={},this}function p(y){let w={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?Be("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(y)?(w.boundary=16,w.storage=y.byteLength):Be("WebGLRenderer: Unsupported uniform value type.",y),w}function S(y){let w=y.target;w.removeEventListener("dispose",S);let b=o.indexOf(w.__bindingPointIndex);o.splice(b,1),n.deleteBuffer(s[w.id]),delete s[w.id],delete r[w.id]}function T(){for(let y in s)n.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:c,update:l,dispose:T}}var jy=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]),ii=null;function Qy(){return ii===null&&(ii=new Hr(jy,16,16,Xi,Vn),ii.name="DFG_LUT",ii.minFilter=Yt,ii.magFilter=Yt,ii.wrapS=Jn,ii.wrapT=Jn,ii.generateMipmaps=!1,ii.needsUpdate=!0),ii}var ol=class{constructor(e={}){let{canvas:t=Mf(),context:i=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:u=!1,outputBufferType:d=fn}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=o;let v=d,g=new Set([Sc,Mc,yc]),p=new Set([fn,kn,tr,nr,_c,xc]),S=new Uint32Array(4),T=new Int32Array(4),y=new N,w=null,b=null,C=[],x=[],E=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=zn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let I=this,D=!1,O=null,V=null,R=null,P=null;this._outputColorSpace=sn;let k=0,X=0,te=null,q=-1,Z=null,j=new At,Re=new At,be=null,Ke=new Xe(0),Ze=0,et=t.width,J=t.height,ne=1,ye=null,Ve=null,Ee=new At(0,0,et,J),He=new At(0,0,et,J),gt=!1,ie=new qs,re=!1,ae=!1,ce=new ht,de=new N,ze=new At,Oe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},We=!1;function $e(){return te===null?ne:1}let L=i;function ut(M,U){return t.getContext(M,U)}let it,A,_,B,W,$,he,ue,K,ee,pe,Ne,xe,me,Ue,ke,Je,F,ge,Q,_e,we,se;try{let M={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"186"}`),t.addEventListener("webglcontextlost",Mt,!1),t.addEventListener("webglcontextrestored",dt,!1),t.addEventListener("webglcontextcreationerror",In,!1),L===null){let U="webgl2";if(L=ut(U,M),L===null)throw ut(U)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}Fe()}catch(M){throw t.removeEventListener("webglcontextlost",Mt,!1),t.removeEventListener("webglcontextrestored",dt,!1),t.removeEventListener("webglcontextcreationerror",In,!1),Ge("WebGLRenderer: "+M.message),M}function Fe(){it=new ov(L),it.init(),_e=new qy(L,it),A=new Jx(L,it,e,_e),_=new Wy(L,it),A.reversedDepthBuffer&&u&&_.buffers.depth.setReversed(!0),V=L.createFramebuffer(),R=L.createFramebuffer(),P=L.createFramebuffer(),B=new lv(L),W=new Iy,$=new Xy(L,it,_,W,A,_e,B),he=new rv(I),ue=new u0(L),we=new Zx(L,ue),K=new av(L,ue,B,we),ee=new uv(L,K,ue,we,B),F=new hv(L,A,$),Ue=new Kx(W),pe=new Ry(I,he,it,A,we,Ue),Ne=new Jy(I,W),xe=new Ly,me=new By(it),Je=new Yx(I,he,_,ee,m,c),ke=new Hy(I,ee,A),se=new Ky(L,B,A,_),ge=new $x(L,it,B),Q=new cv(L,it,B),B.programs=pe.programs,I.capabilities=A,I.extensions=it,I.properties=W,I.renderLists=xe,I.shadowMap=ke,I.state=_,I.info=B}v!==fn&&(E=new fv(v,t.width,t.height,a,s,r));let Le=new pu(I,L);this.xr=Le,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let M=it.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){let M=it.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(M){M!==void 0&&(ne=M,this.setSize(et,J,!1))},this.getSize=function(M){return M.set(et,J)},this.setSize=function(M,U,Y=!0){if(Le.isPresenting){Be("WebGLRenderer: Can't change size while VR device is presenting.");return}et=M,J=U,t.width=Math.floor(M*ne),t.height=Math.floor(U*ne),Y===!0&&(t.style.width=M+"px",t.style.height=U+"px"),E!==null&&E.setSize(t.width,t.height),this.setViewport(0,0,M,U)},this.getDrawingBufferSize=function(M){return M.set(et*ne,J*ne).floor()},this.setDrawingBufferSize=function(M,U,Y){et=M,J=U,ne=Y,t.width=Math.floor(M*Y),t.height=Math.floor(U*Y),this.setViewport(0,0,M,U)},this.setEffects=function(M){if(v===fn){Ge("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(M){for(let U=0;U<M.length;U++)if(M[U].isOutputPass===!0){Be("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}E.setEffects(M||[])},this.getCurrentViewport=function(M){return M.copy(j)},this.getViewport=function(M){return M.copy(Ee)},this.setViewport=function(M,U,Y,G){M.isVector4?Ee.set(M.x,M.y,M.z,M.w):Ee.set(M,U,Y,G),_.viewport(j.copy(Ee).multiplyScalar(ne).round())},this.getScissor=function(M){return M.copy(He)},this.setScissor=function(M,U,Y,G){M.isVector4?He.set(M.x,M.y,M.z,M.w):He.set(M,U,Y,G),_.scissor(Re.copy(He).multiplyScalar(ne).round())},this.getScissorTest=function(){return gt},this.setScissorTest=function(M){_.setScissorTest(gt=M)},this.setOpaqueSort=function(M){ye=M},this.setTransparentSort=function(M){Ve=M},this.getClearColor=function(M){return M.copy(Je.getClearColor())},this.setClearColor=function(){Je.setClearColor(...arguments)},this.getClearAlpha=function(){return Je.getClearAlpha()},this.setClearAlpha=function(){Je.setClearAlpha(...arguments)},this.clear=function(M=!0,U=!0,Y=!0){let G=0;if(M){let H=!1;if(te!==null){let Se=te.texture.format;H=g.has(Se)}if(H){let Se=te.texture.type,Ce=p.has(Se),Me=Je.getClearColor(),Ie=Je.getClearAlpha(),De=Me.r,je=Me.g,st=Me.b;Ce?(S[0]=De,S[1]=je,S[2]=st,S[3]=Ie,L.clearBufferuiv(L.COLOR,0,S)):(T[0]=De,T[1]=je,T[2]=st,T[3]=Ie,L.clearBufferiv(L.COLOR,0,T))}else G|=L.COLOR_BUFFER_BIT}U&&(G|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),Y&&(G|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),G!==0&&L.clear(G)},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(M){M.setRenderer(this),O=M},this.dispose=function(){t.removeEventListener("webglcontextlost",Mt,!1),t.removeEventListener("webglcontextrestored",dt,!1),t.removeEventListener("webglcontextcreationerror",In,!1),Je.dispose(),xe.dispose(),me.dispose(),W.dispose(),he.dispose(),ee.dispose(),we.dispose(),se.dispose(),pe.dispose(),Le.dispose(),Le.removeEventListener("sessionstart",Tu),Le.removeEventListener("sessionend",Au),Ki.stop()};function Mt(M){M.preventDefault(),Hh("WebGLRenderer: Context Lost."),D=!0}function dt(){Hh("WebGLRenderer: Context Restored."),D=!1;let M=B.autoReset,U=ke.enabled,Y=ke.autoUpdate,G=ke.needsUpdate,H=ke.type;Fe(),B.autoReset=M,ke.enabled=U,ke.autoUpdate=Y,ke.needsUpdate=G,ke.type=H}function In(M){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function Hn(M){let U=M.target;U.removeEventListener("dispose",Hn),xm(U)}function xm(M){vm(M),W.remove(M)}function vm(M){let U=W.get(M).programs;U!==void 0&&(U.forEach(function(Y){pe.releaseProgram(Y)}),M.isShaderMaterial&&pe.releaseShaderCache(M))}this.renderBufferDirect=function(M,U,Y,G,H,Se){U===null&&(U=Oe);let Ce=H.isMesh&&H.matrixWorld.determinantAffine()<0,Me=Sm(M,U,Y,G,H);_.setMaterial(G,Ce);let Ie=Y.index,De=1;if(G.wireframe===!0){if(Ie=K.getWireframeAttribute(Y),Ie===void 0)return;De=2}let je=Y.drawRange,st=Y.attributes.position,Pe=je.start*De,ft=(je.start+je.count)*De;Se!==null&&(Pe=Math.max(Pe,Se.start*De),ft=Math.min(ft,(Se.start+Se.count)*De)),Ie!==null?(Pe=Math.max(Pe,0),ft=Math.min(ft,Ie.count)):st!=null&&(Pe=Math.max(Pe,0),ft=Math.min(ft,st.count));let Dt=ft-Pe;if(Dt<0||Dt===1/0)return;we.setup(H,G,Me,Y,Ie);let Et,xt=ge;if(Ie!==null&&(Et=ue.get(Ie),xt=Q,xt.setIndex(Et)),H.isMesh)G.wireframe===!0?(_.setLineWidth(G.wireframeLinewidth*$e()),xt.setMode(L.LINES)):xt.setMode(L.TRIANGLES);else if(H.isLine){let Jt=G.linewidth;Jt===void 0&&(Jt=1),_.setLineWidth(Jt*$e()),H.isLineSegments?xt.setMode(L.LINES):H.isLineLoop?xt.setMode(L.LINE_LOOP):xt.setMode(L.LINE_STRIP)}else H.isPoints?xt.setMode(L.POINTS):H.isSprite&&xt.setMode(L.TRIANGLES);if(H.isBatchedMesh)if(it.get("WEBGL_multi_draw"))xt.renderMultiDraw(H._multiDrawStarts,H._multiDrawCounts,H._multiDrawCount);else{let Jt=H._multiDrawStarts,Te=H._multiDrawCounts,nn=H._multiDrawCount,ct=Ie?ue.get(Ie).bytesPerElement:1,bn=W.get(G).currentProgram.getUniforms();for(let Wn=0;Wn<nn;Wn++)bn.setValue(L,"_gl_DrawID",Wn),xt.render(Jt[Wn]/ct,Te[Wn])}else if(H.isInstancedMesh)xt.renderInstances(Pe,Dt,H.count);else if(Y.isInstancedBufferGeometry){let Jt=Y._maxInstanceCount!==void 0?Y._maxInstanceCount:1/0,Te=Math.min(Y.instanceCount,Jt);xt.renderInstances(Pe,Dt,Te)}else xt.render(Pe,Dt)};function Eu(M,U,Y,G){O!==null&&M.isNodeMaterial&&O.setObject(G,M),re===!0&&Ue.setState(M,Y,!1),M.transparent===!0&&M.side===An&&M.forceSinglePass===!1?(M.side=$t,M.needsUpdate=!0,Io(M,U,G),M.side=Tn,M.needsUpdate=!0,Io(M,U,G),M.side=An):Io(M,U,G)}this.compile=function(M,U,Y=null){Y===null&&(Y=M),O!==null&&O.renderStart(M,U,Y),b=me.get(Y),b.init(U),x.push(b),Y.traverseVisible(function(H){H.isLight&&H.layers.test(U.layers)&&(b.pushLight(H),H.castShadow&&b.pushShadow(H))}),M!==Y&&M.traverseVisible(function(H){H.isLight&&H.layers.test(U.layers)&&(b.pushLight(H),H.castShadow&&b.pushShadow(H))}),b.setupLights(),O!==null&&O.updateLights(b.state.lightsArray),ae=this.localClippingEnabled,re=Ue.init(this.clippingPlanes,ae),re===!0&&Ue.setGlobalState(this.clippingPlanes,U),O!==null&&ke.render(b.state.shadowsArray,Y,U);let G=new Set;return M.traverse(function(H){if(!(H.isMesh||H.isPoints||H.isLine||H.isSprite))return;let Se=H.material;if(Se)if(Array.isArray(Se))for(let Ce=0;Ce<Se.length;Ce++){let Me=Se[Ce];Eu(Me,Y,U,H),G.add(Me)}else Eu(Se,Y,U,H),G.add(Se)}),b=x.pop(),O!==null&&O.renderEnd(),G},this.compileAsync=function(M,U,Y=null){let G=this.compile(M,U,Y);return new Promise(H=>{function Se(){if(G.forEach(function(Ce){let Ie=W.get(Ce).currentProgram;(Ie===void 0||Ie.isReady())&&G.delete(Ce)}),G.size===0){H(M);return}setTimeout(Se,10)}it.get("KHR_parallel_shader_compile")!==null?Se():setTimeout(Se,10)})};let yl=null;function ym(M){yl&&yl(M)}function Tu(){Ki.stop()}function Au(){Ki.start()}let Ki=new ep;Ki.setAnimationLoop(ym),typeof self<"u"&&Ki.setContext(self),this.setAnimationLoop=function(M){yl=M,Le.setAnimationLoop(M),M===null?Ki.stop():Ki.start()},Le.addEventListener("sessionstart",Tu),Le.addEventListener("sessionend",Au),this.render=function(M,U){if(U!==void 0&&U.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;O!==null&&O.renderStart(M,U);let Y=Le.enabled===!0&&Le.isPresenting===!0,G=E!==null&&(te===null||Y)&&E.begin(I,te);if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),Le.enabled===!0&&Le.isPresenting===!0&&(E===null||E.isCompositing()===!1)&&(Le.cameraAutoUpdate===!0&&Le.updateCamera(U),U=Le.getCamera()),M.isScene===!0&&M.onBeforeRender(I,M,U,te),b=me.get(M,x.length),b.init(U),b.state.textureUnits=$.getTextureUnits(),x.push(b),ce.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),ie.setFromProjectionMatrix(ce,On,U.reversedDepth),ae=this.localClippingEnabled,re=Ue.init(this.clippingPlanes,ae),w=xe.get(M,C.length),w.init(),C.push(w),Le.enabled===!0&&Le.isPresenting===!0){let Ce=I.xr.getDepthSensingMesh();Ce!==null&&Ml(Ce,U,-1/0,I.sortObjects)}Ml(M,U,0,I.sortObjects),w.finish(),O!==null&&O.updateLights(b.state.lightsArray),I.sortObjects===!0&&w.sort(ye,Ve),We=Le.enabled===!1||Le.isPresenting===!1||Le.hasDepthSensing()===!1,We&&Je.addToRenderList(w,M),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),re===!0&&Ue.beginShadows();let H=b.state.shadowsArray;if(ke.render(H,M,U),re===!0&&Ue.endShadows(),(G&&E.hasRenderPass())===!1){let Ce=w.opaque,Me=w.transmissive;if(b.setupLights(),U.isArrayCamera){let Ie=U.cameras;if(Me.length>0)for(let De=0,je=Ie.length;De<je;De++){let st=Ie[De];Ru(Ce,Me,M,st)}We&&Je.render(M);for(let De=0,je=Ie.length;De<je;De++){let st=Ie[De];Cu(w,M,st,st.viewport)}}else Me.length>0&&Ru(Ce,Me,M,U),We&&Je.render(M),Cu(w,M,U)}te!==null&&X===0&&($.updateMultisampleRenderTarget(te),$.updateRenderTargetMipmap(te)),G&&E.end(I),M.isScene===!0&&M.onAfterRender(I,M,U),we.resetDefaultState(),q=-1,Z=null,x.pop(),x.length>0?(b=x[x.length-1],$.setTextureUnits(b.state.textureUnits),re===!0&&Ue.setGlobalState(I.clippingPlanes,b.state.camera)):b=null,C.pop(),C.length>0?w=C[C.length-1]:w=null,O!==null&&O.renderEnd()};function Ml(M,U,Y,G){if(M.visible===!1)return;if(M.layers.test(U.layers)){if(M.isGroup)Y=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(U);else if(M.isLightProbeGrid)b.pushLightProbeGrid(M);else if(M.isLight)b.pushLight(M),M.castShadow&&b.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||M.intersectsFrustum(ie)){G&&ze.setFromMatrixPosition(M.matrixWorld).applyMatrix4(ce);let Ce=ee.update(M),Me=M.material;Me.visible&&w.push(M,Ce,Me,Y,ze.z,null,U)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||M.intersectsFrustum(ie))){let Ce=ee.update(M),Me=M.material;if(G&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),ze.copy(M.boundingSphere.center)):(Ce.boundingSphere===null&&Ce.computeBoundingSphere(),ze.copy(Ce.boundingSphere.center)),ze.applyMatrix4(M.matrixWorld).applyMatrix4(ce)),Array.isArray(Me)){let Ie=Ce.groups;for(let De=0,je=Ie.length;De<je;De++){let st=Ie[De],Pe=Me[st.materialIndex];Pe&&Pe.visible&&w.push(M,Ce,Pe,Y,ze.z,st,U)}}else Me.visible&&w.push(M,Ce,Me,Y,ze.z,null,U)}}let Se=M.children;for(let Ce=0,Me=Se.length;Ce<Me;Ce++)Ml(Se[Ce],U,Y,G)}function Cu(M,U,Y,G){let{opaque:H,transmissive:Se,transparent:Ce}=M;b.setupLightsView(Y),re===!0&&Ue.setGlobalState(I.clippingPlanes,Y),G&&_.viewport(j.copy(G)),H.length>0&&Ro(H,U,Y),Se.length>0&&Ro(Se,U,Y),Ce.length>0&&Ro(Ce,U,Y),_.buffers.depth.setTest(!0),_.buffers.depth.setMask(!0),_.buffers.color.setMask(!0),_.setPolygonOffset(!1)}function Ru(M,U,Y,G){if((Y.isScene===!0?Y.overrideMaterial:null)!==null)return;if(b.state.transmissionRenderTarget[G.id]===void 0){let Pe=it.has("EXT_color_buffer_half_float")||it.has("EXT_color_buffer_float");b.state.transmissionRenderTarget[G.id]=new dn(1,1,{generateMipmaps:!0,type:Pe?Vn:fn,minFilter:Hi,samples:Math.max(4,A.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:ot.workingColorSpace})}let Se=b.state.transmissionRenderTarget[G.id],Ce=G.viewport||j;Se.setSize(Ce.z*I.transmissionResolutionScale,Ce.w*I.transmissionResolutionScale);let Me=I.getRenderTarget(),Ie=I.getActiveCubeFace(),De=I.getActiveMipmapLevel();I.setRenderTarget(Se),I.getClearColor(Ke),Ze=I.getClearAlpha(),Ze<1&&I.setClearColor(16777215,.5),I.clear(),We&&Je.render(Y);let je=I.toneMapping;I.toneMapping=zn;let st=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),b.setupLightsView(G),re===!0&&Ue.setGlobalState(I.clippingPlanes,G),Ro(M,Y,G),$.updateMultisampleRenderTarget(Se),$.updateRenderTargetMipmap(Se),it.has("WEBGL_multisampled_render_to_texture")===!1){let Pe=!1;for(let ft=0,Dt=U.length;ft<Dt;ft++){let Et=U[ft],{object:xt,geometry:Jt,material:Te,group:nn}=Et;if(Te.side===An&&xt.layers.test(G.layers)){let ct=Te.side;Te.side=$t,Te.needsUpdate=!0,Iu(xt,Y,G,Jt,Te,nn),Te.side=ct,Te.needsUpdate=!0,Pe=!0}}Pe===!0&&($.updateMultisampleRenderTarget(Se),$.updateRenderTargetMipmap(Se))}I.setRenderTarget(Me,Ie,De),I.setClearColor(Ke,Ze),st!==void 0&&(G.viewport=st),I.toneMapping=je}function Ro(M,U,Y){let G=U.isScene===!0?U.overrideMaterial:null;for(let H=0,Se=M.length;H<Se;H++){let Ce=M[H],{object:Me,geometry:Ie,group:De}=Ce,je=Ce.material;je.allowOverride===!0&&G!==null&&(je=G),Me.layers.test(Y.layers)&&Iu(Me,U,Y,Ie,je,De)}}function Iu(M,U,Y,G,H,Se){O!==null&&H.isNodeMaterial&&O.setObject(M,H),M.onBeforeRender(I,U,Y,G,H,Se),M.modelViewMatrix.multiplyMatrices(Y.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),H.onBeforeRender(I,U,Y,G,M,Se),H.transparent===!0&&H.side===An&&H.forceSinglePass===!1?(H.side=$t,H.needsUpdate=!0,I.renderBufferDirect(Y,U,G,H,M,Se),H.side=Tn,H.needsUpdate=!0,I.renderBufferDirect(Y,U,G,H,M,Se),H.side=An):I.renderBufferDirect(Y,U,G,H,M,Se),M.onAfterRender(I,U,Y,G,H,Se)}function Io(M,U,Y){U.isScene!==!0&&(U=Oe);let G=W.get(M),H=b.state.lights,Se=b.state.shadowsArray,Ce=H.state.version,Me=pe.getParameters(M,H.state,Se,U,Y,b.state.lightProbeGridArray),Ie=pe.getProgramCacheKey(Me),De=G.programs;G.environment=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?U.environment:null,G.fog=U.fog;let je=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap;G.envMap=he.get(M.envMap||G.environment,je),G.envMapRotation=G.environment!==null&&M.envMap===null?U.environmentRotation:M.envMapRotation,De===void 0&&(M.addEventListener("dispose",Hn),De=new Map,G.programs=De);let st=De.get(Ie);if(st!==void 0){if(G.currentProgram===st&&G.lightsStateVersion===Ce)return Lu(M,Me),st}else Me.uniforms=pe.getUniforms(M),O!==null&&M.isNodeMaterial&&O.build(M,Y,Me),M.onBeforeCompile(Me,I),st=pe.acquireProgram(Me,Ie),De.set(Ie,st),G.uniforms=Me.uniforms;let Pe=G.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Pe.clippingPlanes=Ue.uniform),Lu(M,Me),G.needsLights=wm(M),G.lightsStateVersion=Ce,G.needsLights&&(Pe.ambientLightColor.value=H.state.ambient,Pe.lightProbe.value=H.state.probe,Pe.sunLights.value=H.state.sun,Pe.sunLightShadows.value=H.state.sunShadow,Pe.directionalLights.value=H.state.directional,Pe.directionalLightShadows.value=H.state.directionalShadow,Pe.spotLights.value=H.state.spot,Pe.spotLightShadows.value=H.state.spotShadow,Pe.rectAreaLights.value=H.state.rectArea,Pe.ltc_1.value=H.state.rectAreaLTC1,Pe.ltc_2.value=H.state.rectAreaLTC2,Pe.pointLights.value=H.state.point,Pe.pointLightShadows.value=H.state.pointShadow,Pe.hemisphereLights.value=H.state.hemi,Pe.sunShadowMatrix.value=H.state.sunShadowMatrix,Pe.sunShadowCascade.value=H.state.sunShadowCascade,Pe.directionalShadowMatrix.value=H.state.directionalShadowMatrix,Pe.spotLightMatrix.value=H.state.spotLightMatrix,Pe.spotLightMap.value=H.state.spotLightMap,Pe.pointShadowMatrix.value=H.state.pointShadowMatrix),G.lightProbeGrid=b.state.lightProbeGridArray.length>0,G.currentProgram=st,G.uniformsList=null,st}function Pu(M){if(M.uniformsList===null){let U=M.currentProgram.getUniforms();M.uniformsList=or.seqWithValue(U.seq,M.uniforms)}return M.uniformsList}function Lu(M,U){let Y=W.get(M);Y.outputColorSpace=U.outputColorSpace,Y.batching=U.batching,Y.batchingColor=U.batchingColor,Y.instancing=U.instancing,Y.instancingColor=U.instancingColor,Y.instancingMorph=U.instancingMorph,Y.skinning=U.skinning,Y.morphTargets=U.morphTargets,Y.morphNormals=U.morphNormals,Y.morphColors=U.morphColors,Y.morphTargetsCount=U.morphTargetsCount,Y.numClippingPlanes=U.numClippingPlanes,Y.numIntersection=U.numClipIntersection,Y.vertexAlphas=U.vertexAlphas,Y.vertexTangents=U.vertexTangents,Y.toneMapping=U.toneMapping}function Mm(M,U){if(M.length===0)return null;if(M.length===1)return M[0].texture!==null?M[0]:null;y.setFromMatrixPosition(U.matrixWorld);for(let Y=0,G=M.length;Y<G;Y++){let H=M[Y];if(H.texture!==null&&H.boundingBox.containsPoint(y))return H}return null}function Sm(M,U,Y,G,H){U.isScene!==!0&&(U=Oe),$.resetTextureUnits();let Se=U.fog,Ce=G.isMeshStandardMaterial||G.isMeshLambertMaterial||G.isMeshPhongMaterial?U.environment:null,Me=te===null?I.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ot.workingColorSpace,Ie=G.isMeshStandardMaterial||G.isMeshLambertMaterial&&!G.envMap||G.isMeshPhongMaterial&&!G.envMap,De=he.get(G.envMap||Ce,Ie),je=G.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,st=!!Y.attributes.tangent&&(!!G.normalMap||G.anisotropy>0),Pe=!!Y.morphAttributes.position,ft=!!Y.morphAttributes.normal,Dt=!!Y.morphAttributes.color,Et=zn;G.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(Et=I.toneMapping);let xt=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,Jt=xt!==void 0?xt.length:0,Te=W.get(G),nn=b.state.lights;if(re===!0&&(ae===!0||M!==Z)){let St=M===Z&&G.id===q;Ue.setState(G,M,St)}let ct=!1;G.version===Te.__version?(Te.needsLights&&Te.lightsStateVersion!==nn.state.version||Te.outputColorSpace!==Me||H.isBatchedMesh&&Te.batching===!1||!H.isBatchedMesh&&Te.batching===!0||H.isBatchedMesh&&Te.batchingColor===!0&&H._colorsTexture===null||H.isBatchedMesh&&Te.batchingColor===!1&&H._colorsTexture!==null||H.isInstancedMesh&&Te.instancing===!1||!H.isInstancedMesh&&Te.instancing===!0||H.isSkinnedMesh&&Te.skinning===!1||!H.isSkinnedMesh&&Te.skinning===!0||H.isInstancedMesh&&Te.instancingColor===!0&&H.instanceColor===null||H.isInstancedMesh&&Te.instancingColor===!1&&H.instanceColor!==null||H.isInstancedMesh&&Te.instancingMorph===!0&&H.morphTexture===null||H.isInstancedMesh&&Te.instancingMorph===!1&&H.morphTexture!==null||Te.envMap!==De||G.fog===!0&&Te.fog!==Se||Te.numClippingPlanes!==void 0&&(Te.numClippingPlanes!==Ue.numPlanes||Te.numIntersection!==Ue.numIntersection)||Te.vertexAlphas!==je||Te.vertexTangents!==st||Te.morphTargets!==Pe||Te.morphNormals!==ft||Te.morphColors!==Dt||Te.toneMapping!==Et||Te.morphTargetsCount!==Jt||!!Te.lightProbeGrid!=b.state.lightProbeGridArray.length>0)&&(ct=!0):(ct=!0,Te.__version=G.version);let bn=Te.currentProgram;ct===!0&&(bn=Io(G,U,H),O&&G.isNodeMaterial&&O.onUpdateProgram(G,bn,Te));let Wn=!1,wi=!1,_s=!1,_t=bn.getUniforms(),Pt=Te.uniforms;if(_.useProgram(bn.program)&&(Wn=!0,wi=!0,_s=!0),G.id!==q&&(q=G.id,wi=!0),Te.needsLights){let St=Mm(b.state.lightProbeGridArray,H);Te.lightProbeGrid!==St&&(Te.lightProbeGrid=St,wi=!0)}if(Wn||Z!==M){_.buffers.depth.getReversed()&&M.reversedDepth!==!0&&(M._reversedDepth=!0,M.updateProjectionMatrix()),_t.setValue(L,"projectionMatrix",M.projectionMatrix),_t.setValue(L,"viewMatrix",M.matrixWorldInverse);let Ti=_t.map.cameraPosition;Ti!==void 0&&Ti.setValue(L,de.setFromMatrixPosition(M.matrixWorld)),A.logarithmicDepthBuffer&&_t.setValue(L,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&_t.setValue(L,"isOrthographic",M.isOrthographicCamera===!0),Z!==M&&(Z=M,wi=!0,_s=!0)}if(Te.needsLights&&(nn.state.sunShadowMap.length>0&&_t.setValue(L,"sunShadowMap",nn.state.sunShadowMap,$),nn.state.directionalShadowMap.length>0&&_t.setValue(L,"directionalShadowMap",nn.state.directionalShadowMap,$),nn.state.spotShadowMap.length>0&&_t.setValue(L,"spotShadowMap",nn.state.spotShadowMap,$),nn.state.pointShadowMap.length>0&&_t.setValue(L,"pointShadowMap",nn.state.pointShadowMap,$)),H.isSkinnedMesh){_t.setOptional(L,H,"bindMatrix"),_t.setOptional(L,H,"bindMatrixInverse");let St=H.skeleton;St&&(St.boneTexture===null&&St.computeBoneTexture(),_t.setValue(L,"boneTexture",St.boneTexture,$))}H.isBatchedMesh&&(_t.setOptional(L,H,"batchingTexture"),_t.setValue(L,"batchingTexture",H._matricesTexture,$),_t.setOptional(L,H,"batchingIdTexture"),_t.setValue(L,"batchingIdTexture",H._indirectTexture,$),_t.setOptional(L,H,"batchingColorTexture"),H._colorsTexture!==null&&_t.setValue(L,"batchingColorTexture",H._colorsTexture,$));let Ei=Y.morphAttributes;if((Ei.position!==void 0||Ei.normal!==void 0||Ei.color!==void 0)&&F.update(H,Y,bn),(wi||Te.receiveShadow!==H.receiveShadow)&&(Te.receiveShadow=H.receiveShadow,_t.setValue(L,"receiveShadow",H.receiveShadow)),(G.isMeshStandardMaterial||G.isMeshLambertMaterial||G.isMeshPhongMaterial)&&G.envMap===null&&U.environment!==null&&(Pt.envMapIntensity.value=U.environmentIntensity),Pt.dfgLUT!==void 0&&(Pt.dfgLUT.value=Qy()),wi){if(_t.setValue(L,"toneMappingExposure",I.toneMappingExposure),Te.needsLights&&bm(Pt,_s),Se&&G.fog===!0&&Ne.refreshFogUniforms(Pt,Se),Ne.refreshMaterialUniforms(Pt,G,ne,J,b.state.transmissionRenderTarget[M.id]),Te.needsLights&&Te.lightProbeGrid){let St=Te.lightProbeGrid;Pt.probesSH.value=St.texture,Pt.probesMin.value.copy(St.boundingBox.min),Pt.probesMax.value.copy(St.boundingBox.max),Pt.probesResolution.value.copy(St.resolution)}or.upload(L,Pu(Te),Pt,$)}if(G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(or.upload(L,Pu(Te),Pt,$),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&_t.setValue(L,"center",H.center),_t.setValue(L,"modelViewMatrix",H.modelViewMatrix),_t.setValue(L,"normalMatrix",H.normalMatrix),_t.setValue(L,"modelMatrix",H.matrixWorld),G.uniformsGroups!==void 0){let St=G.uniformsGroups;for(let Ti=0,xs=St.length;Ti<xs;Ti++){let Nu=St[Ti];se.update(Nu,bn),se.bind(Nu,bn)}}return bn}function bm(M,U){M.ambientLightColor.needsUpdate=U,M.lightProbe.needsUpdate=U,M.sunLights.needsUpdate=U,M.sunLightShadows.needsUpdate=U,M.directionalLights.needsUpdate=U,M.directionalLightShadows.needsUpdate=U,M.pointLights.needsUpdate=U,M.pointLightShadows.needsUpdate=U,M.spotLights.needsUpdate=U,M.spotLightShadows.needsUpdate=U,M.rectAreaLights.needsUpdate=U,M.hemisphereLights.needsUpdate=U}function wm(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return k},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(M,U,Y){let G=W.get(M);G.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,G.__autoAllocateDepthBuffer===!1&&(G.__useRenderToTexture=!1),W.get(M.texture).__webglTexture=U,W.get(M.depthTexture).__webglTexture=G.__autoAllocateDepthBuffer?void 0:Y,G.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,U){let Y=W.get(M);Y.__webglFramebuffer=U,Y.__useDefaultFramebuffer=U===void 0},this.setRenderTarget=function(M,U=0,Y=0){te=M,k=U,X=Y;let G=null,H=!1,Se=!1;if(M){let Me=W.get(M);if(Me.__useDefaultFramebuffer!==void 0){_.bindFramebuffer(L.FRAMEBUFFER,Me.__webglFramebuffer),j.copy(M.viewport),Re.copy(M.scissor),be=M.scissorTest,_.viewport(j),_.scissor(Re),_.setScissorTest(be),q=-1;return}else if(Me.__webglFramebuffer===void 0)$.setupRenderTarget(M);else if(Me.__hasExternalTextures)$.rebindTextures(M,W.get(M.texture).__webglTexture,W.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){let je=M.depthTexture;if(Me.__boundDepthTexture!==je){if(je!==null&&W.has(je)&&(M.width!==je.image.width||M.height!==je.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");$.setupDepthRenderbuffer(M)}}let Ie=M.texture;(Ie.isData3DTexture||Ie.isDataArrayTexture||Ie.isCompressedArrayTexture)&&(Se=!0);let De=W.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(De[U])?G=De[U][Y]:G=De[U],H=!0):M.samples>0&&$.useMultisampledRTT(M)===!1?G=W.get(M).__webglMultisampledFramebuffer:Array.isArray(De)?G=De[Y]:G=De,j.copy(M.viewport),Re.copy(M.scissor),be=M.scissorTest}else j.copy(Ee).multiplyScalar(ne).floor(),Re.copy(He).multiplyScalar(ne).floor(),be=gt;if(Y!==0&&(G=V),_.bindFramebuffer(L.FRAMEBUFFER,G)&&_.drawBuffers(M,G),_.viewport(j),_.scissor(Re),_.setScissorTest(be),H){let Me=W.get(M.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+U,Me.__webglTexture,Y)}else if(Se){let Me=U;for(let Ie=0;Ie<M.textures.length;Ie++){let De=W.get(M.textures[Ie]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+Ie,De.__webglTexture,Y,Me)}}else if(M!==null&&Y!==0){let Me=W.get(M.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Me.__webglTexture,Y)}q=-1};function Du(M){let U=W.get(M);return(U.__readFormat!==M.format||U.__readType!==M.type)&&(U.__readFormat=M.format,U.__readType=M.type,U.__formatReadable=A.textureFormatReadable(M.format),U.__typeReadable=A.textureTypeReadable(M.type)),U}this.readRenderTargetPixels=function(M,U,Y,G,H,Se,Ce,Me=0){if(!(M&&M.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ie=W.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Ce!==void 0&&(Ie=Ie[Ce]),Ie){_.bindFramebuffer(L.FRAMEBUFFER,Ie);try{let De=M.textures[Me],je=De.format,st=De.type;M.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+Me);let Pe=Du(De);if(Pe.__formatReadable===!1){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Pe.__typeReadable===!1){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=M.width-G&&Y>=0&&Y<=M.height-H&&L.readPixels(U,Y,G,H,_e.convert(je),_e.convert(st),Se)}finally{let De=te!==null?W.get(te).__webglFramebuffer:null;_.bindFramebuffer(L.FRAMEBUFFER,De)}}},this.readRenderTargetPixelsAsync=async function(M,U,Y,G,H,Se,Ce,Me=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ie=W.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Ce!==void 0&&(Ie=Ie[Ce]),Ie)if(U>=0&&U<=M.width-G&&Y>=0&&Y<=M.height-H){_.bindFramebuffer(L.FRAMEBUFFER,Ie);let De=M.textures[Me],je=De.format,st=De.type;M.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+Me);let Pe=Du(De);if(Pe.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Pe.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let ft=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,ft),L.bufferData(L.PIXEL_PACK_BUFFER,Se.byteLength,L.STREAM_READ),L.readPixels(U,Y,G,H,_e.convert(je),_e.convert(st),0),L.bindBuffer(L.PIXEL_PACK_BUFFER,null);let Dt=te!==null?W.get(te).__webglFramebuffer:null;_.bindFramebuffer(L.FRAMEBUFFER,Dt);let Et=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await bf(L,Et,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,ft),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,Se),L.bindBuffer(L.PIXEL_PACK_BUFFER,null),L.deleteBuffer(ft),L.deleteSync(Et),Se}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,U=null,Y=0){let G=Math.pow(2,-Y),H=Math.floor(M.image.width*G),Se=Math.floor(M.image.height*G),Ce=U!==null?U.x:0,Me=U!==null?U.y:0;$.setTexture2D(M,0),L.copyTexSubImage2D(L.TEXTURE_2D,Y,0,0,Ce,Me,H,Se),_.unbindTexture()},this.copyTextureToTexture=function(M,U,Y=null,G=null,H=0,Se=0){let Ce,Me,Ie,De,je,st,Pe,ft,Dt,Et=M.isCompressedTexture?M.mipmaps[Se]:M.image;if(Y!==null)Ce=Y.max.x-Y.min.x,Me=Y.max.y-Y.min.y,Ie=Y.isBox3?Y.max.z-Y.min.z:1,De=Y.min.x,je=Y.min.y,st=Y.isBox3?Y.min.z:0;else{let Pt=Math.pow(2,-H);Ce=Math.floor(Et.width*Pt),Me=Math.floor(Et.height*Pt),M.isDataArrayTexture?Ie=Et.depth:M.isData3DTexture?Ie=Math.floor(Et.depth*Pt):Ie=1,De=0,je=0,st=0}G!==null?(Pe=G.x,ft=G.y,Dt=G.z):(Pe=0,ft=0,Dt=0);let xt=_e.convert(U.format),Jt=_e.convert(U.type),Te;U.isData3DTexture?($.setTexture3D(U,0),Te=L.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?($.setTexture2DArray(U,0),Te=L.TEXTURE_2D_ARRAY):($.setTexture2D(U,0),Te=L.TEXTURE_2D),_.activeTexture(L.TEXTURE0),_.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,U.flipY),_.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),_.pixelStorei(L.UNPACK_ALIGNMENT,U.unpackAlignment);let nn=_.getParameter(L.UNPACK_ROW_LENGTH),ct=_.getParameter(L.UNPACK_IMAGE_HEIGHT),bn=_.getParameter(L.UNPACK_SKIP_PIXELS),Wn=_.getParameter(L.UNPACK_SKIP_ROWS),wi=_.getParameter(L.UNPACK_SKIP_IMAGES);_.pixelStorei(L.UNPACK_ROW_LENGTH,Et.width),_.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Et.height),_.pixelStorei(L.UNPACK_SKIP_PIXELS,De),_.pixelStorei(L.UNPACK_SKIP_ROWS,je),_.pixelStorei(L.UNPACK_SKIP_IMAGES,st);let _s=M.isDataArrayTexture||M.isData3DTexture,_t=U.isDataArrayTexture||U.isData3DTexture;if(M.isDepthTexture){let Pt=W.get(M),Ei=W.get(U),St=W.get(Pt.__renderTarget),Ti=W.get(Ei.__renderTarget);_.bindFramebuffer(L.READ_FRAMEBUFFER,St.__webglFramebuffer),_.bindFramebuffer(L.DRAW_FRAMEBUFFER,Ti.__webglFramebuffer);for(let xs=0;xs<Ie;xs++)_s&&(L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,W.get(M).__webglTexture,H,st+xs),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,W.get(U).__webglTexture,Se,Dt+xs)),L.blitFramebuffer(De,je,Ce,Me,Pe,ft,Ce,Me,L.DEPTH_BUFFER_BIT,L.NEAREST);_.bindFramebuffer(L.READ_FRAMEBUFFER,null),_.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(H!==0||M.isRenderTargetTexture||W.has(M)){let Pt=W.get(M),Ei=W.get(U);_.bindFramebuffer(L.READ_FRAMEBUFFER,R),_.bindFramebuffer(L.DRAW_FRAMEBUFFER,P);for(let St=0;St<Ie;St++)_s?L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Pt.__webglTexture,H,st+St):L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Pt.__webglTexture,H),_t?L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Ei.__webglTexture,Se,Dt+St):L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Ei.__webglTexture,Se),H!==0?L.blitFramebuffer(De,je,Ce,Me,Pe,ft,Ce,Me,L.COLOR_BUFFER_BIT,L.NEAREST):_t?L.copyTexSubImage3D(Te,Se,Pe,ft,Dt+St,De,je,Ce,Me):L.copyTexSubImage2D(Te,Se,Pe,ft,De,je,Ce,Me);_.bindFramebuffer(L.READ_FRAMEBUFFER,null),_.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else _t?M.isDataTexture||M.isData3DTexture?L.texSubImage3D(Te,Se,Pe,ft,Dt,Ce,Me,Ie,xt,Jt,Et.data):U.isCompressedArrayTexture?L.compressedTexSubImage3D(Te,Se,Pe,ft,Dt,Ce,Me,Ie,xt,Et.data):L.texSubImage3D(Te,Se,Pe,ft,Dt,Ce,Me,Ie,xt,Jt,Et):M.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,Se,Pe,ft,Ce,Me,xt,Jt,Et.data):M.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,Se,Pe,ft,Et.width,Et.height,xt,Et.data):L.texSubImage2D(L.TEXTURE_2D,Se,Pe,ft,Ce,Me,xt,Jt,Et);_.pixelStorei(L.UNPACK_ROW_LENGTH,nn),_.pixelStorei(L.UNPACK_IMAGE_HEIGHT,ct),_.pixelStorei(L.UNPACK_SKIP_PIXELS,bn),_.pixelStorei(L.UNPACK_SKIP_ROWS,Wn),_.pixelStorei(L.UNPACK_SKIP_IMAGES,wi),Se===0&&U.generateMipmaps&&L.generateMipmap(Te),_.unbindTexture()},this.initRenderTarget=function(M){W.get(M).__webglFramebuffer===void 0&&$.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?$.setTextureCube(M,0):M.isData3DTexture?$.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?$.setTexture2DArray(M,0):$.setTexture2D(M,0),_.unbindTexture()},this.resetState=function(){k=0,X=0,te=null,_.reset(),we.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return On}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ot._getDrawingBufferColorSpace(e),t.unpackColorSpace=ot._getUnpackColorSpace()}};function lr(n,e=!1){let t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),r={},o={},a=n[0].morphTargetsRelative,c=new Ot,l=0;for(let h=0;h<n.length;++h){let f=n[h],u=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in f.attributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;r[d]===void 0&&(r[d]=[]),r[d].push(f.attributes[d]),u++}if(u!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in f.morphAttributes){if(!s.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(f.morphAttributes[d])}if(e){let d;if(t)d=f.index.count;else if(f.attributes.position!==void 0)d=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,d,h),l+=d}}if(t){let h=0,f=[];for(let u=0;u<n.length;++u){let d=n[u].index;for(let m=0;m<d.count;++m)f.push(d.getX(m)+h);h+=n[u].attributes.position.count}c.setIndex(f)}for(let h in r){let f=ap(r[h]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;c.setAttribute(h,f)}for(let h in o){let f=o[h][0].length;if(f!==0){c.morphAttributes=c.morphAttributes||{},c.morphAttributes[h]=[];for(let u=0;u<f;++u){let d=[];for(let v=0;v<o[h].length;++v)d.push(o[h][v][u]);let m=ap(d);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;c.morphAttributes[h].push(m)}}}return c}function ap(n){let e,t,i,s=-1,r=0;for(let l=0;l<n.length;++l){let h=n[l];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=h.itemSize),t!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=h.normalized),i!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=h.gpuType),s!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;r+=h.count*t}let o=new e(r),a=new Ft(o,t,i),c=0;for(let l=0;l<n.length;++l){let h=n[l];if(h.isInterleavedBufferAttribute){let f=c/t;for(let u=0,d=h.count;u<d;u++)for(let m=0;m<t;m++){let v=h.getComponent(u,m);a.setComponent(u+f,m,v)}}else o.set(h.array,c);c+=h.count*t}return s!==void 0&&(a.gpuType=s),a}var lp={rail:{color:"#5a677a",metalness:1,roughness:.36},cover:{color:"#8a93a0",metalness:.55,roughness:.74},backGlass:{color:"#2f3744",metalness:.15,roughness:.46},screen:{color:"#07080a",metalness:0,roughness:.2},matte:{color:"#101114",metalness:0,roughness:.62},lens:{color:"#04060a",metalness:.4,roughness:.08},frame:{color:"#17181b",metalness:.4,roughness:.62},pouch:{color:"#c6c7ca",metalness:.35,roughness:.52},brushed:{color:"#8f9195",metalness:.85,roughness:.55},can:{color:"#a0a2a6",metalness:.8,roughness:.48},plastic:{color:"#17181b",metalness:0,roughness:.68},board:{color:"#1a1c20",metalness:.15,roughness:.6},steel:{color:"#b6b7ba",metalness:1,roughness:.44},gold:{color:"#c79f58",metalness:1,roughness:.4},copper:{color:"#b9855f",metalness:.9,roughness:.5},plate:{color:"#b3a48f",metalness:.6,roughness:.52},flash:{color:"#efe7c8",metalness:0,roughness:.3},cowl:{color:"#6f7277",metalness:.8,roughness:.5},film:{color:"#d4d3cb",metalness:0,roughness:.74},nano:{color:"#262a31",metalness:0,roughness:.72},ribbon:{color:"#2a2622",metalness:.1,roughness:.6},fastener:{color:"#ffffff",metalness:.9,roughness:.46},component:{color:"#ffffff",metalness:.2,roughness:.56},package:{color:"#ffffff",metalness:.1,roughness:.5},lid:{color:"#ffffff",metalness:.85,roughness:.46},die:{color:"#ffffff",metalness:.5,roughness:.36}},mt=(n,e=0)=>{let t=Array.isArray(e)?e:n.map(()=>e),i=new on,s=n.length;return n.forEach((r,o)=>{let a=n[(o+s-1)%s],c=n[(o+1)%s],l=t[o],h=(d,m,v)=>{let g=Math.hypot(m[0]-d[0],m[1]-d[1]),p=Math.min(v,g/2)/g;return[d[0]+(m[0]-d[0])*p,d[1]+(m[1]-d[1])*p]},f=h(r,a,l),u=h(r,c,l);o===0?i.moveTo(...f):i.lineTo(...f),l&&i.quadraticCurveTo(r[0],r[1],...u)}),i.closePath(),i},bt=(n,e,t,i)=>[[n,e],[t,e],[t,i],[n,i]],yt=(n,e,t,i=0,s=8)=>{let r=Math.max(t-e-2*i,.01),o=new Oi(n,{depth:r,curveSegments:s,bevelEnabled:i>0,bevelThickness:i,bevelSize:i,bevelOffset:-i,bevelSegments:2});return o.rotateX(Math.PI/2),o.translate(0,t-i,0),o},fe=(n,e,t,i,s,r,o=.3,a=0)=>yt(mt(bt(n,e,t,i),o),s,r,a,3),lt=(n,e,t,i,s,r=28)=>{let o=new En(t,t,s-i,r);return o.translate(n,(i+s)/2,e),o},pn=(n,e,t,i,s,r,o=40)=>{let a=new on;a.absarc(0,0,i,0,Math.PI*2,!1);let c=new ti;c.absarc(0,0,t,0,Math.PI*2,!0),a.holes.push(c);let l=yt(a,s,r,0,o/2);return l.translate(n,0,e),l},hp=(n,e,t,i,s)=>{let r=Math.round((i-t)/.62),o=[];for(let c=0;c<=r*2;c++)o.push(new le(s*(c%2?1:.8),(i-t)*c/(r*2)));let a=new Bi(o,7);return a.rotateX(Math.PI/2),a.translate(n,e,t),a},up=(n,e,t)=>{let i=new on,s=n*.76,r=Math.PI*2/e;for(let a=0;a<e;a++){let c=a*r,l=[[s,c],[n,c+r*.2],[n,c+r*.5],[s,c+r*.7]];for(let[h,f]of l){let u=h*Math.cos(f),d=h*Math.sin(f);a===0&&h===s&&f===c?i.moveTo(u,d):i.lineTo(u,d)}}i.closePath();let o=new Oi(i,{depth:t,bevelEnabled:!1,curveSegments:1});return o.translate(0,0,-t/2),o},hl=(n,e,t,i=n*6)=>{let s=new on;for(let r=0;r<i;r++){let o=r/i*Math.PI*2,a=e+(t-e)*(.5+.5*Math.cos(n*o)),c=[a*Math.cos(o),a*Math.sin(o)];r?s.lineTo(...c):s.moveTo(...c)}return s.closePath(),s},ul=(n,e,t=.8)=>{for(let[i,s]of e){let r=new ti;r.absarc(i,s,t,0,Math.PI*2,!0),n.holes.push(r)}return n},Wt=(n,e,t,i=t+.14)=>{let s=[],r=[],o=([a,c],[l,h])=>{let f=Math.hypot(l-a,h-c);return[(c-h)/f,(l-a)/f]};return n.forEach((a,c)=>{let l=o(n[Math.max(c-1,0)],n[Math.max(c,1)]),h=o(n[Math.min(c,n.length-2)],n[Math.min(c+1,n.length-1)]),f=l[0]+h[0],u=l[1]+h[1],d=Math.hypot(f,u),m=e/2/((f*l[0]+u*l[1])/d)/d;s.push([a[0]+f*m,a[1]+u*m]),r.push([a[0]-f*m,a[1]-u*m])}),yt(mt([...s,...r.reverse()],.3),t,i,0,2)},eM=n=>{let e=n.index?n.toNonIndexed():n;for(let t of Object.keys(e.attributes))t!=="position"&&t!=="normal"&&e.deleteAttribute(t);return e},dp=`
4576 {
4577 float lum = dot(gl_FragColor.rgb, vec3(0.3, 0.59, 0.11));
4578 gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.961, 0.502, 0.145) * (0.62 + 0.6 * lum), uTint);
4579 if (uDrawing > 0.995) discard;
4580 gl_FragColor.a *= 1.0 - uDrawing;
4581 }
4582 #include <dithering_fragment>`,cp=["frame","board","cover","rail","brushed","pouch","can","plate","matte","screen","nano","backGlass","plastic","ribbon","copper","component","steel","cowl","gold","film","lens","flash","package","lid","die","fastener"],tM=3,fp=n=>({polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1+(cp.length-1-cp.indexOf(n))*tM}),pp={blending:uc,blendSrc:co,blendDst:er,blendSrcAlpha:dc,blendDstAlpha:er,forceSinglePass:!0},hr=(n,e,t=Tn)=>{let i=new Js({...lp[n],...pp,...fp(n),side:t,envMapIntensity:.5});return i.onBeforeCompile=s=>{s.uniforms.uTint=e.uTint,s.uniforms.uDrawing=e.uDrawing,s.fragmentShader=`uniform float uTint;
4583uniform float uDrawing;
4584${s.fragmentShader}`.replace("#include <dithering_fragment>",dp)},i.customProgramCacheKey=()=>"duo-part",i},So=n=>{let e=new Js({...lp[n],...pp,...fp(n),vertexColors:!0,envMapIntensity:.5});return e.onBeforeCompile=t=>{t.vertexShader=`attribute vec2 aStyle;
4585varying vec2 vStyle;
4586${t.vertexShader}`.replace("#include <begin_vertex>",`#include <begin_vertex>
4587vStyle = aStyle;`),t.fragmentShader=`varying vec2 vStyle;
4588#define uDrawing vStyle.x
4589#define uTint vStyle.y
4590${t.fragmentShader}`.replace("#include <dithering_fragment>",dp)},e.customProgramCacheKey=()=>"duo-piece",e},mu=n=>(n.deleteAttribute("uv"),n),nM=mu(new Bn(1,1,1)),iM=mu(new vn(1,1).rotateX(-Math.PI/2)),sM=mu(new vn(1,1).rotateX(Math.PI/2)),wt=n=>{let e={uTint:{value:0},uDrawing:{value:0}},t=new Ys({color:"#17191c",transparent:!0,opacity:.3}),i=new Map,s=[],r={id:n,style:e,lines:t,groups:{},meshes:[],details:[],add(o,a,c="main",l=!0){let h=`${c}/${o}/${l}`;return i.has(h)||i.set(h,{carrier:c,surface:o,outlined:l,list:[]}),i.get(h).list.push(eM(a)),r},fine(o,a,c="main"){return r.add(o,a,c,!1)},crowd(o,a,c="box",l="main"){return s.push({surface:o,list:a,shape:c,carrier:l}),r},group(o="main"){return r.groups[o]||(r.groups[o]=new hn),r.groups[o]},build(o){for(let{carrier:h,surface:f,outlined:u,list:d}of i.values()){let m=lr(d),v=new Rt(m,hr(f,e));if(v.receiveShadow=o,r.group(h).add(v),r.meshes.push(v),u){let g=new Wr(new Zr(m,42),t);g.renderOrder=1,r.group(h).add(g)}}let a=new ht,c=new Xe,l={box:nM,top:iM,bottom:sM};for(let{surface:h,list:f,shape:u,carrier:d}of s){let m=new cs(l[u],hr(h,e),f.length);f.forEach(([v,g,p,S,T,y,w],b)=>{m.setMatrixAt(b,a.makeScale(S,T,y).setPosition(v,g,p)),w&&m.setColorAt(b,c.set(w))}),m.frustumCulled=!1,m.receiveShadow=o,r.group(d).add(m),r.details.push(m)}}};return r};var mp=[{w:.6,d:.3,h:.28,odds:.46,tone:"#8f7d5c"},{w:.6,d:.3,h:.22,odds:.32,tone:"#17181b"},{w:.4,d:.2,h:.18,odds:.14,tone:"#6d604a"},{w:1,d:.5,h:.4,odds:.06,tone:"#8a7856"},{w:1.6,d:1.2,h:.62,odds:.02,tone:"#5e6167"}],gu=.16,rM=.4,oM=n=>{let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=Math.imul(e^e>>>15,e|1);return t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}},aM=(n,e,t)=>{let i=!1;return n.forEach(([s,r],o)=>{let[a,c]=n[(o+1)%n.length];r>t!=c>t&&e<s+(t-r)/(c-r)*(a-s)&&(i=!i)}),i},gp=({x:n,z:e,w:t,d:i},s)=>{let r=Math.max(.6,Math.sqrt(t*i/70)),o=Math.floor((t-.4)/r),a=Math.floor((i-.4)/r),c=[];for(let l=0;l<o;l++)for(let h=0;h<a;h++)c.push([n+(l-(o-1)/2)*r,s,e+(h-(a-1)/2)*r,r*.5,1,r*.5]);return c},_p=(n,e,t,i,s,r)=>{let o=oM(n),a=new Set,c=(d,m,v,g)=>{let p=[],S=T=>Math.floor(T/rM);for(let T=S(d-v/2-.1);T<=S(d+v/2+.1);T++)for(let y=S(m-g/2-.1);y<=S(m+g/2+.1);y++)p.push(`${T},${y}`);return p},l=d=>d.forEach(m=>a.add(m));for(let[d,m,v,g]of i)l(c(d,m,v,g));let h=[],f=[],u=()=>{let d=o();return mp.find(m=>(d-=m.odds)<0)??mp[0]};for(let d=0;d<e*8&&h.length<e;d++){let m=u(),v=o()<.5,g=v?m.d:m.w,p=v?m.w:m.d,S=o()<.8?i[Math.floor(o()*i.length)]:null,T=o()<.5,y=o()<.5?-1:1,w=.6+o()*o()*3,b=S?S[0]+(T?y*(S[2]/2+w):(o()-.5)*S[2]):-60+o()*140,C=S?S[1]+(T?(o()-.5)*S[3]:y*(S[3]/2+w)):-60+o()*120,x=Math.round(b/.25)*.25,E=Math.round(C/.25)*.25;if(![[x-g/2,E-p/2],[x+g/2,E-p/2],[x+g/2,E+p/2],[x-g/2,E+p/2]].every(([k,X])=>aM(t,k,X)))continue;let D=c(x,E,g,p);if(D.some(k=>a.has(k)))continue;l(D);let O=h.length%4*.012;if(h.push([x,s+r*(m.h+O)/2,E,g+O,m.h+O,p+O,m.tone]),m.w>1.2)continue;let V=s+r*(m.h+O+.004),R=Math.max(g,p),P=R/2*(1-gu*1.4);for(let k of[-1,1])f.push(v?[x,V,E+k*P,g,1,R*gu]:[x+k*P,V,E,R*gu,1,p])}return{bodies:h,ends:f}},cM=(n,[e,t,i,s],r)=>{let[o,a,c,l]=[e-i/2,e+i/2,t-s/2,t+s/2];n.add("plastic",fe(o,c,a,l,r,r+.38,.14));let h=i>s,f=.22;n.fine("steel",fe(o+f,c+f,a-f,l-f,r+.38,r+.4,.06));let u=Math.round((h?i:s)/.42),d=[];for(let m of[-1,1])for(let v=0;v<u;v++){let g=-((h?i:s)-.6)/2+v*((h?i:s)-.6)/Math.max(u-1,1),p=m*((h?s:i)/2+.1);d.push(h?[e+g,r+.02,t+p,.16,1,.22]:[e+p,r+.02,t+g,.22,1,.16])}return d},xp=(n,e,t,i)=>n.fine("steel",Wt(e,.32,i>0?t:t-.3,i>0?t+.3:t)),vp=n=>n.map(({x:e,z:t,w:i,d:s})=>[e,t,i+.5,s+.5]),yp=({id:n,points:e,connectors:t,holes:i,fences:s,seed:r,counts:o})=>{let a=wt(n),[c,l]=Nt[n].y,h=qn[n],f=h.filter(p=>p.side==="front"),u=h.filter(p=>p.side==="back");a.add("board",yt(ul(mt(e,.8),i,1),c,l,0,4));for(let[p,S]of i)a.fine("gold",pn(p,S,1,1.6,l,l+.02,14)),a.fine("gold",pn(p,S,1,1.6,c-.02,c,14));let d=t.flatMap(p=>cM(a,p,l));a.crowd("gold",[...d,...f.flatMap(p=>gp(p,l+.006))],"top"),a.crowd("gold",u.flatMap(p=>gp(p,c-.006)),"bottom");let m=i.map(([p,S])=>[p,S,3.4,3.4]),v=_p(r,o.front,e,[...vp(f),...t,...m],l,1),g=_p(r+1,o.back,e,[...vp(u),...m],c,-1);a.crowd("component",v.bodies),a.crowd("component",g.bodies),a.crowd("steel",v.ends,"top"),a.crowd("steel",g.ends,"bottom");for(let p of s.front)xp(a,p,l,1);for(let p of s.back)xp(a,p,c,-1);return a},Mp=()=>{let n=yp({id:"logicBoard",points:Uu,connectors:Fu,holes:Bu,seed:20261023,counts:{front:1300,back:640},fences:{front:[[[-42,-22],[-42,10.4],[-29.4,10.4],[-29.4,-6],[-27.8,-6],[-27.8,-22],[-42,-22]],[[-28.6,-29.4],[-28.6,-7.4],[-18.8,-7.4],[-18.8,-29.4],[-28.6,-29.4]],[[-37,-29.8],[-30.2,-29.8],[-30.2,-23.4],[-37,-23.4],[-37,-29.8]]],back:[[[-43.2,-21],[-43.2,10.4],[-25.2,10.4],[-25.2,-21],[-43.2,-21]],[[-24.6,10.4],[-12.2,10.4],[-12.2,-22.2],[-24.6,-22.2],[-24.6,10.4]],[[-31.6,-32.4],[-18.8,-32.4],[-18.8,-41.8],[-31.6,-41.8],[-31.6,-32.4]]]}}),[,e]=Nt.logicBoard.y;n.add("plastic",fe(-28.1,-44.9,-19.7,-32.1,e,e+.08,.5)),n.add("plastic",yt(mt([[-18.4,-54.7],[-13.3,-54.7],[-13.3,-30.9],[-18.4,-30.9]],2.4),e,e+.08,0,8));for(let[t,i]of[[-40.4,-46.4],[-40.4,8.6]])n.fine("gold",lt(t,i,.5,e,e+.02,10));return n},Sp=()=>{let n=yp({id:"ioBoard",points:Lo,connectors:Ou,holes:zu,seed:20261027,counts:{front:380,back:460},fences:{front:[],back:[[[15,43],[34,43],[34,49.2],[15,49.2],[15,43]],[[50.6,43.2],[70,43.2],[70,50.6],[50.6,50.6],[50.6,43.2]]]}}),[,e]=Nt.ioBoard.y;for(let[t,i]of[[21.8,56.5],[59.2,56.5]])n.add("gold",fe(t-2,i-3.6,t+2,i+.9,e-.2,e,.4)),n.add("steel",fe(t-1.4,i-2.4,t+1.4,i-1.4,e,e+.3,.2));return n.add("gold",fe(50,51.6,52.8,54.6,e-.2,e,.4)),n};var{HALF_H:ms,HINGE:lM,PART:qi}=hi,bo=lM.halfOpen,dl=n=>(li[n]??[]).filter(e=>e.dir[1]===1).map(({x:e,z:t})=>[e,t]),Si=(n,e,t=qi[e].y[1])=>{for(let[i,s]of dl(e))n.fine("steel",pn(i,s,.62,1.1,t-.02,t+.03,14));return n},ur=(n,e,t="cowl",i=.8)=>{let s=wt(n),[r,o]=qi[n].y;return s.add(t,yt(ul(mt(e,i),dl(n),.72),r,o,0,4)),Si(s,n)},bp=(n,e)=>{let t=wt(n),[i,s,r,o]=qi[n].rect,[a,c]=qi[n].y,l=2.6,h=mt(bt(i,s,r,o),e);return h.holes.push(mt(bt(i+l,s+l,r-l,o-l),e.map(f=>Math.max(f-l,.4)))),t.add("film",yt(h,a,c,0,8)),t.fine("film",fe(i+10,o-2.6,i+18,o+.6,a,c,.8)),t},wp=()=>bp("backAdhesive",[10.3,1,1,10.3]),Ep=()=>bp("outerAdhesive",[1,10.3,10.3,1]),Tp=()=>ur("batteryCowling",[[-16,-26.5],[-12.6,-26.5],[-12.6,-10],[-18,-8],[-18,12],[-30,12],[-30,7],[-21,7],[-21,-8],[-16,-12]]),Ap=()=>ur("boardCowling",[[-41,-44],[-24,-44],[-24,-29],[-33,-29],[-33,-16],[-41,-16]]),Cp=()=>ur("faceTimeCowling",bt(-43,-56.4,-8,-47.6),"cowl",1.4),Rp=()=>ur("alsCowling",bt(...qi.alsCowling.rect),"cowl",1),Ip=()=>{let n=ur("ioCowling",Lo,"cowl",.6);for(let[e,t]of[[47.6,46.8],[41.1,38.9]])n.fine("plastic",lt(e,t,1.2,-.82,-.78,12));return n},Pp=(n,e)=>{let t=wt(n),[i,s]=qi[n].y;t.add("ribbon",Wt(e,2.4,i,s));for(let[r,o]of dl(n))t.fine("gold",lt(r,o,1.3,s,s+.02,12));return Si(t,n)},Lp=()=>Pp("lowerAntenna",[[-6.4,8],[-6.4,42],[-8.6,57],[-27.6,57],[-27.6,54]]),Dp=()=>Pp("upperAntenna",[[-6.4,8.1],[-8,-20],[-8,-53.7],[-14.1,-53.7],[-22.5,-55.8]]),Np=()=>ur("cameraSpacer",[[-80,-38],[-44,-38],[-44,-32.6],[-62,-32.6],[-62,-28.6],[-74,-28.6],[-74,-34.6],[-80,-34.6]],"frame",.6),Up=()=>{let n=wt("mainMic"),[e,t,i,s]=qi.mainMic.rect,[r,o]=qi.mainMic.y;return n.add("steel",fe(e+5,t+.6,i-.4,s-.8,r,o-.5,.6,.08)),n.add("plastic",fe(e+6,s-.8,i-1.4,s,r+.2,o-.8,.2)),n.add("cowl",fe(e,t,i,s-1.6,o-.2,o,.8)),n.fine("gold",fe(e+6.4,t+1.4,i-2,t+3,o,o+.02,.1)),n.add("ribbon",Wt([[i-2,t+1],[i+5,t+1]],2,o-.3)),Si(n,"mainMic")},Fp=(n,e,t,i,s)=>{let[r,o]=s==="x"?[i/2,.22]:[.22,i/2];n.add("steel",fe(e-r,t-o,e+r,t+o,-2.7,-2.3,.18))},Op=()=>{let n=wt("volumeButtons");for(let[e,t]of[[-62,-51.2],[-48.8,-38]])n.add("rail",fe(e,-ms-.28,t,-ms+.1,-3.6,-1.4,.5,.1)),n.add("frame",fe(e+1,-ms+.1,t-1,-ms+1.1,-3.3,-1.7,.2)),Fp(n,(e+t)/2,-ms+1.5,t-e-2,"x"),n.add("steel",fe((e+t)/2-1.4,-ms+1,(e+t)/2+1.4,-ms+2.1,-3,-2.8,.2));n.add("cowl",fe(-63,-57.2,-32.6,-55.6,-3.2,-1.8,.4)),n.add("ribbon",Wt([[-33.6,-55.4],[-72,-55.4]],1.8,-3.3,-3.16));for(let e of[-70.9,-66.2])n.fine("gold",lt(e,-55.8,1.1,-3.16,-3.14,12));return n},Bp=()=>{let n=wt("touchId");for(let[e,t]of[[-30,-8],[8,24]])n.add("rail",fe(-bo-.28,e,-bo+.1,t,-3.6,-1.4,.5,.1)),n.add("frame",fe(-bo+.1,e+1,-bo+1.1,t-1,-3.3,-1.7,.2)),Fp(n,-bo+1.5,(e+t)/2,t-e-2,"z"),n.add("cowl",fe(-80.4,e+2,-76.2,t-2,-3.2,-3,.5));n.add("ribbon",Wt([[-78,-29],[-78,25]],2.2,-3.4,-3.26));for(let[e,t]of dl("touchId"))n.fine("steel",pn(e,t,.62,1.1,-3.02,-2.98,14));return n};var uM="#cfd0d3",dM="#9c9ea3",fM="#0c0d0f",pM="#39402f",mM="#1a1b1f",zp="#4e5157",gM={package:mM,lid:"#c2c4c8",die:"#2c3442"},_u=.72,pl=.32,xu=1.5,_M=.3,Yi=(n,e)=>{let t=n.index?n.toNonIndexed():n;t.deleteAttribute("uv");let i=new Xe(e),s=t.attributes.position.count,r=new Float32Array(s*3);for(let o=0;o<s;o++)r.set([i.r,i.g,i.b],o*3);return t.setAttribute("color",new Ft(r,3)),t},Vp=()=>{let e=[new le(0,-xu)];for(let t=0;t<=10;t++)e.push(new le(t%2?.38:.3,-xu+xu*t/10));return Yi(new Bi(e,7),dM)},xM=()=>{let n=[[.3,0],[_u,0],[_u,pl*.6],[_u*.86,pl],[0,pl]].map(([e,t])=>new le(e,t));return Yi(new Bi(n,14),uM)},Gp=(n,e)=>Yi(new no(n,4).rotateX(-Math.PI/2).translate(0,e+.012,0),fM),vM=()=>mt([[.09,.09],[.42,.09],[.42,-.09],[.09,-.09],[.09,-.42],[-.09,-.42],[-.09,-.09],[-.42,-.09],[-.42,.09],[-.09,.09],[-.09,.42],[.09,.42]]),yM=n=>{let e=new on;return e.absarc(0,0,n,0,Math.PI*2,!1),e},MM=()=>{let e=new En(.92,.92,.9,6).translate(0,.45,0);return lr([Vp(),Yi(e,"#b9a57f"),Gp(yM(.46),.9)])},fl=n=>lr([Vp(),xM(),Gp(n,pl)]),SM={crosshead:()=>fl(vM()),pentalobe:()=>fl(hl(5,.2,.44)),trilobe:()=>fl(hl(3,.18,.46)),torx:()=>fl(hl(6,.25,.44)),super:MM},bM=n=>{let e=(i,s,r,o,a)=>Yi(new vn(r,o).rotateX(-Math.PI/2).translate(i,.504,s),a),t=[Yi(new Bn(1,.32,1).translate(0,-.34,0),pM),Yi(new Bn(.95,.68,.95).translate(0,.16,0),gM[n])];if(n==="package"){t.push(Yi(lt(-.36,-.36,.05,.5,.505,8),zp));for(let[i,s]of[[-.14,.5],[0,.62],[.14,.36]])t.push(e(s/2-.28,i,s,.05,zp))}return lr(t)},kp=(n,e)=>{let t=new Map;for(let i of n){let s=e(i);t.has(s)||t.set(s,[]),t.get(s).push(i)}return[...t.values()]},wM=new N(0,1,0),EM=new un().setFromAxisAngle(new N(1,0,0),Math.PI),TM=n=>{let[e,t,i]=ko(n),s=new N(e,t,i);if(n.kind==="chip")return{position:s,quaternion:n.side==="back"?EM:new un,scale:new N(n.w,n.h,n.d)};let r=new N(...n.dir);return n.dir[1]!==1&&s.addScaledVector(r,-_M),{position:s,quaternion:new un().setFromUnitVectors(wM,r),scale:new N(1,1,1)}},AM=(n,e,t)=>{let i=new cs(e,t,n.length);i.frustumCulled=!1,i.instanceMatrix.setUsage(nl);let s=new Ui(new Float32Array(n.length*2),2);s.setUsage(nl),e.setAttribute("aStyle",s);let r=new ht,o=n.map((c,l)=>{let{position:h,quaternion:f,scale:u}=TM(c);return i.setMatrixAt(l,r.compose(h,f,u)),h});return{mesh:i,update:(c,l,h,f,u,d)=>{let m=i.instanceMatrix.array;n.forEach((v,g)=>{let[p,S,T]=zo(v,c),y=o[g];m[g*16+12]=y.x+p,m[g*16+13]=y.y+S,m[g*16+14]=y.z+T;let{drawing:w,tint:b}=Bl(v,c,l,h,f,u,d);s.array[g*2]=w,s.array[g*2+1]=b}),i.instanceMatrix.needsUpdate=!0,s.needsUpdate=!0}}};function Hp(n){let e=So("fastener"),t={package:So("package"),lid:So("lid"),die:So("die")},i=r=>Nt[r.host].side,s=[...kp(Oo.filter(r=>r.kind==="screw"),r=>`${i(r)}/${r.head}`).map(r=>({items:r,geometry:SM[r[0].head](),material:e})),...kp(Oo.filter(r=>r.kind==="chip"),r=>`${i(r)}/${r.surface}`).map(r=>({items:r,geometry:bM(r[0].surface),material:t[r[0].surface]}))].map(({items:r,geometry:o,material:a})=>{let c=AM(r,o,a);return n[i(r[0])].inner.add(c.mesh),c});return(r,o,a,c,l,h)=>{for(let f of s)f.update(r,o,a,c,l,h);for(let f of[e,...Object.values(t)])f.transparent=a>0}}var{HALF_H:mn,HINGE:Lt,PART:Xt,SPEC:Yp,ISLAND:ml,LENSES:Eo}=hi,CM=Yp.open.t,fr=11,gl=Lt.panelEdge,RM=new Xe("#17191c"),IM=new Xe("#f58025"),Zp=(n,e,t)=>n>0?mt(e,t):mt(e.map(([i,s])=>[-i,s]).reverse(),[...t].reverse()),PM=n=>{let t=Lt.halfOpen,i=mn,s=[[gl,-i],[t,-i],[t,i],[gl,i],[gl,i-1.05],[t-1.05,i-1.05],[t-1.05,-i+1.05],[gl,-i+1.05]];return Zp(n,s,[0,fr,fr,0,0,fr-1.05,fr-1.05,0])},To=11.8,LM=To-.05,Wp=Lt.halfThick+.25,DM=n=>{let e=Lt.halfOpen-.9,t=mn-.9;return Zp(n,[[To,-t],[e,-t],[e,t],[To,t]],[0,fr-1,fr-1,0])},NM=()=>{let n=wt("enclosure");for(let[l,h]of[[-1,"B"],[1,"O"]]){n.add("rail",yt(PM(l),-CM,-.02,.16,10),h),n.add("frame",yt(DM(l),-4.5,-4.1,0,8),h);let[f,u]=l>0?[Wp,To+.4]:[-To-.4,-Wp];for(let[d,m]of[[-57.4,-7],[7,57.4]])n.add("frame",fe(f,d,u,m,-2.6,-1.8,.3),h);for(let d of[-50,-37.5,-25,-12.5,12.5,25,37.5,50])n.add("steel",lt(l*9,d,1.15,-1.8,-1.62,14),h),n.add("plastic",lt(l*9,d,.5,-1.62,-1.58,8),h);for(let d of[-22,22])n.add("frame",fe(l>0?17:-81,d-.5,l>0?81:-17,d+.5,-4.1,-3.7,.2),h);for(let[d,m]of[[70,-58.7],[70,58.7],[28,-58.7],[28,58.7]])n.add("plastic",fe(l*d-.6,m-.21,l*d+.6,m+.21,-5,-.3,.05),h);for(let[d,m]of[[20,-55],[50,-56],[78,-48],[79.5,0],[78,48],[50,56],[20,55]])n.add("steel",lt(l*d,m,1.05,-4.1,-3.5,12),h),n.add("plastic",lt(l*d,m,.5,-3.5,-3.45,8),h)}let e=(l,h,f,u)=>n.add("brushed",yt(mt(l,h),-4.1,f,0,4),u);e([[-70,-34],[-44,-34],[-37,4],[-37,9],[-58,26],[-70,26]],1.4,-3.96,"B"),e([[-44,37],[-12.4,16.2],[-12.4,37]],1,-3.96,"B"),e(bt(-22,-35,-12.4,-8),1,-3.96,"B"),e(bt(17,-41,38,-14),2,-3.96,"O"),e(bt(62.6,-43,78,21),1.4,-3.96,"O"),n.add("copper",yt(mt(bt(40.6,-42.6,61.7,23.6),2.4),-4.1,-3.98,0,5),"O"),e(bt(41.4,-41.8,60.9,22.8),1.8,-3.92,"O");for(let l=0;l<12;l++)for(let h=0;h<36;h++)n.fine("plastic",lt(42.8+l*1.53,-40.4+h*1.77,.34,-3.92,-3.9,6),"O");for(let l=0;l<6;l++){let h=66-l*2.4,f=new En(.42,.42,.5,8);f.rotateX(Math.PI/2);for(let u of[-1,1])n.add("plastic",f.clone().translate(u*h,-2.6,mn-.24),u<0?"B":"O");n.add("plastic",f.clone().translate(l*2.4+16,-2.6,-mn+.24),"O")}n.add("plastic",fe(36.1,mn-.2,45.1,mn+.02,-3.9,-1.1,.9),"O");for(let[l,h]of[[-62,-51.2],[-48.8,-38]])n.add("plastic",fe(l,-mn-.02,h,-mn+.3,-3.6,-1.4,.4),"B");for(let[l,h]of[[-30,-8],[8,24]])n.add("plastic",fe(-Lt.halfOpen-.02,l,-Lt.halfOpen+.3,h,-3.6,-1.4,.4),"B");for(let l of[33.6,47.6])for(let[h,f]of[[-1,"B"],[1,"O"]]){let u=new En(.46,.46,.2,10);u.rotateX(Math.PI/2),n.add("plastic",u.translate(h*l,-2.6,mn-.09),f)}let t=Lt.halfThick,i=.7,s=Lt.coverBand,r=Lt.coverSplit,o=l=>new Oi(l,{depth:Yp.open.h-1,curveSegments:8,bevelEnabled:!0,bevelThickness:.3,bevelSize:.2,bevelOffset:-.2,bevelSegments:2}).translate(0,0,-mn+.5),a=l=>{let h=new on;return h.moveTo(l*(s+r),-i),h.lineTo(l*(t-i),-i),h.lineTo(l*(t-i),-4.2),h.lineTo(l*t,-4.2),h.lineTo(l*t,-2.6),h.quadraticCurveTo(l*t,0,l*(t-2.6),0),h.lineTo(l*(s+r),0),h.closePath(),h},c=new on;c.moveTo(-s,-i),c.lineTo(s,-i),c.lineTo(s,0),c.lineTo(-s,0),c.closePath();for(let l of[-mn+.3,mn-1.1])n.add("cover",fe(-t+.3,l,t-.3,l+.8,-4.1,-.5,.2),"cover");n.add("cover",o(c),"cover");for(let l of[-1,1])n.add("rail",o(a(l)),"cover");for(let l of[-1,1]){let[h,f]=[s+.04,s+r-.04].map(u=>l*u);n.add("plastic",fe(Math.min(h,f),-mn+.8,Math.max(h,f),mn-.8,-i-.2,-.08,.02),"cover")}return n},UM=()=>{let n=wt("backGlass"),[e,,t]=Xt.backGlass.rect;n.add("backGlass",yt(mt(bt(e,-58,t,58),[10.3,1,1,10.3]),-.7,0,.12,10));let{z:i,ring:s}=Eo;n.add("backGlass",yt(mt(bt(ml.x0,i-ml.halfDepth,ml.x1,i+ml.halfDepth),11),0,1.5,.5,14));for(let r of Eo.x)n.add("rail",pn(r,i,s-2.1,s,1.4,2.5)),n.add("lens",lt(r,i,s-2,1.2,2.3,36)),n.add("plastic",pn(r,i,s-4.4,s-2,2.3,2.34,32));n.add("flash",lt(-37.5,i,2.4,-.1,.05,20)),n.add("plastic",pn(-37.5,i,2.4,2.9,-.1,.03,20)),n.add("steel",pn(-42.5,3,23,27.5,-1,-.7,56));for(let r=7;r<21;r+=1.4)n.fine("copper",pn(-42.5,3,r,r+1.05,-.92,-.72,40));return n.add("ribbon",Wt([[-22,40],[-22,28],[-27,18]],5,-1,-.86)),n.add("plastic",fe(-30,37,-14,42,-.9,-.7,.6)),n},FM=()=>{let n=wt("outerDisplay"),[e,,t]=Xt.outerDisplay.rect;return n.add("screen",yt(mt(bt(e,-58,t,58),[1,10.3,10.3,1]),-.7,0,.12,10)),n.add("lens",lt(73.5,-49.8,1.9,-.02,.02,20)),n.add("rail",pn(73.5,-49.8,1.9,2.15,-.02,.02,20)),n.add("plastic",fe(30,46,58,53,-1.1,-.7,.8)),n.add("ribbon",Wt([[34,50],[34,40],[28,30]],6,-1,-.86)),n},$p=(n,e,t)=>{for(let i=0;i<6;i++)n.fine("brushed",fe(e,t+i*1.1,e+15-i*37%7,t+i*1.1+.26,-.9,-.89,.03))},OM=()=>{let n=wt("battery1"),e=[[-78,-28],[-42.7,-28],[-42.7,11],[-16,11],[-16,40.6],[-78,40.6]];return n.add("pouch",yt(mt(e,[2.4,2.4,2,2.4,2.4,2.4]),-3.7,-.9,.34,6)),n.add("plastic",fe(-78.2,-20,-77.2,30,-3.4,-1.1,.2)),n.add("plastic",fe(-17,15,-15.8,36,-3.4,-1.1,.2)),n.add("steel",fe(-74,40.2,-60,42,-1.2,-.9,.3)),n.add("steel",fe(-34,40.2,-20,42,-1.2,-.9,.3)),n.add("ribbon",Wt([[-24,15],[-24,9]],6,-1,-.86)),n.add("plastic",fe(-27,7.5,-21,11,-1.1,-.9,.5)),n.fine("gold",fe(-26.4,8.2,-21.6,10.4,-.9,-.88,.1)),$p(n,-72,16),n},BM=()=>{let n=wt("battery2"),e=[[17.4,-40],[72,-40],[72,-33],[79.8,-33],[79.8,37.4],[17.4,37.4]];return n.add("pouch",yt(mt(e,[2.4,1,1.4,2.4,2.4,2.4]),-3.7,-.9,.34,6)),n.add("plastic",fe(30,36.6,72,37.7,-3.4,-1.1,.2)),n.add("plastic",fe(17.1,-30,18,30,-3.4,-1.1,.2)),n.add("plastic",fe(34,37.6,46,39,-1.2,-.9,.3)),n.add("plastic",fe(52,37.6,64,39,-1.2,-.9,.3)),n.add("plastic",lt(68,-36,2.2,-1,-.86,16)),n.add("steel",pn(68,-36,2.2,3,-1,-.86,16)),n.add("ribbon",Wt([[27,34],[27,45]],5.4,-1,-.86)),n.add("plastic",fe(23.6,42,30.4,46,-1.1,-.9,.4)),$p(n,26,12),n},Xp=(n,e,t,i,s)=>{let r=wt(n),{y:o}=Xt[n];r.add("plastic",yt(mt(bt(e,t,i,s),1.6),o[0],o[1],.25,5));let a=(e+i)/2,c=(t+s)/2,l=(i-e)*.32,h=(s-t)*.26;r.add("steel",yt(mt(bt(a-l,c-h,a+l,c+h),1),o[1],o[1]+.08,0,4));let f=i-e;for(let u=0;u<14;u++)r.fine("steel",lt(e+f*.14+u*f*.72/13,n==="topSpeaker"?t+1:s-1,.32,o[1],o[1]+.02,8));return r.add("ribbon",Wt(n==="topSpeaker"?[[i-6,s-1],[i+2,s+3]]:[[i-8,t+1],[i+3,t-1]],2.4,o[1]-.16)),Si(r,n)},zM=()=>{let n=wt("taptic"),[e,t,i]=Xt.taptic.rect,[s,r]=Xt.taptic.y,o=52.4;return n.add("steel",yt(mt(bt(e+2.2,t,i-2.2,o),.6),s,r,.16,4)),n.add("plastic",fe(e,t+.4,e+2.4,o-.4,s+.2,r-.2,.5)),n.add("plastic",fe(i-2.4,t+.4,i,o-.4,s+.2,r-.2,.5)),n.add("gold",fe(e+6,t+2,e+12,t+3.6,r,r+.05,.1)),n.add("cowl",fe(-34.4,51.6,-31.6,56.4,r-.2,r,.5)),n.add("cowl",fe(-15.2,51.6,-12.4,55.4,r-.2,r,.5)),n.add("ribbon",Wt([[e+9,t+1],[e+9,40]],3,r-.16)),Si(n,"taptic")},kM=()=>{let n=wt("usbC"),[e,t,i,s]=Xt.usbC.rect,[r,o]=Xt.usbC.y;return n.add("steel",yt(mt(bt(e+2.8,t+2,i-2.8,s),.9),r,o,.14,4)),n.add("plastic",fe(e+3.8,s-3.6,i-3.8,s+.06,r+.7,o-.7,.6)),n.add("gold",fe(e+5,s-1.2,i-5,s+.08,r+1.25,o-1.25,.05)),n.add("cowl",fe(e,t,i,t+2.6,o-.3,o,.5)),n.add("ribbon",Wt([[40.6,t+1],[40.6,t-3]],8,o-.14)),n.add("plastic",fe(e+2.2,s-1.6,e+2.8,s-.6,r+.3,o-.3,.1)),n.add("plastic",fe(i-2.8,s-1.6,i-2.2,s-.6,r+.3,o-.3,.1)),Si(n,"usbC")},VM=()=>{let n=wt("rearCamera"),e=Eo.z;n.add("steel",fe(-78.4,-55,-60,-35,-4.2,-1.8,1.2,.14)),n.add("steel",fe(-60.5,-55,-42.7,-35,-4.2,-1.8,1.2,.14));for(let[t,i]of[[Eo.x[0],7.2],[Eo.x[1],7.8]])n.add("plastic",lt(t,e,i,-1.8,-.9,32)),n.add("plastic",lt(t,e,i*.76,-.9,-.3,28)),n.add("lens",lt(t,e,i*.52,-.3,-.24,24));n.add("cowl",fe(-60.6,-36,-57,-33,-2.2,-1.8,.5)),n.add("cowl",fe(-43.4,-42.2,-35.6,-39,-1.5,-1.3,.6)),n.add("cowl",fe(-78.4,-53.4,-74.8,-49.6,-2,-1.8,.5));for(let[t,i,s]of[[-52,-35,2.4],[-47,-35,2.4]])n.add("ribbon",Wt([[t,i+1],[t,i-1.6],[-40.6,i+8+(t===-52?-6:0)]],s,-1.5,-1.36));return Si(n,"rearCamera",-1.8)},GM=()=>{let n=wt("faceTime"),[e,t,i,s]=Xt.faceTime.rect,[r,o]=Xt.faceTime.y;return n.add("plastic",fe(e,t,i,s,r+.8,o,.4,.1)),n.add("plastic",lt((e+i)/2,(t+s)/2,2.2,r,r+.8,18)),n.add("lens",lt((e+i)/2,(t+s)/2,1.3,r-.04,r,16)),n.add("steel",fe(e+.5,t+.5,i-.5,s-.5,o,o+.1,.3)),n.add("ribbon",Wt([[i-1,t+3.4],[i+3,t+3.4],[i+3,t+8]],2.4,o-.3)),n},HM=()=>{let n=wt("outerFront"),[e,t,i,s]=Xt.outerFront.rect,[r,o]=Xt.outerFront.y,a=(e+i)/2,c=(t+s)/2;return n.add("steel",fe(e,t,i,s,r,r+.5,.5,.08)),n.add("plastic",lt(a,c,3.2,r+.5,o-.5,20)),n.add("plastic",lt(a,c,2.1,o-.5,o,18)),n.add("lens",lt(a,c,1.3,o,o+.04,16)),n.add("cowl",fe(70,-56.4,72.2,c,o-.2,o,.4)),n.add("cowl",fe(77.8,-51.4,80,-49.2,o-.2,o,.4)),n.add("ribbon",Wt([[a,c+3],[a-8,c+3]],2.4,r+.5)),Si(n,"outerFront")},vu=(n,e,t,i,s=Ho,r=32)=>{let o=(r+1)*2,a=new Float32Array(o*i.length*3),c=new Float32Array(o*i.length*3),l=[];i.forEach((d,m)=>{for(let v=0;v<r;v++){let g=m*o+v*2;l.push(g,g+1,g+2,g+1,g+3,g+2)}});let h=new Ot;h.setAttribute("position",new Ft(a,3)),h.setAttribute("normal",new Ft(c,3)),h.setIndex(l);let f=new Rt(h,hr(e,n.style,$t)),u=new Rt(h,hr(t,n.style,Tn));return n.group("strip").add(f,u),n.meshes.push(f,u),d=>{let m=s(d,r);i.forEach(([v,g],p)=>{for(let S=0;S<=r;S++){let[T,y]=m[S],[w,b]=m[Math.max(S-1,0)],[C,x]=m[Math.min(S+1,r)],E=C-w,I=x-b,D=Math.hypot(E,I)||1,O=(p*o+S*2)*3;a.set([T,y,v,T,y,g],O),c.set([-I/D,E/D,0,-I/D,E/D,0],O)}}),h.attributes.position.needsUpdate=!0,h.attributes.normal.needsUpdate=!0,h.computeBoundingSphere()}},WM=()=>{let n=wt("innerDisplay"),e=Lt.displayEdge;for(let[t,i]of[[-1,"B"],[1,"O"]]){let s=t*e,r=t*81,o=t>0?bt(s,-57,r,57):bt(r,-57,s,57),a=t>0?[0,9.5,9.5,0]:[9.5,0,0,9.5];n.add("matte",yt(mt(o,a),-5.2,-4.95,0,8),i),n.add("plate",yt(mt(o,a),-4.95,-4.6,0,8),i),n.add("plastic",fe(t>0?s+1:s-7,-54,t>0?s+7:s-1,54,-4.6,-4.54,.3),i);for(let c of[-46,-10,26,50])n.add("copper",lt(t*74,c,.9,-4.6,-4.56,10),i)}return n.add("lens",lt(-68,-40,1.6,-5.24,-5.2,18),"B"),n.add("plastic",fe(36,-56,60,-44,-4.6,-4.5,1),"O"),n.setStrip=vu(n,"matte","plate",[[-57,57]]),n},XM=()=>{let n=wt("displayTrim"),e=Lt.displayEdge;for(let[t,i]of[[-1,"B"],[1,"O"]]){let s=t*81,r=mt(t>0?bt(e,-58,t*82,58):bt(t*82,-58,-e,58),t>0?[0,10,10,0]:[10,0,0,10]);r.holes.push(new ti(mt(t>0?bt(e+.1,-56.6,s-.4,56.6):bt(s+.4,-56.6,-e-.1,56.6),t>0?[0,9,9,0]:[9,0,0,9]).getPoints(8))),n.add("plastic",yt(r,-5.32,-4.9,0,8),i);for(let o of[-57.2,56.2])n.add("steel",fe(t>0?e+1:-e-7,o,t>0?e+7:-e-1,o+1,-4.9,-4.7,.2),i)}return n.setStrip=vu(n,"plastic","plastic",[[-57.8,-57],[57,57.8]]),n},qM=()=>{let n=wt("coverLayer"),[e,t,i,s]=Xt.coverLayer.rect,[r,o]=Xt.coverLayer.y;return n.add("nano",yt(mt(bt(e,t,i,s),9.5),r,o,0,8)),n},qp={pinOuter:[52,57],springOuter:[40,51.4],gears:[33,39.4],springInner:[21,32.4],pinInner:[14.4,20.4]},wo=1.1,YM=-2.9,ZM=[-3*wo,-wo,wo,3*wo],$M=[[15,23.5],[24,32.5],[33,41.5],[42,50.5],[51,56.5]].flatMap(([n,e])=>[[n,e],[-e,-n]]),$i=Lt.axisX,Zi=n=>n>$i?"R":n<-$i?"L":"",JM=()=>{let n=wt("hinge"),e=-3.3,t=(o,a,c,l,h,f,u,d,m,v)=>{for(let[g,p]of[[a,-$i],[-$i,$i],[$i,c]]){let S=Math.max(g,a),T=Math.min(p,c);T-S>.05&&n.add(o,fe(S,l,T,h,f,u,Math.min(d,(T-S)/2-.01),m),v+Zi((S+T)/2))}};for(let o of[-1,1]){let a=h=>{let[f,u]=qp[h];return o>0?[f,u]:[-u,-f]};for(let h of["pinOuter","pinInner"]){let[f,u]=a(h);t("steel",-4.8,4.8,f,u,-3.9,-2.4,.5,.1,"pins");for(let d of[-3,3])n.add("gold",lt(d,(f+u)/2,1.4,-3.96,-3.9,16),"pins"+Zi(d)),n.add("plastic",lt(d,(f+u)/2,.6,-4,-3.96,10),"pins"+Zi(d));for(let d of[-4.2,-1.2,1.2,4.2]){let m=new En(.34,.34,u-f+.8,8);m.rotateX(Math.PI/2),n.fine("steel",m.translate(d,-2.2,(f+u)/2),"pins"+Zi(d));for(let v of[f-.3,u+.3]){let g=new En(.46,.46,.12,10);g.rotateX(Math.PI/2),n.fine("gold",g.translate(d,-2.2,v),"pins"+Zi(d))}}}for(let h of["springOuter","springInner"]){let[f,u]=a(h);for(let d of[-4,-2.4,-.8,.8,2.4,4])n.fine("steel",hp(d,e,f,u,.7),"springs"+Zi(d));t("frame",-4.8,4.8,f-.2,f+.2,-3.9,-2.6,.1,0,"springs"),t("frame",-4.8,4.8,u-.2,u+.2,-3.9,-2.6,.1,0,"springs")}let[c,l]=a("gears");t("frame",-4.8,4.8,c,c+.8,-3.9,-2.4,.2,0,"gears"),t("frame",-4.8,4.8,l-.8,l,-3.9,-2.4,.2,0,"gears")}for(let[o,a]of[[-13.6,-7.6],[7.6,13.6]]){t("plastic",-4.8,4.8,o,a,-3.9,-2.6,.4,.06,"bar");for(let c of[-3.4,3.4])n.fine("steel",lt(c,(o+a)/2,.6,-2.6,-2.56,10),"bar"+Zi(c))}n.add("plastic",fe(-4.8,-13.6,-3.4,13.6,-3.9,-2.6,.3),"barL"),n.add("plastic",fe(3.4,-13.6,4.8,13.6,-3.9,-2.6,.3),"barR");let i=ws(0)[2].x+.15;for(let[o,a]of[[-1,"L"],[1,"R"]])for(let[c,l]of[[-57.4,57.4]]){let[h,f]=o>0?[$i+.1,i]:[-i,-$i-.1];n.add("frame",fe(h,c,f,l,Lt.axisY-.98,Lt.axisY-.58,.2),"pins"+a)}ws(0).forEach(({length:o},a)=>{for(let c of[-1,1]){let l=`link${c>0?"R":"L"}${a}`;for(let[u,d]of $M){let m=v=>c>0?v:v.rotateY(Math.PI).translate(0,0,u+d);n.add(a===1?"can":"steel",m(fe(0,u+a*.2,o,d-a*.2,-.3,.3,.3)),l),!(a<2)&&(n.add("steel",m(fe(1.4,u+1.6,4.8,d-1.6,-.5,-.3,.4)),l),n.add("gold",m(lt(o-.9,(u+d)/2,.7,-.36,-.3,12)),l))}if(a<2)continue;let h=u=>c>0?u:u.rotateY(Math.PI);for(let u of[-13.6,12.6])n.add("steel",h(fe(0,u,o,u+1,-.3,.3,.2)),l);n.add("steel",h(fe(o-1,-13.6,o,13.6,-.3,.3,.2)),l);let f=LM-ws(0)[a].x;for(let[u,d]of[[-57.4,57.4]])n.add("frame",h(fe(.15,u,f,d,-.98,-.58,.2)),l)}});let s=up(wo,10,4),r=hr("gold",n.style);n.gears=[];for(let o of[-1,1]){let[a,c]=qp.gears,l=o*((a+c)/2);ZM.forEach((h,f)=>{let u=new Rt(s,r);u.position.set(h,YM,l),u.userData.index=f,n.group("gears"+Zi(h)).add(u),n.meshes.push(u),n.gears.push(u)})}return n},KM=()=>{let n=wt("flexCable"),[e]=Xt.flexCable.y,t=Lt.displayEdge;n.setStrip=vu(n,"plastic","plastic",[[-6.5,6.5]],Fl,72);for(let[i,s]of[[-1,"B"],[1,"O"]]){n.add("plastic",fe(i>0?t-.4:-28,-6.5,i>0?28:.4-t,6.5,e,e+.3,.4),s),n.add("gold",fe(i>0?24.5:-27.2,-5.6,i>0?27.2:-24.5,5.6,e+.3,e+.36,.2),s);for(let r=-5;r<=5;r+=1.25)n.fine("copper",fe(i>0?t:-24.4,r-.09,i>0?24.4:-t,r+.09,e+.3,e+.32,.02),s);n.add("cowl",fe(i>0?20:-24,-6.4,i>0?24:-20,6.4,e+.3,e+.42,.3),s)}return n},jM={enclosure:NM,backGlass:UM,outerDisplay:FM,backAdhesive:wp,outerAdhesive:Ep,batteryCowling:Tp,boardCowling:Ap,faceTimeCowling:Cp,ioCowling:Ip,alsCowling:Rp,battery1:OM,battery2:BM,bottomSpeaker:()=>Xp("bottomSpeaker",...Xt.bottomSpeaker.rect),lowerAntenna:Lp,taptic:zM,mainMic:Up,topSpeaker:()=>Xp("topSpeaker",...Xt.topSpeaker.rect),usbC:kM,cameraSpacer:Np,rearCamera:VM,faceTime:GM,outerFront:HM,upperAntenna:Dp,logicBoard:Mp,ioBoard:Sp,displayTrim:XM,coverLayer:qM,innerDisplay:WM,hinge:JM,flexCable:KM,volumeButtons:Op,touchId:Bp},dr=n=>{let e=new hn;e.position.set(n*Lt.axisX,Lt.axisY,0);let t=new hn;return t.position.set(-n*Lt.axisX,-Lt.axisY,0),e.add(t),{pivot:e,inner:t}};function Jp({shadows:n}){let e=new hn,t=Object.fromEntries(Object.entries(jM).map(([S,T])=>{let y=T();return y.build(n),[S,y]})),i=dr(-1),s=dr(1),r=dr(-1),o=dr(1);e.add(i.pivot,s.pivot,r.pivot,o.pivot);let a={B:i,O:s};for(let S of Object.values(t))Xt[S.id].side!=="C"&&a[Xt[S.id].side].inner.add(S.group());let c=Hp(a);r.inner.add(t.enclosure.group("B")),o.inner.add(t.enclosure.group("O")),e.add(t.enclosure.group("cover"));for(let S of["innerDisplay","displayTrim"])i.inner.add(t[S].group("B")),s.inner.add(t[S].group("O"));e.add(t.innerDisplay.group("strip"),t.displayTrim.group("strip"),t.coverLayer.group()),r.inner.add(t.flexCable.group("B")),o.inner.add(t.flexCable.group("O")),e.add(t.flexCable.group("strip"));let l=new hn,h=["pins","springs","gears","bar"],f=Object.fromEntries(h.map(S=>[S,t.hinge.group(S)]));l.add(...Object.values(f));let u=Object.fromEntries(h.map(S=>{let T={L:dr(-1),R:dr(1)};return T.L.inner.add(t.hinge.group(`${S}L`)),T.R.inner.add(t.hinge.group(`${S}R`)),l.add(T.L.pivot,T.R.pivot),[S,T]})),d=[0,1,2].map(S=>({L:t.hinge.group(`linkL${S}`),R:t.hinge.group(`linkR${S}`)}));for(let{L:S,R:T}of d)l.add(S,T);e.add(l);let m=Object.values(t),v=!0;return{root:e,parts:t,update:(S,T=null,y=0,w=null,b=null,C=1)=>{let x=es(S);e.rotation.z=x.rot,e.position.set(x.x,x.y,0);let E=x.phi,I=E+Dl(S);i.pivot.rotation.z=E,s.pivot.rotation.z=-E,r.pivot.rotation.z=I,o.pivot.rotation.z=-I,t.enclosure.group("cover").position.y=bs(I);for(let P of m){let[k,X,te]=ci(P.id,S);for(let Z of Object.keys(P.groups))P.id==="enclosure"||P.id==="hinge"||P.groups[Z].position.set(k,X,te);let q=Yo(P.id,S,T,y,b,C);P.style.uDrawing.value=q.drawing,P.style.uTint.value=q.tint,P.lines.color.copy(RM).lerp(IM,q.line),P.lines.opacity=.26-.15*q.drawing+.44*q.line;for(let Z of P.meshes)Z.castShadow=q.drawing<.5,Z.visible=q.drawing<1,Z.material.transparent=q.drawing>0;for(let Z of P.details)Z.visible=v&&q.drawing<1,Z.material.transparent=q.drawing>0}let[,D]=ci("hinge",S);l.position.y=D,ws(I).forEach(({x:P,y:k,rot:X},te)=>{d[te].R.position.set(P,k,0),d[te].R.rotation.z=X,d[te].L.position.set(-P,k,0),d[te].L.rotation.z=-X});for(let P of t.hinge.gears)P.rotation.z=Ul(I,P.userData.index);let V=Go(I),R=Ll(S);for(let P of h){let k=V+(R[P]??0);f[P].position.y=k,u[P].L.pivot.position.y=Lt.axisY+k,u[P].R.pivot.position.y=Lt.axisY+k,u[P].L.pivot.rotation.z=I,u[P].R.pivot.rotation.z=-I}t.innerDisplay.setStrip(E),t.displayTrim.setStrip(E),t.flexCable.setStrip(E),t.coverLayer.group().visible=Yn("coverLayer",S)>0,c(S,T,y,w,b,C)},setDetail:S=>{v=S}}}var Kp=14,pr=1.35,QM=()=>{let n=document.createElement("canvas");n.width=n.height=256;let e=n.getContext("2d"),t=e.createRadialGradient(128,128,8,128,128,128);return t.addColorStop(0,"rgba(40,42,46,0.42)"),t.addColorStop(.55,"rgba(40,42,46,0.14)"),t.addColorStop(1,"rgba(40,42,46,0)"),e.fillStyle=t,e.fillRect(0,0,256,256),new qr(n)},eS=n=>{let e=new Xs;e.background=new Xe("#d7d8da");let t=(r,o,a,c)=>{let l=new Rt(new vn(r,o),new Ni({color:new Xe(1,1,1).multiplyScalar(c),side:An}));l.position.set(...a),l.lookAt(0,0,0),e.add(l)};t(14,14,[0,14,3],2),t(3,14,[-13,4,6],3.2),t(3,14,[13,4,-4],2),t(18,2,[0,2,14],1.5),t(14,14,[0,-14,0],.8);let i=new ar(n),s=i.fromScene(e,.02).texture;return i.dispose(),s};function jp(n,{shadows:e,keepBuffer:t=!1}){let i=new ol({canvas:n,antialias:!0,alpha:!0,preserveDrawingBuffer:t,powerPreference:"high-performance"});i.setClearColor(0,0),i.toneMapping=lo,i.outputColorSpace=sn,i.shadowMap.enabled=e,i.shadowMap.type=hs;let s=new Xs;s.environment=eS(i);let r=new en(qo,16/9,10,6e3),o=new ao("#ffffff",1.5);o.position.set(-160,420,200),o.castShadow=e,Object.assign(o.shadow.camera,{left:-240,right:240,top:240,bottom:-240,near:60,far:900}),o.shadow.mapSize.set(2048,2048),o.shadow.bias=-6e-4,o.shadow.normalBias=1,s.add(o,o.target,new ro("#ffffff","#cfd0d3",.55));let a=Jp({shadows:e});s.add(a.root);let c=new Rt(new vn(1,1),new Ni({map:QM(),transparent:!0,depthWrite:!1,toneMapped:!1}));c.rotation.x=-Math.PI/2,c.renderOrder=-1,s.add(c);let l={w:16,h:9},h=(w,b,C)=>{l.w=w,l.h=b,i.setPixelRatio(C),i.setSize(w,b,!1),r.aspect=w/b,r.updateProjectionMatrix()},f=Math.PI/180,u=({target:[w,b,C],az:x,el:E,dist:I})=>{let D=x*f,O=E*f;r.position.set(w+I*Math.cos(O)*Math.sin(D),b+I*Math.sin(O),C+I*Math.cos(O)*Math.cos(D)),r.lookAt(w,b,C),r.updateMatrixWorld()},d=40,m=new N,v=new N,g=({min:w,max:b})=>{r.getWorldDirection(m);let C=1/0,x=0;for(let E of[w[0]*pr,b[0]*pr])for(let I of[w[1]-Kp,b[1]])for(let D of[w[2]*pr,b[2]*pr]){let O=v.set(E,I,D).sub(r.position).dot(m);C=Math.min(C,O),x=Math.max(x,O)}r.near=Math.max(C-d,8),r.far=x+d,r.updateProjectionMatrix()},p=(w,b,C=null,x=0,E=null,I=null,D=1)=>{a.update(w,C,x,E,I,D);let O=Xo(w),{min:V,max:R}=O;c.position.set(0,V[1]-Kp,0),c.scale.set((R[0]-V[0])*pr,(R[2]-V[2])*pr,1),c.material.opacity=1-x*.8,u(b),g(O),i.render(s,r)},S=new N;return{renderer:i,scene:s,camera:r,phone:a,resize:h,draw:p,project:([w,b,C])=>(S.set(w,b,C).project(r),[(S.x*.5+.5)*l.w,(-S.y*.5+.5)*l.h]),setShadows:w=>{i.shadowMap.enabled!==w&&(i.shadowMap.enabled=w,o.castShadow=w,s.traverse(b=>{b.isMesh&&b.material.isMeshStandardMaterial&&(b.receiveShadow=w,b.material.needsUpdate=!0)}))},size:l}}var _l={appleSpecs:{label:"Apple tech specs",url:"https://www.apple.com/iphone-duo/specs/"},applePress:{label:"Apple press release",url:"https://www.apple.com/newsroom/2026/09/apple-unveils-iphone-duo/"},appleManual:{label:"Apple repair manual",url:"https://support.apple.com/en-us/127682"},appleParts:{label:"Apple exploded views",url:"https://support.apple.com/en-us/127676"},appleBackGlass:{label:"Apple back glass procedure",url:"https://support.apple.com/en-us/127660"},appleOuterDisplay:{label:"Apple outer display procedure",url:"https://support.apple.com/en-us/127671"},appleBattery:{label:"Apple battery procedure",url:"https://support.apple.com/en-us/127657"},appleBattery2:{label:"Apple Battery 2 procedure",url:"https://support.apple.com/en-us/127667"},appleScrews:{label:"Apple screw diagrams",url:"https://support.apple.com/en-us/127678"},appleCamera:{label:"Apple camera procedure",url:"https://support.apple.com/en-us/127661"},appleLogicBoard:{label:"Apple logic board procedure",url:"https://support.apple.com/en-us/127665"},appleTaptic:{label:"Apple Taptic Engine procedure",url:"https://support.apple.com/en-us/127669"},appleIo:{label:"Apple I/O board procedure",url:"https://support.apple.com/en-us/127666"},appleVolume:{label:"Apple volume buttons procedure",url:"https://support.apple.com/en-us/127863"},appleTouchId:{label:"Apple side buttons procedure",url:"https://support.apple.com/en-us/127870"},appleHinge:{label:"Apple hinge troubleshooting",url:"https://support.apple.com/en-us/148323"},ifixitTeardown:{label:"iFixit teardown",url:"https://www.ifixit.com/News/119895/iphone-duo-teardown"},ifixitVideo:{label:"iFixit teardown video",url:"https://www.youtube.com/watch?v=WOVIjFnivJA"},ifixitChips:{label:"iFixit chip ID",url:"https://www.ifixit.com/Teardown/iPhone+Duo+Chip+ID/245251"},ifixitDevice:{label:"iFixit device page",url:"https://www.ifixit.com/Device/iPhone_Duo"},ifixitPrices:{label:"iFixit repair prices",url:"https://www.ifixit.com/News/119797/how-the-iphone-duos-crazy-repair-prices-compare"},macrumorsBattery:{label:"MacRumors on Apple\u2019s EU label",url:"https://www.macrumors.com/2026/10/18/iphone-duo-battery-capacity/"}};var qt=n=>document.getElementById(n),tS="http://www.w3.org/2000/svg",Qp=18,xl=12,yu=29,em=920,nS=matchMedia("(prefers-reduced-motion: reduce)").matches,nt=(n,e,t)=>{let i=document.createElement(n);return e&&(i.className=e),t!==void 0&&(i.textContent=t),i},Ji=(n,e={},t=null)=>{let i=document.createElementNS(tS,n);for(let[s,r]of Object.entries(e))i.setAttribute(s,r);return t?.append(i),i},Su=n=>{let{label:e,url:t}=_l[n],i=nt("a","",e);return i.href=t,i.target="_blank",i.rel="noopener",i},im=({k:n,v:e,s:t,note:i})=>{let s=nt("div","fact");s.append(nt("dt","",n));let r=nt("dd","source");return r.append(Su(t)),s.append(r,nt("dd","value",e)),i&&s.append(nt("dd","note",i)),s},iS=(n,e)=>{let t=qt("steps"),i={},s={};for(let r of Zn.slice(1)){let o=Vt.filter(u=>u.chapter===r.id),a=nt("div","group"),c=nt("h2"),l=nt("button","chapter-toggle");l.type="button",l.setAttribute("aria-expanded","false"),l.append(nt("span","",r.name),nt("span","count",o.length)),l.addEventListener("click",()=>e(r.id)),c.append(l);let h=nt("div","group-inner"),f=nt("div","group-steps");f.append(h),a.append(c,f),s[r.id]={group:a,toggle:l};for(let u of o){let d=nt("button","step");d.type="button",d.setAttribute("aria-pressed","false"),d.append(nt("span","n",u.n),nt("span","",u.name)),d.addEventListener("click",()=>n(u.id)),i[u.id]=d,h.append(d)}t.append(a)}return{buttons:i,groups:s}},sS=n=>{let e={};for(let[t,i]of Object.entries(yr)){let s=nt("button","",i.name);s.type="button",s.setAttribute("aria-pressed","false"),s.addEventListener("click",()=>n(t)),e[t]=s,qt("views").append(s)}return e},rS=()=>{let n=e=>{let t=Vt.find(i=>i.chapter===e?.id);return t?Kt[t.id][0]:e?0:1};return Zn.map((e,t)=>{let i=nt("span","",e.short),s=n(e);return i.style.left=`${s*100}%`,i.style.width=`${(n(Zn[t+1])-s)*100}%`,qt("ticks").append(i),i})},oS=()=>{for(let n of xr)qt("specs").append(im(n));for(let n of Il)qt("unsourced").append(nt("li","",n));for(let n of Object.keys(_l)){let e=nt("li");e.append(Su(n)),qt("sources").append(e)}},Mu=n=>{let e=qt("detail");if(e.replaceChildren(),n.n&&e.append(nt("p","partno",`Part ${n.n} of ${Vt.length}`)),e.append(nt("h2","",n.name),nt("p","does",n.does)),!n.facts.length)return;let t=nt("dl","facts");t.append(...n.facts.map(im)),e.append(t)},sm=(n,e,t)=>{let i=nt("button","piece");return i.type="button",i.dataset.piece=n.id,i.setAttribute("aria-pressed","false"),i.append(nt("span","piece-tag",n.kind==="screw"?n.id:n.tag),...t),i.addEventListener("click",()=>e(n.id)),i},aS=(n,e)=>sm(n,e,[nt("span","piece-name",vs[n.head]),nt("span","piece-role",`${n.part}, ${n.torque}`)]),cS=(n,e)=>sm(n,e,[nt("span","piece-name",n.name),nt("span","piece-role",n.role)]),tm=(n,e,t)=>{let i=nt("section","pieces"),s=nt("div","pieces-head");return s.append(nt("h3","",`${n}, ${t.length}`),Su(e)),i.append(s,...t),i},nm=(n,e)=>{let t=qt("pieces");t.replaceChildren();let i=li[n]??[],s=qn[n]??[];i.length&&t.append(tm("Screws","appleScrews",i.map(r=>aS(r,e))));for(let[r,o]of[["front","Chips on the front"],["back","Chips on the back"]]){let a=s.filter(c=>c.side===r).map(c=>cS(c,e));a.length&&t.append(tm(o,"ifixitChips",a))}},lS=(n,e,t)=>{n.sort((s,r)=>s.y-r.y);for(let s=1;s<n.length;s++)n[s].y=Math.max(n[s].y,n[s-1].y+yu);let i=t;for(let s=n.length-1;s>=0;s--)n[s].y=Math.min(n[s].y,i),i=n[s].y-yu;if(n.length&&n[0].y<e){n[0].y=e;for(let s=1;s<n.length;s++)n[s].y=Math.max(n[s].y,n[s-1].y+yu)}},hS=n=>{let e=qt("leaders"),t=Vt.map(()=>{let i=Ji("g",{},e),s={group:i,line:Ji("line",{},i),anchor:Ji("circle",{class:"anchor",r:2.5},i),tag:Ji("circle",{class:"tag",r:xl},i),label:Ji("text",{},i),name:Ji("text",{class:"name"},i)};return s.tag.addEventListener("click",()=>n(s.id)),s});return(i,s,r,o)=>{let a=r>=560,l=(a?i:i.filter(u=>u.active)).map(u=>{let[d,m]=s(u.at);return{...u,x:d,y:m}}).filter(({x:u,y:d})=>u>0&&u<r&&d>0&&d<o),h=16,f=o-16;for(let u of["left","right"])lS(l.filter(d=>d.side===u),h,f);t.forEach((u,d)=>{let m=l[d];if(!m){u.group.style.display="none";return}let[v,g]=s(m.at),p=m.side==="left"?Qp:r-Qp;u.id=m.id,u.group.style.display="",u.group.setAttribute("class",m.active?"active":"");let S=m.side==="left"?1:-1;u.line.setAttribute("x1",p+S*xl),u.line.setAttribute("y1",m.y),u.line.setAttribute("x2",v),u.line.setAttribute("y2",g),u.anchor.setAttribute("cx",v),u.anchor.setAttribute("cy",g),u.tag.setAttribute("cx",p),u.tag.setAttribute("cy",m.y),u.label.setAttribute("x",p),u.label.setAttribute("y",m.y),u.label.textContent=m.n,u.name.textContent=m.active&&a?m.name:"",u.name.setAttribute("class",m.side==="left"?"name":"name end"),u.name.setAttribute("x",p+S*(xl+6)),u.name.setAttribute("y",m.y-xl-4)})}},uS="M2 1 11 6 2 11Z",dS="M2 1H5V11H2ZM7 1H10V11H7Z",fS=n=>{let e=qt("play"),t=Ji("svg",{viewBox:"0 0 12 12","aria-hidden":"true"},e),i=Ji("path",{},t),s=nt("span");return e.append(s),e.addEventListener("click",n),r=>{i.setAttribute("d",r?dS:uS),s.textContent=r?"Pause":"Play"}};function rm({onPart:n,onPiece:e,onView:t,onSlide:i,onPlay:s,onRestart:r}){let o=null,a=null,c=null,l=R=>{if(R!==a){a=R;for(let[P,{group:k,toggle:X}]of Object.entries(f))k.classList.toggle("open",P===R),X.setAttribute("aria-expanded",P===R)}},{buttons:h,groups:f}=iS(n,R=>{o=o===R?null:R,l(o??c)}),u=sS(t),d=rS();oS();let m=hS(n),v=qt("progress");v.addEventListener("input",()=>i(Number(v.value)));let g=fS(s);qt("restart").addEventListener("click",r);let p=null,S=null,T=null,y="",w=null,b=qt("chapter"),C=R=>{R!==w&&(w=R,g(R))},x=(R,P,k)=>{let X=`${k.id}|${Math.round(P.angle)}|${P.out}|${P.screws}|${P.size?.k??""}`;if(X===y)return;y=X;let te=qt("readout");te.replaceChildren();let q=P.size?`${P.size.k}: ${P.size.v}`:`Opening ${Math.round(P.angle)}\xB0`;te.append(nt("strong","",k.n?`Step ${k.n} of ${P.total}: ${k.name}`:Ci.name)),te.append(nt("span","num",q),nt("span","num wide",`${P.out} of ${P.total} parts, ${P.screws} of ${Rl.screws} screws out`));let Z=Zn.findIndex(({id:Ke})=>Ke===k.chapter),j=Zn[Z];b.replaceChildren(nt("span","chapter-name",`${j.name}, `),`iFixit video at ${j.time}`);let[Re,be]=j.time.split(":").map(Number);b.href=`${_l.ifixitVideo.url}&t=${Re*60+be}s`,d.forEach((Ke,Ze)=>Ke.classList.toggle("current",Ze===Z));for(let Ke of Vt){let Ze=h[Ke.id];Ze.classList.toggle("active",Ke.id===k.id),Ze.classList.toggle("out",Yn(Ke.id,R)>=1)}E(Zn[Math.max(Z,1)].id),I(h[k.id]??h[Vt[0].id])},E=R=>{R!==c&&(c=R,o=null,l(R))},I=R=>{if(!R||R===T||innerWidth>=em)return;T=R;let P=qt("steps");P.scrollTo({left:R.offsetLeft-(P.clientWidth-R.offsetWidth)/2,behavior:nS?"auto":"smooth"})},D=R=>{if(R===S)return;S=R;let P=qt("sheet");for(let k of qt("pieces").querySelectorAll(".piece")){let X=k.dataset.piece===R;k.setAttribute("aria-pressed",X),X&&innerWidth>=em&&(P.scrollTop=k.offsetTop-P.clientHeight/3)}},O=({p:R,focus:P,iso:k,view:X,touring:te,pick:q=null,selected:Z=null},j)=>{let Re=Ol(R),be=Z?Nt[Z]??Ci:Re.part;(document.activeElement!==v||te)&&(v.value=R),v.style.setProperty("--done",`${R*100}%`),x(R,Re,be),C(te),be.id!==p&&(p=be.id,S=null,Mu(be),nm(be.id,e),qt("sheet").scrollTop=0),D(q);for(let et of Vt)h[et.id].setAttribute("aria-pressed",Z===et.id);for(let[et,J]of Object.entries(u))J.setAttribute("aria-pressed",et===X);let{w:Ke,h:Ze}=j.size;m(zl(R,P&&k>.5?P:null,X,q),j.project,Ke,Ze)};return Mu(Ci),p=Ci.id,E(Zn[1].id),{sync:O,show:R=>{Mu(Nt[R]),nm(R,()=>{})}}}var pS=new URLSearchParams(location.search),fm=!!window.__CAPTURE,pm=pS.has("card"),om=Qi("topSpeaker"),bi=document.getElementById("view"),am=document.getElementById("stage"),mS=matchMedia("(pointer: coarse)").matches,gS=Math.min(innerWidth,innerHeight)<720,vl=matchMedia("(prefers-reduced-motion: reduce)").matches,cm=window.devicePixelRatio||1,Ao=[{shadows:!0,pixelRatio:Math.min(cm,2)},{shadows:!1,pixelRatio:Math.min(cm,1.5)},{shadows:!1,pixelRatio:1,plain:!0}],_S=28,xS=30,vS=.9,lm=86,yS=.45,MS=1.6,SS=4e-4,bS=.45,Sn={index:mS||gS?1:0,sum:0,count:0},z={touring:!1,attract:!1,tourTime:0,blend:1,blendTime:1.1,fadeFirst:!1,from:null,p:0,targetP:0,view:"three",focus:null,pick:null,was:null,swap:1,iso:0,targetIso:0,cam:null,orbit:{az:0,el:0,zoom:1},drag:null,dirty:!0,visible:!0},wS=()=>{document.getElementById("no-webgl").hidden=!1,bi.hidden=!0},ES=()=>{try{return jp(bi,{shadows:Ao[Sn.index].shadows,keepBuffer:fm||pm})}catch{return null}},Gn=ES(),gs=()=>Gn.size.w/Gn.size.h,Co=()=>{let{width:n,height:e}=bi.getBoundingClientRect();Gn.resize(Math.max(n,1),Math.max(e,1),Ao[Sn.index].pixelRatio),z.dirty=!0},TS=()=>{Gn.setShadows(Ao[Sn.index].shadows),Gn.phone.setDetail(!Ao[Sn.index].plain),Co()},wu=(n,e)=>{Gn.draw(n.p,e,n.focus,n.iso,n.pick,n.was??null,n.swap??1),gm.sync(n,Gn)},mm=()=>{let n=Mr(z.view,z.p,gs(),z.iso>.02||z.targetIso>0?z.focus:null);return{...n,az:n.az+z.orbit.az,el:Math.max(-lm,Math.min(lm,n.el+z.orbit.el)),dist:n.dist*z.orbit.zoom}},ri=()=>{if(!z.touring)return;let{p:n,focus:e,iso:t,view:i,pick:s}=ts(z.tourTime),r=ns(z.tourTime,gs());Object.assign(z,{touring:!1,attract:!1,p:n,targetP:n,focus:e,pick:s,iso:t,targetIso:e&&t>.5?1:0,view:i,cam:{...r}}),z.targetIso||(z.focus=null);let o=mm();z.orbit={az:r.az-o.az,el:0,zoom:1},z.dirty=!0},hm=(n,e=!1)=>{let t=ts(n);z.from={p:z.p,iso:z.iso,focus:z.focus,cam:z.cam??ns(n,gs())},z.blend=0,z.blendTime=1.1+2*Math.abs(t.p-z.p),z.fadeFirst=e,z.tourTime=n,z.touring=!0,z.pick=null,z.orbit={az:0,el:0,zoom:1},z.dirty=!0},AS=()=>Math.abs(ts(z.tourTime).p-z.p)<.001?z.tourTime:(Xn.find(e=>e.p>=z.p-1e-6&&!e.focus)??Xn[0]).at,bu=n=>{z.focus&&z.focus!==n&&z.iso>.02&&(z.was=z.focus,z.swap=0),z.focus=n},gm=rm({onPart(n){if(!Gn)return gm.show(n);ri(),z.pick=null,z.focus===n&&z.targetIso?z.targetIso=0:(bu(n),z.targetIso=1,z.targetP=Qi(n),z.view=Nt[n].view),z.orbit={az:0,el:0,zoom:1},z.dirty=!0},onPiece(n){ri();let e=vr[n];z.pick=z.pick===n?null:n,bu(e.host),z.targetIso=1,z.targetP=Qi(e.host),z.view=e.side==="back"?"inner":Nt[e.host].view,z.orbit={az:0,el:0,zoom:1},z.dirty=!0},onView(n){ri(),z.view=n,n==="hinge"&&(bu("hinge"),z.targetIso=1),z.orbit={az:0,el:0,zoom:1},z.dirty=!0},onSlide(n){ri(),z.targetP=n,z.targetIso=0,z.pick=null,z.dirty=!0},onPlay(){z.touring?ri():hm(AS())},onRestart(){ri(),hm(0,!0)}}),CS=()=>{let n=t=>{z.attract&&!t.target.closest?.("#play, #restart")&&ri()};for(let t of["pointerdown","wheel","keydown","touchstart"])addEventListener(t,n,{passive:!0,capture:!0});bi.addEventListener("pointerdown",t=>{ri(),z.drag={x:t.clientX,y:t.clientY,id:t.pointerId},bi.setPointerCapture(t.pointerId)}),bi.addEventListener("pointermove",t=>{!z.drag||z.drag.id!==t.pointerId||(z.orbit.az-=(t.clientX-z.drag.x)*.3,z.orbit.el+=(t.clientY-z.drag.y)*.25,z.drag.x=t.clientX,z.drag.y=t.clientY,z.dirty=!0)});let e=()=>{z.drag=null};bi.addEventListener("pointerup",e),bi.addEventListener("pointercancel",e),bi.addEventListener("wheel",t=>{t.ctrlKey&&(t.preventDefault(),ri(),z.orbit.zoom=Math.max(yS,Math.min(MS,z.orbit.zoom*Math.exp(t.deltaY*.01))),z.dirty=!0)},{passive:!1}),new ResizeObserver(Co).observe(am),new IntersectionObserver(([t])=>{z.visible=t.isIntersecting,z.dirty=!0}).observe(am)},RS=n=>{if((!z.fadeFirst||z.blend>=1)&&(z.tourTime+=n),!z.attract&&z.tourTime>=Ai){z.tourTime=0,ri();return}z.blend=Math.min(1,z.blend+n/z.blendTime);let e=ts(z.tourTime),t=ns(z.tourTime,gs()),i=cn(z.blend);i>=1?(z.p=e.p,z.iso=e.iso,z.focus=e.focus,z.cam=t):(z.p=z.from.p+(e.p-z.from.p)*i,z.iso=e.focus?e.iso*i:z.from.iso*(1-i),z.focus=e.focus??z.from.focus,z.cam=Sr(z.from.cam,t,i)),z.view=e.view,wu({p:z.p,focus:z.focus,iso:z.iso,view:e.view,touring:!0,pick:e.pick,selected:e.selected},z.cam)},IS=n=>{let e=vl?1:1-Math.exp(-n*6),t={p:z.p,iso:z.iso,cam:z.cam,swap:z.swap},i=z.targetP-z.p,s=vl?1/0:vS*n,r=Math.max(-s,Math.min(s,i*e));z.p=Math.abs(i)<SS?z.targetP:z.p+r,z.iso+=(z.targetIso-z.iso)*e,Math.abs(z.targetIso-z.iso)<.003&&(z.iso=z.targetIso),!z.iso&&!z.targetIso&&(z.focus=z.pick=null),z.swap=vl?1:Math.min(1,z.swap+n/bS),z.swap===1&&(z.was=null);let o=mm();z.cam=z.cam?Sr(z.cam,o,e):o;let a=z.p!==t.p||z.iso!==t.iso||z.swap!==t.swap||!t.cam||Math.abs(z.cam.dist-t.cam.dist)>.01||Math.abs(z.cam.az-t.cam.az)>.003||Math.abs(z.cam.el-t.cam.el)>.003||z.cam.target.some((l,h)=>Math.abs(l-t.cam.target[h])>.01);if(!a&&!z.dirty)return!1;z.dirty=a;let c=z.targetIso?z.focus:null;return wu({p:z.p,focus:z.focus,iso:z.iso,view:z.view,touring:!1,pick:z.pick,selected:c,was:z.was,swap:z.swap},z.cam),!0},um=n=>{if(Sn.index>=Ao.length-1||(Sn.sum+=n,Sn.count+=1,Sn.count<xS))return;let e=Sn.sum/Sn.count>_S;Sn.sum=0,Sn.count=0,e&&(Sn.index+=1,TS())},dm=0,_m=n=>{requestAnimationFrame(_m);let e=Math.min(n-dm,100);if(dm=n,!z.visible||document.hidden)return;let t=e/1e3;z.touring?(RS(t),um(e)):IS(t)&&um(e)},PS=()=>{Co(),window.SIM={ready:!0,duration:Ai,fps:60,info:()=>Gn.renderer.info.render,render(n){let e=ts(n);return wu({...e,touring:!0},ns(n,gs())),{}}}},LS=()=>{document.body.classList.add("card"),Co();let n=Mr("three",om,gs());Gn.draw(om,{...n,dist:n.dist*.94},null,0),window.CARD_READY=!0},DS=()=>{CS(),Co(),vl?(z.p=z.targetP=Qi("usbC"),z.dirty=!0):(z.touring=!0,z.attract=!0,z.from={p:0,iso:0,focus:null,cam:ns(0,gs())}),requestAnimationFrame(_m)};Gn?fm?PS():pm?LS():DS():wS();})();
4591
4592</script>
4593</body>
4594</html>