shopar-plugin 1.1.2-alpha.0 → 1.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- const e=["AR","3D"];class t extends Error{constructor(e){super(e),this.name="PluginError"}}class n extends t{constructor(e){super(e),this.name="ValidationError"}}class i extends t{constructor(e,t){super(e),this.name="ApiError",this.status=t}}class r extends t{constructor(e){super(e),this.name="SanitizationError"}}class a extends t{constructor(e){super((null==e?void 0:e.trim())||"3D failed to launch."),this.name="Launch3DError"}}class s extends t{constructor(e){super((null==e?void 0:e.trim())||"AR failed to launch."),this.name="LaunchARError"}}class o extends s{constructor(e){super((null==e?void 0:e.trim())||"Camera permission denied."),this.name="CameraPermissionDeniedError"}}class l extends s{constructor(e){super((null==e?void 0:e.trim())||"QR failed."),this.name="QRError"}}function c(e,t,n,i){return new(n||(n=Promise))(function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})}function h(e){return null!=e&&"object"==typeof e&&"name"in e&&"string"==typeof e.name?e.name:"Unknown"}function A(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:"Unknown error."}"function"==typeof SuppressedError&&SuppressedError;function u(e){if(null!=e&&"object"==typeof e&&"stack"in e&&"string"==typeof e.stack)return e.stack.length>1e3?e.stack.slice(0,1e3):e.stack}function d(e,n){return()=>c(this,void 0,void 0,function*(){try{return yield n()}catch(n){if(n instanceof t)throw n;throw new t(`${e} failed: ${A(n)}`)}})}const p=[Uint8Array,Uint32Array].length-2,f=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame"],g=[2,12,7,1],m=window[f[g[g[p]]]][f[g[g[g.length-1]]]];function v(){const e=(new TextEncoder).encode(m),t=f.map(e=>e.length);for(let n=0;n<e.length;n++)e[n]^=t[n%t.length];return window[f[t[2]]](String.fromCodePoint(...e))}m.charCodeAt(p);function E(e){return e*(180/Math.PI)}function b(e){return Math.round(100*e)/100}const C=["Glasses","Shoes","Watches","Bracelets","Scarves","Hats","Necklaces"],_=["Shoes"];const I="1.1.2-alpha.0";let x=`https://cdn.jsdelivr.net/npm/shopar-plugin@${I}/dist`;const y=e=>{null!=e&&(x=e.endsWith("/")?e.substring(0,e.length-1):e)},w=()=>x;function M(e,t){return c(this,void 0,void 0,function*(){if("function"!=typeof importScripts){if("function"==typeof window.define&&window.define.amd&&"function"==typeof window.require)return new Promise(n=>{window.require([e],e=>{window[t]=e,n()},()=>{n()})});{const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise(e=>{t.addEventListener("load",()=>e(),!1),t.addEventListener("error",()=>e(),!1),document.body.appendChild(t)})}}importScripts(e.toString())})}let S;function B(e,t){let n=!0;return{qrPaused:()=>n,qrDraw:(i,r)=>c(this,void 0,void 0,function*(){!function(){c(this,void 0,void 0,function*(){null==S&&(S=M(`${w()}/shopar-qr.js`,"ShopAR__QR"))})}(),yield S;const a=`https://ar.shopar.ai/${I.includes("alpha")?"qr-alpha":"qr"}/?${new URLSearchParams({a:i,s:r,h:location.href})}`,s=yield window.ShopAR__QR.toDataURL(a),o=new Promise((e,n)=>{t.onload=e,t.onerror=n});t.src=s,yield o,n=!1,e.style.display=""}),qrPause:()=>c(this,void 0,void 0,function*(){n=!0,e.style.display="none"})}}const T={"loading.ar":"Loading Try On...","prompt.ar.shoes":void 0,"prompt.ar.glasses":void 0,"prompt.ar.watches":void 0,"prompt.ar.bracelets":void 0,"prompt.ar.scarves":void 0,"prompt.ar.hats":void 0,"prompt.ar.necklaces":void 0},R=Object.keys(T);const D="--shopar";function Q(e){return`var(${e.var}, ${e.default})`}const U={padding:{var:`${D}-btn-padding`,default:"0.5rem 0.75rem"},gap:{var:`${D}-btn-gap`,default:"0.25rem"},border:{var:`${D}-btn-border`,default:"1px solid #dddddd"},borderRadius:{var:`${D}-btn-border-radius`,default:"calc(infinity * 1px)"},bg:{var:`${D}-btn-bg`,default:"#ffffff"},hoverBg:{var:`${D}-btn-hover-bg`,default:"#f5f5f5"}};function L(e,t,n){const i=document.createElement("button");i.type="button",i.appendChild(n);{const t=document.createElement("span");t.textContent=e,i.appendChild(t)}i.ariaLabel=t;const r=i.style;r.display="none",r.pointerEvents="auto",r.padding=Q(U.padding),r.justifyContent="center",r.alignItems="center",r.gap=Q(U.gap),r.backgroundColor=Q(U.bg),r.border=Q(U.border),r.borderRadius=Q(U.borderRadius),r.cursor="pointer";const a=Q(U.bg),s=Q(U.hoverBg);return i.addEventListener("mouseenter",()=>{r.backgroundColor=s}),i.addEventListener("mouseleave",()=>{r.backgroundColor=a}),i}const P={paddingBottom:{var:`${D}-btn-container-padding-bottom`,default:"2rem"},gap:{var:`${D}-btn-container-gap`,default:"0.5rem"}};const N={bg:{var:`${D}-ar-prompt-bg`,default:"#1e293bb2"},gap:{var:`${D}-ar-prompt-gap`,default:"1rem"},textColor:{var:`${D}-ar-prompt-text-color`,default:"white"},imgMaxWidth:{var:`${D}-ar-prompt-img-max-width`,default:"80%"},imgMaxHeight:{var:`${D}-ar-prompt-img-max-height`,default:"50%"}};const F={containerDisplay:{var:`${D}-ar-loading-container-display`,default:"flex"},containerBg:{var:`${D}-ar-loading-container-bg`,default:"#ffffff"},containerGap:{var:`${D}-ar-loading-container-gap`,default:"1rem"},barWidth:{var:`${D}-ar-loading-bar-width`,default:"80%"},barHeight:{var:`${D}-ar-loading-bar-height`,default:"0.5rem"},barRadius:{var:`${D}-ar-loading-bar-radius`,default:"calc(infinity * 1px)"},barFg:{var:`${D}-ar-loading-bar-fg`,default:"linear-gradient(90deg, #773cd8, #5fb9ec)"},barBg:{var:`${D}-ar-loading-bar-bg`,default:"#e5e7eb"}};const O={bg:{var:`${D}-qr-bg`,default:"#ffffff"}};function k(e,t,n,i){return new(n||(n=Promise))(function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})}function G(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function H(e,t,n,i,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const z=.1,V="function"==typeof Float32Array;function W(e,t){return 1-3*t+3*e}function q(e,t){return 3*t-6*e}function j(e){return 3*e}function Y(e,t,n){return((W(t,n)*e+q(t,n))*e+j(t))*e}function X(e,t,n){return 3*W(t,n)*e*e+2*q(t,n)*e+j(t)}function K(e){return e}function J(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return K;const r=V?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)r[t]=Y(t*z,e,n);function a(t){let i=0,a=1;for(;10!==a&&r[a]<=t;++a)i+=z;--a;const s=i+(t-r[a])/(r[a+1]-r[a])*z,o=X(s,e,n);return o>=.001?function(e,t,n,i){for(let r=0;r<4;++r){const r=X(t,n,i);if(0===r)return t;t-=(Y(t,n,i)-e)/r}return t}(t,s,e,n):0===o?s:function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=Y(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,i,i+z,e,n)}return function(e){return 0===e||1===e?e:Y(a(e),t,i)}}(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function Z(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort((e,t)=>e.time-t.time).map(({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:J(n)}));let i=0,r=n[0].value;const a=()=>{for(i<0&&(i=0);i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}};return{reset:()=>{i=0,a()},update:e=>{i+=e,a()},seek:e=>{i=e,a()},get:()=>r}}const $="time",ee="interpolation",te="pitch",ne=[$,"yaw",te,"fov",ee],ie=Math.PI/180,re="ease-in-out",ae="cubic-bezier(";function se(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map(e=>function(e){const t=e.indexOf("#");return(-1!==t?e.substring(0,t):e).trim()}(e)).filter(e=>""!==e)}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!ne.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes($))throw new Error(`Missing required token: '${$}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=oe(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:s}=i;if(null==e)throw new Error("Time missing.");const o=ce(null!==(t=i.interpolation)&&void 0!==t?t:re);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*ie,interpolation:o})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*ie,interpolation:o})),null!=s&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:s*ie,interpolation:o}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every(t=>t.length!==e.length))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function oe(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter(e=>!(null==n?void 0:n.includes(e))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter(t=>!e.includes(t)).join(", ")}'.`);const i=e.indexOf($),r=function(e){return e.endsWith("ms")?Ae(e.substring(0,e.length-2)):e.endsWith("s")?1e3*Ae(e.substring(0,e.length-1)):Ae(e)}(n[i]),a=e.indexOf(ee),s=ce(-1===a?re:n[a]),o={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case"yaw":o.theta={time:r,value:le(c),interpolation:s};break;case te:o.phi={time:r,value:le(c),interpolation:s};break;case"fov":o.fov={time:r,value:le(c),interpolation:s};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return o}function le(e){return e.endsWith("deg")?Ae(e.substring(0,e.length-3))*ie:e.endsWith("rad")?Ae(e.substring(0,e.length-3)):Ae(e)*ie}function ce(e){if("hold"===e)return{type:"hold"};if("linear"===e)return he(0,0,1,1);if("sine"===e)return he(.37,0,.63,1);if("sine-in"===e)return he(.12,0,.39,0);if("sine-out"===e)return he(.61,1,.88,1);if("ease"===e)return he(.25,.1,.25,1);if("ease-in"===e)return he(.42,0,1,1);if("ease-out"===e)return he(0,0,.58,1);if("ease-in-out"===e)return he(.42,0,.58,1);if(e.startsWith(ae)&&e.endsWith(")")){const t=e.substring(13,e.length-1).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:Ae(t[0]),y1:Ae(t[1]),x2:Ae(t[2]),y2:Ae(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function he(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function Ae(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}
1
+ const e=["AR","3D"];class t extends Error{constructor(e){super(e),this.name="PluginError"}}class n extends t{constructor(e){super(e),this.name="ValidationError"}}class i extends t{constructor(e,t){super(e),this.name="ApiError",this.status=t}}class r extends t{constructor(e){super(e),this.name="SanitizationError"}}class a extends t{constructor(e){super((null==e?void 0:e.trim())||"3D failed to launch."),this.name="Launch3DError"}}class o extends t{constructor(e){super((null==e?void 0:e.trim())||"AR failed to launch."),this.name="LaunchARError"}}class s extends o{constructor(e){super((null==e?void 0:e.trim())||"Camera permission denied."),this.name="CameraPermissionDeniedError"}}class l extends o{constructor(e){super((null==e?void 0:e.trim())||"QR failed."),this.name="QRError"}}function c(e,t,n,i){return new(n||(n=Promise))(function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((i=i.apply(e,t||[])).next())})}function h(e){return null!=e&&"object"==typeof e&&"name"in e&&"string"==typeof e.name?e.name:"Unknown"}function A(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:"Unknown error."}"function"==typeof SuppressedError&&SuppressedError;function u(e){if(null!=e&&"object"==typeof e&&"stack"in e&&"string"==typeof e.stack)return e.stack.length>1e3?e.stack.slice(0,1e3):e.stack}function d(e,n){return()=>c(this,void 0,void 0,function*(){try{return yield n()}catch(n){if(n instanceof t)throw n;throw new t(`${e} failed: ${A(n)}`)}})}const p=[Uint8Array,Uint32Array].length-2,f=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame"],g=[2,12,7,1],m=window[f[g[g[p]]]][f[g[g[g.length-1]]]];function v(){const e=(new TextEncoder).encode(m),t=f.map(e=>e.length);for(let n=0;n<e.length;n++)e[n]^=t[n%t.length];return window[f[t[2]]](String.fromCodePoint(...e))}m.charCodeAt(p);function E(e){return e*(180/Math.PI)}function b(e){return Math.round(100*e)/100}const C=["Glasses","Shoes","Watches","Bracelets","Scarves","Hats","Necklaces"],_=["Shoes"];const I="1.2.0-alpha.0";let x=`https://cdn.jsdelivr.net/npm/shopar-plugin@${I}/dist`;const y=e=>{null!=e&&(x=e.endsWith("/")?e.substring(0,e.length-1):e)},M=()=>x;function w(e,t){return c(this,void 0,void 0,function*(){if("function"!=typeof importScripts){if("function"==typeof window.define&&window.define.amd&&"function"==typeof window.require)return new Promise(n=>{window.require([e],e=>{window[t]=e,n()},()=>{n()})});{const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise(e=>{t.addEventListener("load",()=>e(),!1),t.addEventListener("error",()=>e(),!1),document.body.appendChild(t)})}}importScripts(e.toString())})}let S;function B(e,t){let n=!0;return{qrPaused:()=>n,qrDraw:(i,r)=>c(this,void 0,void 0,function*(){!function(){c(this,void 0,void 0,function*(){null==S&&(S=w(`${M()}/shopar-qr.js`,"ShopAR__QR"))})}(),yield S;const a=`https://ar.shopar.ai/${I.includes("alpha")?"qr-alpha":"qr"}/?${new URLSearchParams({a:i,s:r,h:location.href})}`,o=yield window.ShopAR__QR.toDataURL(a),s=new Promise((e,n)=>{t.onload=e,t.onerror=n});t.src=o,yield s,n=!1,e.style.display=""}),qrPause:()=>c(this,void 0,void 0,function*(){n=!0,e.style.display="none"})}}const T={"loading.ar":"Loading Try On...","prompt.ar.shoes":void 0,"prompt.ar.glasses":void 0,"prompt.ar.watches":void 0,"prompt.ar.bracelets":void 0,"prompt.ar.scarves":void 0,"prompt.ar.hats":void 0,"prompt.ar.necklaces":void 0},R=Object.keys(T);const D="--shopar";function Q(e){return`var(${e.var}, ${e.default})`}const L={padding:{var:`${D}-btn-padding`,default:"0.5rem 0.75rem"},gap:{var:`${D}-btn-gap`,default:"0.25rem"},border:{var:`${D}-btn-border`,default:"1px solid #dddddd"},borderRadius:{var:`${D}-btn-border-radius`,default:"calc(infinity * 1px)"},bg:{var:`${D}-btn-bg`,default:"#ffffff"},hoverBg:{var:`${D}-btn-hover-bg`,default:"#f5f5f5"}};function U(e,t,n){const i=document.createElement("button");i.type="button",i.appendChild(n);{const t=document.createElement("span");t.textContent=e,i.appendChild(t)}i.ariaLabel=t;const r=i.style;r.display="none",r.pointerEvents="auto",r.padding=Q(L.padding),r.justifyContent="center",r.alignItems="center",r.gap=Q(L.gap),r.backgroundColor=Q(L.bg),r.border=Q(L.border),r.borderRadius=Q(L.borderRadius),r.cursor="pointer";const a=Q(L.bg),o=Q(L.hoverBg);return i.addEventListener("mouseenter",()=>{r.backgroundColor=o}),i.addEventListener("mouseleave",()=>{r.backgroundColor=a}),i}const P={paddingBottom:{var:`${D}-btn-container-padding-bottom`,default:"2rem"},gap:{var:`${D}-btn-container-gap`,default:"0.5rem"}};const N={bg:{var:`${D}-ar-prompt-bg`,default:"#1e293bb2"},gap:{var:`${D}-ar-prompt-gap`,default:"1rem"},textColor:{var:`${D}-ar-prompt-text-color`,default:"white"},imgMaxWidth:{var:`${D}-ar-prompt-img-max-width`,default:"80%"},imgMaxHeight:{var:`${D}-ar-prompt-img-max-height`,default:"50%"}};const F={containerDisplay:{var:`${D}-ar-loading-container-display`,default:"flex"},containerBg:{var:`${D}-ar-loading-container-bg`,default:"#ffffff"},containerGap:{var:`${D}-ar-loading-container-gap`,default:"1rem"},barWidth:{var:`${D}-ar-loading-bar-width`,default:"80%"},barHeight:{var:`${D}-ar-loading-bar-height`,default:"0.5rem"},barRadius:{var:`${D}-ar-loading-bar-radius`,default:"calc(infinity * 1px)"},barFg:{var:`${D}-ar-loading-bar-fg`,default:"linear-gradient(90deg, #773cd8, #5fb9ec)"},barBg:{var:`${D}-ar-loading-bar-bg`,default:"#e5e7eb"}};const O={bg:{var:`${D}-qr-bg`,default:"#ffffff"}};function k(e,t,n,i){return new(n||(n=Promise))(function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((i=i.apply(e,t||[])).next())})}function G(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function H(e,t,n,i,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const z=.1,V="function"==typeof Float32Array;function W(e,t){return 1-3*t+3*e}function q(e,t){return 3*t-6*e}function j(e){return 3*e}function Y(e,t,n){return((W(t,n)*e+q(t,n))*e+j(t))*e}function X(e,t,n){return 3*W(t,n)*e*e+2*q(t,n)*e+j(t)}function K(e){return e}function J(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return K;const r=V?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)r[t]=Y(t*z,e,n);function a(t){let i=0,a=1;for(;10!==a&&r[a]<=t;++a)i+=z;--a;const o=i+(t-r[a])/(r[a+1]-r[a])*z,s=X(o,e,n);return s>=.001?function(e,t,n,i){for(let r=0;r<4;++r){const r=X(t,n,i);if(0===r)return t;t-=(Y(t,n,i)-e)/r}return t}(t,o,e,n):0===s?o:function(e,t,n,i,r){let a,o,s=0;do{o=t+(n-t)/2,a=Y(o,i,r)-e,a>0?n=o:t=o}while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+z,e,n)}return function(e){return 0===e||1===e?e:Y(a(e),t,i)}}(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function Z(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort((e,t)=>e.time-t.time).map(({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:J(n)}));let i=0,r=n[0].value;const a=()=>{for(i<0&&(i=0);i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}};return{reset:()=>{i=0,a()},update:e=>{i+=e,a()},seek:e=>{i=e,a()},get:()=>r}}const $="time",ee="interpolation",te="pitch",ne=[$,"yaw",te,"fov",ee],ie=Math.PI/180,re="ease-in-out",ae="cubic-bezier(";function oe(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map(e=>function(e){const t=e.indexOf("#");return(-1!==t?e.substring(0,t):e).trim()}(e)).filter(e=>""!==e)}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!ne.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes($))throw new Error(`Missing required token: '${$}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=se(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:o}=i;if(null==e)throw new Error("Time missing.");const s=ce(null!==(t=i.interpolation)&&void 0!==t?t:re);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*ie,interpolation:s})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*ie,interpolation:s})),null!=o&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:o*ie,interpolation:s}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every(t=>t.length!==e.length))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function se(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter(e=>!(null==n?void 0:n.includes(e))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter(t=>!e.includes(t)).join(", ")}'.`);const i=e.indexOf($),r=function(e){return e.endsWith("ms")?Ae(e.substring(0,e.length-2)):e.endsWith("s")?1e3*Ae(e.substring(0,e.length-1)):Ae(e)}(n[i]),a=e.indexOf(ee),o=ce(-1===a?re:n[a]),s={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case"yaw":s.theta={time:r,value:le(c),interpolation:o};break;case te:s.phi={time:r,value:le(c),interpolation:o};break;case"fov":s.fov={time:r,value:le(c),interpolation:o};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return s}function le(e){return e.endsWith("deg")?Ae(e.substring(0,e.length-3))*ie:e.endsWith("rad")?Ae(e.substring(0,e.length-3)):Ae(e)*ie}function ce(e){if("hold"===e)return{type:"hold"};if("linear"===e)return he(0,0,1,1);if("sine"===e)return he(.37,0,.63,1);if("sine-in"===e)return he(.12,0,.39,0);if("sine-out"===e)return he(.61,1,.88,1);if("ease"===e)return he(.25,.1,.25,1);if("ease-in"===e)return he(.42,0,1,1);if("ease-out"===e)return he(0,0,.58,1);if("ease-in-out"===e)return he(.42,0,.58,1);if(e.startsWith(ae)&&e.endsWith(")")){const t=e.substring(13,e.length-1).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:Ae(t[0]),y1:Ae(t[1]),x2:Ae(t[2]),y2:Ae(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function he(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function Ae(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2010-2024 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
6
- */const ue="166dev",de=0,pe=1,fe=2,ge=100,me=101,ve=102,Ee=200,be=201,Ce=202,_e=203,Ie=204,xe=205,ye=206,we=207,Me=208,Se=209,Be=210,Te=211,Re=212,De=213,Qe=214,Ue="attached",Le=301,Pe=302,Ne=303,Fe=306,Oe=1e3,ke=1001,Ge=1002,He=1003,ze=1004,Ve=1005,We=1006,qe=1007,je=1008,Ye=1009,Xe=1012,Ke=1014,Je=1015,Ze=1016,$e=1020,et=1023,tt=1026,nt=1027,it=1028,rt=1030,at=33776,st=33777,ot=33778,lt=33779,ct=35840,ht=35842,At=36196,ut=37492,dt=37496,pt=37808,ft=37812,gt=36492,mt=2300,vt=2301,Et=2302,bt="",Ct="srgb",_t="srgb-linear",It="display-p3",xt="display-p3-linear",yt="linear",wt="srgb",Mt="rec709",St="p3",Bt=7680,Tt=512,Rt=513,Dt=514,Qt=515,Ut=516,Lt=517,Pt=518,Nt=519,Ft=35044,Ot="300 es",kt=2e3,Gt=2001;class Ht{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t<i;t++)n[t].call(this,e);e.target=null}}}const zt=["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"];const Vt=Math.PI/180,Wt=180/Math.PI;function qt(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(zt[255&e]+zt[e>>8&255]+zt[e>>16&255]+zt[e>>24&255]+"-"+zt[255&t]+zt[t>>8&255]+"-"+zt[t>>16&15|64]+zt[t>>24&255]+"-"+zt[63&n|128]+zt[n>>8&255]+"-"+zt[n>>16&255]+zt[n>>24&255]+zt[255&i]+zt[i>>8&255]+zt[i>>16&255]+zt[i>>24&255]).toLowerCase()}function jt(e,t,n){return Math.max(t,Math.min(n,e))}function Yt(e,t){return(e%t+t)%t}function Xt(e,t,n){return(1-n)*e+n*t}function Kt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Jt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Zt=Vt,$t=Wt,en=function(e){return e*Wt};class tn{constructor(e=0,t=0){tn.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class nn{constructor(e,t,n,i,r,a,s,o,l){nn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=s,c[3]=t,c[4]=r,c[5]=o,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],c=n[4],h=n[7],A=n[2],u=n[5],d=n[8],p=i[0],f=i[3],g=i[6],m=i[1],v=i[4],E=i[7],b=i[2],C=i[5],_=i[8];return r[0]=a*p+s*m+o*b,r[3]=a*f+s*v+o*C,r[6]=a*g+s*E+o*_,r[1]=l*p+c*m+h*b,r[4]=l*f+c*v+h*C,r[7]=l*g+c*E+h*_,r[2]=A*p+u*m+d*b,r[5]=A*f+u*v+d*C,r[8]=A*g+u*E+d*_,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8];return t*a*c-t*s*l-n*r*c+n*s*o+i*r*l-i*a*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=c*a-s*l,A=s*o-c*r,u=l*r-a*o,d=t*h+n*A+i*u;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const p=1/d;return e[0]=h*p,e[1]=(i*l-c*n)*p,e[2]=(s*n-i*a)*p,e[3]=A*p,e[4]=(c*t-i*o)*p,e[5]=(i*r-s*t)*p,e[6]=u*p,e[7]=(n*o-l*t)*p,e[8]=(a*t-n*r)*p,this}transpose(){let e;const 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){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(rn.makeScale(e,t)),this}rotate(e){return this.premultiply(rn.makeRotation(-e)),this}translate(e,t){return this.premultiply(rn.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){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const rn=new nn;function an(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function sn(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function on(){const e=sn("canvas");return e.style.display="block",e}const ln={};function cn(e){e in ln||(ln[e]=!0,console.warn(e))}const hn=(new nn).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),An=(new nn).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),un={[_t]:{transfer:yt,primaries:Mt,toReference:e=>e,fromReference:e=>e},[Ct]:{transfer:wt,primaries:Mt,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[xt]:{transfer:yt,primaries:St,toReference:e=>e.applyMatrix3(An),fromReference:e=>e.applyMatrix3(hn)},[It]:{transfer:wt,primaries:St,toReference:e=>e.convertSRGBToLinear().applyMatrix3(An),fromReference:e=>e.applyMatrix3(hn).convertLinearToSRGB()}},dn=new Set([_t,xt]),pn={enabled:!0,_workingColorSpace:_t,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!dn.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=un[t].toReference;return(0,un[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return un[e].primaries},getTransfer:function(e){return e===bt?yt:un[e].transfer}};function fn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function gn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let mn;class vn{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===mn&&(mn=sn("canvas")),mn.width=e.width,mn.height=e.height;const n=mn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=mn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=sn("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*fn(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*fn(t[e]/255)):t[e]=fn(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let En=0;class bn{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:En++}),this.uuid=qt(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(Cn(i[t].image)):e.push(Cn(i[t]))}else e=Cn(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function Cn(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?vn.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let _n=0;class In extends Ht{constructor(e=In.DEFAULT_IMAGE,t=In.DEFAULT_MAPPING,n=ke,i=ke,r=We,a=1008,s=1023,o=1009,l=In.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:_n++}),this.uuid=qt(),this.name="",this.source=new bn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new tn(0,0),this.repeat=new tn(1,1),this.center=new tn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Oe:e.x=e.x-Math.floor(e.x);break;case ke:e.x=e.x<0?0:1;break;case Ge:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Oe:e.y=e.y-Math.floor(e.y);break;case ke:e.y=e.y<0?0:1;break;case Ge:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}In.DEFAULT_IMAGE=null,In.DEFAULT_MAPPING=300,In.DEFAULT_ANISOTROPY=1;class xn{constructor(e=0,t=0,n=0,i=1){xn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const a=.01,s=.1,o=e.elements,l=o[0],c=o[4],h=o[8],A=o[1],u=o[5],d=o[9],p=o[2],f=o[6],g=o[10];if(Math.abs(c-A)<a&&Math.abs(h-p)<a&&Math.abs(d-f)<a){if(Math.abs(c+A)<s&&Math.abs(h+p)<s&&Math.abs(d+f)<s&&Math.abs(l+u+g-3)<s)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,o=(u+1)/2,m=(g+1)/2,v=(c+A)/4,E=(h+p)/4,b=(d+f)/4;return e>o&&e>m?e<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=v/n,r=E/n):o>m?o<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=v/i,r=b/i):m<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=E/r,i=b/r),this.set(n,i,r,t),this}let m=Math.sqrt((f-d)*(f-d)+(h-p)*(h-p)+(A-c)*(A-c));return Math.abs(m)<.001&&(m=1),this.x=(f-d)/m,this.y=(h-p)/m,this.z=(A-c)/m,this.w=Math.acos((l+u+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class yn extends Ht{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:We,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new In(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let e=0;e<a;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new bn(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class wn extends yn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Mn extends In{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=He,this.minFilter=He,this.wrapR=ke,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Sn extends In{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=He,this.minFilter=He,this.wrapR=ke,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,s){let o=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const A=r[a+0],u=r[a+1],d=r[a+2],p=r[a+3];if(0===s)return e[t+0]=o,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===s)return e[t+0]=A,e[t+1]=u,e[t+2]=d,void(e[t+3]=p);if(h!==p||o!==A||l!==u||c!==d){let e=1-s;const t=o*A+l*u+c*d+h*p,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*e+A*r,l=l*e+u*r,c=c*e+d*r,h=h*e+p*r,e===1-s){const e=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=e,l*=e,c*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[a],A=r[a+1],u=r[a+2],d=r[a+3];return e[t]=s*d+c*h+o*u-l*A,e[t+1]=o*d+c*A+l*h-s*u,e[t+2]=l*d+c*u+s*A-o*h,e[t+3]=c*d-s*h-o*A-l*u,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),c=s(i/2),h=s(r/2),A=o(n/2),u=o(i/2),d=o(r/2);switch(a){case"XYZ":this._x=A*c*h+l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h-A*u*d;break;case"YXZ":this._x=A*c*h+l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h+A*u*d;break;case"ZXY":this._x=A*c*h-l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h-A*u*d;break;case"ZYX":this._x=A*c*h-l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h+A*u*d;break;case"YZX":this._x=A*c*h+l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h-A*u*d;break;case"XZY":this._x=A*c*h-l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h+A*u*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],c=t[6],h=t[10],A=n+s+h;if(A>0){const e=.5/Math.sqrt(A+1);this._w=.25/e,this._x=(c-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>h){const e=2*Math.sqrt(1+n-s-h);this._w=(c-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>h){const e=2*Math.sqrt(1+s-n-h);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+c)/e}else{const e=2*Math.sqrt(1+h-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(jt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,c=t._w;return this._x=n*c+a*s+i*l-r*o,this._y=i*c+a*o+r*s-n*l,this._z=r*c+a*l+n*o-i*s,this._w=a*c-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*e._w+n*e._x+i*e._y+r*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,A=Math.sin(t*c)/l;return this._w=a*h+this._w*A,this._x=n*h+this._x*A,this._y=i*h+this._y*A,this._z=r*h+this._z*A,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Tn{constructor(e=0,t=0,n=0){Tn.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Dn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Dn.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),c=2*(s*t-r*i),h=2*(r*n-a*t);return this.x=t+o*l+a*h-s*c,this.y=n+o*c+s*l-r*h,this.z=i+o*h+r*c-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Rn.copy(this).projectOnVector(e),this.sub(Rn)}reflect(e){return this.sub(Rn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,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(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Rn=new Tn,Dn=new Bn;class Qn{constructor(e=new Tn(1/0,1/0,1/0),t=new Tn(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Ln.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ln.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ln.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Ln):Ln.fromBufferAttribute(i,t),Ln.applyMatrix4(e.matrixWorld),this.expandByPoint(Ln);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Pn.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),Pn.copy(n.boundingBox)),Pn.applyMatrix4(e.matrixWorld),this.union(Pn)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],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,Ln),Ln.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(zn),Vn.subVectors(this.max,zn),Nn.subVectors(e.a,zn),Fn.subVectors(e.b,zn),On.subVectors(e.c,zn),kn.subVectors(Fn,Nn),Gn.subVectors(On,Fn),Hn.subVectors(Nn,On);let t=[0,-kn.z,kn.y,0,-Gn.z,Gn.y,0,-Hn.z,Hn.y,kn.z,0,-kn.x,Gn.z,0,-Gn.x,Hn.z,0,-Hn.x,-kn.y,kn.x,0,-Gn.y,Gn.x,0,-Hn.y,Hn.x,0];return!!jn(t,Nn,Fn,On,Vn)&&(t=[1,0,0,0,1,0,0,0,1],!!jn(t,Nn,Fn,On,Vn)&&(Wn.crossVectors(kn,Gn),t=[Wn.x,Wn.y,Wn.z],jn(t,Nn,Fn,On,Vn)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ln).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Ln).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Un[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Un[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Un[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Un[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Un[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Un[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Un[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Un[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Un)),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)}}const Un=[new Tn,new Tn,new Tn,new Tn,new Tn,new Tn,new Tn,new Tn],Ln=new Tn,Pn=new Qn,Nn=new Tn,Fn=new Tn,On=new Tn,kn=new Tn,Gn=new Tn,Hn=new Tn,zn=new Tn,Vn=new Tn,Wn=new Tn,qn=new Tn;function jn(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){qn.fromArray(e,a);const s=r.x*Math.abs(qn.x)+r.y*Math.abs(qn.y)+r.z*Math.abs(qn.z),o=t.dot(qn),l=n.dot(qn),c=i.dot(qn);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Yn=new Qn,Xn=new Tn,Kn=new Tn;class Jn{constructor(e=new Tn,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){const n=this.center;void 0!==t?n.copy(t):Yn.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const 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){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Xn.subVectors(e,this.center);const t=Xn.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Xn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Kn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xn.copy(e.center).add(Kn)),this.expandByPoint(Xn.copy(e.center).sub(Kn))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Zn=new Tn,$n=new Tn,ei=new Tn,ti=new Tn,ni=new Tn,ii=new Tn,ri=new Tn;class ai{constructor(e=new Tn,t=new Tn(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Zn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Zn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zn.copy(this.origin).addScaledVector(this.direction,t),Zn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){$n.copy(e).add(t).multiplyScalar(.5),ei.copy(t).sub(e).normalize(),ti.copy(this.origin).sub($n);const r=.5*e.distanceTo(t),a=-this.direction.dot(ei),s=ti.dot(this.direction),o=-ti.dot(ei),l=ti.lengthSq(),c=Math.abs(1-a*a);let h,A,u,d;if(c>0)if(h=a*o-s,A=a*s-o,d=r*c,h>=0)if(A>=-d)if(A<=d){const e=1/c;h*=e,A*=e,u=h*(h+a*A+2*s)+A*(a*h+A+2*o)+l}else A=r,h=Math.max(0,-(a*A+s)),u=-h*h+A*(A+2*o)+l;else A=-r,h=Math.max(0,-(a*A+s)),u=-h*h+A*(A+2*o)+l;else A<=-d?(h=Math.max(0,-(-a*r+s)),A=h>0?-r:Math.min(Math.max(-r,-o),r),u=-h*h+A*(A+2*o)+l):A<=d?(h=0,A=Math.min(Math.max(-r,-o),r),u=A*(A+2*o)+l):(h=Math.max(0,-(a*r+s)),A=h>0?r:Math.min(Math.max(-r,-o),r),u=-h*h+A*(A+2*o)+l);else A=a>0?-r:r,h=Math.max(0,-(a*A+s)),u=-h*h+A*(A+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy($n).addScaledVector(ei,A),u}intersectSphere(e,t){Zn.subVectors(e.center,this.origin);const n=Zn.dot(this.direction),i=Zn.dot(Zn)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,A=this.origin;return l>=0?(n=(e.min.x-A.x)*l,i=(e.max.x-A.x)*l):(n=(e.max.x-A.x)*l,i=(e.min.x-A.x)*l),c>=0?(r=(e.min.y-A.y)*c,a=(e.max.y-A.y)*c):(r=(e.max.y-A.y)*c,a=(e.min.y-A.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),h>=0?(s=(e.min.z-A.z)*h,o=(e.max.z-A.z)*h):(s=(e.max.z-A.z)*h,o=(e.min.z-A.z)*h),n>o||s>i?null:((s>n||n!=n)&&(n=s),(o<i||i!=i)&&(i=o),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Zn)}intersectTriangle(e,t,n,i,r){ni.subVectors(t,e),ii.subVectors(n,e),ri.crossVectors(ni,ii);let a,s=this.direction.dot(ri);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}ti.subVectors(this.origin,e);const o=a*this.direction.dot(ii.crossVectors(ti,ii));if(o<0)return null;const l=a*this.direction.dot(ni.cross(ti));if(l<0)return null;if(o+l>s)return null;const c=-a*ti.dot(ri);return c<0?null:this.at(c/s,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)}}class si{constructor(e,t,n,i,r,a,s,o,l,c,h,A,u,d,p,f){si.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,c,h,A,u,d,p,f)}set(e,t,n,i,r,a,s,o,l,c,h,A,u,d,p,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=A,g[3]=u,g[7]=d,g[11]=p,g[15]=f,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 si).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/oi.setFromMatrixColumn(e,0).length(),r=1/oi.setFromMatrixColumn(e,1).length(),a=1/oi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=a*c,n=a*h,i=s*c,r=s*h;t[0]=o*c,t[4]=-o*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){const e=o*c,n=o*h,i=l*c,r=l*h;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){const e=o*c,n=o*h,i=l*c,r=l*h;t[0]=e-r*s,t[4]=-a*h,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*c,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){const e=a*c,n=a*h,i=s*c,r=s*h;t[0]=o*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=a*c,t[9]=-s*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=s*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ci,e,hi)}lookAt(e,t,n){const i=this.elements;return di.subVectors(e,t),0===di.lengthSq()&&(di.z=1),di.normalize(),Ai.crossVectors(n,di),0===Ai.lengthSq()&&(1===Math.abs(n.z)?di.x+=1e-4:di.z+=1e-4,di.normalize(),Ai.crossVectors(n,di)),Ai.normalize(),ui.crossVectors(di,Ai),i[0]=Ai.x,i[4]=ui.x,i[8]=di.x,i[1]=Ai.y,i[5]=ui.y,i[9]=di.y,i[2]=Ai.z,i[6]=ui.z,i[10]=di.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],c=n[1],h=n[5],A=n[9],u=n[13],d=n[2],p=n[6],f=n[10],g=n[14],m=n[3],v=n[7],E=n[11],b=n[15],C=i[0],_=i[4],I=i[8],x=i[12],y=i[1],w=i[5],M=i[9],S=i[13],B=i[2],T=i[6],R=i[10],D=i[14],Q=i[3],U=i[7],L=i[11],P=i[15];return r[0]=a*C+s*y+o*B+l*Q,r[4]=a*_+s*w+o*T+l*U,r[8]=a*I+s*M+o*R+l*L,r[12]=a*x+s*S+o*D+l*P,r[1]=c*C+h*y+A*B+u*Q,r[5]=c*_+h*w+A*T+u*U,r[9]=c*I+h*M+A*R+u*L,r[13]=c*x+h*S+A*D+u*P,r[2]=d*C+p*y+f*B+g*Q,r[6]=d*_+p*w+f*T+g*U,r[10]=d*I+p*M+f*R+g*L,r[14]=d*x+p*S+f*D+g*P,r[3]=m*C+v*y+E*B+b*Q,r[7]=m*_+v*w+E*T+b*U,r[11]=m*I+v*M+E*R+b*L,r[15]=m*x+v*S+E*D+b*P,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],c=e[2],h=e[6],A=e[10],u=e[14];return e[3]*(+r*o*h-i*l*h-r*s*A+n*l*A+i*s*u-n*o*u)+e[7]*(+t*o*u-t*l*A+r*a*A-i*a*u+i*l*c-r*o*c)+e[11]*(+t*l*h-t*s*u-r*a*h+n*a*u+r*s*c-n*l*c)+e[15]*(-i*s*c-t*o*h+t*s*A+i*a*h-n*a*A+n*o*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=e[9],A=e[10],u=e[11],d=e[12],p=e[13],f=e[14],g=e[15],m=h*f*l-p*A*l+p*o*u-s*f*u-h*o*g+s*A*g,v=d*A*l-c*f*l-d*o*u+a*f*u+c*o*g-a*A*g,E=c*p*l-d*h*l+d*s*u-a*p*u-c*s*g+a*h*g,b=d*h*o-c*p*o-d*s*A+a*p*A+c*s*f-a*h*f,C=t*m+n*v+i*E+r*b;if(0===C)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/C;return e[0]=m*_,e[1]=(p*A*r-h*f*r-p*i*u+n*f*u+h*i*g-n*A*g)*_,e[2]=(s*f*r-p*o*r+p*i*l-n*f*l-s*i*g+n*o*g)*_,e[3]=(h*o*r-s*A*r-h*i*l+n*A*l+s*i*u-n*o*u)*_,e[4]=v*_,e[5]=(c*f*r-d*A*r+d*i*u-t*f*u-c*i*g+t*A*g)*_,e[6]=(d*o*r-a*f*r-d*i*l+t*f*l+a*i*g-t*o*g)*_,e[7]=(a*A*r-c*o*r+c*i*l-t*A*l-a*i*u+t*o*u)*_,e[8]=E*_,e[9]=(d*h*r-c*p*r-d*n*u+t*p*u+c*n*g-t*h*g)*_,e[10]=(a*p*r-d*s*r+d*n*l-t*p*l-a*n*g+t*s*g)*_,e[11]=(c*s*r-a*h*r-c*n*l+t*h*l+a*n*u-t*s*u)*_,e[12]=b*_,e[13]=(c*p*i-d*h*i+d*n*A-t*p*A-c*n*f+t*h*f)*_,e[14]=(d*s*i-a*p*i-d*n*o+t*p*o+a*n*f-t*s*f)*_,e[15]=(a*h*i-c*s*i+c*n*o-t*h*o-a*n*A+t*s*A)*_,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,c=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,c*s+n,c*o-i*a,0,l*o-i*s,c*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,c=a+a,h=s+s,A=r*l,u=r*c,d=r*h,p=a*c,f=a*h,g=s*h,m=o*l,v=o*c,E=o*h,b=n.x,C=n.y,_=n.z;return i[0]=(1-(p+g))*b,i[1]=(u+E)*b,i[2]=(d-v)*b,i[3]=0,i[4]=(u-E)*C,i[5]=(1-(A+g))*C,i[6]=(f+m)*C,i[7]=0,i[8]=(d+v)*_,i[9]=(f-m)*_,i[10]=(1-(A+p))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=oi.set(i[0],i[1],i[2]).length();const a=oi.set(i[4],i[5],i[6]).length(),s=oi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],li.copy(this);const o=1/r,l=1/a,c=1/s;return li.elements[0]*=o,li.elements[1]*=o,li.elements[2]*=o,li.elements[4]*=l,li.elements[5]*=l,li.elements[6]*=l,li.elements[8]*=c,li.elements[9]*=c,li.elements[10]*=c,t.setFromRotationMatrix(li),n.x=r,n.y=a,n.z=s,this}makePerspective(e,t,n,i,r,a,s=2e3){const o=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),A=(n+i)/(n-i);let u,d;if(s===kt)u=-(a+r)/(a-r),d=-2*a*r/(a-r);else{if(s!==Gt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);u=-a/(a-r),d=-a*r/(a-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=A,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3){const o=this.elements,l=1/(t-e),c=1/(n-i),h=1/(a-r),A=(t+e)*l,u=(n+i)*c;let d,p;if(s===kt)d=(a+r)*h,p=-2*h;else{if(s!==Gt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);d=r*h,p=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-A,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=p,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const oi=new Tn,li=new si,ci=new Tn(0,0,0),hi=new Tn(1,1,1),Ai=new Tn,ui=new Tn,di=new Tn,pi=new si,fi=new Bn;class gi{constructor(e=0,t=0,n=0,i=gi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],c=i[9],h=i[2],A=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(jt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(A,l),this._z=0);break;case"YXZ":this._x=Math.asin(-jt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(jt(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-jt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(A,u),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(jt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,u));break;case"XZY":this._z=Math.asin(-jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(A,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return pi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(pi,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fi.setFromEuler(this),this.setFromQuaternion(fi,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(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}}gi.DEFAULT_ORDER="XYZ";class mi{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return!!(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let vi=0;const Ei=new Tn,bi=new Bn,Ci=new si,_i=new Tn,Ii=new Tn,xi=new Tn,yi=new Bn,wi=new Tn(1,0,0),Mi=new Tn(0,1,0),Si=new Tn(0,0,1),Bi={type:"added"},Ti={type:"removed"},Ri={type:"childadded",child:null},Di={type:"childremoved",child:null};class Qi extends Ht{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:vi++}),this.uuid=qt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Qi.DEFAULT_UP.clone();const e=new Tn,t=new gi,n=new Bn,i=new Tn(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new si},normalMatrix:{value:new nn}}),this.matrix=new si,this.matrixWorld=new si,this.matrixWorldInv=new si,this.offsetMatrix=(new si).identity(),this.offsetMatrixInv=(new si).identity(),this.center=new Tn,this.centerOffset=new Tn,this.modelOffsetMatrix=(new si).identity(),this.modelOffsetMatrixInv=(new si).identity(),this.matrixAutoUpdate=Qi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Qi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new mi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return bi.setFromAxisAngle(e,t),this.quaternion.multiply(bi),this}rotateOnWorldAxis(e,t){return bi.setFromAxisAngle(e,t),this.quaternion.premultiply(bi),this}rotateX(e){return this.rotateOnAxis(wi,e)}rotateY(e){return this.rotateOnAxis(Mi,e)}rotateZ(e){return this.rotateOnAxis(Si,e)}translateOnAxis(e,t){return Ei.copy(e).applyQuaternion(this.quaternion),this.position.add(Ei.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(wi,e)}translateY(e){return this.translateOnAxis(Mi,e)}translateZ(e){return this.translateOnAxis(Si,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ci.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?_i.copy(e):_i.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ii.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ci.lookAt(Ii,_i,this.up):Ci.lookAt(_i,Ii,this.up),this.quaternion.setFromRotationMatrix(Ci),i&&(Ci.extractRotation(i.matrixWorld),bi.setFromRotationMatrix(Ci),this.quaternion.premultiply(bi.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Bi),Ri.child=e,this.dispatchEvent(Ri),Ri.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ti),Di.child=e,this.dispatchEvent(Di),Di.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ci.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Ci.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ci),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Bi),Ri.child=e,this.dispatchEvent(Ri),Ri.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ii,e,xi),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ii,yi,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?(this.matrixWorld.copy(this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert()):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert())),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?(this.matrixWorld.copy(this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert()):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert())),this.modelOffsetMatrix.copy(this.matrixWorld).multiply(this.offsetMatrix),this.modelOffsetMatrixInv.copy(this.modelOffsetMatrix).invert(),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=a(e.geometries),i=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),c=a(e.animations),h=a(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixWorldInv.copy(e.matrixWorldInv),this.offsetMatrix.copy(e.offsetMatrix),this.offsetMatrixInv.copy(e.offsetMatrixInv),this.center.copy(e.center),this.centerOffset.copy(e.centerOffset),this.modelOffsetMatrix.copy(e.modelOffsetMatrix),this.modelOffsetMatrixInv.copy(e.modelOffsetMatrixInv),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}Qi.DEFAULT_UP=new Tn(0,1,0),Qi.DEFAULT_MATRIX_AUTO_UPDATE=!0,Qi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ui=new Tn,Li=new Tn,Pi=new Tn,Ni=new Tn,Fi=new Tn,Oi=new Tn,ki=new Tn,Gi=new Tn,Hi=new Tn,zi=new Tn;class Vi{constructor(e=new Tn,t=new Tn,n=new Tn){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Ui.subVectors(e,t),i.cross(Ui);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Ui.subVectors(i,t),Li.subVectors(n,t),Pi.subVectors(e,t);const a=Ui.dot(Ui),s=Ui.dot(Li),o=Ui.dot(Pi),l=Li.dot(Li),c=Li.dot(Pi),h=a*l-s*s;if(0===h)return r.set(0,0,0),null;const A=1/h,u=(l*o-s*c)*A,d=(a*c-s*o)*A;return r.set(1-u-d,d,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Ni)&&Ni.x>=0&&Ni.y>=0&&Ni.x+Ni.y<=1}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,Ni)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Ni.x),o.addScaledVector(a,Ni.y),o.addScaledVector(s,Ni.z),o)}static isFrontFacing(e,t,n,i){return Ui.subVectors(n,t),Li.subVectors(e,t),Ui.cross(Li).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ui.subVectors(this.c,this.b),Li.subVectors(this.a,this.b),.5*Ui.cross(Li).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Vi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Vi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Vi.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Vi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Vi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,s;Fi.subVectors(i,n),Oi.subVectors(r,n),Gi.subVectors(e,n);const o=Fi.dot(Gi),l=Oi.dot(Gi);if(o<=0&&l<=0)return t.copy(n);Hi.subVectors(e,i);const c=Fi.dot(Hi),h=Oi.dot(Hi);if(c>=0&&h<=c)return t.copy(i);const A=o*h-c*l;if(A<=0&&o>=0&&c<=0)return a=o/(o-c),t.copy(n).addScaledVector(Fi,a);zi.subVectors(e,r);const u=Fi.dot(zi),d=Oi.dot(zi);if(d>=0&&u<=d)return t.copy(r);const p=u*l-o*d;if(p<=0&&l>=0&&d<=0)return s=l/(l-d),t.copy(n).addScaledVector(Oi,s);const f=c*d-u*h;if(f<=0&&h-c>=0&&u-d>=0)return ki.subVectors(r,i),s=(h-c)/(h-c+(u-d)),t.copy(i).addScaledVector(ki,s);const g=1/(f+p+A);return a=p*g,s=A*g,t.copy(n).addScaledVector(Fi,a).addScaledVector(Oi,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Wi={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},qi={h:0,s:0,l:0},ji={h:0,s:0,l:0};function Yi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class Xi{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ct){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,pn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=pn.workingColorSpace){return this.r=e,this.g=t,this.b=n,pn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=pn.workingColorSpace){if(e=Yt(e,1),t=jt(t,0,1),n=jt(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Yi(r,i,e+1/3),this.g=Yi(r,i,e),this.b=Yi(r,i,e-1/3)}return pn.toWorkingColorSpace(this,i),this}setStyle(e,t=Ct){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ct){const n=Wi[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fn(e.r),this.g=fn(e.g),this.b=fn(e.b),this}copyLinearToSRGB(e){return this.r=gn(e.r),this.g=gn(e.g),this.b=gn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ct){return pn.fromWorkingColorSpace(Ki.copy(this),e),65536*Math.round(jt(255*Ki.r,0,255))+256*Math.round(jt(255*Ki.g,0,255))+Math.round(jt(255*Ki.b,0,255))}getHexString(e=Ct){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=pn.workingColorSpace){pn.fromWorkingColorSpace(Ki.copy(this),t);const n=Ki.r,i=Ki.g,r=Ki.b,a=Math.max(n,i,r),s=Math.min(n,i,r);let o,l;const c=(s+a)/2;if(s===a)o=0,l=0;else{const e=a-s;switch(l=c<=.5?e/(a+s):e/(2-a-s),a){case n:o=(i-r)/e+(i<r?6:0);break;case i:o=(r-n)/e+2;break;case r:o=(n-i)/e+4}o/=6}return e.h=o,e.s=l,e.l=c,e}getRGB(e,t=pn.workingColorSpace){return pn.fromWorkingColorSpace(Ki.copy(this),t),e.r=Ki.r,e.g=Ki.g,e.b=Ki.b,e}getStyle(e=Ct){pn.fromWorkingColorSpace(Ki.copy(this),e);const t=Ki.r,n=Ki.g,i=Ki.b;return e!==Ct?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(qi),this.setHSL(qi.h+e,qi.s+t,qi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(qi),e.getHSL(ji);const n=Xt(qi.h,ji.h,t),i=Xt(qi.s,ji.s,t),r=Xt(qi.l,ji.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ki=new Xi;Xi.NAMES=Wi;let Ji=0;class Zi extends Ht{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ji++}),this.uuid=qt(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=ge,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xi(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Bt,this.stencilZFail=Bt,this.stencilZPass=Bt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==ge&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Bt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Bt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Bt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class $i extends Zi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xi(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 gi,this.combine=0,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}}const er=function(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}();const tr=function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=jt(e,-65504,65504),er.floatView[0]=e;const t=er.uint32View[0],n=t>>23&511;return er.baseTable[n]+((8388607&t)>>er.shiftTable[n])},nr=new Tn,ir=new tn;class rr{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Ft,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Je,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return cn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix3(e),this.setXY(t,ir.x,ir.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)nr.fromBufferAttribute(this,t),nr.applyMatrix3(e),this.setXYZ(t,nr.x,nr.y,nr.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)nr.fromBufferAttribute(this,t),nr.applyMatrix4(e),this.setXYZ(t,nr.x,nr.y,nr.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)nr.fromBufferAttribute(this,t),nr.applyNormalMatrix(e),this.setXYZ(t,nr.x,nr.y,nr.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)nr.fromBufferAttribute(this,t),nr.transformDirection(e),this.setXYZ(t,nr.x,nr.y,nr.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Kt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Jt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Kt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Kt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Jt(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=Kt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Jt(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=Kt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array),r=Jt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Ft&&(e.usage=this.usage),e}}class ar extends rr{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class sr extends rr{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class or extends rr{constructor(e,t,n){super(new Float32Array(e),t,n)}}let lr=0;const cr=new si,hr=new Qi,Ar=new Tn,ur=new Qn,dr=new Qn,pr=new Tn;class fr extends Ht{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:lr++}),this.uuid=qt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this.cubeMapNormalTarget=null}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(an(e)?sr:ar)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new nn).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return cr.makeRotationFromQuaternion(e),this.applyMatrix4(cr),this}rotateX(e){return cr.makeRotationX(e),this.applyMatrix4(cr),this}rotateY(e){return cr.makeRotationY(e),this.applyMatrix4(cr),this}rotateZ(e){return cr.makeRotationZ(e),this.applyMatrix4(cr),this}translate(e,t,n){return cr.makeTranslation(e,t,n),this.applyMatrix4(cr),this}scale(e,t,n){return cr.makeScale(e,t,n),this.applyMatrix4(cr),this}lookAt(e){return hr.lookAt(e),hr.updateMatrix(),this.applyMatrix4(hr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ar).negate(),this.translate(Ar.x,Ar.y,Ar.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new or(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Qn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Tn(-1/0,-1/0,-1/0),new Tn(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];ur.setFromBufferAttribute(n),this.morphTargetsRelative?(pr.addVectors(this.boundingBox.min,ur.min),this.boundingBox.expandByPoint(pr),pr.addVectors(this.boundingBox.max,ur.max),this.boundingBox.expandByPoint(pr)):(this.boundingBox.expandByPoint(ur.min),this.boundingBox.expandByPoint(ur.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Jn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Tn,1/0);if(e){const n=this.boundingSphere.center;if(ur.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];dr.setFromBufferAttribute(n),this.morphTargetsRelative?(pr.addVectors(ur.min,dr.min),ur.expandByPoint(pr),pr.addVectors(ur.max,dr.max),ur.expandByPoint(pr)):(ur.expandByPoint(dr.min),ur.expandByPoint(dr.max))}ur.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)pr.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(pr));if(t)for(let r=0,a=t.length;r<a;r++){const a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)pr.fromBufferAttribute(a,t),s&&(Ar.fromBufferAttribute(e,t),pr.add(Ar)),i=Math.max(i,n.distanceToSquared(pr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new rr(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<n.count;e++)s[e]=new Tn,o[e]=new Tn;const l=new Tn,c=new Tn,h=new Tn,A=new tn,u=new tn,d=new tn,p=new Tn,f=new Tn;function g(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),h.fromBufferAttribute(n,i),A.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,i),c.sub(l),h.sub(l),u.sub(A),d.sub(A);const a=1/(u.x*d.y-d.x*u.y);isFinite(a)&&(p.copy(c).multiplyScalar(d.y).addScaledVector(h,-u.y).multiplyScalar(a),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-d.x).multiplyScalar(a),s[e].add(p),s[t].add(p),s[i].add(p),o[e].add(f),o[t].add(f),o[i].add(f))}let m=this.groups;0===m.length&&(m=[{start:0,count:e.count}]);for(let t=0,n=m.length;t<n;++t){const n=m[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const v=new Tn,E=new Tn,b=new Tn,C=new Tn;function _(e){b.fromBufferAttribute(i,e),C.copy(b);const t=s[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),E.crossVectors(C,t);const n=E.dot(o[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=m.length;t<n;++t){const n=m[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)_(e.getX(t+0)),_(e.getX(t+1)),_(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new rr(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Tn,r=new Tn,a=new Tn,s=new Tn,o=new Tn,l=new Tn,c=new Tn,h=new Tn;if(e)for(let A=0,u=e.count;A<u;A+=3){const u=e.getX(A+0),d=e.getX(A+1),p=e.getX(A+2);i.fromBufferAttribute(t,u),r.fromBufferAttribute(t,d),a.fromBufferAttribute(t,p),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),s.fromBufferAttribute(n,u),o.fromBufferAttribute(n,d),l.fromBufferAttribute(n,p),s.add(c),o.add(c),l.add(c),n.setXYZ(u,s.x,s.y,s.z),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(p,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)pr.fromBufferAttribute(e,t),pr.normalize(),e.setXYZ(t,pr.x,pr.y,pr.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i);let s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)a[o++]=n[s++]}return new rr(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new fr,n=this.index.array,i=this.attributes;for(const r in i){const a=e(i[r],n);t.setAttribute(r,a)}const r=this.morphAttributes;for(const i in r){const a=[],s=r[i];for(let t=0,i=s.length;t<i;t++){const i=e(s[t],n);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let e=0,n=a.length;e<n;e++){const n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let e=0,t=a.length;e<t;e++){const t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}const s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());const o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,null!==e.cubeMapNormalTarget&&this.cubeMapNormalTarget.copy(e.cubeMapNormalTarget),this}dispose(){this.cubeMapNormalTarget&&this.cubeMapNormalTarget.dispose(),this.dispatchEvent({type:"dispose"})}}const gr=new si,mr=new ai,vr=new Jn,Er=new Tn,br=new Tn,Cr=new Tn,_r=new Tn,Ir=new Tn,xr=new Tn,yr=new tn,wr=new tn,Mr=new tn,Sr=new Tn,Br=new Tn,Tr=new Tn,Rr=new Tn,Dr=new Tn;class Qr extends Qi{constructor(e=new fr,t=new $i){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeOffsets(){this.geometry.computeBoundingBox(),this.geometry.computeBoundingSphere(),this.center=this.geometry.boundingSphere.center,this.offsetMatrix=this._computeOffsetMatrix(),this.offsetMatrixInv.copy(this.offsetMatrix).invert(),this.centerOffset.copy(this.center).applyMatrix4(this.offsetMatrixInv),this.modelOffsetMatrix.copy(this.matrixWorld).multiply(this.offsetMatrix),this.modelOffsetMatrixInv.copy(this.modelOffsetMatrix).invert()}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const s=this.morphTargetInfluences;if(r&&s){xr.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=s[n],o=r[n];0!==i&&(Ir.fromBufferAttribute(o,e),a?xr.addScaledVector(Ir,i):xr.addScaledVector(Ir.sub(t),i))}t.add(xr)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),vr.copy(n.boundingSphere),vr.applyMatrix4(r),mr.copy(e.ray).recast(e.near),!1===vr.containsPoint(mr.origin)){if(null===mr.intersectSphere(vr,Er))return;if(mr.origin.distanceToSquared(Er)>(e.far-e.near)**2)return}gr.copy(r).invert(),mr.copy(e.ray).applyMatrix4(gr),null!==n.boundingBox&&!1===mr.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,mr)}}_computeOffsetMatrix(){const e=this.geometry,t=e.getAttribute("position"),n=e.getIndex(),i=new Tn(0,0,0),r=new Tn(0,0,0),a=new Tn(0,0,0),s=new Tn(0,0,0);if(void 0!==n){const o=Math.max(0,e.drawRange.start),l=(Math.min(n.count,e.drawRange.start+e.drawRange.count)-1)/3;for(let e=o;e<l;e+=3){const o=n.getX(e),l=n.getX(e+1),c=n.getX(e+2);r.set(t.getX(o),t.getY(o),t.getZ(o)),a.set(t.getX(l),t.getY(l),t.getZ(l)),s.set(t.getX(c),t.getY(c),t.getZ(c)),a.sub(r),s.sub(r),s.cross(a),s.normalize(),i.add(s)}}else for(let e=0;e<t.count;e+=3)r.set(t.getX(e),t.getY(e),t.getZ(e)),a.set(t.getX(e+1),t.getY(e+1),t.getZ(e+1)),s.set(t.getX(e+2),t.getY(e+2),t.getZ(e+2)),a.sub(r),s.sub(r),s.cross(a),s.normalize(),i.add(s);i.normalize();let o=!0,l=0;for(;o;){const e=l/3;if(n){if(e+1>=n.count)break}else if(e+1>=t.count)break;const r=n?n.getX(e):e,c=n?n.getX(e+1):e+1;a.set(t.getX(r),t.getY(r),t.getZ(r)),s.set(t.getX(c),t.getY(c),t.getZ(c)),a.sub(s),a.normalize();const h=i.dot(a);Math.abs(h-1)>.001&&a.length()>.5&&(o=!1),l+=3}s.crossVectors(a,i),s.normalize(),a.crossVectors(i,s),a.normalize();const c=new si;c.elements[0]=a.x,c.elements[1]=a.y,c.elements[2]=a.z,c.elements[3]=0,c.elements[4]=i.x,c.elements[5]=i.y,c.elements[6]=i.z,c.elements[7]=0,c.elements[8]=s.x,c.elements[9]=s.y,c.elements[10]=s.z,c.elements[11]=0,c.elements[12]=0,c.elements[13]=0,c.elements[14]=0,c.elements[15]=1;const h=e.boundingSphere.radius,A=(new si).makeScale(h,h,h);return c.multiply(A),c}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,A=r.groups,u=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=A.length;r<o;r++){const o=A[r],d=a[o.materialIndex];for(let r=Math.max(o.start,u.start),a=Math.min(s.count,Math.min(o.start+o.count,u.start+u.count));r<a;r+=3)i=Ur(this,d,e,n,l,c,h,s.getX(r),s.getX(r+1),s.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),o=Math.min(s.count,u.start+u.count);r<o;r+=3)i=Ur(this,a,e,n,l,c,h,s.getX(r),s.getX(r+1),s.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i));else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=A.length;r<s;r++){const s=A[r],d=a[s.materialIndex];for(let r=Math.max(s.start,u.start),a=Math.min(o.count,Math.min(s.start+s.count,u.start+u.count));r<a;r+=3)i=Ur(this,d,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),s=Math.min(o.count,u.start+u.count);r<s;r+=3)i=Ur(this,a,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}function Ur(e,t,n,i,r,a,s,o,l,c){e.getVertexPosition(o,br),e.getVertexPosition(l,Cr),e.getVertexPosition(c,_r);const h=function(e,t,n,i,r,a,s,o){let l;if(l=1===t.side?i.intersectTriangle(s,a,r,!0,o):i.intersectTriangle(r,a,s,0===t.side,o),null===l)return null;Dr.copy(o),Dr.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Dr);return c<n.near||c>n.far?null:{distance:c,point:Dr.clone(),object:e}}(e,t,n,i,br,Cr,_r,Rr);if(h){r&&(yr.fromBufferAttribute(r,o),wr.fromBufferAttribute(r,l),Mr.fromBufferAttribute(r,c),h.uv=Vi.getInterpolation(Rr,br,Cr,_r,yr,wr,Mr,new tn)),a&&(yr.fromBufferAttribute(a,o),wr.fromBufferAttribute(a,l),Mr.fromBufferAttribute(a,c),h.uv1=Vi.getInterpolation(Rr,br,Cr,_r,yr,wr,Mr,new tn)),s&&(Sr.fromBufferAttribute(s,o),Br.fromBufferAttribute(s,l),Tr.fromBufferAttribute(s,c),h.normal=Vi.getInterpolation(Rr,br,Cr,_r,Sr,Br,Tr,new Tn),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:o,b:l,c:c,normal:new Tn,materialIndex:0};Vi.getNormal(br,Cr,_r,e.normal),h.face=e}return h}class Lr extends fr{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],c=[],h=[];let A=0,u=0;function d(e,t,n,i,r,a,d,p,f,g,m){const v=a/f,E=d/g,b=a/2,C=d/2,_=p/2,I=f+1,x=g+1;let y=0,w=0;const M=new Tn;for(let a=0;a<x;a++){const s=a*E-C;for(let o=0;o<I;o++){const A=o*v-b;M[e]=A*i,M[t]=s*r,M[n]=_,l.push(M.x,M.y,M.z),M[e]=0,M[t]=0,M[n]=p>0?1:-1,c.push(M.x,M.y,M.z),h.push(o/f),h.push(1-a/g),y+=1}}for(let e=0;e<g;e++)for(let t=0;t<f;t++){const n=A+t+I*e,i=A+t+I*(e+1),r=A+(t+1)+I*(e+1),a=A+(t+1)+I*e;o.push(n,i,a),o.push(i,r,a),w+=6}s.addGroup(u,w,m),u+=w,A+=y}d("z","y","x",-1,-1,n,t,e,a,r,0),d("z","y","x",1,-1,n,t,-e,a,r,1),d("x","z","y",1,1,e,n,t,i,a,2),d("x","z","y",1,-1,e,n,-t,i,a,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new or(l,3)),this.setAttribute("normal",new or(c,3)),this.setAttribute("uv",new or(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Lr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Pr(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function Nr(e){const t={};for(let n=0;n<e.length;n++){const i=Pr(e[n]);for(const e in i)t[e]=i[e]}return t}function Fr(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:pn.workingColorSpace}const Or={clone:Pr,merge:Nr};class kr extends Zi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Pr(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}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;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Gr extends Qi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new si,this.projectionMatrix=new si,this.projectionMatrixInverse=new si,this.coordinateSystem=kt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Hr=new Tn,zr=new tn,Vr=new tn;class Wr extends Gr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Wt*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Vt*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Wt*Math.atan(Math.tan(.5*Vt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Hr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Hr.x,Hr.y).multiplyScalar(-e/Hr.z),Hr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Hr.x,Hr.y).multiplyScalar(-e/Hr.z)}getViewSize(e,t){return this.getViewBounds(e,zr,Vr),t.subVectors(Vr,zr)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Vt*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}const s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const qr=-90;class jr extends Qi{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Wr(qr,1,e,t);i.layers=this.layers,this.add(i);const r=new Wr(qr,1,e,t);r.layers=this.layers,this.add(r);const a=new Wr(qr,1,e,t);a.layers=this.layers,this.add(a);const s=new Wr(qr,1,e,t);s.layers=this.layers,this.add(s);const o=new Wr(qr,1,e,t);o.layers=this.layers,this.add(o);const l=new Wr(qr,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(const e of t)this.remove(e);if(e===kt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(e!==Gt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,s,o,l,c]=this.children,h=e.getRenderTarget(),A=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,s),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,A,u),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class Yr extends In{constructor(e,t,n,i,r,a,s,o,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:Le,n,i,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Xr extends wn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Yr(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:We}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;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Lr(5,5,5),s=new kr({name:"CubemapFromEquirect",uniforms:Pr(n),vertexShader:i,fragmentShader:r,side:1,blending:0});s.uniforms.tEquirect.value=t;const o=new Qr(a,s),l=t.minFilter;return t.minFilter===je&&(t.minFilter=We),new jr(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}const Kr=new Tn,Jr=new Tn,Zr=new nn;class $r{constructor(e=new Tn(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Kr.subVectors(n,t).cross(Jr.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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){const n=e.delta(Kr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Zr.getNormalMatrix(e),i=this.coplanarPoint(Kr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const ea=new Jn,ta=new Tn;class na{constructor(e=new $r,t=new $r,n=new $r,i=new $r,r=new $r,a=new $r){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3){const n=this.planes,i=e.elements,r=i[0],a=i[1],s=i[2],o=i[3],l=i[4],c=i[5],h=i[6],A=i[7],u=i[8],d=i[9],p=i[10],f=i[11],g=i[12],m=i[13],v=i[14],E=i[15];if(n[0].setComponents(o-r,A-l,f-u,E-g).normalize(),n[1].setComponents(o+r,A+l,f+u,E+g).normalize(),n[2].setComponents(o+a,A+c,f+d,E+m).normalize(),n[3].setComponents(o-a,A-c,f-d,E-m).normalize(),n[4].setComponents(o-s,A-h,f-p,E-v).normalize(),t===kt)n[5].setComponents(o+s,A+h,f+p,E+v).normalize();else{if(t!==Gt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(s,h,p,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ea.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ea.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ea)}intersectsSprite(e){return ea.center.set(0,0,0),ea.radius=.7071067811865476,ea.applyMatrix4(e.matrixWorld),this.intersectsSphere(ea)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(ta.x=i.normal.x>0?e.max.x:e.min.x,ta.y=i.normal.y>0?e.max.y:e.min.y,ta.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ta)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function ia(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ra(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}n.isInterleavedBufferAttribute&&(n=n.data);const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,a=i.byteLength,s=e.createBuffer();let o;if(e.bindBuffer(n,s),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)o=e.FLOAT;else if(i instanceof Uint16Array)o=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)o=e.SHORT;else if(i instanceof Uint32Array)o=e.UNSIGNED_INT;else if(i instanceof Int32Array)o=e.INT;else if(i instanceof Int8Array)o=e.BYTE;else if(i instanceof Uint8Array)o=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);o=e.UNSIGNED_BYTE}return{buffer:s,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:a}}(n,i));else if(r.version<n.version){if(r.size!==n.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.");!function(t,n,i){const r=n.array,a=n._updateRange,s=n.updateRanges;if(e.bindBuffer(i,t),-1===a.count&&0===s.length&&e.bufferSubData(i,0,r),0!==s.length){for(let t=0,n=s.length;t<n;t++){const n=s[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(i,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count),a.count=-1),n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}class aa extends fr{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,s=Math.floor(n),o=Math.floor(i),l=s+1,c=o+1,h=e/s,A=t/o,u=[],d=[],p=[],f=[];for(let e=0;e<c;e++){const t=e*A-a;for(let n=0;n<l;n++){const i=n*h-r;d.push(i,-t,0),p.push(0,0,1),f.push(n/s),f.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;u.push(n,i,a),u.push(i,r,a)}this.setIndex(u),this.setAttribute("position",new or(d,3)),this.setAttribute("normal",new or(p,3)),this.setAttribute("uv",new or(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new aa(e.width,e.height,e.widthSegments,e.heightSegments)}}const sa={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cubeNormals_vert:"varying vec3 vNormal;\nvarying vec3 vecPosition;\nuniform mat4 offsetMatrixInv;\nuniform vec3 center;\n#include <morphtarget_pars_vertex>\nvoid main() {\n\tvNormal = normalize((offsetMatrixInv * vec4(normal, 0.)).xyz);\n\t#include <begin_vertex>\n\ttransformed -= center;\n\t#include <morphtarget_vertex>\n\tvec4 offsetPos = offsetMatrixInv * vec4(transformed, 1.);\n\tvecPosition = (modelMatrix * offsetPos).xyz;\n\tgl_Position = projectionMatrix * modelViewMatrix * offsetPos;\n}",cubeNormals_frag:"varying vec3 vNormal;\nvarying vec3 vecPosition;\nuniform float radius;\nvoid main() {\n\tvec3 color = normalize(vNormal);\n\tcolor = color * 0.5 + 0.5;\n\tgl_FragColor = vec4(color.x, color.y, color.z, length(vecPosition) / radius);\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshdiamond_vert:"#ifndef USE_ENVMAP\n\t#define USE_ENVMAP\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vWorldNormal;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\n#ifdef USE_INSTANCING\n\tuniform mat4 inverseModelMatrix;\n\tuniform mat4 modelOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrixInv;\n#endif\n#include <morphtarget_pars_vertex>\n#ifdef USE_MORPHTARGETS\n\tvarying vec3 vCenterOffset;\n\t#ifndef USE_INSTANCING\n\t\tuniform mat4 modelOffsetMatrixInv;\n\t#endif\n#endif\nvoid main() {\n\t#ifdef USE_INSTANCING\n\t\tvWorldNormal = (modelMatrix * instanceMatrix * vec4(normal, 0.0)).xyz;\n\t#else\n\t\tvWorldNormal = (modelMatrix * vec4(normal, 0.0)).xyz;\n\t#endif\n\t#include <beginnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#ifdef USE_MORPHTARGETS\n\t\tvCenterOffset = transformed;\n\t\t#include <morphtarget_vertex>\n\t\tvCenterOffset = transformed - vCenterOffset;\n\t\t#ifndef USE_INSTANCING\n\t\t\tvCenterOffset = (modelOffsetMatrixInv * modelMatrix * vec4(vCenterOffset, 1.0)).xyz;\n\t\t#endif\n\t#endif\n\t#include <project_vertex>\n\tvViewPosition = -mvPosition.xyz;\n\tvUv = uv;\n\t#include <worldpos_vertex>\n\tvWorldPosition = worldPosition.xyz;\n\t#ifdef USE_INSTANCING\n\t\tvModelInstanceOffsetMatrix = modelMatrix * instanceMatrix * inverseModelMatrix * modelOffsetMatrix;\n\t\tvModelInstanceOffsetMatrixInv = inverse(vModelInstanceOffsetMatrix);\n\t\t#ifdef USE_MORPHTARGETS\n\t\t\tvCenterOffset = (vModelInstanceOffsetMatrixInv * modelMatrix * vec4(vCenterOffset, 1.0)).xyz;\n\t\t#endif\n\t#endif\n}",meshdiamond_frag:"varying vec3 vWorldNormal;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform float radius;\nuniform vec3 centerOffset;\n#include <common>\n#ifdef USE_INSTANCING\n\tvarying mat4 vModelInstanceOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrixInv;\n\t#define MODEL_OFFSET_MATRIX vModelInstanceOffsetMatrix\n\t#define INV_MODEL_OFFSET_MATRIX vModelInstanceOffsetMatrixInv\n#else\n\tuniform mat4 modelOffsetMatrixInv;\n\tuniform mat4 modelOffsetMatrix;\n\t#define MODEL_OFFSET_MATRIX modelOffsetMatrix\n\t#define INV_MODEL_OFFSET_MATRIX modelOffsetMatrixInv\n#endif\n#ifdef USE_MORPHTARGETS\n\tvarying vec3 vCenterOffset;\n\t#define CENTER_OFFSET (centerOffset + vCenterOffset)\n#else\n\t#define CENTER_OFFSET (centerOffset)\n#endif\nuniform mat4 projectionMatrix;\nuniform samplerCube tCubeMapNormals;\n#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#else\n\tuniform sampler2D envMap;\n#endif\nuniform float envMapIntensity;\nuniform float transmission;\nuniform vec2 transmissionSamplerSize;\nuniform sampler2D transmissionSamplerMap;\nuniform float ior;\nuniform float rIndexDelta;\nuniform float squashFactor;\nuniform float geometryFactor;\nuniform vec3 color;\nuniform vec3 colorCorrection;\nuniform vec3 boostFactors;\nuniform float gammaFactor;\nuniform float absorptionFactor;\nuniform float envMapRotation;\nuniform vec4 envMapRotationQuat;\nuniform float reflectivity;\nvec3 BRDF_Specular_GGX_Environment(const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness) {\n float dotNV = abs(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nvec2 cartesianToPolar(vec3 n) {\n vec2 uv;\n uv.x = atan(n.z, n.x) / (PI * 2.0) + 0.5;\n uv.y = asin(n.y) / PI + 0.5;\n return uv;\n}\nvec4 sampleEnvMap(vec3 direction) {\n\t#if !defined(USE_ENVMAP)\n\t\treturn vec4(direction, 1);\n\t#else\n\t\tfloat cs = cos(envMapRotation);\n\t\tfloat sn = sin(envMapRotation);\n\t\tfloat temp = cs * direction.x + sn * direction.z;\n\t\tdirection.z = -sn * direction.x + cs * direction.z;\n\t\tdirection.x = temp;\n\t\tdirection.x *= -1.;\n\t\tdirection.y *= -1.;\n\t\tdirection.z *= -1.;\n\t\tvec3 t = 2.0 * cross(envMapRotationQuat.xyz, direction);\n\t\tdirection += envMapRotationQuat.w * t + cross(envMapRotationQuat.xyz, t);\n\t\t#if defined( ENVMAP_TYPE_CUBE )\n\t\t\treturn (textureCube(envMap, direction));\n\t\t#elif defined( ENVMAP_TYPE_TEXTURE_2D )\n\t\t\treturn (texture2D(envMap, cartesianToPolar(direction)));\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\treturn (texture2D(envMap, cartesianToPolar(direction)));\n\t\t#endif\n\t\treturn vec4(1, 0, 1, 1);\n\t#endif\n}\nvec4 SampleSpecularReflection(vec3 direction) {\n\t#if defined(FIX_ENV_DIRECTION)\n\t\tdirection = (viewMatrix * vec4(direction, 0.0)).xyz;\n\t#endif\n\treturn envMapIntensity * (sampleEnvMap(direction));\n}\nvec4 SampleSpecularContribution(vec3 direction) {\n\t#if (DIA_ORIENT_ENVMAP < 1)\n\t\tdirection = mat3(MODEL_OFFSET_MATRIX) * direction;\n\t#endif\n\t#if defined(FIX_ENV_DIRECTION)\n\t\tdirection = (viewMatrix * vec4(direction, 0.0)).xyz;\n\t#endif\n direction = normalize(direction);\n direction.x *= -1.;\n direction.z *= -1.;\n return envMapIntensity * (sampleEnvMap(direction));\n}\nvec4 SampleSpecularContributionRef(vec3 origin, int i) {\n vec4 ndcPos = projectionMatrix * viewMatrix * vec4(origin, 1.);\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n return texture2D(transmissionSamplerMap, refractionCoords);\n}\nvec3 intersectSphere(vec3 origin, vec3 direction) {\n origin -= CENTER_OFFSET;\n direction.y /= squashFactor;\n float A = dot(direction, direction);\n float B = 2. * dot(origin, direction);\n float C = dot(origin, origin) - radius * radius;\n float disc = B * B - 4. * A * C;\n if(disc > 0.) {\n disc = sqrt(disc);\n float t1 = (-B + disc) * geometryFactor / A;\n float t2 = (-B - disc) * geometryFactor / A;\n float t = (t1 > t2) ? t1 : t2;\n direction.y *= squashFactor;\n return vec3(origin + CENTER_OFFSET + direction * t);\n }\n return vec3(0.);\n}\nvec3 linePlaneIntersect(in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal) {\n return lineDirection * (dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\n}\nvec4 getNormalDistance(vec3 d) {\n return textureCube(tCubeMapNormals, d);\n}\nvec3 getSurfaceNormal(vec4 surfaceInfos) {\n vec3 surfaceNormal = surfaceInfos.rgb;\n surfaceNormal = surfaceNormal * 2. - 1.;\n return -normalize(surfaceNormal);\n}\nvec3 intersect(vec3 rayOrigin,vec3 rayDirection) {\n vec3 sphereHitPoint = intersectSphere(rayOrigin, rayDirection);\n vec3 direction1 = normalize(sphereHitPoint - CENTER_OFFSET);\n vec4 normalDistanceData1 = getNormalDistance(direction1);\n float distance1 = normalDistanceData1.a * radius;\n vec3 pointOnPlane1 = CENTER_OFFSET + direction1 * distance1;\n vec3 planeNormal1 = getSurfaceNormal(normalDistanceData1);\n vec3 hitPoint1 = linePlaneIntersect(rayOrigin, rayDirection, pointOnPlane1, planeNormal1);\n vec3 direction2 = normalize(hitPoint1 - CENTER_OFFSET);\n vec4 normalDistanceData2 = getNormalDistance(direction2);\n float distance2 = normalDistanceData2.a * radius;\n vec3 pointOnPlane2 = CENTER_OFFSET + direction2 * distance2;\n vec3 hitPoint = hitPoint1;\n vec3 planeNormal2 = getSurfaceNormal(normalDistanceData2);\n hitPoint = linePlaneIntersect(rayOrigin, rayDirection, pointOnPlane2, planeNormal2);\n return hitPoint;\n}\nvec3 getRefractionColor(vec3 origin, vec3 direction, vec3 normal) {\n vec3 outColor = vec3(0.);\n const float n1 = 1.;\n const float epsilon = 1e-4;\n float f0 = (2.4 - n1) / (2.4 + n1);\n f0 *= f0;\n vec3 attenuationFactor = vec3(1.);\n vec3 newDirection = refract(direction, normal, n1 / ior);\n vec3 brdfRefracted = BRDF_Specular_GGX_Environment(newDirection, -normal, vec3(f0), 0.);\n attenuationFactor *= (vec3(1.) - brdfRefracted);\n int count = 0;\n mat4 invModelOffsetMatrix = INV_MODEL_OFFSET_MATRIX;\n newDirection = normalize((invModelOffsetMatrix * vec4(newDirection, 0.)).xyz);\n origin = (invModelOffsetMatrix * vec4(origin, 1.)).xyz;\n for (int i = 0; i < RAY_BOUNCES; i++) {\n vec3 intersectedPos = intersect(origin, newDirection);\n vec3 dist = intersectedPos - origin;\n vec3 d = normalize(intersectedPos - CENTER_OFFSET);\n vec3 mappedNormal = getNormalDistance(d).rgb;\n mappedNormal = 2. * mappedNormal - 1.;\n mappedNormal = -normalize(mappedNormal);\n float r = length(dist) / radius * absorptionFactor;\n attenuationFactor *= exp(-r * (1. - color));\n origin = intersectedPos;\n vec3 origin2 = (MODEL_OFFSET_MATRIX * vec4(intersectedPos, 1)).xyz;\n vec3 oldDir = newDirection;\n newDirection = refract(newDirection, mappedNormal, ior / n1);\n if (dot(newDirection, newDirection) < epsilon) {\n newDirection = reflect(oldDir, mappedNormal);\n if (i == RAY_BOUNCES - 1) {\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(-oldDir, mappedNormal, vec3(f0), 0.);\n vec3 d1 = mat3(MODEL_OFFSET_MATRIX) * oldDir;\n d1 = normalize(d1);\n float cosT = 1. - dot(direction, d1);\n outColor += ((transmission > 0. && cosT < transmission) ? SampleSpecularContributionRef(origin2 + 0.5 * d1 * cosT, i).rgb : SampleSpecularContribution(oldDir).rgb) * attenuationFactor * colorCorrection * boostFactors * (vec3(1.) - brdfReflected);\n }\n } else {\n vec3 brdfRefracted = vec3(1.) - BRDF_Specular_GGX_Environment(newDirection, -mappedNormal, vec3(f0), 0.);\n vec3 d1 = normalize(mat3(MODEL_OFFSET_MATRIX) * newDirection);\n float cosT = 1. - dot(direction, d1);\n if (transmission > 0. && cosT < transmission) {\n outColor += SampleSpecularContributionRef(origin2 + 0.5 * d1 * cosT, i).rgb * brdfRefracted * attenuationFactor * colorCorrection * boostFactors;\n } else {\n vec3 dir0 = newDirection;\n vec3 dir1 = refract(oldDir, mappedNormal, (ior + rIndexDelta) / n1);\n vec3 dir2 = refract(oldDir, mappedNormal, (ior - rIndexDelta) / n1);\n outColor += vec3(SampleSpecularContribution(dir1).r, SampleSpecularContribution(dir0).g, SampleSpecularContribution(dir2).b) * brdfRefracted * attenuationFactor * colorCorrection * boostFactors;\n }\n newDirection = reflect(oldDir, mappedNormal);\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(newDirection, mappedNormal, vec3(f0), 0.);\n attenuationFactor *= brdfReflected * boostFactors;\n count++;\n }\n }\n return outColor;\n}\nvoid main() {\n vec3 normalizedNormal = normalize(vWorldNormal);\n vec3 viewVector = normalize(vWorldPosition - cameraPosition);\n const float n1 = 1.;\n const float epsilon = 1e-4;\n float f0 = (2.4 - n1) / (2.4 + n1);\n f0 *= f0;\n vec3 attenuationFactor = vec3(1.);\n vec3 reflectedDirection = reflect(viewVector, normalizedNormal);\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(reflectedDirection, normalizedNormal, vec3(f0), 0.);\n vec3 reflectionColor = SampleSpecularReflection(reflectedDirection).rgb * brdfReflected * reflectivity * 2.;\n vec3 refractionColor = getRefractionColor(vWorldPosition, viewVector, normalizedNormal);\n vec3 normal = normalize(vNormal);\n vec3 diffuseColor = vec3(1.);\n gl_FragColor = vec4((refractionColor.rgb + reflectionColor.rgb) * diffuseColor, 1.);\n gl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(gammaFactor));\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n\tgl_FragColor.rgb = max(vec3(0.0), gl_FragColor.rgb);\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},oa={common:{diffuse:{value:new Xi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new nn},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new nn}},envmap:{envMap:{value:null},envMapRotation:{value:new nn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new nn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new nn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new nn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new nn},normalScale:{value:new tn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new nn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new nn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new nn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new nn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0},uvTransform:{value:new nn}},sprite:{diffuse:{value:new Xi(16777215)},opacity:{value:1},center:{value:new tn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new nn},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0}}},la={basic:{uniforms:Nr([oa.common,oa.specularmap,oa.envmap,oa.aomap,oa.lightmap,oa.fog]),vertexShader:sa.meshbasic_vert,fragmentShader:sa.meshbasic_frag},cubeNormals:{uniforms:Nr([oa.common,{offsetMatrixInv:{value:(new si).identity()},centerOffset:{value:new Tn(0,0,0)},radius:{value:1}}]),vertexShader:sa.cubeNormals_vert,fragmentShader:sa.cubeNormals_frag},diamond:{uniforms:Nr([oa.common,oa.envmap,{inverseModelMatrix:{value:(new si).identity()},modelOffsetMatrix:{value:(new si).identity()},modelOffsetMatrixInv:{value:(new si).identity()},radius:{value:1},centerOffset:{value:new Tn(0,0,0)},tCubeMapNormals:{value:null},envMapIntensity:{value:1},envMapRotation:{value:0},transmission:{value:0},transmissionSamplerSize:{value:new tn},transmissionSamplerMap:{value:null},rIndexDelta:{value:.012},squashFactor:{value:.98},geometryFactor:{value:.5},color:{value:new Tn(1,1,1)},colorCorrection:{value:new Tn(1,1,1)},boostFactors:{value:new Tn(.892,.892,.98595025)},gammaFactor:{value:1},absorptionFactor:{value:1},envMapRotationQuat:{value:new Bn}}]),vertexShader:sa.meshdiamond_vert,fragmentShader:sa.meshdiamond_frag},lambert:{uniforms:Nr([oa.common,oa.specularmap,oa.envmap,oa.aomap,oa.lightmap,oa.emissivemap,oa.bumpmap,oa.normalmap,oa.displacementmap,oa.fog,oa.lights,{emissive:{value:new Xi(0)}}]),vertexShader:sa.meshlambert_vert,fragmentShader:sa.meshlambert_frag},phong:{uniforms:Nr([oa.common,oa.specularmap,oa.envmap,oa.aomap,oa.lightmap,oa.emissivemap,oa.bumpmap,oa.normalmap,oa.displacementmap,oa.fog,oa.lights,{emissive:{value:new Xi(0)},specular:{value:new Xi(1118481)},shininess:{value:30}}]),vertexShader:sa.meshphong_vert,fragmentShader:sa.meshphong_frag},standard:{uniforms:Nr([oa.common,oa.envmap,oa.aomap,oa.lightmap,oa.emissivemap,oa.bumpmap,oa.normalmap,oa.displacementmap,oa.roughnessmap,oa.metalnessmap,oa.fog,oa.lights,{emissive:{value:new Xi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:sa.meshphysical_vert,fragmentShader:sa.meshphysical_frag},toon:{uniforms:Nr([oa.common,oa.aomap,oa.lightmap,oa.emissivemap,oa.bumpmap,oa.normalmap,oa.displacementmap,oa.gradientmap,oa.fog,oa.lights,{emissive:{value:new Xi(0)}}]),vertexShader:sa.meshtoon_vert,fragmentShader:sa.meshtoon_frag},matcap:{uniforms:Nr([oa.common,oa.bumpmap,oa.normalmap,oa.displacementmap,oa.fog,{matcap:{value:null}}]),vertexShader:sa.meshmatcap_vert,fragmentShader:sa.meshmatcap_frag},points:{uniforms:Nr([oa.points,oa.fog]),vertexShader:sa.points_vert,fragmentShader:sa.points_frag},dashed:{uniforms:Nr([oa.common,oa.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:sa.linedashed_vert,fragmentShader:sa.linedashed_frag},depth:{uniforms:Nr([oa.common,oa.displacementmap]),vertexShader:sa.depth_vert,fragmentShader:sa.depth_frag},normal:{uniforms:Nr([oa.common,oa.bumpmap,oa.normalmap,oa.displacementmap,{opacity:{value:1}}]),vertexShader:sa.meshnormal_vert,fragmentShader:sa.meshnormal_frag},sprite:{uniforms:Nr([oa.sprite,oa.fog]),vertexShader:sa.sprite_vert,fragmentShader:sa.sprite_frag},background:{uniforms:{uvTransform:{value:new nn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:sa.background_vert,fragmentShader:sa.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new nn}},vertexShader:sa.backgroundCube_vert,fragmentShader:sa.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:sa.cube_vert,fragmentShader:sa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:sa.equirect_vert,fragmentShader:sa.equirect_frag},distanceRGBA:{uniforms:Nr([oa.common,oa.displacementmap,{referencePosition:{value:new Tn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:sa.distanceRGBA_vert,fragmentShader:sa.distanceRGBA_frag},shadow:{uniforms:Nr([oa.lights,oa.fog,{color:{value:new Xi(0)},opacity:{value:1}}]),vertexShader:sa.shadow_vert,fragmentShader:sa.shadow_frag}};la.physical={uniforms:Nr([la.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new nn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new nn},clearcoatNormalScale:{value:new tn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new nn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new nn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new nn},sheen:{value:0},sheenColor:{value:new Xi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new nn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new nn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new nn},transmissionSamplerSize:{value:new tn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new nn},attenuationDistance:{value:0},attenuationColor:{value:new Xi(0)},specularColor:{value:new Xi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new nn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new nn},anisotropyVector:{value:new tn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new nn}}]),vertexShader:sa.meshphysical_vert,fragmentShader:sa.meshphysical_frag};const ca={r:0,b:0,g:0},ha=new gi,Aa=new si;function ua(e,t,n,i,r,a,s){const o=new Xi(0);let l,c,h=!0===a?0:1,A=null,u=0,d=null;function p(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function f(t,n){t.getRGB(ca,Fr(e)),i.buffers.color.setClear(ca.r,ca.g,ca.b,n,s)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),h=t,f(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,f(o,h)},render:function(t){let n=!1;const r=p(t);null===r?f(o,h):r&&r.isColor&&(f(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,s),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=p(n);i&&(i.isCubeTexture||i.mapping===Fe)?(void 0===c&&(c=new Qr(new Lr(1,1,1),new kr({name:"BackgroundCubeMaterial",uniforms:Pr(la.backgroundCube.uniforms),vertexShader:la.backgroundCube.vertexShader,fragmentShader:la.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),ha.copy(n.backgroundRotation),ha.x*=-1,ha.y*=-1,ha.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(ha.y*=-1,ha.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Aa.makeRotationFromEuler(ha)),c.material.toneMapped=pn.getTransfer(i.colorSpace)!==wt,A===i&&u===i.version&&d===e.toneMapping||(c.material.needsUpdate=!0,A=i,u=i.version,d=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Qr(new aa(2,2),new kr({name:"BackgroundMaterial",uniforms:Pr(la.background.uniforms),vertexShader:la.background.vertexShader,fragmentShader:la.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=pn.getTransfer(i.colorSpace)!==wt,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),A===i&&u===i.version&&d===e.toneMapping||(l.material.needsUpdate=!0,A=i,u=i.version,d=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}}}function da(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){const e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function A(e){u(e,0)}function u(t,n){const i=a.newAttributes,r=a.enabledAttributes,s=a.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),s[t]!==n&&(e.vertexAttribDivisor(t,n),s[t]=n)}function d(){const t=a.newAttributes,n=a.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function p(t,n,i,r,a,s,o){!0===o?e.vertexAttribIPointer(t,n,i,a,s):e.vertexAttribPointer(t,n,i,r,a,s)}function f(){g(),s=!0,a!==r&&(a=r,o(a.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,g){let m=!1;const v=function(t,n,r){const a=!0===r.wireframe;let s=i[t.id];void 0===s&&(s={},i[t.id]=s);let o=s[n.id];void 0===o&&(o={},s[n.id]=o);let l=o[a];return void 0===l&&(l=c(e.createVertexArray()),o[a]=l),l}(f,l,r);a!==v&&(a=v,o(a.object)),m=function(e,t,n,i){const r=a.attributes,s=t.attributes;let o=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){const n=r[t];let i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return a.attributesNum!==o||a.index!==i}(n,f,l,g),m&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}a.attributes=r,a.attributesNum=o,a.index=i}(n,f,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(m||s)&&(s=!1,function(n,i,r,a){h();const s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,d=l.bytesPerElement,f=h===e.INT||h===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){const t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)u(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)A(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)p(r.location+e,s/r.locationSize,h,i,l*d,(g+s/r.locationSize*e)*d,f)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)u(r.location+e,o.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)A(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)p(r.location+e,s/r.locationSize,h,i,s*d,s/r.locationSize*e*d,f)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}d()}(n,r,l,f),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:h,enableAttribute:A,disableUnusedAttributes:d}}function pa(e,t,n){let i;function r(t,r,a){0!==a&&(e.drawArraysInstanced(i,t,r,a),n.update(r,i,a))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,a);let s=0;for(let e=0;e<a;e++)s+=r[e];n.update(s,i,1)},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],a[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e];for(let e=0;e<o.length;e++)n.update(t,i,o[e])}}}function fa(e,t,n,i){let r;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp";const o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===et||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===Ze&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==Ye&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Je&&!r)},precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function ga(e){const t=this;let n=null,i=0,r=!1,a=!1;const s=new $r,o=new nn,l={value:null,needsUpdate:!1};function c(e,n,i,r){const a=null!==e?e.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const t=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==a;++t,n+=4)s.copy(e[t]).applyMatrix4(r,o),s.normal.toArray(c,n),c[n+3]=s.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(s,o,h){const A=s.clippingPlanes,u=s.clipIntersection,d=s.clipShadows,p=e.get(s);if(!r||null===A||0===A.length||a&&!d)a?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{const e=a?0:i,t=4*e;let r=p.clippingState||null;l.value=r,r=c(A,o,t,h);for(let e=0;e!==t;++e)r[e]=n[e];p.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function ma(e){let t=new WeakMap;function n(e,t){return t===Ne?e.mapping=Le:304===t&&(e.mapping=Pe),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(a===Ne||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const s=new Xr(a.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}class va extends Gr{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const Ea=[.125,.215,.35,.446,.526,.582],ba=new va,Ca=new Xi;let _a=null,Ia=0,xa=0,ya=!1;const wa=(1+Math.sqrt(5))/2,Ma=1/wa,Sa=[new Tn(-wa,Ma,0),new Tn(wa,Ma,0),new Tn(-Ma,0,wa),new Tn(Ma,0,wa),new Tn(0,wa,-Ma),new Tn(0,wa,Ma),new Tn(-1,1,-1),new Tn(1,1,-1),new Tn(-1,1,1),new Tn(1,1,1)];class Ba{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){_a=this._renderer.getRenderTarget(),Ia=this._renderer.getActiveCubeFace(),xa=this._renderer.getActiveMipmapLevel(),ya=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Qa(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Da(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(_a,Ia,xa),this._renderer.xr.enabled=ya,e.scissorTest=!1,Ra(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Le||e.mapping===Pe?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),_a=this._renderer.getRenderTarget(),Ia=this._renderer.getActiveCubeFace(),xa=this._renderer.getActiveMipmapLevel(),ya=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:We,minFilter:We,generateMipmaps:!1,type:Ze,format:et,colorSpace:_t,depthBuffer:!1},i=Ta(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Ta(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const a=e-4+1+Ea.length;for(let s=0;s<a;s++){const a=Math.pow(2,r);n.push(a);let o=1/a;s>e-4?o=Ea[s-e+4-1]:0===s&&(o=0),i.push(o);const l=1/(a-2),c=-l,h=1+l,A=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,d=6,p=3,f=2,g=1,m=new Float32Array(p*d*u),v=new Float32Array(f*d*u),E=new Float32Array(g*d*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];m.set(i,p*d*e),v.set(A,f*d*e);const r=[e,e,e,e,e,e];E.set(r,g*d*e)}const b=new fr;b.setAttribute("position",new rr(m,p)),b.setAttribute("uv",new rr(v,f)),b.setAttribute("faceIndex",new rr(E,g)),t.push(b),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new Tn(0,1,0);return new kr({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new Qr(this._lodPlanes[0],e);this._renderer.compile(t,ba)}_sceneToCubeUV(e,t,n,i){const r=new Wr(90,1,t,n),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(Ca),o.toneMapping=0,o.autoClear=!1;const h=new $i({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),A=new Qr(new Lr,h);let u=!1;const d=e.background;d?d.isColor&&(h.color.copy(d),e.background=null,u=!0):(h.color.copy(Ca),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,a[t],0),r.lookAt(s[t],0,0)):1===n?(r.up.set(0,0,a[t]),r.lookAt(0,s[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,s[t]));const l=this._cubeSize;Ra(i,n*l,t>2?l:0,l,l),o.setRenderTarget(i),u&&o.render(A,r),o.render(e,r)}A.geometry.dispose(),A.material.dispose(),o.toneMapping=c,o.autoClear=l,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Le||e.mapping===Pe;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Qa()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Da());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Qr(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const s=this._cubeSize;Ra(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,ba)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=Sa[(i-t-1)%Sa.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,s){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Qr(this._lodPlanes[i],l),h=l.uniforms,A=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*A):2*Math.PI/39,d=r/u,p=isFinite(r)?1+Math.floor(3*d):20;p>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e<20;++e){const t=e/d,n=Math.exp(-t*t/2);f.push(n),0===e?g+=n:e<p&&(g+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/g;h.envMap.value=e.texture,h.samples.value=p,h.weights.value=f,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s);const{_lodMax:m}=this;h.dTheta.value=u,h.mipInt.value=m-n;const v=this._sizeLods[i];Ra(t,3*v*(i>m-4?i-m+4:0),4*(this._cubeSize-v),3*v,2*v),o.setRenderTarget(t),o.render(c,ba)}}function Ta(e,t,n){const i=new wn(e,t,n);return i.texture.mapping=Fe,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ra(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Da(){return new kr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Qa(){return new kr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ua(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,s=a===Ne||304===a,o=a===Le||a===Pe;if(s||o){let a=t.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Ba(e)),a=s?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new Ba(e)),a=s?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function La(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&cn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Pa(e,t,n,i){const r={},a=new WeakMap;function s(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);for(const e in o.morphAttributes){const n=o.morphAttributes[e];for(let e=0,i=n.length;e<i;e++)t.remove(n[e])}o.removeEventListener("dispose",s),delete r[o.id];const l=a.get(o);l&&(t.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){const n=[],i=e.index,r=e.attributes.position;let s=0;if(null!==i){const e=i.array;s=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],a=e[t+2];n.push(i,r,r,a,a,i)}}else{if(void 0===r)return;{const e=r.array;s=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const o=new(an(n)?sr:ar)(n,1);o.version=s;const l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER);const r=n.morphAttributes;for(const n in r){const i=r[n];for(let n=0,r=i.length;n<r;n++)t.update(i[n],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return a.get(e)}}}function Na(e,t,n){let i,r,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(i,s,r,t*a,o),n.update(s,i,o))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(i,s,r,t*a),n.update(s,i,1)},this.renderInstances=s,this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,r,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,o,l,c){if(0===l)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(i,o,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e];for(let e=0;e<c.length;e++)n.update(t,i,c[e])}}}function Fa(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Oa(e,t,n){const i=new WeakMap,r=new xn;return{update:function(a,s,o){const l=a.morphTargetInfluences,c=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,h=void 0!==c?c.length:0;let A=i.get(s);if(void 0===A||A.count!==h){void 0!==A&&A.texture.dispose();const u=void 0!==s.morphAttributes.position,d=void 0!==s.morphAttributes.normal,p=void 0!==s.morphAttributes.color,f=s.morphAttributes.position||[],g=s.morphAttributes.normal||[],m=s.morphAttributes.color||[];let v=0;!0===u&&(v=1),!0===d&&(v=2),!0===p&&(v=3);let E=s.attributes.position.count*v,b=1;E>t.maxTextureSize&&(b=Math.ceil(E/t.maxTextureSize),E=t.maxTextureSize);const C=new Float32Array(E*b*4*h),_=new Mn(C,E,b,h);_.type=Je,_.needsUpdate=!0;const I=4*v;for(let y=0;y<h;y++){const w=f[y],M=g[y],S=m[y],B=E*b*4*y;for(let T=0;T<w.count;T++){const R=T*I;!0===u&&(r.fromBufferAttribute(w,T),C[B+R+0]=r.x,C[B+R+1]=r.y,C[B+R+2]=r.z,C[B+R+3]=0),!0===d&&(r.fromBufferAttribute(M,T),C[B+R+4]=r.x,C[B+R+5]=r.y,C[B+R+6]=r.z,C[B+R+7]=0),!0===p&&(r.fromBufferAttribute(S,T),C[B+R+8]=r.x,C[B+R+9]=r.y,C[B+R+10]=r.z,C[B+R+11]=4===S.itemSize?r.w:1)}}function x(){_.dispose(),i.delete(s),s.removeEventListener("dispose",x)}A={count:h,texture:_,size:new tn(E,b)},i.set(s,A),s.addEventListener("dispose",x)}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,n);else{let D=0;for(let U=0;U<l.length;U++)D+=l[U];const Q=s.morphTargetsRelative?1:1-D;o.getUniforms().setValue(e,"morphTargetBaseInfluence",Q),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",A.texture,n),o.getUniforms().setValue(e,"morphTargetsTextureSize",A.size)}}}function ka(e,t,n,i){let r=new WeakMap;function a(e){const t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(s){const o=i.render.frame,l=s.geometry,c=t.get(s,l);if(r.get(c)!==o&&(t.update(c),r.set(c,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),r.get(s)!==o&&(n.update(s.instanceMatrix,e.ARRAY_BUFFER),null!==s.instanceColor&&n.update(s.instanceColor,e.ARRAY_BUFFER),r.set(s,o))),s.isSkinnedMesh){const e=s.skeleton;r.get(e)!==o&&(e.update(),r.set(e,o))}return c},dispose:function(){r=new WeakMap}}}class Ga extends In{constructor(e,t,n,i,r,a,s,o,l,c=1026){if(c!==tt&&c!==nt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===tt&&(n=Ke),void 0===n&&c===nt&&(n=$e),super(null,i,r,a,s,o,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:He,this.minFilter=void 0!==o?o:He,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}const Ha=new In,za=new Ga(1,1);za.compareFunction=515;const Va=new Mn,Wa=new Sn,qa=new Yr,ja=[],Ya=[],Xa=new Float32Array(16),Ka=new Float32Array(9),Ja=new Float32Array(4);function Za(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let a=ja[r];if(void 0===a&&(a=new Float32Array(r),ja[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function $a(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function es(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function ts(e,t){let n=Ya[t];void 0===n&&(n=new Int32Array(t),Ya[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function ns(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function is(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if($a(n,t))return;e.uniform2fv(this.addr,t),es(n,t)}}function rs(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if($a(n,t))return;e.uniform3fv(this.addr,t),es(n,t)}}function as(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if($a(n,t))return;e.uniform4fv(this.addr,t),es(n,t)}}function ss(e,t){const n=this.cache,i=t.elements;if(void 0===i){if($a(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),es(n,t)}else{if($a(n,i))return;Ja.set(i),e.uniformMatrix2fv(this.addr,!1,Ja),es(n,i)}}function os(e,t){const n=this.cache,i=t.elements;if(void 0===i){if($a(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),es(n,t)}else{if($a(n,i))return;Ka.set(i),e.uniformMatrix3fv(this.addr,!1,Ka),es(n,i)}}function ls(e,t){const n=this.cache,i=t.elements;if(void 0===i){if($a(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),es(n,t)}else{if($a(n,i))return;Xa.set(i),e.uniformMatrix4fv(this.addr,!1,Xa),es(n,i)}}function cs(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function hs(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if($a(n,t))return;e.uniform2iv(this.addr,t),es(n,t)}}function As(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if($a(n,t))return;e.uniform3iv(this.addr,t),es(n,t)}}function us(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if($a(n,t))return;e.uniform4iv(this.addr,t),es(n,t)}}function ds(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function ps(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if($a(n,t))return;e.uniform2uiv(this.addr,t),es(n,t)}}function fs(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if($a(n,t))return;e.uniform3uiv(this.addr,t),es(n,t)}}function gs(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if($a(n,t))return;e.uniform4uiv(this.addr,t),es(n,t)}}function ms(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r);const a=this.type===e.SAMPLER_2D_SHADOW?za:Ha;n.setTexture2D(t||a,r)}function vs(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||Wa,r)}function Es(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||qa,r)}function bs(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||Va,r)}function Cs(e,t){e.uniform1fv(this.addr,t)}function _s(e,t){const n=Za(t,this.size,2);e.uniform2fv(this.addr,n)}function Is(e,t){const n=Za(t,this.size,3);e.uniform3fv(this.addr,n)}function xs(e,t){const n=Za(t,this.size,4);e.uniform4fv(this.addr,n)}function ys(e,t){const n=Za(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function ws(e,t){const n=Za(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Ms(e,t){const n=Za(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Ss(e,t){e.uniform1iv(this.addr,t)}function Bs(e,t){e.uniform2iv(this.addr,t)}function Ts(e,t){e.uniform3iv(this.addr,t)}function Rs(e,t){e.uniform4iv(this.addr,t)}function Ds(e,t){e.uniform1uiv(this.addr,t)}function Qs(e,t){e.uniform2uiv(this.addr,t)}function Us(e,t){e.uniform3uiv(this.addr,t)}function Ls(e,t){e.uniform4uiv(this.addr,t)}function Ps(e,t,n){const i=this.cache,r=t.length,a=ts(n,r);$a(i,a)||(e.uniform1iv(this.addr,a),es(i,a));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||Ha,a[e])}function Ns(e,t,n){const i=this.cache,r=t.length,a=ts(n,r);$a(i,a)||(e.uniform1iv(this.addr,a),es(i,a));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||Wa,a[e])}function Fs(e,t,n){const i=this.cache,r=t.length,a=ts(n,r);$a(i,a)||(e.uniform1iv(this.addr,a),es(i,a));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||qa,a[e])}function Os(e,t,n){const i=this.cache,r=t.length,a=ts(n,r);$a(i,a)||(e.uniform1iv(this.addr,a),es(i,a));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||Va,a[e])}class ks{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return ns;case 35664:return is;case 35665:return rs;case 35666:return as;case 35674:return ss;case 35675:return os;case 35676:return ls;case 5124:case 35670:return cs;case 35667:case 35671:return hs;case 35668:case 35672:return As;case 35669:case 35673:return us;case 5125:return ds;case 36294:return ps;case 36295:return fs;case 36296:return gs;case 35678:case 36198:case 36298:case 36306:case 35682:return ms;case 35679:case 36299:case 36307:return vs;case 35680:case 36300:case 36308:case 36293:return Es;case 36289:case 36303:case 36311:case 36292:return bs}}(t.type)}}class Gs{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Cs;case 35664:return _s;case 35665:return Is;case 35666:return xs;case 35674:return ys;case 35675:return ws;case 35676:return Ms;case 5124:case 35670:return Ss;case 35667:case 35671:return Bs;case 35668:case 35672:return Ts;case 35669:case 35673:return Rs;case 5125:return Ds;case 36294:return Qs;case 36295:return Us;case 36296:return Ls;case 35678:case 36198:case 36298:case 36306:case 35682:return Ps;case 35679:case 36299:case 36307:return Ns;case 35680:case 36300:case 36308:case 36293:return Fs;case 36289:case 36303:case 36311:case 36292:return Os}}(t.type)}}class Hs{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(e,t[a.id],n)}}}const zs=/(\w+)(\])?(\[|\.)?/g;function Vs(e,t){e.seq.push(t),e.map[t.id]=t}function Ws(e,t,n){const i=e.name,r=i.length;for(zs.lastIndex=0;;){const a=zs.exec(i),s=zs.lastIndex;let o=a[1];const l="]"===a[2],c=a[3];if(l&&(o|=0),void 0===c||"["===c&&s+2===r){Vs(n,void 0===c?new ks(o,e,t):new Gs(o,e,t));break}{let e=n.map[o];void 0===e&&(e=new Hs(o),Vs(n,e)),n=e}}}class qs{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);Ws(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function js(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let Ys=0;function Xs(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e<a;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function Ks(e,t){const n=function(e){const t=pn.getPrimaries(pn.workingColorSpace),n=pn.getPrimaries(e);let i;switch(t===n?i="":t===St&&n===Mt?i="LinearDisplayP3ToLinearSRGB":t===Mt&&n===St&&(i="LinearSRGBToLinearDisplayP3"),e){case _t:case xt:return[i,"LinearTransferOETF"];case Ct:case It:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function Js(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Zs(e){return""!==e}function $s(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function eo(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const to=/^[ \t]*#include +<([\w\d./]+)>/gm;function no(e){return e.replace(to,ro)}const io=new Map;function ro(e,t){let n=sa[t];if(void 0===n){const e=io.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=sa[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return no(n)}const ao=/#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 so(e){return e.replace(ao,oo)}function oo(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function lo(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function co(e,t,n,i){const r=e.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 300:t="ENVMAP_TYPE_TEXTURE_2D";break;case Le:case Pe:t="ENVMAP_TYPE_CUBE";break;case Fe:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===Pe&&(t="ENVMAP_MODE_REFRACTION"),t}(n),A=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),u=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),d=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Zs).join("\n")}(n),p=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(a),f=r.createProgram();let g,m,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter(Zs).join("\n"),g.length>0&&(g+="\n"),m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter(Zs).join("\n"),m.length>0&&(m+="\n")):(g=[lo(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.fixedEnvMapDirection?"#define FIX_ENV_DIRECTION":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Zs).join("\n"),m=[lo(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+A:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.fixedEnvMapDirection?"#define FIX_ENV_DIRECTION":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?sa.tonemapping_pars_fragment:"",0!==n.toneMapping?Js("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",sa.colorspace_pars_fragment,Ks("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Zs).join("\n")),s=no(s),s=$s(s,n),s=eo(s,n),o=no(o),o=$s(o,n),o=eo(o,n),o=function(e,t){return e.replace(/RAY_BOUNCES/g,t.rayBounces)}(o,n),o=function(e,t){return e.replace(/DIA_ORIENT_ENVMAP/g,t.diamondOrientedEnvMap)}(o,n),s=so(s),o=so(o),!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=[d,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,m=["#define varying in",n.glslVersion===Ot?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Ot?"":"#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("\n")+"\n"+m);const E=v+g+s,b=v+m+o,C=js(r,r.VERTEX_SHADER,E),_=js(r,r.FRAGMENT_SHADER,b);function I(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(f).trim(),i=r.getShaderInfoLog(C).trim(),a=r.getShaderInfoLog(_).trim();let s=!0,o=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(s=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,f,C,_);else{const e=Xs(r,C,"vertex"),i=Xs(r,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==a||(o=!1);o&&(t.diagnostics={runnable:s,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:a,prefix:m}})}r.deleteShader(C),r.deleteShader(_),x=new qs(r,f),y=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),a=i.name;let s=1;i.type===e.FLOAT_MAT2&&(s=2),i.type===e.FLOAT_MAT3&&(s=3),i.type===e.FLOAT_MAT4&&(s=4),n[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:s}}return n}(r,f)}let x,y;r.attachShader(f,C),r.attachShader(f,_),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===x&&I(this),x},this.getAttributes=function(){return void 0===y&&I(this),y};let w=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===w&&(w=r.getProgramParameter(f,37297)),w},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Ys++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=C,this.fragmentShader=_,this}let ho=0;class Ao{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new uo(e),t.set(e,n)),n}}class uo{constructor(e){this.id=ho++,this.code=e,this.usedTimes=0}}function po(e,t,n,i,r,a,s){const o=new mi,l=new Ao,c=new Set,h=[],A=r.logarithmicDepthBuffer,u=r.vertexTextures;let d=r.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite",MeshDiamondMaterial:"diamond",CubeNormalsMaterial:"cubeNormals"};function f(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(a,o,h,g,m){const v=g.fog,E=m.geometry,b=a.isMeshStandardMaterial?g.environment:null,C=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),_=C&&C.mapping===Fe?C.image.height:null,I=p[a.type];null!==a.precision&&(d=r.getMaxPrecision(a.precision),d!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",d,"instead."));const x=E.morphAttributes.position||E.morphAttributes.normal||E.morphAttributes.color,y=void 0!==x?x.length:0;let w,M,S,B,T=0;if(void 0!==E.morphAttributes.position&&(T=1),void 0!==E.morphAttributes.normal&&(T=2),void 0!==E.morphAttributes.color&&(T=3),I){const e=la[I];w=e.vertexShader,M=e.fragmentShader}else w=a.vertexShader,M=a.fragmentShader,l.update(a),S=l.getVertexShaderID(a),B=l.getFragmentShaderID(a);const R=e.getRenderTarget(),D=!0===m.isInstancedMesh,Q=!0===m.isBatchedMesh,U=!!a.map,L=!!a.matcap,P=!!C,N=!!a.aoMap,F=!!a.lightMap,O=!!a.bumpMap,k=!!a.normalMap,G=!!a.displacementMap,H=!!a.emissiveMap,z=!!a.metalnessMap,V=!!a.roughnessMap,W=a.anisotropy>0,q=a.clearcoat>0,j=a.dispersion>0,Y=a.iridescence>0,X=a.sheen>0,K=a.transmission>0,J=W&&!!a.anisotropyMap,Z=q&&!!a.clearcoatMap,$=q&&!!a.clearcoatNormalMap,ee=q&&!!a.clearcoatRoughnessMap,te=Y&&!!a.iridescenceMap,ne=Y&&!!a.iridescenceThicknessMap,ie=X&&!!a.sheenColorMap,re=X&&!!a.sheenRoughnessMap,ae=!!a.specularMap,se=!!a.specularColorMap,oe=!!a.specularIntensityMap,le=K&&!!a.transmissionMap,ce=K&&!!a.thicknessMap,he=!!a.gradientMap,Ae=!!a.alphaMap,ue=a.alphaTest>0,de=!!a.alphaHash,pe=!!a.extensions;let fe=0;a.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(fe=e.toneMapping));const ge={shaderID:I,shaderType:a.type,shaderName:a.name,vertexShader:w,fragmentShader:M,defines:a.defines,customVertexShaderID:S,customFragmentShaderID:B,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:d,batching:Q,batchingColor:Q&&null!==m._colorsTexture,instancing:D,instancingColor:D&&null!==m.instanceColor,instancingMorph:D&&null!==m.morphTexture,supportsVertexTextures:u,outputColorSpace:null===R?e.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:_t,alphaToCoverage:!!a.alphaToCoverage,map:U,matcap:L,envMap:P,envMapMode:P&&C.mapping,envMapCubeUVHeight:_,aoMap:N,lightMap:F,bumpMap:O,normalMap:k,displacementMap:u&&G,emissiveMap:H,normalMapObjectSpace:k&&1===a.normalMapType,normalMapTangentSpace:k&&0===a.normalMapType,metalnessMap:z,roughnessMap:V,anisotropy:W,anisotropyMap:J,clearcoat:q,clearcoatMap:Z,clearcoatNormalMap:$,clearcoatRoughnessMap:ee,dispersion:j,iridescence:Y,iridescenceMap:te,iridescenceThicknessMap:ne,sheen:X,sheenColorMap:ie,sheenRoughnessMap:re,specularMap:ae,specularColorMap:se,specularIntensityMap:oe,transmission:K,transmissionMap:le,thicknessMap:ce,gradientMap:he,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:Ae,alphaTest:ue,alphaHash:de,combine:a.combine,mapUv:U&&f(a.map.channel),aoMapUv:N&&f(a.aoMap.channel),lightMapUv:F&&f(a.lightMap.channel),bumpMapUv:O&&f(a.bumpMap.channel),normalMapUv:k&&f(a.normalMap.channel),displacementMapUv:G&&f(a.displacementMap.channel),emissiveMapUv:H&&f(a.emissiveMap.channel),metalnessMapUv:z&&f(a.metalnessMap.channel),roughnessMapUv:V&&f(a.roughnessMap.channel),anisotropyMapUv:J&&f(a.anisotropyMap.channel),clearcoatMapUv:Z&&f(a.clearcoatMap.channel),clearcoatNormalMapUv:$&&f(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&f(a.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&f(a.iridescenceMap.channel),iridescenceThicknessMapUv:ne&&f(a.iridescenceThicknessMap.channel),sheenColorMapUv:ie&&f(a.sheenColorMap.channel),sheenRoughnessMapUv:re&&f(a.sheenRoughnessMap.channel),specularMapUv:ae&&f(a.specularMap.channel),specularColorMapUv:se&&f(a.specularColorMap.channel),specularIntensityMapUv:oe&&f(a.specularIntensityMap.channel),transmissionMapUv:le&&f(a.transmissionMap.channel),thicknessMapUv:ce&&f(a.thicknessMap.channel),alphaMapUv:Ae&&f(a.alphaMap.channel),vertexTangents:!!E.attributes.tangent&&(k||W),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!E.attributes.color&&4===E.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!E.attributes.uv&&(U||Ae),fog:!!v,useFog:!0===a.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:A,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==E.morphAttributes.position,morphNormals:void 0!==E.morphAttributes.normal,morphColors:void 0!==E.morphAttributes.color,morphTargetsCount:y,morphTextureStride:T,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,diamondOrientedEnvMap:a.diamondOrientedEnvMap,rayBounces:a.rayBounces,fixedEnvMapDirection:a.fixedEnvMapDirection,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:fe,decodeVideoTexture:U&&!0===a.map.isVideoTexture&&pn.getTransfer(a.map.colorSpace)===wt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:pe&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pe&&!0===a.extensions.multiDraw||Q)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ge.vertexUv1s=c.has(1),ge.vertexUv2s=c.has(2),ge.vertexUv3s=c.has(3),c.clear(),ge},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){o.disableAll(),t.supportsVertexTextures&&o.enable(0),t.instancing&&o.enable(1),t.instancingColor&&o.enable(2),t.instancingMorph&&o.enable(3),t.matcap&&o.enable(4),t.envMap&&o.enable(5),t.normalMapObjectSpace&&o.enable(6),t.normalMapTangentSpace&&o.enable(7),t.clearcoat&&o.enable(8),t.iridescence&&o.enable(9),t.alphaTest&&o.enable(10),t.vertexColors&&o.enable(11),t.vertexAlphas&&o.enable(12),t.vertexUv1s&&o.enable(13),t.vertexUv2s&&o.enable(14),t.vertexUv3s&&o.enable(15),t.vertexTangents&&o.enable(16),t.anisotropy&&o.enable(17),t.alphaHash&&o.enable(18),t.batching&&o.enable(19),t.dispersion&&o.enable(20),t.batchingColor&&o.enable(21),e.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.skinning&&o.enable(4),t.morphTargets&&o.enable(5),t.morphNormals&&o.enable(6),t.morphColors&&o.enable(7),t.premultipliedAlpha&&o.enable(8),t.shadowMapEnabled&&o.enable(9),t.doubleSided&&o.enable(10),t.flipSided&&o.enable(11),t.useDepthPacking&&o.enable(12),t.dithering&&o.enable(13),t.transmission&&o.enable(14),t.sheen&&o.enable(15),t.opaque&&o.enable(16),t.pointsUvs&&o.enable(17),t.decodeVideoTexture&&o.enable(18),t.alphaToCoverage&&o.enable(19),e.push(o.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=p[e.type];let n;if(t){const e=la[t];n=Or.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e<t;e++){const t=h[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new co(e,n,t,a),h.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function fo(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function go(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function mo(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function vo(){const e=[];let t=0;const n=[],i=[],r=[];function a(n,i,r,a,s,o){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:s,group:o},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,s,o,l,c){const h=a(e,t,s,o,l,c);s.transmission>0?i.push(h):!0===s.transparent?r.push(h):n.push(h)},unshift:function(e,t,s,o,l,c){const h=a(e,t,s,o,l,c);s.transmission>0?i.unshift(h):!0===s.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||go),i.length>1&&i.sort(t||mo),r.length>1&&r.sort(t||mo)}}}function Eo(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new vo,e.set(t,[r])):n>=i.length?(r=new vo,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function bo(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Tn,color:new Xi};break;case"SpotLight":n={position:new Tn,direction:new Tn,color:new Xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Tn,color:new Xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Tn,skyColor:new Xi,groundColor:new Xi};break;case"RectAreaLight":n={color:new Xi,position:new Tn,halfWidth:new Tn,halfHeight:new Tn}}return e[t.id]=n,n}}}let Co=0;function _o(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Io(e){const t=new bo,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tn,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)i.probe.push(new Tn);const r=new Tn,a=new si,s=new si;return{setup:function(r){let a=0,s=0,o=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,A=0,u=0,d=0,p=0,f=0,g=0,m=0,v=0;r.sort(_o);for(let e=0,E=r.length;e<E;e++){const E=r[e],b=E.color,C=E.intensity,_=E.distance,I=E.shadow&&E.shadow.map?E.shadow.map.texture:null;if(E.isAmbientLight)a+=b.r*C,s+=b.g*C,o+=b.b*C;else if(E.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(E.sh.coefficients[e],C);v++}else if(E.isDirectionalLight){const e=t.get(E);if(e.color.copy(E.color).multiplyScalar(E.intensity),E.castShadow){const e=E.shadow,t=n.get(E);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=I,i.directionalShadowMatrix[l]=E.shadow.matrix,d++}i.directional[l]=e,l++}else if(E.isSpotLight){const e=t.get(E);e.position.setFromMatrixPosition(E.matrixWorld),e.color.copy(b).multiplyScalar(C),e.distance=_,e.coneCos=Math.cos(E.angle),e.penumbraCos=Math.cos(E.angle*(1-E.penumbra)),e.decay=E.decay,i.spot[h]=e;const r=E.shadow;if(E.map&&(i.spotLightMap[g]=E.map,g++,r.updateMatrices(E),E.castShadow&&m++),i.spotLightMatrix[h]=r.matrix,E.castShadow){const e=n.get(E);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=I,f++}h++}else if(E.isRectAreaLight){const e=t.get(E);e.color.copy(b).multiplyScalar(C),e.halfWidth.set(.5*E.width,0,0),e.halfHeight.set(0,.5*E.height,0),i.rectArea[A]=e,A++}else if(E.isPointLight){const e=t.get(E);if(e.color.copy(E.color).multiplyScalar(E.intensity),e.distance=E.distance,e.decay=E.decay,E.castShadow){const e=E.shadow,t=n.get(E);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,i.pointShadow[c]=t,i.pointShadowMap[c]=I,i.pointShadowMatrix[c]=E.shadow.matrix,p++}i.point[c]=e,c++}else if(E.isHemisphereLight){const e=t.get(E);e.skyColor.copy(E.color).multiplyScalar(C),e.groundColor.copy(E.groundColor).multiplyScalar(C),i.hemi[u]=e,u++}}A>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=oa.LTC_FLOAT_1,i.rectAreaLTC2=oa.LTC_FLOAT_2):(i.rectAreaLTC1=oa.LTC_HALF_1,i.rectAreaLTC2=oa.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=o;const E=i.hash;E.directionalLength===l&&E.pointLength===c&&E.spotLength===h&&E.rectAreaLength===A&&E.hemiLength===u&&E.numDirectionalShadows===d&&E.numPointShadows===p&&E.numSpotShadows===f&&E.numSpotMaps===g&&E.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=A,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=d,i.directionalShadowMap.length=d,i.pointShadow.length=p,i.pointShadowMap.length=p,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=d,i.pointShadowMatrix.length=p,i.spotLightMatrix.length=f+g-m,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=m,i.numLightProbes=v,E.directionalLength=l,E.pointLength=c,E.spotLength=h,E.rectAreaLength=A,E.hemiLength=u,E.numDirectionalShadows=d,E.numPointShadows=p,E.numSpotShadows=f,E.numSpotMaps=g,E.numLightProbes=v,i.version=Co++)},setupView:function(e,t){let n=0,o=0,l=0,c=0,h=0;const A=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(A),n++}else if(u.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(A),l++}else if(u.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),s.identity(),a.copy(u.matrixWorld),a.premultiply(A),s.extractRotation(a),e.halfWidth.set(.5*u.width,0,0),e.halfHeight.set(0,.5*u.height,0),e.halfWidth.applyMatrix4(s),e.halfHeight.applyMatrix4(s),c++}else if(u.isPointLight){const e=i.point[o];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),o++}else if(u.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(u.matrixWorld),e.direction.transformDirection(A),h++}}},state:i}}function xo(e){const t=new Io(e),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function yo(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let a;return void 0===r?(a=new xo(e),t.set(n,[a])):i>=r.length?(a=new xo(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}class wo extends Zi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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}}class Mo extends Zi{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 So(e,t,n){let i=new na;const r=new tn,a=new tn,s=new xn,o=new wo({depthPacking:3201}),l=new Mo,c={},h=n.maxTextureSize,A={[de]:1,[pe]:0,[fe]:2},u=new kr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new tn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=u.clone();d.defines.HORIZONTAL_PASS=1;const p=new fr;p.setAttribute("position",new rr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new Qr(p,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let m=this.type;function v(n,i){const a=t.update(f);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,d.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,d.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new wn(r.x,r.y)),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,a,u,f,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,a,d,f,null)}function E(t,n,i,r){let a=null;const s=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=a.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",C)),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:A[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function b(n,r,a,s,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,h=t.length;c<h;c++){const h=t[c],A=l[h.materialIndex];if(A&&A.visible){const t=E(n,A,s,o);n.onBeforeShadow(e,n,r,a,i,t,h),e.renderBufferDirect(a,null,i,t,n,h),n.onAfterShadow(e,n,r,a,i,t,h)}}}else if(l.visible){const t=E(n,l,s,o);n.onBeforeShadow(e,n,r,a,i,t,null),e.renderBufferDirect(a,null,i,t,n,null),n.onAfterShadow(e,n,r,a,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)b(l[e],r,a,s,o)}function C(e){e.target.removeEventListener("dispose",C);for(const t in c){const n=c[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(t,n,o){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),u=e.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const d=3!==m&&3===this.type,p=3===m&&3!==this.type;for(let l=0,c=t.length;l<c;l++){const c=t[l],A=c.shadow;if(void 0===A){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===A.autoUpdate&&!1===A.needsUpdate)continue;r.copy(A.mapSize);const f=A.getFrameExtents();if(r.multiply(f),a.copy(A.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/f.x),r.x=a.x*f.x,A.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/f.y),r.y=a.y*f.y,A.mapSize.y=a.y)),null===A.map||!0===d||!0===p){const e=3!==this.type?{minFilter:He,magFilter:He}:{};null!==A.map&&A.map.dispose(),A.map=new wn(r.x,r.y,e),A.map.texture.name=c.name+".shadowMap",A.camera.updateProjectionMatrix()}e.setRenderTarget(A.map),e.clear();const g=A.getViewportCount();for(let e=0;e<g;e++){const t=A.getViewport(e);s.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),u.viewport(s),A.updateMatrices(c,e),i=A.getFrustum(),b(n,o,A.camera,c,this.type)}!0!==A.isPointLightShadow&&3===this.type&&v(A,o),A.needsUpdate=!1}m=this.type,g.needsUpdate=!1,e.setRenderTarget(l,c,A)}}function Bo(e){const t=new function(){let t=!1;const n=new xn;let i=null;const r=new xn(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,s,o){!0===o&&(t*=s,i*=s,a*=s),n.set(t,i,a,s),!1===r.equals(n)&&(e.clearColor(t,i,a,s),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},n=new function(){let t=!1,n=null,i=null,r=null;return{setTest:function(t){t?O(e.DEPTH_TEST):k(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},i=new function(){let t=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null;return{setTest:function(n){t||(n?O(e.STENCIL_TEST):k(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,s){i===t&&r===n&&a===s||(e.stencilFunc(t,n,s),i=t,r=n,a=s)},setOp:function(t,n,i){s===t&&o===n&&l===i||(e.stencilOp(t,n,i),s=t,o=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap;let s={},o={},l=new WeakMap,c=[],h=null,A=!1,u=null,d=null,p=null,f=null,g=null,m=null,v=null,E=new Xi(0,0,0),b=0,C=!1,_=null,I=null,x=null,y=null,w=null;const M=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let S=!1,B=0;const T=e.getParameter(e.VERSION);-1!==T.indexOf("WebGL")?(B=parseFloat(/^WebGL (\d)/.exec(T)[1]),S=B>=1):-1!==T.indexOf("OpenGL ES")&&(B=parseFloat(/^OpenGL ES (\d)/.exec(T)[1]),S=B>=2);let R=null,D={};const Q=e.getParameter(e.SCISSOR_BOX),U=e.getParameter(e.VIEWPORT),L=(new xn).fromArray(Q),P=(new xn).fromArray(U);function N(t,n,i,r){const a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<i;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}const F={};function O(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function k(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}F[e.TEXTURE_2D]=N(e.TEXTURE_2D,e.TEXTURE_2D,1),F[e.TEXTURE_CUBE_MAP]=N(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),F[e.TEXTURE_2D_ARRAY]=N(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),F[e.TEXTURE_3D]=N(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),n.setClear(1),i.setClear(0),O(e.DEPTH_TEST),n.setFunc(3),V(!1),W(1),O(e.CULL_FACE),z(0);const G={[ge]:e.FUNC_ADD,[me]:e.FUNC_SUBTRACT,[ve]:e.FUNC_REVERSE_SUBTRACT};G[103]=e.MIN,G[104]=e.MAX;const H={[Ee]:e.ZERO,[be]:e.ONE,[Ce]:e.SRC_COLOR,[Ie]:e.SRC_ALPHA,[Be]:e.SRC_ALPHA_SATURATE,[Me]:e.DST_COLOR,[ye]:e.DST_ALPHA,[_e]:e.ONE_MINUS_SRC_COLOR,[xe]:e.ONE_MINUS_SRC_ALPHA,[Se]:e.ONE_MINUS_DST_COLOR,[we]:e.ONE_MINUS_DST_ALPHA,[Te]:e.CONSTANT_COLOR,[Re]:e.ONE_MINUS_CONSTANT_COLOR,[De]:e.CONSTANT_ALPHA,[Qe]:e.ONE_MINUS_CONSTANT_ALPHA};function z(t,n,i,r,a,s,o,l,c,h){if(0!==t){if(!1===A&&(O(e.BLEND),A=!0),5===t)a=a||n,s=s||i,o=o||r,n===d&&a===g||(e.blendEquationSeparate(G[n],G[a]),d=n,g=a),i===p&&r===f&&s===m&&o===v||(e.blendFuncSeparate(H[i],H[r],H[s],H[o]),p=i,f=r,m=s,v=o),!1!==l.equals(E)&&c===b||(e.blendColor(l.r,l.g,l.b,c),E.copy(l),b=c),u=t,C=!1;else if(t!==u||h!==C){if(d===ge&&g===ge||(e.blendEquation(e.FUNC_ADD),d=ge,g=ge),h)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}p=null,f=null,m=null,v=null,E.set(0,0,0),b=0,u=t,C=h}}else!0===A&&(k(e.BLEND),A=!1)}function V(t){_!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),_=t)}function W(t){0!==t?(O(e.CULL_FACE),t!==I&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):k(e.CULL_FACE),I=t}function q(t,n,i){t?(O(e.POLYGON_OFFSET_FILL),y===n&&w===i||(e.polygonOffset(n,i),y=n,w=i)):k(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:n,stencil:i},enable:O,disable:k,bindFramebuffer:function(t,n){return o[t]!==n&&(e.bindFramebuffer(t,n),o[t]=n,t===e.DRAW_FRAMEBUFFER&&(o[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(o[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=c,r=!1;if(t){i=l.get(n),void 0===i&&(i=[],l.set(n,i));const a=t.textures;if(i.length!==a.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=a.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:z,setMaterial:function(r,a){2===r.side?k(e.CULL_FACE):O(e.CULL_FACE);let s=1===r.side;a&&(s=!s),V(s),1===r.blending&&!1===r.transparent?z(0):z(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),n.setFunc(r.depthFunc),n.setTest(r.depthTest),n.setMask(r.depthWrite),t.setMask(r.colorWrite);const o=r.stencilWrite;i.setTest(o),o&&(i.setMask(r.stencilWriteMask),i.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),i.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),q(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?O(e.SAMPLE_ALPHA_TO_COVERAGE):k(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:V,setCullFace:W,setLineWidth:function(t){t!==x&&(S&&e.lineWidth(t),x=t)},setPolygonOffset:q,setScissorTest:function(t){t?O(e.SCISSOR_TEST):k(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+M-1),R!==t&&(e.activeTexture(t),R=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===R?e.TEXTURE0+M-1:R);let r=D[i];void 0===r&&(r={type:void 0,texture:void 0},D[i]=r),r.type===t&&r.texture===n||(R!==i&&(e.activeTexture(i),R=i),e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=D[R];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=a.get(n);void 0===i&&(i=new WeakMap,a.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=a.get(n).get(t);r.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),r.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===L.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),L.copy(t))},viewport:function(t){!1===P.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),P.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),s={},R=null,D={},o={},l=new WeakMap,c=[],h=null,A=!1,u=null,d=null,p=null,f=null,g=null,m=null,v=null,E=new Xi(0,0,0),b=0,C=!1,_=null,I=null,x=null,y=null,w=null,L.set(0,0,e.canvas.width,e.canvas.height),P.set(0,0,e.canvas.width,e.canvas.height),t.reset(),n.reset(),i.reset()}}}function To(e,t,n,i,r,a,s){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new tn,h=new WeakMap;let A;const u=new WeakMap;let d=!1;try{d="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function p(e,t){return d?new OffscreenCanvas(e,t):sn("canvas")}function f(e,t,n){let i=1;const r=k(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===A&&(A=p(n,a));const s=t?p(n,a):A;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function g(e){return e.generateMipmaps&&e.minFilter!==He&&e.minFilter!==We}function m(t){e.generateMipmap(t)}function v(n,i,r,a,s=!1){if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;if(i===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),i===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),i===e.RGBA){const t=s?yt:pn.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===wt?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return o!==e.R16F&&o!==e.R32F&&o!==e.RG16F&&o!==e.RG32F&&o!==e.RGBA16F&&o!==e.RGBA32F||t.get("EXT_color_buffer_float"),o}function E(t,n){let i;return t?null===n||n===Ke||n===$e?i=e.DEPTH24_STENCIL8:n===Je?i=e.DEPTH32F_STENCIL8:n===Xe&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Ke||n===$e?i=e.DEPTH_COMPONENT24:n===Je?i=e.DEPTH_COMPONENT32F:n===Xe&&(i=e.DEPTH_COMPONENT16),i}function b(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==He&&e.minFilter!==We?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function C(e){const t=e.target;t.removeEventListener("dispose",C),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=u.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&I(e),0===Object.keys(r).length&&u.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function _(t){const n=t.target;n.removeEventListener("dispose",_),function(t){const n=i.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),s.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function I(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete u.get(r)[n.__cacheKey],s.memory.textures--}let x=0;function y(t,r){const a=i.get(t);if(t.isVideoTexture&&function(e){const t=s.render.frame;h.get(e)!==t&&(h.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void R(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}const w={[Oe]:e.REPEAT,[ke]:e.CLAMP_TO_EDGE,[Ge]:e.MIRRORED_REPEAT},M={[He]:e.NEAREST,[ze]:e.NEAREST_MIPMAP_NEAREST,[Ve]:e.NEAREST_MIPMAP_LINEAR,[We]:e.LINEAR,[qe]:e.LINEAR_MIPMAP_NEAREST,[je]:e.LINEAR_MIPMAP_LINEAR},S={[Tt]:e.NEVER,[Nt]:e.ALWAYS,[Rt]:e.LESS,[Qt]:e.LEQUAL,[Dt]:e.EQUAL,[Pt]:e.GEQUAL,[Ut]:e.GREATER,[Lt]:e.NOTEQUAL};function B(n,a){if(a.type!==Je||!1!==t.has("OES_texture_float_linear")||a.magFilter!==We&&a.magFilter!==qe&&a.magFilter!==Ve&&a.magFilter!==je&&a.minFilter!==We&&a.minFilter!==qe&&a.minFilter!==Ve&&a.minFilter!==je||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,w[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,w[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,w[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,M[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,M[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,S[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===He)return;if(a.minFilter!==Ve&&a.minFilter!==je)return;if(a.type===Je&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function T(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",C));const r=n.source;let a=u.get(r);void 0===a&&(a={},u.set(r,a));const o=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&I(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function R(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);const c=T(t,s),h=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);const A=i.get(h);if(h.version!==A.__version||!0===c){n.activeTexture(e.TEXTURE0+o);const t=pn.getPrimaries(pn.workingColorSpace),i=s.colorSpace===bt?null:pn.getPrimaries(s.colorSpace),u=s.colorSpace===bt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let d=f(s.image,!1,r.maxTextureSize);d=O(s,d);const p=a.convert(s.format,s.colorSpace),C=a.convert(s.type);let _,I=v(s.internalFormat,p,C,s.colorSpace,s.isVideoTexture);B(l,s);const x=s.mipmaps,y=!0!==s.isVideoTexture,w=void 0===A.__version||!0===c,M=h.dataReady,S=b(s,d);if(s.isDepthTexture)I=E(s.format===nt,s.type),w&&(y?n.texStorage2D(e.TEXTURE_2D,1,I,d.width,d.height):n.texImage2D(e.TEXTURE_2D,0,I,d.width,d.height,0,p,C,null));else if(s.isDataTexture)if(x.length>0){y&&w&&n.texStorage2D(e.TEXTURE_2D,S,I,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)_=x[t],y?M&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,C,_.data):n.texImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,p,C,_.data);s.generateMipmaps=!1}else y?(w&&n.texStorage2D(e.TEXTURE_2D,S,I,d.width,d.height),M&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,d.width,d.height,p,C,d.data)):n.texImage2D(e.TEXTURE_2D,0,I,d.width,d.height,0,p,C,d.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){y&&w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,S,I,x[0].width,x[0].height,d.depth);for(let t=0,i=x.length;t<i;t++)if(_=x[t],s.format!==et)if(null!==p)if(y){if(M)if(s.layerUpdates.size>0){for(const i of s.layerUpdates){const r=_.width*_.height;n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,_.width,_.height,1,p,_.data.slice(r*i,r*(i+1)),0,0)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,d.depth,p,_.data,0,0)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,I,_.width,_.height,d.depth,0,_.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else y?M&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,d.depth,p,C,_.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,I,_.width,_.height,d.depth,0,p,C,_.data)}else{y&&w&&n.texStorage2D(e.TEXTURE_2D,S,I,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)_=x[t],s.format!==et?null!==p?y?M&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,_.data):n.compressedTexImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):y?M&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,C,_.data):n.texImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,p,C,_.data)}else if(s.isDataArrayTexture)if(y){if(w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,S,I,d.width,d.height,d.depth),M)if(s.layerUpdates.size>0){let t;switch(C){case e.UNSIGNED_BYTE:switch(p){case e.ALPHA:case e.LUMINANCE:t=1;break;case e.LUMINANCE_ALPHA:t=2;break;case e.RGB:t=3;break;case e.RGBA:t=4;break;default:throw new Error(`Unknown texel size for format ${p}.`)}break;case e.UNSIGNED_SHORT_4_4_4_4:case e.UNSIGNED_SHORT_5_5_5_1:case e.UNSIGNED_SHORT_5_6_5:t=1;break;default:throw new Error(`Unknown texel size for type ${C}.`)}const i=d.width*d.height*t;for(const t of s.layerUpdates)n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,t,d.width,d.height,1,p,C,d.data.slice(i*t,i*(t+1)));s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,d.width,d.height,d.depth,p,C,d.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,I,d.width,d.height,d.depth,0,p,C,d.data);else if(s.isData3DTexture)y?(w&&n.texStorage3D(e.TEXTURE_3D,S,I,d.width,d.height,d.depth),M&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,d.width,d.height,d.depth,p,C,d.data)):n.texImage3D(e.TEXTURE_3D,0,I,d.width,d.height,d.depth,0,p,C,d.data);else if(s.isFramebufferTexture){if(w)if(y)n.texStorage2D(e.TEXTURE_2D,S,I,d.width,d.height);else{let t=d.width,i=d.height;for(let r=0;r<S;r++)n.texImage2D(e.TEXTURE_2D,r,I,t,i,0,p,C,null),t>>=1,i>>=1}}else if(x.length>0){if(y&&w){const t=k(x[0]);n.texStorage2D(e.TEXTURE_2D,S,I,t.width,t.height)}for(let t=0,i=x.length;t<i;t++)_=x[t],y?M&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,p,C,_):n.texImage2D(e.TEXTURE_2D,t,I,p,C,_);s.generateMipmaps=!1}else if(y){if(w){const t=k(d);n.texStorage2D(e.TEXTURE_2D,S,I,t.width,t.height)}M&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p,C,d)}else n.texImage2D(e.TEXTURE_2D,0,I,p,C,d);g(s)&&m(l),A.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function D(t,r,s,l,c,h){const A=a.convert(s.format,s.colorSpace),u=a.convert(s.type),d=v(s.internalFormat,A,u,s.colorSpace);if(!i.get(r).__hasExternalTextures){const t=Math.max(1,r.width>>h),i=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,h,d,t,i,r.depth,0,A,u,null):n.texImage2D(c,h,d,t,i,0,A,u,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,i.get(s).__webglTexture,0,N(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,i.get(s).__webglTexture,h),n.bindFramebuffer(e.FRAMEBUFFER,null)}function Q(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=E(n.stencilBuffer,a),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=N(n);F(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,s,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r<t.length;r++){const s=t[r],l=a.convert(s.format,s.colorSpace),c=a.convert(s.type),h=v(s.internalFormat,l,c,s.colorSpace),A=N(n);i&&!1===F(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,A,h,n.width,n.height):F(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,A,h,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,h,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function U(t){const r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),y(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture,s=N(r);if(r.depthTexture.format===tt)F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,s):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==nt)throw new Error("Unknown depthTexture format");F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,s):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=e.createRenderbuffer(),Q(r.__webglDepthbuffer[i],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),Q(r.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}const L=[],P=[];function N(e){return Math.min(r.maxSamples,e.samples)}function F(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function O(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==_t&&n!==bt&&(pn.getTransfer(n)===wt?i===et&&r===Ye||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function k(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){const e=x;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),x+=1,e},this.resetTextureUnits=function(){x=0},this.setTexture2D=y,this.setTexture2DArray=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;const l=T(t,s),c=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+o);const t=pn.getPrimaries(pn.workingColorSpace),i=s.colorSpace===bt?null:pn.getPrimaries(s.colorSpace),A=s.colorSpace===bt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,A);const u=s.isCompressedTexture||s.image[0].isCompressedTexture,d=s.image[0]&&s.image[0].isDataTexture,p=[];for(let e=0;e<6;e++)p[e]=u||d?d?s.image[e].image:s.image[e]:f(s.image[e],!0,r.maxCubemapSize),p[e]=O(s,p[e]);const E=p[0],C=a.convert(s.format,s.colorSpace),_=a.convert(s.type),I=v(s.internalFormat,C,_,s.colorSpace),x=!0!==s.isVideoTexture,y=void 0===h.__version||!0===l,w=c.dataReady;let M,S=b(s,E);if(B(e.TEXTURE_CUBE_MAP,s),u){x&&y&&n.texStorage2D(e.TEXTURE_CUBE_MAP,S,I,E.width,E.height);for(let t=0;t<6;t++){M=p[t].mipmaps;for(let i=0;i<M.length;i++){const r=M[i];s.format!==et?null!==C?x?w&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,C,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,I,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,C,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,I,r.width,r.height,0,C,_,r.data)}}}else{if(M=s.mipmaps,x&&y){M.length>0&&S++;const t=k(p[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,S,I,t.width,t.height)}for(let t=0;t<6;t++)if(d){x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,p[t].width,p[t].height,C,_,p[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,I,p[t].width,p[t].height,0,C,_,p[t].data);for(let i=0;i<M.length;i++){const r=M[i].image[t].image;x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,C,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,I,r.width,r.height,0,C,_,r.data)}}else{x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,C,_,p[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,I,C,_,p[t]);for(let i=0;i<M.length;i++){const r=M[i];x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,C,_,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,I,C,_,r.image[t])}}}g(s)&&m(e.TEXTURE_CUBE_MAP),h.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,n,r){const a=i.get(t);void 0!==n&&D(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&U(t)},this.setupRenderTarget=function(t){const r=t.texture,o=i.get(t),l=i.get(r);t.addEventListener("dispose",_);const c=t.textures,h=!0===t.isWebGLCubeRenderTarget,A=c.length>1;if(A||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),h){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)o.__webglFramebuffer[t][n]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(A)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===F(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];o.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[n]);const r=a.convert(i.format,i.colorSpace),s=a.convert(i.type),l=v(i.internalFormat,r,s,i.colorSpace,!0===t.isXRRenderTarget),h=N(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,o.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),Q(o.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),B(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)D(o.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else D(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&m(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(A){for(let r=0,a=c.length;r<a;r++){const a=c[r],s=i.get(a);n.bindTexture(e.TEXTURE_2D,s.__webglTexture),B(e.TEXTURE_2D,a),D(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),g(a)&&m(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),B(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)D(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else D(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);g(r)&&m(i),n.unbindTexture()}t.depthBuffer&&U(t)},this.updateRenderTargetMipmap=function(t){const r=t.textures;for(let a=0,s=r.length;a<s;a++){const s=r[a];if(g(s)){const r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=i.get(s).__webglTexture;n.bindTexture(r,a),m(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===F(t)){const r=t.textures,a=t.width,s=t.height;let o=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),A=r.length>1;if(A)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),A){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===l&&(L.length=0,P.length=0,L.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(L.push(c),P.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,P)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,L))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),A)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);const a=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=D,this.useMultisampledRTT=F}function Ro(e,t){return{convert:function(n,i=""){let r;const a=pn.getTransfer(i);if(n===Ye)return e.UNSIGNED_BYTE;if(1017===n)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===n)return e.UNSIGNED_INT_5_9_9_9_REV;if(1010===n)return e.BYTE;if(1011===n)return e.SHORT;if(n===Xe)return e.UNSIGNED_SHORT;if(1013===n)return e.INT;if(n===Ke)return e.UNSIGNED_INT;if(n===Je)return e.FLOAT;if(n===Ze)return e.HALF_FLOAT;if(1021===n)return e.ALPHA;if(1022===n)return e.RGB;if(n===et)return e.RGBA;if(1024===n)return e.LUMINANCE;if(1025===n)return e.LUMINANCE_ALPHA;if(n===tt)return e.DEPTH_COMPONENT;if(n===nt)return e.DEPTH_STENCIL;if(n===it)return e.RED;if(1029===n)return e.RED_INTEGER;if(n===rt)return e.RG;if(1031===n)return e.RG_INTEGER;if(1033===n)return e.RGBA_INTEGER;if(n===at||n===st||n===ot||n===lt)if(a===wt){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===at)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ot)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===lt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===at)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===st)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ot)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===lt)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ct||35841===n||n===ht||35843===n){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===ct)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ht)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===At||n===ut||n===dt){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===At||n===ut)return a===wt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===dt)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===pt||37809===n||37810===n||37811===n||n===ft||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===pt)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ft)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===gt||36494===n||36495===n){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===gt)return a===wt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===n)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===n)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||36284===n||36285===n||36286===n){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===gt)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===n)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===n)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===n)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===$e?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class Do extends Wr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Qo extends Qi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Uo={type:"move"};class Lo{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Qo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Qo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Tn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Tn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Qo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Tn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Tn),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null;const s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&s>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==s&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Uo)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Qo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Po{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new In;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new kr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Qr(new aa(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class No extends Ht{constructor(e,t){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,c=null,h=null,A=null,u=null,d=null;const p=new Po,f=t.getContextAttributes();let g=null,m=null;const v=[],E=[],b=new tn;let C=null;const _=new Wr;_.layers.enable(1),_.viewport=new xn;const I=new Wr;I.layers.enable(2),I.viewport=new xn;const x=[_,I],y=new Do;y.layers.enable(1),y.layers.enable(2);let w=null,M=null;function S(e){const t=E.indexOf(e.inputSource);if(-1===t)return;const n=v[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function B(){i.removeEventListener("select",S),i.removeEventListener("selectstart",S),i.removeEventListener("selectend",S),i.removeEventListener("squeeze",S),i.removeEventListener("squeezestart",S),i.removeEventListener("squeezeend",S),i.removeEventListener("end",B),i.removeEventListener("inputsourceschange",T);for(let e=0;e<v.length;e++){const t=E[e];null!==t&&(E[e]=null,v[e].disconnect(t))}w=null,M=null,p.reset(),e.setRenderTarget(g),u=null,A=null,h=null,i=null,m=null,L.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(b.width,b.height,!1),n.dispatchEvent({type:"sessionend"})}function T(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=E.indexOf(n);i>=0&&(E[i]=null,v[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=E.indexOf(n);if(-1===i){for(let e=0;e<v.length;e++){if(e>=E.length){E.push(n),i=e;break}if(null===E[e]){E[e]=n,i=e;break}}if(-1===i)break}const r=v[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return void 0===t&&(t=new Lo,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return void 0===t&&(t=new Lo,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return void 0===t&&(t=new Lo,v[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==A?A:u},this.getBinding=function(){return h},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=e.getRenderTarget(),i.addEventListener("select",S),i.addEventListener("selectstart",S),i.addEventListener("selectend",S),i.addEventListener("squeeze",S),i.addEventListener("squeezestart",S),i.addEventListener("squeezeend",S),i.addEventListener("end",B),i.addEventListener("inputsourceschange",T),!0!==f.xrCompatible&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(b),void 0===i.renderState.layers){const n={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),m=new wn(u.framebufferWidth,u.framebufferHeight,{format:et,type:Ye,colorSpace:e.outputColorSpace,stencilBuffer:f.stencil})}else{let n=null,a=null,s=null;f.depth&&(s=f.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=f.stencil?nt:tt,a=f.stencil?$e:Ke);const o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};h=new XRWebGLBinding(i,t),A=h.createProjectionLayer(o),i.updateRenderState({layers:[A]}),e.setPixelRatio(1),e.setSize(A.textureWidth,A.textureHeight,!1),m=new wn(A.textureWidth,A.textureHeight,{format:et,type:Ye,depthTexture:new Ga(A.textureWidth,A.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,colorSpace:e.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===A.ignoreDepthValues})}m.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),L.setContext(i),L.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};const R=new Tn,D=new Tn;function Q(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===i)return;null!==p.texture&&(e.near=p.depthNear,e.far=p.depthFar),y.near=I.near=_.near=e.near,y.far=I.far=_.far=e.far,w===y.near&&M===y.far||(i.updateRenderState({depthNear:y.near,depthFar:y.far}),w=y.near,M=y.far,_.near=w,_.far=M,I.near=w,I.far=M,_.updateProjectionMatrix(),I.updateProjectionMatrix(),e.updateProjectionMatrix());const t=e.parent,n=y.cameras;Q(y,t);for(let e=0;e<n.length;e++)Q(n[e],t);2===n.length?function(e,t,n){R.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);const i=R.distanceTo(D),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],A=(a[8]+1)/a[0],u=s*h,d=s*A,p=i/(-h+A),f=p*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const g=s+p,m=o+p,v=u-f,E=d+(i-f),b=l*o/m*g,C=c*o/m*g;e.projectionMatrix.makePerspective(v,E,b,C,g,m),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(y,_,I):y.projectionMatrix.copy(_.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*Wt*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,y,t)},this.getCamera=function(){return y},this.getFoveation=function(){if(null!==A||null!==u)return o},this.setFoveation=function(e){o=e,null!==A&&(A.fixedFoveation=e),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==p.texture},this.getDepthSensingMesh=function(){return p.getMesh(y)};let U=null;const L=new ia;L.setAnimationLoop(function(t,r){if(c=r.getViewerPose(l||a),d=r,null!==c){const t=c.views;null!==u&&(e.setRenderTargetFramebuffer(m,u.framebuffer),e.setRenderTarget(m));let n=!1;t.length!==y.cameras.length&&(y.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let a=null;if(null!==u)a=u.getViewport(r);else{const t=h.getViewSubImage(A,r);a=t.viewport,0===i&&(e.setRenderTargetTextures(m,t.colorTexture,A.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(m))}let s=x[i];void 0===s&&(s=new Wr,s.layers.enable(i),s.viewport=new xn,x[i]=s),s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(r.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===i&&(y.matrix.copy(s.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale)),!0===n&&y.cameras.push(s)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")){const n=h.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&p.init(e,n,i.renderState)}}for(let e=0;e<v.length;e++){const t=E[e],n=v[e];null!==t&&void 0!==n&&n.update(t,r,l||a)}U&&U(t,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),d=null}),this.setAnimationLoop=function(e){U=e},this.dispose=function(){}}}const Fo=new gi,Oo=new si;function ko(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,Fo.copy(s),Fo.x*=-1,Fo.y*=-1,Fo.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Fo.y*=-1,Fo.z*=-1),e.envMapRotation.value.setFromMatrix4(Oo.makeRotationFromEuler(Fo)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Fr(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,s,o,l){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,o)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,s):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial?r.uniformsNeedUpdate=!1:r.isMeshDiamondMaterial&&function(e,n,i,r){e.opacity.value=n.opacity,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.radius.value=n.radius,e.squashFactor.value=n.squashFactor,e.geometryFactor.value=n.geometryFactor,e.gammaFactor.value=n.gammaFactor,e.absorptionFactor.value=n.absorptionFactor,e.rIndexDelta.value=n.rIndexDelta,n.boostFactors&&e.boostFactors.value.copy(n.boostFactors),n.colorCorrection&&e.colorCorrection.value.set(n.colorCorrection.r,n.colorCorrection.g,n.colorCorrection.b),n.color&&(e.diffuse.value.copy(n.color),e.color.value.set(n.color.r,n.color.g,n.color.b));const a=t.get(n).envMap;a&&(e.envMap.value=a,e.envMapRotation.value=n.envMapRotation,e.envMapIntensity.value=n.envMapIntensity),n.transmission>0&&(e.transmission.value=n.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height)),r&&(e.tCubeMapNormals.value=r.texture)}(e,r,o,l)}}}function Go(e,t,n,i){let r={},a={},s=[];const o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){const n=t.target;n.removeEventListener("dispose",h);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,A){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e<i;e++){const i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){const t=i[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){const i=c(r[e]),a=n%16;0!==a&&16-a<i.boundary&&(n+=16-a),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=u,n.addEventListener("dispose",h));const d=A.program;i.updateUBOMapping(n,d);const p=t.render.frame;a[n.id]!==p&&(function(t){const n=r[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,a)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let a=0;a<n.length;a++){const s=n[a],o=c(s);"number"==typeof s||"boolean"==typeof s?(r.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=0,r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=0,r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=0):(s.toArray(r.__data,i),i+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);s=[],r={},a={}}}}class Ho extends kr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class zo extends Zi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Xi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}class Vo extends Zi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Xi(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 Xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new tn(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 gi,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}}class Wo extends Vo{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new tn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xi(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xi(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xi(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class qo extends Zi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xi(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}}class jo extends Zi{constructor(e){super(),this.isMeshDiamondMaterial=!0,this.type="MeshDiamondMaterial",this.defines={RAY_BOUNCES:5},this.color=new Xi(16777215),this.map=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=0,this.envMapRotationQuat=(new Bn).identity(),this.envMapIntensity=.01,this.ior=2.4,this.reflectivity=.5,this.roughness=1,this.metalness=0,this.radius=1,this.transmission=0,this.squashFactor=.98,this.geometryFactor=.5,this.gammaFactor=1,this.absorptionFactor=1,this.rIndexDelta=.012,this.diamondOrientedEnvMap=0,this.boostFactors=new Tn(1,1,1),this.fixedEnvMapDirection=!1,this.rayBounces=5,this.colorCorrection=new Xi(16777215),this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.defines=Object.assign({},e.defines),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation=e.envMapRotation,this.envMapRotationQuat.copy(e.envMapRotationQuat),this.envMapIntensity=e.envMapIntensity,this.ior=e.ior,this.reflectivity=e.reflectivity,this.roughness=e.roughness,this.metalness=e.metalness,this.radius=e.radius,this.transmission=e.transmission,this.squashFactor=e.squashFactor,this.geometryFactor=e.geometryFactor,this.gammaFactor=e.gammaFactor,this.absorptionFactor=e.absorptionFactor,this.colorCorrection=e.colorCorrection,this.rIndexDelta=e.rIndexDelta,this.diamondOrientedEnvMap=e.diamondOrientedEnvMap,this.boostFactors.copy(e.boostFactors),this.fixedEnvMapDirection=e.fixedEnvMapDirection,this.rayBounces=e.rayBounces,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}class Yo extends Zi{constructor(e){super(),this.isCubeNormalsMaterial=!0,this.type="CubeNormalsMaterial",this.radius=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.radius=e.radius,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}class Xo extends Qi{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 gi,this.environmentIntensity=1,this.environmentRotation=new gi,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Ko{constructor(e={}){const{canvas:t=on(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:s=!1,premultipliedAlpha:o=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1}=e;let A;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=n.getContextAttributes().alpha}else A=a;const u=new Uint32Array(4),d=new Int32Array(4);let p=null,f=null;const g=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ct,this.toneMapping=0,this.toneMappingExposure=1;const v=this;let E=!1,b=0,C=0,_=null,I=-1,x=null;const y=new xn,w=new xn;let M=null;const S=new Xi(0);let B=0,T=t.width,R=t.height,D=1,Q=null,U=null;const L=new xn(0,0,T,R),P=new xn(0,0,T,R);let N=!1;const F=new na;let O=!1,k=!1;const G=new si,H=new Tn,z=new xn,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let W=!1;function q(){return null===_?D:1}let j,Y,X,K,J,Z,$,ee,te,ne,ie,re,ae,se,oe,le,ce,he,Ae,de,pe,fe,ge,me,ve=n;function Ee(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ue}`),t.addEventListener("webglcontextlost",_e,!1),t.addEventListener("webglcontextrestored",Ie,!1),t.addEventListener("webglcontextcreationerror",xe,!1),null===ve){const t="webgl2";if(ve=Ee(t,e),null===ve)throw Ee(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function be(){j=new La(ve),j.init(),fe=new Ro(ve,j),Y=new fa(ve,j,e,fe),X=new Bo(ve),K=new Fa(ve),J=new fo,Z=new To(ve,j,X,J,Y,fe,K),$=new ma(v),ee=new Ua(v),te=new ra(ve),ge=new da(ve,te),ne=new Pa(ve,te,K,ge),ie=new ka(ve,ne,te,K),Ae=new Oa(ve,Y,Z),le=new ga(J),re=new po(v,$,ee,j,Y,ge,le),ae=new ko(v,J),se=new Eo,oe=new yo(j),he=new ua(v,$,ee,X,ie,A,o),ce=new So(v,ie,Y),me=new Go(ve,K,Y,X),de=new pa(ve,j,K),pe=new Na(ve,j,K),K.programs=re.programs,v.capabilities=Y,v.extensions=j,v.properties=J,v.renderLists=se,v.shadowMap=ce,v.state=X,v.info=K}be();const Ce=new No(v,ve);function _e(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function Ie(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;const e=K.autoReset,t=ce.enabled,n=ce.autoUpdate,i=ce.needsUpdate,r=ce.type;be(),K.autoReset=e,ce.enabled=t,ce.autoUpdate=n,ce.needsUpdate=i,ce.type=r}function xe(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ye(e){const t=e.target;t.removeEventListener("dispose",ye),function(e){(function(e){const t=J.get(e).programs;void 0!==t&&(t.forEach(function(e){re.releaseProgram(e)}),e.isShaderMaterial&&re.releaseShaderCache(e))})(e),J.remove(e)}(t)}function we(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,Pe(e,t,n),e.side=0,e.needsUpdate=!0,Pe(e,t,n),e.side=2):Pe(e,t,n)}this.xr=Ce,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.getContextAttributes()},this.forceContextLoss=function(){const e=j.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=j.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(e){void 0!==e&&(D=e,this.setSize(T,R,!1))},this.getSize=function(e){return e.set(T,R)},this.setSize=function(e,n,i=!0){Ce.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=e,R=n,t.width=Math.floor(e*D),t.height=Math.floor(n*D),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(T*D,R*D).floor()},this.setDrawingBufferSize=function(e,n,i){T=e,R=n,D=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(y)},this.getViewport=function(e){return e.copy(L)},this.setViewport=function(e,t,n,i){e.isVector4?L.set(e.x,e.y,e.z,e.w):L.set(e,t,n,i),X.viewport(y.copy(L).multiplyScalar(D).round())},this.getScissor=function(e){return e.copy(P)},this.setScissor=function(e,t,n,i){e.isVector4?P.set(e.x,e.y,e.z,e.w):P.set(e,t,n,i),X.scissor(w.copy(P).multiplyScalar(D).round())},this.getScissorTest=function(){return N},this.setScissorTest=function(e){X.setScissorTest(N=e)},this.setOpaqueSort=function(e){Q=e},this.setTransparentSort=function(e){U=e},this.getClearColor=function(e){return e.copy(he.getClearColor())},this.setClearColor=function(){he.setClearColor.apply(he,arguments)},this.getClearAlpha=function(){return he.getClearAlpha()},this.setClearAlpha=function(){he.setClearAlpha.apply(he,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==_){const t=_.texture.format;e=1033===t||1031===t||1029===t}if(e){const e=_.texture.type,t=e===Ye||e===Ke||e===Xe||e===$e||1017===e||1018===e,n=he.getClearColor(),i=he.getClearAlpha(),r=n.r,a=n.g,s=n.b;t?(u[0]=r,u[1]=a,u[2]=s,u[3]=i,ve.clearBufferuiv(ve.COLOR,0,u)):(d[0]=r,d[1]=a,d[2]=s,d[3]=i,ve.clearBufferiv(ve.COLOR,0,d))}else i|=ve.COLOR_BUFFER_BIT}t&&(i|=ve.DEPTH_BUFFER_BIT),n&&(i|=ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ve.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",_e,!1),t.removeEventListener("webglcontextrestored",Ie,!1),t.removeEventListener("webglcontextcreationerror",xe,!1),se.dispose(),oe.dispose(),J.dispose(),$.dispose(),ee.dispose(),ie.dispose(),ge.dispose(),me.dispose(),re.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",Se),Ce.removeEventListener("sessionend",Be),Te.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=V);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(e,t,n,i,r){!0!==t.isScene&&(t=V),Z.resetTextureUnits();const a=t.fog,s=i.isMeshStandardMaterial?t.environment:null,o=null===_?v.outputColorSpace:!0===_.isXRRenderTarget?_.texture.colorSpace:_t,l=(i.isMeshStandardMaterial?ee:$).get(i.envMap||s),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),A=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,d=!!n.morphAttributes.color;let p=0;i.toneMapped&&(null!==_&&!0!==_.isXRRenderTarget||(p=v.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==g?g.length:0,E=J.get(i),b=f.state.lights;if(!0===O&&(!0===k||e!==x)){const t=e===x&&i.id===I;le.setState(i,e,t)}let C=!1;i.version===E.__version?E.needsLights&&E.lightsStateVersion!==b.state.version||E.outputColorSpace!==o||r.isBatchedMesh&&!1===E.batching?C=!0:r.isBatchedMesh||!0!==E.batching?r.isBatchedMesh&&!0===E.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===E.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===E.instancing?C=!0:r.isInstancedMesh||!0!==E.instancing?r.isSkinnedMesh&&!1===E.skinning?C=!0:r.isSkinnedMesh||!0!==E.skinning?r.isInstancedMesh&&!0===E.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===E.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===E.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===E.instancingMorph&&null!==r.morphTexture||E.envMap!==l||!0===i.fog&&E.fog!==a?C=!0:void 0===E.numClippingPlanes||E.numClippingPlanes===le.numPlanes&&E.numIntersection===le.numIntersection?(E.vertexAlphas!==c||E.vertexTangents!==h||E.morphTargets!==A||E.morphNormals!==u||E.morphColors!==d||E.toneMapping!==p||E.morphTargetsCount!==m)&&(C=!0):C=!0:C=!0:C=!0:C=!0:(C=!0,E.__version=i.version);let y=E.currentProgram;!0===C&&(y=Pe(i,t,r));let w=!1,M=!1,S=!1;const B=y.getUniforms(),T=E.uniforms;if(X.useProgram(y.program)&&(w=!0,M=!0,S=!0),i.id!==I&&(I=i.id,M=!0),n.cubeMapNormalTarget&&(M=!0),w||x!==e){B.setValue(ve,"projectionMatrix",e.projectionMatrix),B.setValue(ve,"viewMatrix",e.matrixWorldInverse);const t=B.map.cameraPosition;void 0!==t&&t.setValue(ve,H.setFromMatrixPosition(e.matrixWorld)),Y.logarithmicDepthBuffer&&B.setValue(ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&B.setValue(ve,"isOrthographic",!0===e.isOrthographicCamera),x!==e&&(x=e,M=!0,S=!0)}if(r.isSkinnedMesh){B.setOptional(ve,r,"bindMatrix"),B.setOptional(ve,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),B.setValue(ve,"boneTexture",e.boneTexture,Z))}r.isBatchedMesh&&(B.setOptional(ve,r,"batchingTexture"),B.setValue(ve,"batchingTexture",r._matricesTexture,Z),B.setOptional(ve,r,"batchingIdTexture"),B.setValue(ve,"batchingIdTexture",r._indirectTexture,Z),B.setOptional(ve,r,"batchingColorTexture"),null!==r._colorsTexture&&B.setValue(ve,"batchingColorTexture",r._colorsTexture,Z));const Q=n.morphAttributes;var U,L;if(void 0===Q.position&&void 0===Q.normal&&void 0===Q.color||Ae.update(r,n,y),(M||E.receiveShadow!==r.receiveShadow)&&(E.receiveShadow=r.receiveShadow,B.setValue(ve,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(T.envMap.value=l,T.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(T.envMapIntensity.value=t.environmentIntensity),M&&(B.setValue(ve,"toneMappingExposure",v.toneMappingExposure),E.needsLights&&(L=S,(U=T).ambientLightColor.needsUpdate=L,U.lightProbe.needsUpdate=L,U.directionalLights.needsUpdate=L,U.directionalLightShadows.needsUpdate=L,U.pointLights.needsUpdate=L,U.pointLightShadows.needsUpdate=L,U.spotLights.needsUpdate=L,U.spotLightShadows.needsUpdate=L,U.rectAreaLights.needsUpdate=L,U.hemisphereLights.needsUpdate=L),a&&!0===i.fog&&ae.refreshFogUniforms(T,a),ae.refreshMaterialUniforms(T,i,D,R,f.state.transmissionRenderTarget[e.id],n.cubeMapNormalTarget),qs.upload(ve,Ne(E),T,Z)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(qs.upload(ve,Ne(E),T,Z),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&B.setValue(ve,"center",r.center),B.setValue(ve,"modelViewMatrix",r.modelViewMatrix),B.setValue(ve,"normalMatrix",r.normalMatrix),B.setValue(ve,"modelMatrix",r.matrixWorld),B.setValue(ve,"inverseModelMatrix",r.matrixWorldInv),B.setValue(ve,"offsetMatrixInv",r.offsetMatrixInv),B.setValue(ve,"offsetMatrix",r.offsetMatrix),B.setValue(ve,"centerOffset",r.centerOffset),(i.isCubeNormalsMaterial||i.isMeshDiamondMaterial)&&B.setValue(ve,"center",r.center),i.isMeshDiamondMaterial&&(r.modelOffsetMatrix.copy(r.matrixWorld).multiply(r.offsetMatrix),B.setValue(ve,"modelOffsetMatrix",r.modelOffsetMatrix),r.modelOffsetMatrixInv.copy(r.modelOffsetMatrix).invert(),B.setValue(ve,"modelOffsetMatrixInv",r.modelOffsetMatrixInv)),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];me.update(n,y),me.bind(n,y)}}return y}(e,t,n,i,r);X.setMaterial(i,s);let l=n.index,c=1;if(!0===i.wireframe){if(l=ne.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,A=n.attributes.position;let u=h.start*c,d=(h.start+h.count)*c;null!==a&&(u=Math.max(u,a.start*c),d=Math.min(d,(a.start+a.count)*c)),null!==l?(u=Math.max(u,0),d=Math.min(d,l.count)):null!=A&&(u=Math.max(u,0),d=Math.min(d,A.count));const p=d-u;if(p<0||p===1/0)return;let g;ge.setup(r,i,o,n,l);let m=de;if(null!==l&&(g=te.get(l),m=pe,m.setIndex(g)),r.isMesh)!0===i.wireframe?(X.setLineWidth(i.wireframeLinewidth*q()),m.setMode(ve.LINES)):m.setMode(ve.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),X.setLineWidth(e*q()),r.isLineSegments?m.setMode(ve.LINES):r.isLineLoop?m.setMode(ve.LINE_LOOP):m.setMode(ve.LINE_STRIP)}else r.isPoints?m.setMode(ve.POINTS):r.isSprite&&m.setMode(ve.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(j.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,a=l?te.get(l).bytesPerElement:1,s=J.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)s.setValue(ve,"_gl_DrawID",i),m.render(e[i]/a,t[i])}else if(r.isInstancedMesh)m.renderInstances(u,p,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);m.renderInstances(u,p,t)}else m.render(u,p)},this.compile=function(e,t,n=null){null===n&&(n=e),f=oe.get(n),f.init(t),m.push(f),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),f.setupLights();const i=new Set;return e.traverse(function(e){const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const a=t[r];we(a,n,e),i.add(a)}else we(t,n,e),i.add(t)}),m.pop(),f=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise(t=>{function n(){i.forEach(function(e){J.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==j.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let Me=null;function Se(){Te.stop()}function Be(){Te.start()}const Te=new ia;function Re(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||F.intersectsSprite(e)){i&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=ie.update(e),r=e.material;r.visible&&p.push(e,t,r,n,z.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||F.intersectsObject(e))){const t=ie.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),z.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),z.copy(t.boundingSphere.center)),z.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let a=0,s=i.length;a<s;a++){const s=i[a],o=r[s.materialIndex];o&&o.visible&&p.push(e,t,o,n,z.z,s)}}else r.visible&&p.push(e,t,r,n,z.z,null)}const r=e.children;for(let e=0,a=r.length;e<a;e++)Re(r[e],t,n,i)}function De(e,t,n,i){const r=e.opaque,a=e.transmissive,s=e.transparent;f.setupLightsView(n),!0===O&&le.setGlobalState(v.clippingPlanes,n),i&&X.viewport(y.copy(i)),r.length>0&&Ue(r,t,n),a.length>0&&Ue(a,t,n),s.length>0&&Ue(s,t,n),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function Qe(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===f.state.transmissionRenderTarget[i.id]&&(f.state.transmissionRenderTarget[i.id]=new wn(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?Ze:Ye,minFilter:je,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:pn.workingColorSpace}));const a=f.state.transmissionRenderTarget[i.id],s=i.viewport||y;a.setSize(s.z,s.w);const o=v.getRenderTarget();v.setRenderTarget(a),v.getClearColor(S),B=v.getClearAlpha(),B<1&&v.setClearColor(16777215,.5),W?he.render(n):v.clear();const l=v.toneMapping;v.toneMapping=0;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),f.setupLightsView(i),!0===O&&le.setGlobalState(v.clippingPlanes,i),Ue(e,n,i),Z.updateMultisampleRenderTarget(a),Z.updateRenderTargetMipmap(a),!1===j.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.object,o=a.geometry,l=a.material,c=a.group;if(2===l.side&&s.layers.test(i.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,Le(s,n,i,o,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(Z.updateMultisampleRenderTarget(a),Z.updateRenderTargetMipmap(a))}v.setRenderTarget(o),v.setClearColor(S,B),void 0!==c&&(i.viewport=c),v.toneMapping=l}function Ue(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){const a=e[r],s=a.object,o=a.geometry,l=null===i?a.material:i,c=a.group;s.layers.test(n.layers)&&Le(s,t,n,o,l,c)}}function Le(e,t,n,i,r,a){e.onBeforeRender(v,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(v,t,n,i,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,a),r.side=0,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,a),r.side=2):v.renderBufferDirect(n,t,i,r,e,a),e.onAfterRender(v,t,n,i,r,a)}function Pe(e,t,n){!0!==t.isScene&&(t=V);const i=J.get(e),r=f.state.lights,a=f.state.shadowsArray,s=r.state.version,o=re.getParameters(e,r.state,a,t,n),l=re.getProgramCacheKey(o);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?ee:$).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",ye),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===s)return Fe(e,o),h}else o.uniforms=re.getUniforms(e),e.onBuild(n,o,v),e.onBeforeCompile(o,v),h=re.acquireProgram(o,l),c.set(l,h),i.uniforms=o.uniforms;const A=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(A.clippingPlanes=le.uniform),Fe(e,o),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=s,i.needsLights&&(A.ambientLightColor.value=r.state.ambient,A.lightProbe.value=r.state.probe,A.directionalLights.value=r.state.directional,A.directionalLightShadows.value=r.state.directionalShadow,A.spotLights.value=r.state.spot,A.spotLightShadows.value=r.state.spotShadow,A.rectAreaLights.value=r.state.rectArea,A.ltc_1.value=r.state.rectAreaLTC1,A.ltc_2.value=r.state.rectAreaLTC2,A.pointLights.value=r.state.point,A.pointLightShadows.value=r.state.pointShadow,A.hemisphereLights.value=r.state.hemi,A.directionalShadowMap.value=r.state.directionalShadowMap,A.directionalShadowMatrix.value=r.state.directionalShadowMatrix,A.spotShadowMap.value=r.state.spotShadowMap,A.spotLightMatrix.value=r.state.spotLightMatrix,A.spotLightMap.value=r.state.spotLightMap,A.pointShadowMap.value=r.state.pointShadowMap,A.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Ne(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=qs.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function Fe(e,t){const n=J.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Te.setAnimationLoop(function(e){Me&&Me(e)}),"undefined"!=typeof self&&Te.setContext(self),this.setAnimationLoop=function(e){Me=e,Ce.setAnimationLoop(e),null===e?Te.stop():Te.start()},Ce.addEventListener("sessionstart",Se),Ce.addEventListener("sessionend",Be),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===E)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Ce.enabled&&!0===Ce.isPresenting&&(!0===Ce.cameraAutoUpdate&&Ce.updateCamera(t),t=Ce.getCamera()),!0===e.isScene&&e.onBeforeRender(v,e,t,_),f=oe.get(e,m.length),f.init(t),m.push(f),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromProjectionMatrix(G),k=this.localClippingEnabled,O=le.init(this.clippingPlanes,k),p=se.get(e,g.length),p.init(),g.push(p),!0===Ce.enabled&&!0===Ce.isPresenting){const e=v.xr.getDepthSensingMesh();null!==e&&Re(e,t,-1/0,v.sortObjects)}Re(e,t,0,v.sortObjects),p.finish(),!0===v.sortObjects&&p.sort(Q,U),W=!1===Ce.enabled||!1===Ce.isPresenting||!1===Ce.hasDepthSensing(),W&&he.addToRenderList(p,e),this.info.render.frame++,!0===O&&le.beginShadows();const n=f.state.shadowsArray;ce.render(n,e,t),!0===O&&le.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=p.opaque,r=p.transmissive;if(f.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,a=n.length;t<a;t++)Qe(i,r,e,n[t]);W&&he.render(e);for(let t=0,i=n.length;t<i;t++){const i=n[t];De(p,e,i,i.viewport)}}else r.length>0&&Qe(i,r,e,t),W&&he.render(e),De(p,e,t);null!==_&&(Z.updateMultisampleRenderTarget(_),Z.updateRenderTargetMipmap(_)),!0===e.isScene&&e.onAfterRender(v,e,t),ge.resetDefaultState(),I=-1,x=null,m.pop(),m.length>0?(f=m[m.length-1],!0===O&&le.setGlobalState(v.clippingPlanes,f.state.camera)):f=null,g.pop(),p=g.length>0?g[g.length-1]:null},this.renderCubeMapNormals=function(e){const t=function(e){const t=new Set;return e.traverse(e=>{e.isMesh&&e.geometry&&e.material&&e.material.isMeshDiamondMaterial&&t.add(e.geometry)}),t}(e);if(0===t.size)return;const n=new Yo;n.side=2;const i=new Xo;for(const e of t)if(!e.cubeMapNormalTarget){const t=new Xr(512,{type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?Ze:Ye,magFilter:He,minFilter:He});e.cubeMapNormalTarget=t;const r=new jr(1e-4,100,t),a=new Qr(e);a.material=n,a.computeOffsets(),i.add(a),i.add(r),r.update(this,i),i.remove(a),i.remove(r),a.geometry=null,a.material=null}},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(e,t,n){J.get(e.texture).__webglTexture=t,J.get(e.depthTexture).__webglTexture=n;const i=J.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===j.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=J.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){_=e,b=t,C=n;let i=!0,r=null,a=!1,s=!1;if(e){const o=J.get(e);void 0!==o.__useDefaultFramebuffer?(X.bindFramebuffer(ve.FRAMEBUFFER,null),i=!1):void 0===o.__webglFramebuffer?Z.setupRenderTarget(e):o.__hasExternalTextures&&Z.rebindTextures(e,J.get(e.texture).__webglTexture,J.get(e.depthTexture).__webglTexture);const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(s=!0);const c=J.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],a=!0):r=e.samples>0&&!1===Z.useMultisampledRTT(e)?J.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,y.copy(e.viewport),w.copy(e.scissor),M=e.scissorTest}else y.copy(L).multiplyScalar(D).floor(),w.copy(P).multiplyScalar(D).floor(),M=N;if(X.bindFramebuffer(ve.FRAMEBUFFER,r)&&i&&X.drawBuffers(e,r),X.viewport(y),X.scissor(w),X.setScissorTest(M),a){const i=J.get(e.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(s){const i=J.get(e.texture),r=t||0;ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}I=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,s){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){X.bindFramebuffer(ve.FRAMEBUFFER,o);try{const s=e.texture,o=s.format,l=s.type;if(!Y.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!Y.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ve.readPixels(t,n,i,r,fe.convert(o),fe.convert(l),a)}finally{const e=null!==_?J.get(_).__webglFramebuffer:null;X.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,s){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){X.bindFramebuffer(ve.FRAMEBUFFER,o);try{const s=e.texture,o=s.format,l=s.type;if(!Y.textureFormatReadable(o))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Y.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){const e=ve.createBuffer();ve.bindBuffer(ve.PIXEL_PACK_BUFFER,e),ve.bufferData(ve.PIXEL_PACK_BUFFER,a.byteLength,ve.STREAM_READ),ve.readPixels(t,n,i,r,fe.convert(o),fe.convert(l),0),ve.flush();const s=ve.fenceSync(ve.SYNC_GPU_COMMANDS_COMPLETE,0);await function(e,t){return new Promise(function(n,i){setTimeout(function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}},4)})}(ve,s);try{ve.bindBuffer(ve.PIXEL_PACK_BUFFER,e),ve.getBufferSubData(ve.PIXEL_PACK_BUFFER,0,a)}finally{ve.deleteBuffer(e),ve.deleteSync(s)}return a}}finally{const e=null!==_?J.get(_).__webglFramebuffer:null;X.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),s=null!==t?t.x:0,o=null!==t?t.y:0;Z.setTexture2D(e,0),ve.copyTexSubImage2D(ve.TEXTURE_2D,n,0,0,s,o,r,a),X.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,r=0){let a,s,o,l,c,h;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],r=arguments[3]||0,n=null),null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.min.x,l=n.min.y):(a=e.image.width,s=e.image.height,o=0,l=0),null!==i?(c=i.x,h=i.y):(c=0,h=0);const A=fe.convert(t.format),u=fe.convert(t.type);Z.setTexture2D(t,0),ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const d=ve.getParameter(ve.UNPACK_ROW_LENGTH),p=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),f=ve.getParameter(ve.UNPACK_SKIP_PIXELS),g=ve.getParameter(ve.UNPACK_SKIP_ROWS),m=ve.getParameter(ve.UNPACK_SKIP_IMAGES),v=e.isCompressedTexture?e.mipmaps[r]:e.image;ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,v.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,o),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,l),e.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,r,c,h,a,s,A,u,v.data):e.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,r,c,h,v.width,v.height,A,v.data):ve.texSubImage2D(ve.TEXTURE_2D,r,c,h,A,u,v),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,d),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,p),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,f),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,g),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,m),0===r&&t.generateMipmaps&&ve.generateMipmap(ve.TEXTURE_2D),X.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){let a,s,o,l,c,h,A,u,d;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0);const p=e.isCompressedTexture?e.mipmaps[r]:e.image;null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.max.z-n.min.z,l=n.min.x,c=n.min.y,h=n.min.z):(a=p.width,s=p.height,o=p.depth,l=0,c=0,h=0),null!==i?(A=i.x,u=i.y,d=i.z):(A=0,u=0,d=0);const f=fe.convert(t.format),g=fe.convert(t.type);let m;if(t.isData3DTexture)Z.setTexture3D(t,0),m=ve.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Z.setTexture2DArray(t,0),m=ve.TEXTURE_2D_ARRAY}ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const v=ve.getParameter(ve.UNPACK_ROW_LENGTH),E=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),b=ve.getParameter(ve.UNPACK_SKIP_PIXELS),C=ve.getParameter(ve.UNPACK_SKIP_ROWS),_=ve.getParameter(ve.UNPACK_SKIP_IMAGES);ve.pixelStorei(ve.UNPACK_ROW_LENGTH,p.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,p.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,l),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,c),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,h),e.isDataTexture||e.isData3DTexture?ve.texSubImage3D(m,r,A,u,d,a,s,o,f,g,p.data):t.isCompressedArrayTexture?ve.compressedTexSubImage3D(m,r,A,u,d,a,s,o,f,p.data):ve.texSubImage3D(m,r,A,u,d,a,s,o,f,g,p),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,E),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,b),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,C),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,_),0===r&&t.generateMipmaps&&ve.generateMipmap(m),X.unbindTexture()},this.initRenderTarget=function(e){void 0===J.get(e).__webglFramebuffer&&Z.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Z.setTextureCube(e,0):e.isData3DTexture?Z.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Z.setTexture2DArray(e,0):Z.setTexture2D(e,0),X.unbindTexture()},this.resetState=function(){b=0,C=0,_=null,X.reset(),ge.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return kt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===It?"display-p3":"srgb",t.unpackColorSpace=pn.workingColorSpace===xt?"display-p3":"srgb"}}class Jo{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Ft,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=qt()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return cn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Zo=new Tn;class $o{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Zo.fromBufferAttribute(this,t),Zo.applyMatrix4(e),this.setXYZ(t,Zo.x,Zo.y,Zo.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Zo.fromBufferAttribute(this,t),Zo.applyNormalMatrix(e),this.setXYZ(t,Zo.x,Zo.y,Zo.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Zo.fromBufferAttribute(this,t),Zo.transformDirection(e),this.setXYZ(t,Zo.x,Zo.y,Zo.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Kt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Jt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Kt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Kt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Kt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Kt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array),r=Jt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new rr(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new $o(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const el=new Tn,tl=new xn,nl=new xn,il=new Tn,rl=new si,al=new Tn,sl=new Jn,ol=new si,ll=new ai;class cl extends Qr{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ue,this.bindMatrix=new si,this.bindMatrixInverse=new si,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Qn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,al),this.boundingBox.expandByPoint(al)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Jn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,al),this.boundingSphere.expandByPoint(al)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),sl.copy(this.boundingSphere),sl.applyMatrix4(i),!1!==e.ray.intersectsSphere(sl)&&(ol.copy(i).invert(),ll.copy(e.ray).applyMatrix4(ol),null!==this.boundingBox&&!1===ll.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,ll)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new xn,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ue?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;tl.fromBufferAttribute(i.attributes.skinIndex,e),nl.fromBufferAttribute(i.attributes.skinWeight,e),el.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=nl.getComponent(e);if(0!==i){const r=tl.getComponent(e);rl.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(il.copy(el).applyMatrix4(rl),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class hl extends Qi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Al extends In{constructor(e=null,t=1,n=1,i,r,a,s,o,l=1003,c=1003,h,A){super(null,a,s,o,l,c,i,r,h,A),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const ul=new si,dl=new si;class pl{constructor(e=[],t=[]){this.uuid=qt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new si)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new si;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:dl;ul.multiplyMatrices(r,t[i]),ul.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new pl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Al(t,e,e,et,Je);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new hl),this.bones.push(r),this.boneInverses.push((new si).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class fl extends rr{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const gl=new si,ml=new si,vl=[],El=new Qn,bl=new si,Cl=new Qr,_l=new Jn;class Il extends Qr{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new fl(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,bl)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Qn),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,gl),El.copy(e.boundingBox).applyMatrix4(gl),this.boundingBox.union(El)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Jn),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,gl),_l.copy(e.boundingSphere).applyMatrix4(gl),this.boundingSphere.union(_l)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Cl.geometry=this.geometry,Cl.material=this.material,void 0!==Cl.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),_l.copy(this.boundingSphere),_l.applyMatrix4(n),!1!==e.ray.intersectsSphere(_l)))for(let r=0;r<i;r++){this.getMatrixAt(r,gl),ml.multiplyMatrices(n,gl),Cl.matrixWorld=ml,Cl.raycast(e,vl);for(let e=0,n=vl.length;e<n;e++){const n=vl[e];n.instanceId=r,n.object=this,t.push(n)}vl.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new fl(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new Al(new Float32Array(i*this.count),i,this.count,it,Je));const r=this.morphTexture.source.data.data;let a=0;for(let e=0;e<n.length;e++)a+=n[e];const s=this.geometry.morphTargetsRelative?1:1-a,o=i*e;r[o]=s,r.set(n,o+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const xl=new Tn,yl=new Tn,wl=new si,Ml=new ai,Sl=new Jn,Bl=new Tn,Tl=new Tn;class Rl extends Qi{constructor(e=new fr,t=new qo){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)xl.fromBufferAttribute(t,e-1),yl.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=xl.distanceTo(yl);e.setAttribute("lineDistance",new or(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Sl.copy(n.boundingSphere),Sl.applyMatrix4(i),Sl.radius+=r,!1===e.ray.intersectsSphere(Sl))return;wl.copy(i).invert(),Ml.copy(e.ray).applyMatrix4(wl);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=c.getX(r),i=c.getX(r+1),a=Dl(this,e,Ml,o,n,i);a&&t.push(a)}if(this.isLineLoop){const r=c.getX(i-1),a=c.getX(n),s=Dl(this,e,Ml,o,r,a);s&&t.push(s)}}else{const n=Math.max(0,a.start),i=Math.min(h.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=Dl(this,e,Ml,o,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=Dl(this,e,Ml,o,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Dl(e,t,n,i,r,a){const s=e.geometry.attributes.position;if(xl.fromBufferAttribute(s,r),yl.fromBufferAttribute(s,a),n.distanceSqToSegment(xl,yl,Bl,Tl)>i)return;Bl.applyMatrix4(e.matrixWorld);const o=t.ray.origin.distanceTo(Bl);return o<t.near||o>t.far?void 0:{distance:o,point:Tl.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,object:e}}const Ql=new Tn,Ul=new Tn;class Ll extends Rl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)Ql.fromBufferAttribute(t,e),Ul.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Ql.distanceTo(Ul);e.setAttribute("lineDistance",new or(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Pl extends Rl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}const Nl=new si,Fl=new ai,Ol=new Jn,kl=new Tn;class Gl extends Qi{constructor(e=new fr,t=new zo){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ol.copy(n.boundingSphere),Ol.applyMatrix4(i),Ol.radius+=r,!1===e.ray.intersectsSphere(Ol))return;Nl.copy(i).invert(),Fl.copy(e.ray).applyMatrix4(Nl);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);n<r;n++){const r=l.getX(n);kl.fromBufferAttribute(c,r),Hl(kl,r,o,i,e,t,this)}else for(let n=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);n<r;n++)kl.fromBufferAttribute(c,n),Hl(kl,n,o,i,e,t,this)}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Hl(e,t,n,i,r,a,s){const o=Fl.distanceSqToPoint(e);if(o<n){const n=new Tn;Fl.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,object:s})}}class zl extends In{constructor(e,t,n,i,r,a,s,o,l,c,h,A){super(null,a,s,o,l,c,i,r,h,A),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Vl extends zl{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ke,this.layerUpdates=new Set}addLayerUpdates(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Wl extends zl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Le),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}function ql(e,t,n){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function jl(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function Yl(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,s=0;s!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[s++]=e[i+n]}return r}function Xl(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do{s=a[i],void 0!==s&&(t.push(a.time),n.push.apply(n,s)),a=e[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[i],void 0!==s&&(t.push(a.time),s.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{s=a[i],void 0!==s&&(t.push(a.time),n.push(s)),a=e[r++]}while(void 0!==a)}class Kl{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let a=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(e>=r)break e;{const s=t[1];e<s&&(n=2,r=s);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0}}for(;n<a;){const i=n+a>>>1;e<t[i]?a=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Jl extends Kl{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,s=i[r],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=e,s=2*t-n;break;case 2402:r=i.length-2,s=t+i[r]-i[r+1];break;default:r=e,s=n}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*n-t;break;case 2402:a=1,o=n+i[1]-i[0];break;default:a=e-1,o=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-n),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,c=this._offsetPrev,h=this._offsetNext,A=this._weightPrev,u=this._weightNext,d=(n-t)/(i-t),p=d*d,f=p*d,g=-A*f+2*A*p-A*d,m=(1+A)*f+(-1.5-2*A)*p+(-.5+A)*d+1,v=(-1-u)*f+(1.5+u)*p+.5*d,E=u*f-u*p;for(let e=0;e!==s;++e)r[e]=g*a[c+e]+m*a[l+e]+v*a[o+e]+E*a[h+e];return r}}class Zl extends Kl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==s;++e)r[e]=a[l+e]*h+a[o+e]*c;return r}}class $l extends Kl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class ec{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ql(t,this.TimeBufferType),this.values=ql(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ql(e.times,Array),values:ql(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new $l(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Zl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Jl(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case mt:t=this.InterpolantFactoryMethodDiscrete;break;case vt:t=this.InterpolantFactoryMethodLinear;break;case Et:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return mt;case this.InterpolantFactoryMethodLinear:return vt;case this.InterpolantFactoryMethodSmooth:return Et}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&(s=i,ArrayBuffer.isView(s)&&!(s instanceof DataView)))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}var s;return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Et,r=e.length-1;let a=1;for(let s=1;s<r;++s){let r=!1;const o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(i)r=!0;else{const e=s*n,i=e-n,a=e+n;for(let s=0;s!==n;++s){const n=t[e+s];if(n!==t[i+s]||n!==t[a+s]){r=!0;break}}}if(r){if(s!==a){e[a]=e[s];const i=s*n,r=a*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*n,i=a*n,s=0;s!==n;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}ec.prototype.TimeBufferType=Float32Array,ec.prototype.ValueBufferType=Float32Array,ec.prototype.DefaultInterpolation=vt;class tc extends ec{constructor(e,t,n){super(e,t,n)}}tc.prototype.ValueTypeName="bool",tc.prototype.ValueBufferType=Array,tc.prototype.DefaultInterpolation=mt,tc.prototype.InterpolantFactoryMethodLinear=void 0,tc.prototype.InterpolantFactoryMethodSmooth=void 0;class nc extends ec{}nc.prototype.ValueTypeName="color";class ic extends ec{}ic.prototype.ValueTypeName="number";class rc extends Kl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(i-t);let l=e*s;for(let e=l+s;l!==e;l+=4)Bn.slerpFlat(r,0,a,l-s,a,l,o);return r}}class ac extends ec{InterpolantFactoryMethodLinear(e){return new rc(this.times,this.values,this.getValueSize(),e)}}ac.prototype.ValueTypeName="quaternion",ac.prototype.InterpolantFactoryMethodSmooth=void 0;class sc extends ec{constructor(e,t,n){super(e,t,n)}}sc.prototype.ValueTypeName="string",sc.prototype.ValueBufferType=Array,sc.prototype.DefaultInterpolation=mt,sc.prototype.InterpolantFactoryMethodLinear=void 0,sc.prototype.InterpolantFactoryMethodSmooth=void 0;class oc extends ec{}oc.prototype.ValueTypeName="vector";class lc{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=qt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(cc(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(ec.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let e=0;e<r;e++){let s=[],o=[];s.push((e+r-1)%r,e,(e+1)%r),o.push(0,1,0);const l=jl(s);s=Yl(s,1,l),o=Yl(o,1,l),i||0!==s[0]||(s.push(r),o.push(o[0])),a.push(new ic(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=n.name.match(r);if(a&&a.length>1){const e=a[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const a=[];for(const e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],s=[];Xl(n,a,s,i),0!==a.length&&r.push(new e(t,a,s))}},i=[],r=e.name||"default",a=e.fps||30,s=e.blendMode;let o=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],a=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),a.push(i.morphTarget===n?1:0)}i.push(new ic(".morphTargetInfluence["+n+"]",e,a))}o=e.length*a}else{const a=".bones["+t[e].name+"]";n(oc,a+".position",r,"pos",i),n(ac,a+".quaternion",r,"rot",i),n(oc,a+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,o,i,s)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function cc(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ic;case"vector":case"vector2":case"vector3":case"vector4":return oc;case"color":return nc;case"quaternion":return ac;case"bool":case"boolean":return tc;case"string":return sc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Xl(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const hc={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};const Ac=new class{constructor(e,t,n){const i=this;let r,a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===a&&void 0!==i.onStart&&i.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==i.onProgress&&i.onProgress(e,s,o),s===o&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}};class uc{constructor(e){this.manager=void 0!==e?e:Ac,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}uc.DEFAULT_MATERIAL_NAME="__DEFAULT";const dc={};class pc extends Error{constructor(e,t){super(e),this.response=t}}class fc extends uc{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=hc.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==dc[e])return void dc[e].push({onLoad:t,onProgress:n,onError:i});dc[e]=[],dc[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=dc[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a;let o=0;const l=new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:r})=>{if(i)e.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new pc(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,s));case"json":return e.json();default:if(void 0===s)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{hc.add(e,t);const n=dc[e];delete dc[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{const n=dc[e];if(void 0===n)throw this.manager.itemError(e),t;delete dc[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class gc extends uc{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=hc.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const s=sn("img");function o(){c(),hc.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(e),s.src=e,s}}class mc extends uc{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Al,s=new fc(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(e,function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:ke,a.wrapT=void 0!==n.wrapT?n.wrapT:ke,a.magFilter=void 0!==n.magFilter?n.magFilter:We,a.minFilter=void 0!==n.minFilter?n.minFilter:We,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(a.colorSpace=n.colorSpace),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=je),1===n.mipmapCount&&(a.minFilter=We),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,i),a}}class vc extends uc{constructor(e){super(e)}load(e,t,n,i){const r=new In,a=new gc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}class Ec extends Qi{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Xi(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}const bc=new si,Cc=new Tn,_c=new Tn;class Ic{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new tn(512,512),this.map=null,this.mapPass=null,this.matrix=new si,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new na,this._frameExtents=new tn(1,1),this._viewportCount=1,this._viewports=[new xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Cc.setFromMatrixPosition(e.matrixWorld),t.position.copy(Cc),_c.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(_c),t.updateMatrixWorld(),bc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(bc)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class xc extends Ic{constructor(){super(new Wr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*Wt*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class yc extends Ec{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Qi.DEFAULT_UP),this.updateMatrix(),this.target=new Qi,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new xc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const wc=new si,Mc=new Tn,Sc=new Tn;class Bc extends Ic{constructor(){super(new Wr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new tn(4,2),this._viewportCount=6,this._viewports=[new xn(2,1,1,1),new xn(0,1,1,1),new xn(3,1,1,1),new xn(1,1,1,1),new xn(3,0,1,1),new xn(1,0,1,1)],this._cubeDirections=[new Tn(1,0,0),new Tn(-1,0,0),new Tn(0,0,1),new Tn(0,0,-1),new Tn(0,1,0),new Tn(0,-1,0)],this._cubeUps=[new Tn(0,1,0),new Tn(0,1,0),new Tn(0,1,0),new Tn(0,1,0),new Tn(0,0,1),new Tn(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Mc.setFromMatrixPosition(e.matrixWorld),n.position.copy(Mc),Sc.copy(n.position),Sc.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Sc),n.updateMatrixWorld(),i.makeTranslation(-Mc.x,-Mc.y,-Mc.z),wc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(wc)}}class Tc extends Ec{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Bc}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Rc extends Ic{constructor(){super(new va(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Dc extends Ec{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Qi.DEFAULT_UP),this.updateMatrix(),this.target=new Qi,this.shadow=new Rc}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Qc{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Uc extends uc{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=hc.get(e);if(void 0!==a)return r.manager.itemStart(e),a.then?void a.then(n=>{t&&t(n),r.manager.itemEnd(e)}).catch(e=>{i&&i(e)}):(setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a);const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader;const o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){return hc.add(e,n),t&&t(n),r.manager.itemEnd(e),n}).catch(function(t){i&&i(t),hc.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});hc.add(e,o),r.manager.itemStart(e)}}class Lc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Pc(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Pc();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Pc(){return("undefined"==typeof performance?Date:performance).now()}const Nc="\\[\\]\\.:\\/",Fc=new RegExp("["+Nc+"]","g"),Oc="[^"+Nc+"]",kc="[^"+Nc.replace("\\.","")+"]",Gc=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Oc)+/(WCOD+)?/.source.replace("WCOD",kc)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Oc)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Oc)+"$"),Hc=["material","materials","bones","map"];class zc{constructor(e,t,n){this.path=t,this.parsedPath=n||zc.parseTrackName(t),this.node=zc.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new zc.Composite(e,t,n):new zc(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Fc,"")}static parseTrackName(e){const t=Gc.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Hc.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const a=n(r.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=zc.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const a=e[i];if(void 0===a){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}zc.Composite=class{constructor(e,t,n){const i=n||zc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},zc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},zc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},zc.prototype.GetterByBindingType=[zc.prototype._getValue_direct,zc.prototype._getValue_array,zc.prototype._getValue_arrayElement,zc.prototype._getValue_toArray],zc.prototype.SetterByBindingTypeAndVersioning=[[zc.prototype._setValue_direct,zc.prototype._setValue_direct_setNeedsUpdate,zc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[zc.prototype._setValue_array,zc.prototype._setValue_array_setNeedsUpdate,zc.prototype._setValue_array_setMatrixWorldNeedsUpdate],[zc.prototype._setValue_arrayElement,zc.prototype._setValue_arrayElement_setNeedsUpdate,zc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[zc.prototype._setValue_fromArray,zc.prototype._setValue_fromArray_setNeedsUpdate,zc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Vc{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(jt(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ue}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ue);const Wc=["Glasses","Shoes","Watches","Handbags","Rings","Bottles","Bracelets","Scarves","Hats","Necklaces","Earrings"],qc=["Linear","ACES","Neutral"],jc=["none","pan-x","pan-y"];function Yc(e){return Wc.includes(e)}const Xc={Glasses:new Tn(67.5,15,90),Shoes:new Tn(-55,30,30),Watches:new Tn(0,-10,40),Handbags:new Tn(40,0,0),Rings:new Tn(0,0,10),Bottles:new Tn(40,0,0),Bracelets:new Tn(0,0,40),Hats:new Tn(40,0,0),Scarves:new Tn(40,0,0),Necklaces:new Tn(40,0,0),Earrings:new Tn(40,0,0)},Kc="Shoes",Jc=[1e3,2e3,4e3],Zc=Jc.length;function $c(e){return k(this,arguments,void 0,function*(e,t=0){try{return yield e()}catch(n){if(t>=Zc)throw n;return yield new Promise(e=>setTimeout(e,Jc[t])),$c(e,t+1)}})}function eh(e){return`Resource unavailable: ${e}`}function th(){return eh("Network error.")}function nh(){return eh("Request aborted.")}function ih(){return eh("Request timeout.")}function rh(e){return`Resource download failed with status ${e}.`}function ah(e){return`Resource has invalid body: ${e}`}function sh(){return ah("Response is null.")}function oh(){return ah("Response is not an ArrayBuffer.")}function lh(){return ah("Response is empty.")}function ch(e,t){return k(this,void 0,void 0,function*(){return $c(()=>k(this,void 0,void 0,function*(){return new Promise((n,i)=>{const r=new XMLHttpRequest;r.open("GET",e),r.responseType="arraybuffer",r.onprogress=n=>{const i=function(e,t){var n;if(e.lengthComputable&&e.total>0)return e.total;const i=parseInt(null!==(n=t.getResponseHeader("x-amz-meta-content-length"))&&void 0!==n?n:"",10);return i>0?i:null}(n,r);null!=i&&(null==t||t.updateProgress(e,n.loaded,i))},r.onload=()=>{r.status<200||r.status>=300?i(new Error(rh(r.status))):r.response?r.response instanceof ArrayBuffer?0!==r.response.byteLength?n(r.response):i(new Error(lh())):i(new Error(oh())):i(new Error(sh()))},r.onerror=()=>i(new Error(th())),r.onabort=()=>i(new Error(nh())),r.ontimeout=()=>i(new Error(ih())),r.send()})}))})}const hh=[Uint8Array,Uint32Array],Ah=hh.length-2,uh=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","open","requestAnimationFrame","send"],dh=[2,12,7,1],ph=(window[uh[dh[dh[Ah]]]][uh[dh[dh[dh.length-1]]]].charCodeAt(Ah),0),fh=new hh[1]([ph]);function gh(e,t,n,i){return k(this,void 0,void 0,function*(){let r=uh[15].charCodeAt(2)-10,a=uh[5].charCodeAt(6)-14;r>>=1,r+=a;const s=String.fromCharCode,o=s(r-26);a>>=2,r-=a;const l=s(r-18);a|=9,r^=a;const c=`${o}${l}`,h=s(++r);a>>=1,r^=a+2;const A=s(r-3);r^=a+29;const u="object"[(+!+[]+ +!+[])*(+!+[]+ +!+[])+r^114],d=`${h}${A}`,p=s(r-2);a<<=3,r|=a;const f=s(r-3);a^=r+9;const g=s(r+c.length),m="object"[3*+!+[]],v=`${m}${p}${g}`,E=s(a+6),b=`${u}${u}${f}${E}`,C=s(r),_=`${m}${C}${u}`;a>>=1,r-=a;const I=s(r-6);a-=7,r^=a;const x=`${I}${s(r-13)}`,y=s(r+x.length);r+=a;const w=s(r+1),M="object"[+!+[]-+!+[]];a++;const S=s(r-(a>>3)+1),B=`${M}${S}`,T=`${w}${m}${C}${f}`;a-=T.length,r+=a>>2;const R=s(r+1),D=`${y}${R}${f}`;a>>=1,r-=a;const Q=s(r-T.length),U=`${g}${Q}${Q}${m}${w}`;a-=U.length,r-=a;const L=s(r+1),P=s(r),N=`${P}${u}`;a+=r>>2,r-=a;const F=s(r+2),O=s(r+1),G=`${w}${P}${R}`,H=`${m}${w}${w}`,z=`${M}${g}${u}`;r^=a+U.length;const V=s(r+3),W=r-2<<1,q=(a<<3)+(36&r),j=yield $c(()=>k(this,void 0,void 0,function*(){return new Promise((t,n)=>{const r=new window[`${d}${c}${b}${v}${_}`];r[uh[14]](`${x}${y}`,e),r[`${T}${B}${C}${m}${D}${m}`]=`${P}${w}${G}${L}${U}`,r[`${B}${f}${w}${M}g${w}${m}${C}${C}`]=t=>{const n=t[`${u}${M}${u}${P}l`];t[`l${m}${S}g${u}hC${M}m${f}${g}${u}${P}${L}l${m}`]&&n>0&&(null==i||i[`${g}${f}d${N}${m}P${w}${M}g${w}${m}s${C}`](e,t[`l${M}${P}d${m}d`],n))},r[`${B}l${M}${P}d`]=()=>{const e=r[`${C}${u}${N}${g}${C}`];if(e<W||e>=q)return void n(new Error(rh(e)));const i=r[`${T}${B}${C}${m}`];i?i instanceof window[`${O}${w}${G}${F}${U}`]?0!==i[`${L}${R}${u}${m}${o}${m}${S}g${u}h`]?t(new hh[0](i)):n(new Error(lh())):n(new Error(oh())):n(new Error(sh()))},r[`${B}${H}${M}${w}`]=()=>n(new Error(th())),r[`${B}${P}${L}${M}${w}${u}`]=()=>n(new Error(nh())),r[`${B}${u}${V}m${m}${z}`]=()=>n(new Error(ih())),r[uh[16]]()})}));n+=a;const Y=j[`${L}${R}${u}${m}${o}${m}${S}g${u}h`];if(fh[ph]=Math.min(76,t)*((r>>5)-1),152===fh[ph]&&(fh[ph]=Y),n==ph)return j;n=ph,n^=ph;for(let e=0,t=j.length;e<t;e++)fh[ph]^=fh[n]<<13,fh[ph]^=fh[n]>>17,fh[ph]^=fh[n]<<5,j[e]=j[e]^fh[ph];return n^=fh[0],n^=fh[1],n^=fh[2],j})}const mh={},vh={};function Eh(e,t,n){return n?(null==mh[e]&&(mh[e]=ch(e,t).catch(t=>{throw delete mh[e],t}).finally(()=>{t.completeTask(e)})),mh[e]):ch(e,t).finally(()=>{t.completeTask(e)})}function bh(e,t,n,i,r){return r?(null==vh[e]&&(vh[e]=gh(e,t,n,i).catch(t=>{throw delete vh[e],t}).finally(()=>{i.completeTask(e)})),vh[e]):gh(e,t,n,i).finally(()=>{i.completeTask(e)})}var Ch,_h,Ih,xh,yh;class wh{constructor(){Ch.add(this),_h.set(this,new Map),Ih.set(this,null),xh.set(this,0)}setOnProgress(e){H(this,Ih,e)}updateProgress(e,t,n){const i=G(this,_h,"f").get(e);(null==i?void 0:i.completed)||(i?(i.loaded=t,i.total=n):G(this,_h,"f").set(e,{loaded:t,total:n,completed:!1}),G(this,Ch,"m",yh).call(this))}completeTask(e){const t=G(this,_h,"f").get(e);t&&(t.loaded=t.total,t.completed=!0),G(this,Ch,"m",yh).call(this)}}_h=new WeakMap,Ih=new WeakMap,xh=new WeakMap,Ch=new WeakSet,yh=function(){if(null==G(this,Ih,"f"))return;let e=0,t=0,n=!0;for(const i of G(this,_h,"f").values())e+=i.loaded,t+=i.total,i.completed||(n=!1);if(G(this,_h,"f").size>0&&n)return G(this,_h,"f").clear(),H(this,xh,0),void G(this,Ih,"f").call(this,1);const i=t>0?Math.min(e/t,1):0;H(this,xh,Math.max(G(this,xh,"f"),i)),G(this,Ih,"f").call(this,G(this,xh,"f"))};class Mh extends mc{constructor(e){super(e),this.type=Ze}parse(e){const t=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},n=function(e,t,n){t=t||1024;let i=e.pos,r=-1,a=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));for(;0>(r=o.indexOf("\n"))&&a<t&&i<e.byteLength;)s+=o,a+=o.length,i+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return-1<r&&(e.pos+=a+r+1,s+o.slice(0,r))},i=function(e,t,n,i){const r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=e[t+0]*a,n[i+1]=e[t+1]*a,n[i+2]=e[t+2]*a,n[i+3]=1},r=function(e,t,n,i){const r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=tr(Math.min(e[t+0]*a,65504)),n[i+1]=tr(Math.min(e[t+1]*a,65504)),n[i+2]=tr(Math.min(e[t+2]*a,65504)),n[i+3]=tr(1)},a=new Uint8Array(e);a.pos=0;const s=function(e){const i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;for((e.pos>=e.byteLength||!(l=n(e)))&&t(1,"no header found"),(c=l.match(/^#\?(\S+)/))||t(3,"bad initial token"),o.valid|=1,o.programtype=c[1],o.string+=l+"\n";l=n(e),!1!==l;)if(o.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(i))&&(o.gamma=parseFloat(c[1])),(c=l.match(r))&&(o.exposure=parseFloat(c[1])),(c=l.match(a))&&(o.valid|=2,o.format=c[1]),(c=l.match(s))&&(o.valid|=4,o.height=parseInt(c[1],10),o.width=parseInt(c[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=l+"\n";return 2&o.valid||t(3,"missing format specifier"),4&o.valid||t(3,"missing image size specifier"),o}(a),o=s.width,l=s.height,c=function(e,n,i){const r=n;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");const a=new Uint8Array(4*n*i);a.length||t(4,"unable to allocate buffer space");let s=0,o=0;const l=4*r,c=new Uint8Array(4),h=new Uint8Array(l);let A=i;for(;A>0&&o<e.byteLength;){o+4>e.byteLength&&t(1),c[0]=e[o++],c[1]=e[o++],c[2]=e[o++],c[3]=e[o++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||t(3,"bad rgbe scanline format");let n,i=0;for(;i<l&&o<e.byteLength;){n=e[o++];const r=n>128;if(r&&(n-=128),(0===n||i+n>l)&&t(3,"bad scanline data"),r){const t=e[o++];for(let e=0;e<n;e++)h[i++]=t}else h.set(e.subarray(o,o+n),i),i+=n,o+=n}const u=r;for(let e=0;e<u;e++){let t=0;a[s]=h[e+t],t+=r,a[s+1]=h[e+t],t+=r,a[s+2]=h[e+t],t+=r,a[s+3]=h[e+t],s+=4}A--}return a}(a.subarray(a.pos),o,l);let h,A,u;switch(this.type){case Je:u=c.length/4;const e=new Float32Array(4*u);for(let t=0;t<u;t++)i(c,4*t,e,4*t);h=e,A=Je;break;case Ze:u=c.length/4;const t=new Uint16Array(4*u);for(let e=0;e<u;e++)r(c,4*e,t,4*e);h=t,A=Ze;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:o,height:l,data:h,header:s.string,gamma:s.gamma,exposure:s.exposure,type:A}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){switch(e.type){case Je:case Ze:e.colorSpace=_t,e.minFilter=We,e.magFilter=We,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,n)},n,i)}}
6
+ */const ue="166dev",de=0,pe=1,fe=2,ge=100,me=101,ve=102,Ee=200,be=201,Ce=202,_e=203,Ie=204,xe=205,ye=206,Me=207,we=208,Se=209,Be=210,Te=211,Re=212,De=213,Qe=214,Le="attached",Ue=301,Pe=302,Ne=303,Fe=306,Oe=1e3,ke=1001,Ge=1002,He=1003,ze=1004,Ve=1005,We=1006,qe=1007,je=1008,Ye=1009,Xe=1012,Ke=1014,Je=1015,Ze=1016,$e=1020,et=1023,tt=1026,nt=1027,it=1028,rt=1030,at=33776,ot=33777,st=33778,lt=33779,ct=35840,ht=35842,At=36196,ut=37492,dt=37496,pt=37808,ft=37812,gt=36492,mt=2300,vt=2301,Et=2302,bt="",Ct="srgb",_t="srgb-linear",It="display-p3",xt="display-p3-linear",yt="linear",Mt="srgb",wt="rec709",St="p3",Bt=7680,Tt=512,Rt=513,Dt=514,Qt=515,Lt=516,Ut=517,Pt=518,Nt=519,Ft=35044,Ot="300 es",kt=2e3,Gt=2001;class Ht{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t<i;t++)n[t].call(this,e);e.target=null}}}const zt=["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"];const Vt=Math.PI/180,Wt=180/Math.PI;function qt(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(zt[255&e]+zt[e>>8&255]+zt[e>>16&255]+zt[e>>24&255]+"-"+zt[255&t]+zt[t>>8&255]+"-"+zt[t>>16&15|64]+zt[t>>24&255]+"-"+zt[63&n|128]+zt[n>>8&255]+"-"+zt[n>>16&255]+zt[n>>24&255]+zt[255&i]+zt[i>>8&255]+zt[i>>16&255]+zt[i>>24&255]).toLowerCase()}function jt(e,t,n){return Math.max(t,Math.min(n,e))}function Yt(e,t){return(e%t+t)%t}function Xt(e,t,n){return(1-n)*e+n*t}function Kt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Jt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Zt=Vt,$t=Wt,en=function(e){return e*Wt};class tn{constructor(e=0,t=0){tn.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class nn{constructor(e,t,n,i,r,a,o,s,l){nn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,o,s,l)}set(e,t,n,i,r,a,o,s,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],h=n[7],A=n[2],u=n[5],d=n[8],p=i[0],f=i[3],g=i[6],m=i[1],v=i[4],E=i[7],b=i[2],C=i[5],_=i[8];return r[0]=a*p+o*m+s*b,r[3]=a*f+o*v+s*C,r[6]=a*g+o*E+s*_,r[1]=l*p+c*m+h*b,r[4]=l*f+c*v+h*C,r[7]=l*g+c*E+h*_,r[2]=A*p+u*m+d*b,r[5]=A*f+u*v+d*C,r[8]=A*g+u*E+d*_,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*r*c+n*o*s+i*r*l-i*a*s}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],h=c*a-o*l,A=o*s-c*r,u=l*r-a*s,d=t*h+n*A+i*u;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const p=1/d;return e[0]=h*p,e[1]=(i*l-c*n)*p,e[2]=(o*n-i*a)*p,e[3]=A*p,e[4]=(c*t-i*s)*p,e[5]=(i*r-o*t)*p,e[6]=u*p,e[7]=(n*s-l*t)*p,e[8]=(a*t-n*r)*p,this}transpose(){let e;const 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){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,o){const s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(rn.makeScale(e,t)),this}rotate(e){return this.premultiply(rn.makeRotation(-e)),this}translate(e,t){return this.premultiply(rn.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){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const rn=new nn;function an(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function on(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function sn(){const e=on("canvas");return e.style.display="block",e}const ln={};function cn(e){e in ln||(ln[e]=!0,console.warn(e))}const hn=(new nn).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),An=(new nn).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),un={[_t]:{transfer:yt,primaries:wt,toReference:e=>e,fromReference:e=>e},[Ct]:{transfer:Mt,primaries:wt,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[xt]:{transfer:yt,primaries:St,toReference:e=>e.applyMatrix3(An),fromReference:e=>e.applyMatrix3(hn)},[It]:{transfer:Mt,primaries:St,toReference:e=>e.convertSRGBToLinear().applyMatrix3(An),fromReference:e=>e.applyMatrix3(hn).convertLinearToSRGB()}},dn=new Set([_t,xt]),pn={enabled:!0,_workingColorSpace:_t,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!dn.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=un[t].toReference;return(0,un[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return un[e].primaries},getTransfer:function(e){return e===bt?yt:un[e].transfer}};function fn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function gn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let mn;class vn{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===mn&&(mn=on("canvas")),mn.width=e.width,mn.height=e.height;const n=mn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=mn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=on("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*fn(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*fn(t[e]/255)):t[e]=fn(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let En=0;class bn{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:En++}),this.uuid=qt(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(Cn(i[t].image)):e.push(Cn(i[t]))}else e=Cn(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function Cn(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?vn.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let _n=0;class In extends Ht{constructor(e=In.DEFAULT_IMAGE,t=In.DEFAULT_MAPPING,n=ke,i=ke,r=We,a=1008,o=1023,s=1009,l=In.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:_n++}),this.uuid=qt(),this.name="",this.source=new bn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=s,this.offset=new tn(0,0),this.repeat=new tn(1,1),this.center=new tn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Oe:e.x=e.x-Math.floor(e.x);break;case ke:e.x=e.x<0?0:1;break;case Ge:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Oe:e.y=e.y-Math.floor(e.y);break;case ke:e.y=e.y<0?0:1;break;case Ge:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}In.DEFAULT_IMAGE=null,In.DEFAULT_MAPPING=300,In.DEFAULT_ANISOTROPY=1;class xn{constructor(e=0,t=0,n=0,i=1){xn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const a=.01,o=.1,s=e.elements,l=s[0],c=s[4],h=s[8],A=s[1],u=s[5],d=s[9],p=s[2],f=s[6],g=s[10];if(Math.abs(c-A)<a&&Math.abs(h-p)<a&&Math.abs(d-f)<a){if(Math.abs(c+A)<o&&Math.abs(h+p)<o&&Math.abs(d+f)<o&&Math.abs(l+u+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,s=(u+1)/2,m=(g+1)/2,v=(c+A)/4,E=(h+p)/4,b=(d+f)/4;return e>s&&e>m?e<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=v/n,r=E/n):s>m?s<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(s),n=v/i,r=b/i):m<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=E/r,i=b/r),this.set(n,i,r,t),this}let m=Math.sqrt((f-d)*(f-d)+(h-p)*(h-p)+(A-c)*(A-c));return Math.abs(m)<.001&&(m=1),this.x=(f-d)/m,this.y=(h-p)/m,this.z=(A-c)/m,this.w=Math.acos((l+u+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class yn extends Ht{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:We,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new In(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let e=0;e<a;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new bn(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Mn extends yn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class wn extends In{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=He,this.minFilter=He,this.wrapR=ke,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Sn extends In{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=He,this.minFilter=He,this.wrapR=ke,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Bn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,o){let s=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const A=r[a+0],u=r[a+1],d=r[a+2],p=r[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=A,e[t+1]=u,e[t+2]=d,void(e[t+3]=p);if(h!==p||s!==A||l!==u||c!==d){let e=1-o;const t=s*A+l*u+c*d+h*p,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,o=Math.sin(o*a)/r}const r=o*n;if(s=s*e+A*r,l=l*e+u*r,c=c*e+d*r,h=h*e+p*r,e===1-o){const e=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=e,l*=e,c*=e,h*=e}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,a){const o=n[i],s=n[i+1],l=n[i+2],c=n[i+3],h=r[a],A=r[a+1],u=r[a+2],d=r[a+3];return e[t]=o*d+c*h+s*u-l*A,e[t+1]=s*d+c*A+l*h-o*u,e[t+2]=l*d+c*u+o*A-s*h,e[t+3]=c*d-o*h-s*A-l*u,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),A=s(n/2),u=s(i/2),d=s(r/2);switch(a){case"XYZ":this._x=A*c*h+l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h-A*u*d;break;case"YXZ":this._x=A*c*h+l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h+A*u*d;break;case"ZXY":this._x=A*c*h-l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h-A*u*d;break;case"ZYX":this._x=A*c*h-l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h+A*u*d;break;case"YZX":this._x=A*c*h+l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h-A*u*d;break;case"XZY":this._x=A*c*h-l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h+A*u*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],c=t[6],h=t[10],A=n+o+h;if(A>0){const e=.5/Math.sqrt(A+1);this._w=.25/e,this._x=(c-s)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-s)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(s+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(s+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(jt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const s=1-o*o;if(s<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,A=Math.sin(t*c)/l;return this._w=a*h+this._w*A,this._x=n*h+this._x*A,this._y=i*h+this._y*A,this._z=r*h+this._z*A,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Tn{constructor(e=0,t=0,n=0){Tn.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Dn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Dn.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=2*(a*i-o*n),c=2*(o*t-r*i),h=2*(r*n-a*t);return this.x=t+s*l+a*h-o*c,this.y=n+s*c+o*l-r*h,this.z=i+s*h+r*c-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Rn.copy(this).projectOnVector(e),this.sub(Rn)}reflect(e){return this.sub(Rn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,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(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Rn=new Tn,Dn=new Bn;class Qn{constructor(e=new Tn(1/0,1/0,1/0),t=new Tn(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Un.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Un.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Un.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Un):Un.fromBufferAttribute(i,t),Un.applyMatrix4(e.matrixWorld),this.expandByPoint(Un);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Pn.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),Pn.copy(n.boundingBox)),Pn.applyMatrix4(e.matrixWorld),this.union(Pn)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],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,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(zn),Vn.subVectors(this.max,zn),Nn.subVectors(e.a,zn),Fn.subVectors(e.b,zn),On.subVectors(e.c,zn),kn.subVectors(Fn,Nn),Gn.subVectors(On,Fn),Hn.subVectors(Nn,On);let t=[0,-kn.z,kn.y,0,-Gn.z,Gn.y,0,-Hn.z,Hn.y,kn.z,0,-kn.x,Gn.z,0,-Gn.x,Hn.z,0,-Hn.x,-kn.y,kn.x,0,-Gn.y,Gn.x,0,-Hn.y,Hn.x,0];return!!jn(t,Nn,Fn,On,Vn)&&(t=[1,0,0,0,1,0,0,0,1],!!jn(t,Nn,Fn,On,Vn)&&(Wn.crossVectors(kn,Gn),t=[Wn.x,Wn.y,Wn.z],jn(t,Nn,Fn,On,Vn)))}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=.5*this.getSize(Un).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ln)),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)}}const Ln=[new Tn,new Tn,new Tn,new Tn,new Tn,new Tn,new Tn,new Tn],Un=new Tn,Pn=new Qn,Nn=new Tn,Fn=new Tn,On=new Tn,kn=new Tn,Gn=new Tn,Hn=new Tn,zn=new Tn,Vn=new Tn,Wn=new Tn,qn=new Tn;function jn(e,t,n,i,r){for(let a=0,o=e.length-3;a<=o;a+=3){qn.fromArray(e,a);const o=r.x*Math.abs(qn.x)+r.y*Math.abs(qn.y)+r.z*Math.abs(qn.z),s=t.dot(qn),l=n.dot(qn),c=i.dot(qn);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>o)return!1}return!0}const Yn=new Qn,Xn=new Tn,Kn=new Tn;class Jn{constructor(e=new Tn,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){const n=this.center;void 0!==t?n.copy(t):Yn.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const 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){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Xn.subVectors(e,this.center);const t=Xn.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Xn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Kn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xn.copy(e.center).add(Kn)),this.expandByPoint(Xn.copy(e.center).sub(Kn))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Zn=new Tn,$n=new Tn,ei=new Tn,ti=new Tn,ni=new Tn,ii=new Tn,ri=new Tn;class ai{constructor(e=new Tn,t=new Tn(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Zn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Zn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zn.copy(this.origin).addScaledVector(this.direction,t),Zn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){$n.copy(e).add(t).multiplyScalar(.5),ei.copy(t).sub(e).normalize(),ti.copy(this.origin).sub($n);const r=.5*e.distanceTo(t),a=-this.direction.dot(ei),o=ti.dot(this.direction),s=-ti.dot(ei),l=ti.lengthSq(),c=Math.abs(1-a*a);let h,A,u,d;if(c>0)if(h=a*s-o,A=a*o-s,d=r*c,h>=0)if(A>=-d)if(A<=d){const e=1/c;h*=e,A*=e,u=h*(h+a*A+2*o)+A*(a*h+A+2*s)+l}else A=r,h=Math.max(0,-(a*A+o)),u=-h*h+A*(A+2*s)+l;else A=-r,h=Math.max(0,-(a*A+o)),u=-h*h+A*(A+2*s)+l;else A<=-d?(h=Math.max(0,-(-a*r+o)),A=h>0?-r:Math.min(Math.max(-r,-s),r),u=-h*h+A*(A+2*s)+l):A<=d?(h=0,A=Math.min(Math.max(-r,-s),r),u=A*(A+2*s)+l):(h=Math.max(0,-(a*r+o)),A=h>0?r:Math.min(Math.max(-r,-s),r),u=-h*h+A*(A+2*s)+l);else A=a>0?-r:r,h=Math.max(0,-(a*A+o)),u=-h*h+A*(A+2*s)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy($n).addScaledVector(ei,A),u}intersectSphere(e,t){Zn.subVectors(e.center,this.origin);const n=Zn.dot(this.direction),i=Zn.dot(Zn)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,s;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,A=this.origin;return l>=0?(n=(e.min.x-A.x)*l,i=(e.max.x-A.x)*l):(n=(e.max.x-A.x)*l,i=(e.min.x-A.x)*l),c>=0?(r=(e.min.y-A.y)*c,a=(e.max.y-A.y)*c):(r=(e.max.y-A.y)*c,a=(e.min.y-A.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-A.z)*h,s=(e.max.z-A.z)*h):(o=(e.max.z-A.z)*h,s=(e.min.z-A.z)*h),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Zn)}intersectTriangle(e,t,n,i,r){ni.subVectors(t,e),ii.subVectors(n,e),ri.crossVectors(ni,ii);let a,o=this.direction.dot(ri);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}ti.subVectors(this.origin,e);const s=a*this.direction.dot(ii.crossVectors(ti,ii));if(s<0)return null;const l=a*this.direction.dot(ni.cross(ti));if(l<0)return null;if(s+l>o)return null;const c=-a*ti.dot(ri);return c<0?null:this.at(c/o,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)}}class oi{constructor(e,t,n,i,r,a,o,s,l,c,h,A,u,d,p,f){oi.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,o,s,l,c,h,A,u,d,p,f)}set(e,t,n,i,r,a,o,s,l,c,h,A,u,d,p,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=l,g[6]=c,g[10]=h,g[14]=A,g[3]=u,g[7]=d,g[11]=p,g[15]=f,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 oi).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/si.setFromMatrixColumn(e,0).length(),r=1/si.setFromMatrixColumn(e,1).length(),a=1/si.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=a*c,n=a*h,i=o*c,r=o*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*s,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*s}else if("YXZ"===e.order){const e=s*c,n=s*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=a*s}else if("ZXY"===e.order){const e=s*c,n=s*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-a*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=a*c,t[9]=r-e*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){const e=a*c,n=a*h,i=o*c,r=o*h;t[0]=s*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=s*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){const e=a*s,n=a*l,i=o*s,r=o*l;t[0]=s*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=a*s,n=a*l,i=o*s,r=o*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ci,e,hi)}lookAt(e,t,n){const i=this.elements;return di.subVectors(e,t),0===di.lengthSq()&&(di.z=1),di.normalize(),Ai.crossVectors(n,di),0===Ai.lengthSq()&&(1===Math.abs(n.z)?di.x+=1e-4:di.z+=1e-4,di.normalize(),Ai.crossVectors(n,di)),Ai.normalize(),ui.crossVectors(di,Ai),i[0]=Ai.x,i[4]=ui.x,i[8]=di.x,i[1]=Ai.y,i[5]=ui.y,i[9]=di.y,i[2]=Ai.z,i[6]=ui.z,i[10]=di.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],h=n[5],A=n[9],u=n[13],d=n[2],p=n[6],f=n[10],g=n[14],m=n[3],v=n[7],E=n[11],b=n[15],C=i[0],_=i[4],I=i[8],x=i[12],y=i[1],M=i[5],w=i[9],S=i[13],B=i[2],T=i[6],R=i[10],D=i[14],Q=i[3],L=i[7],U=i[11],P=i[15];return r[0]=a*C+o*y+s*B+l*Q,r[4]=a*_+o*M+s*T+l*L,r[8]=a*I+o*w+s*R+l*U,r[12]=a*x+o*S+s*D+l*P,r[1]=c*C+h*y+A*B+u*Q,r[5]=c*_+h*M+A*T+u*L,r[9]=c*I+h*w+A*R+u*U,r[13]=c*x+h*S+A*D+u*P,r[2]=d*C+p*y+f*B+g*Q,r[6]=d*_+p*M+f*T+g*L,r[10]=d*I+p*w+f*R+g*U,r[14]=d*x+p*S+f*D+g*P,r[3]=m*C+v*y+E*B+b*Q,r[7]=m*_+v*M+E*T+b*L,r[11]=m*I+v*w+E*R+b*U,r[15]=m*x+v*S+E*D+b*P,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],h=e[6],A=e[10],u=e[14];return e[3]*(+r*s*h-i*l*h-r*o*A+n*l*A+i*o*u-n*s*u)+e[7]*(+t*s*u-t*l*A+r*a*A-i*a*u+i*l*c-r*s*c)+e[11]*(+t*l*h-t*o*u-r*a*h+n*a*u+r*o*c-n*l*c)+e[15]*(-i*o*c-t*s*h+t*o*A+i*a*h-n*a*A+n*s*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],h=e[9],A=e[10],u=e[11],d=e[12],p=e[13],f=e[14],g=e[15],m=h*f*l-p*A*l+p*s*u-o*f*u-h*s*g+o*A*g,v=d*A*l-c*f*l-d*s*u+a*f*u+c*s*g-a*A*g,E=c*p*l-d*h*l+d*o*u-a*p*u-c*o*g+a*h*g,b=d*h*s-c*p*s-d*o*A+a*p*A+c*o*f-a*h*f,C=t*m+n*v+i*E+r*b;if(0===C)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/C;return e[0]=m*_,e[1]=(p*A*r-h*f*r-p*i*u+n*f*u+h*i*g-n*A*g)*_,e[2]=(o*f*r-p*s*r+p*i*l-n*f*l-o*i*g+n*s*g)*_,e[3]=(h*s*r-o*A*r-h*i*l+n*A*l+o*i*u-n*s*u)*_,e[4]=v*_,e[5]=(c*f*r-d*A*r+d*i*u-t*f*u-c*i*g+t*A*g)*_,e[6]=(d*s*r-a*f*r-d*i*l+t*f*l+a*i*g-t*s*g)*_,e[7]=(a*A*r-c*s*r+c*i*l-t*A*l-a*i*u+t*s*u)*_,e[8]=E*_,e[9]=(d*h*r-c*p*r-d*n*u+t*p*u+c*n*g-t*h*g)*_,e[10]=(a*p*r-d*o*r+d*n*l-t*p*l-a*n*g+t*o*g)*_,e[11]=(c*o*r-a*h*r-c*n*l+t*h*l+a*n*u-t*o*u)*_,e[12]=b*_,e[13]=(c*p*i-d*h*i+d*n*A-t*p*A-c*n*f+t*h*f)*_,e[14]=(d*o*i-a*p*i-d*n*s+t*p*s+a*n*f-t*o*f)*_,e[15]=(a*h*i-c*o*i+c*n*s-t*h*s-a*n*A+t*o*A)*_,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,c=a+a,h=o+o,A=r*l,u=r*c,d=r*h,p=a*c,f=a*h,g=o*h,m=s*l,v=s*c,E=s*h,b=n.x,C=n.y,_=n.z;return i[0]=(1-(p+g))*b,i[1]=(u+E)*b,i[2]=(d-v)*b,i[3]=0,i[4]=(u-E)*C,i[5]=(1-(A+g))*C,i[6]=(f+m)*C,i[7]=0,i[8]=(d+v)*_,i[9]=(f-m)*_,i[10]=(1-(A+p))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=si.set(i[0],i[1],i[2]).length();const a=si.set(i[4],i[5],i[6]).length(),o=si.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],li.copy(this);const s=1/r,l=1/a,c=1/o;return li.elements[0]*=s,li.elements[1]*=s,li.elements[2]*=s,li.elements[4]*=l,li.elements[5]*=l,li.elements[6]*=l,li.elements[8]*=c,li.elements[9]*=c,li.elements[10]*=c,t.setFromRotationMatrix(li),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,r,a,o=2e3){const s=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),A=(n+i)/(n-i);let u,d;if(o===kt)u=-(a+r)/(a-r),d=-2*a*r/(a-r);else{if(o!==Gt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);u=-a/(a-r),d=-a*r/(a-r)}return s[0]=l,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=c,s[9]=A,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=2e3){const s=this.elements,l=1/(t-e),c=1/(n-i),h=1/(a-r),A=(t+e)*l,u=(n+i)*c;let d,p;if(o===kt)d=(a+r)*h,p=-2*h;else{if(o!==Gt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);d=r*h,p=-1*h}return s[0]=2*l,s[4]=0,s[8]=0,s[12]=-A,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=p,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const si=new Tn,li=new oi,ci=new Tn(0,0,0),hi=new Tn(1,1,1),Ai=new Tn,ui=new Tn,di=new Tn,pi=new oi,fi=new Bn;class gi{constructor(e=0,t=0,n=0,i=gi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],a=i[4],o=i[8],s=i[1],l=i[5],c=i[9],h=i[2],A=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(jt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(A,l),this._z=0);break;case"YXZ":this._x=Math.asin(-jt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(jt(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-jt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(A,u),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(jt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(A,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return pi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(pi,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fi.setFromEuler(this),this.setFromQuaternion(fi,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(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}}gi.DEFAULT_ORDER="XYZ";class mi{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return!!(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let vi=0;const Ei=new Tn,bi=new Bn,Ci=new oi,_i=new Tn,Ii=new Tn,xi=new Tn,yi=new Bn,Mi=new Tn(1,0,0),wi=new Tn(0,1,0),Si=new Tn(0,0,1),Bi={type:"added"},Ti={type:"removed"},Ri={type:"childadded",child:null},Di={type:"childremoved",child:null};class Qi extends Ht{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:vi++}),this.uuid=qt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Qi.DEFAULT_UP.clone();const e=new Tn,t=new gi,n=new Bn,i=new Tn(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new oi},normalMatrix:{value:new nn}}),this.matrix=new oi,this.matrixWorld=new oi,this.matrixWorldInv=new oi,this.offsetMatrix=(new oi).identity(),this.offsetMatrixInv=(new oi).identity(),this.center=new Tn,this.centerOffset=new Tn,this.modelOffsetMatrix=(new oi).identity(),this.modelOffsetMatrixInv=(new oi).identity(),this.matrixAutoUpdate=Qi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Qi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new mi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return bi.setFromAxisAngle(e,t),this.quaternion.multiply(bi),this}rotateOnWorldAxis(e,t){return bi.setFromAxisAngle(e,t),this.quaternion.premultiply(bi),this}rotateX(e){return this.rotateOnAxis(Mi,e)}rotateY(e){return this.rotateOnAxis(wi,e)}rotateZ(e){return this.rotateOnAxis(Si,e)}translateOnAxis(e,t){return Ei.copy(e).applyQuaternion(this.quaternion),this.position.add(Ei.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Mi,e)}translateY(e){return this.translateOnAxis(wi,e)}translateZ(e){return this.translateOnAxis(Si,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ci.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?_i.copy(e):_i.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ii.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ci.lookAt(Ii,_i,this.up):Ci.lookAt(_i,Ii,this.up),this.quaternion.setFromRotationMatrix(Ci),i&&(Ci.extractRotation(i.matrixWorld),bi.setFromRotationMatrix(Ci),this.quaternion.premultiply(bi.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Bi),Ri.child=e,this.dispatchEvent(Ri),Ri.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ti),Di.child=e,this.dispatchEvent(Di),Di.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ci.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Ci.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ci),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Bi),Ri.child=e,this.dispatchEvent(Ri),Ri.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ii,e,xi),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ii,yi,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?(this.matrixWorld.copy(this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert()):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert())),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?(this.matrixWorld.copy(this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert()):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert())),this.modelOffsetMatrix.copy(this.matrixWorld).multiply(this.offsetMatrix),this.modelOffsetMatrixInv.copy(this.modelOffsetMatrix).invert(),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=a(e.geometries),i=a(e.materials),r=a(e.textures),o=a(e.images),s=a(e.shapes),l=a(e.skeletons),c=a(e.animations),h=a(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixWorldInv.copy(e.matrixWorldInv),this.offsetMatrix.copy(e.offsetMatrix),this.offsetMatrixInv.copy(e.offsetMatrixInv),this.center.copy(e.center),this.centerOffset.copy(e.centerOffset),this.modelOffsetMatrix.copy(e.modelOffsetMatrix),this.modelOffsetMatrixInv.copy(e.modelOffsetMatrixInv),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}Qi.DEFAULT_UP=new Tn(0,1,0),Qi.DEFAULT_MATRIX_AUTO_UPDATE=!0,Qi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Li=new Tn,Ui=new Tn,Pi=new Tn,Ni=new Tn,Fi=new Tn,Oi=new Tn,ki=new Tn,Gi=new Tn,Hi=new Tn,zi=new Tn;class Vi{constructor(e=new Tn,t=new Tn,n=new Tn){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Li.subVectors(e,t),i.cross(Li);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Li.subVectors(i,t),Ui.subVectors(n,t),Pi.subVectors(e,t);const a=Li.dot(Li),o=Li.dot(Ui),s=Li.dot(Pi),l=Ui.dot(Ui),c=Ui.dot(Pi),h=a*l-o*o;if(0===h)return r.set(0,0,0),null;const A=1/h,u=(l*s-o*c)*A,d=(a*c-o*s)*A;return r.set(1-u-d,d,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Ni)&&Ni.x>=0&&Ni.y>=0&&Ni.x+Ni.y<=1}static getInterpolation(e,t,n,i,r,a,o,s){return null===this.getBarycoord(e,t,n,i,Ni)?(s.x=0,s.y=0,"z"in s&&(s.z=0),"w"in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(r,Ni.x),s.addScaledVector(a,Ni.y),s.addScaledVector(o,Ni.z),s)}static isFrontFacing(e,t,n,i){return Li.subVectors(n,t),Ui.subVectors(e,t),Li.cross(Ui).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Li.subVectors(this.c,this.b),Ui.subVectors(this.a,this.b),.5*Li.cross(Ui).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Vi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Vi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Vi.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Vi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Vi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,o;Fi.subVectors(i,n),Oi.subVectors(r,n),Gi.subVectors(e,n);const s=Fi.dot(Gi),l=Oi.dot(Gi);if(s<=0&&l<=0)return t.copy(n);Hi.subVectors(e,i);const c=Fi.dot(Hi),h=Oi.dot(Hi);if(c>=0&&h<=c)return t.copy(i);const A=s*h-c*l;if(A<=0&&s>=0&&c<=0)return a=s/(s-c),t.copy(n).addScaledVector(Fi,a);zi.subVectors(e,r);const u=Fi.dot(zi),d=Oi.dot(zi);if(d>=0&&u<=d)return t.copy(r);const p=u*l-s*d;if(p<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(n).addScaledVector(Oi,o);const f=c*d-u*h;if(f<=0&&h-c>=0&&u-d>=0)return ki.subVectors(r,i),o=(h-c)/(h-c+(u-d)),t.copy(i).addScaledVector(ki,o);const g=1/(f+p+A);return a=p*g,o=A*g,t.copy(n).addScaledVector(Fi,a).addScaledVector(Oi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Wi={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},qi={h:0,s:0,l:0},ji={h:0,s:0,l:0};function Yi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class Xi{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ct){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,pn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=pn.workingColorSpace){return this.r=e,this.g=t,this.b=n,pn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=pn.workingColorSpace){if(e=Yt(e,1),t=jt(t,0,1),n=jt(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Yi(r,i,e+1/3),this.g=Yi(r,i,e),this.b=Yi(r,i,e-1/3)}return pn.toWorkingColorSpace(this,i),this}setStyle(e,t=Ct){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ct){const n=Wi[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fn(e.r),this.g=fn(e.g),this.b=fn(e.b),this}copyLinearToSRGB(e){return this.r=gn(e.r),this.g=gn(e.g),this.b=gn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ct){return pn.fromWorkingColorSpace(Ki.copy(this),e),65536*Math.round(jt(255*Ki.r,0,255))+256*Math.round(jt(255*Ki.g,0,255))+Math.round(jt(255*Ki.b,0,255))}getHexString(e=Ct){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=pn.workingColorSpace){pn.fromWorkingColorSpace(Ki.copy(this),t);const n=Ki.r,i=Ki.g,r=Ki.b,a=Math.max(n,i,r),o=Math.min(n,i,r);let s,l;const c=(o+a)/2;if(o===a)s=0,l=0;else{const e=a-o;switch(l=c<=.5?e/(a+o):e/(2-a-o),a){case n:s=(i-r)/e+(i<r?6:0);break;case i:s=(r-n)/e+2;break;case r:s=(n-i)/e+4}s/=6}return e.h=s,e.s=l,e.l=c,e}getRGB(e,t=pn.workingColorSpace){return pn.fromWorkingColorSpace(Ki.copy(this),t),e.r=Ki.r,e.g=Ki.g,e.b=Ki.b,e}getStyle(e=Ct){pn.fromWorkingColorSpace(Ki.copy(this),e);const t=Ki.r,n=Ki.g,i=Ki.b;return e!==Ct?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(qi),this.setHSL(qi.h+e,qi.s+t,qi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(qi),e.getHSL(ji);const n=Xt(qi.h,ji.h,t),i=Xt(qi.s,ji.s,t),r=Xt(qi.l,ji.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ki=new Xi;Xi.NAMES=Wi;let Ji=0;class Zi extends Ht{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ji++}),this.uuid=qt(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=ge,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xi(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Bt,this.stencilZFail=Bt,this.stencilZPass=Bt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==ge&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Bt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Bt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Bt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class $i extends Zi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xi(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 gi,this.combine=0,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}}const er=function(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const a=new Uint32Array(2048),o=new Uint32Array(64),s=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(s[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:o,offsetTable:s}}();const tr=function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=jt(e,-65504,65504),er.floatView[0]=e;const t=er.uint32View[0],n=t>>23&511;return er.baseTable[n]+((8388607&t)>>er.shiftTable[n])},nr=new Tn,ir=new tn;class rr{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Ft,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Je,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return cn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix3(e),this.setXY(t,ir.x,ir.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)nr.fromBufferAttribute(this,t),nr.applyMatrix3(e),this.setXYZ(t,nr.x,nr.y,nr.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)nr.fromBufferAttribute(this,t),nr.applyMatrix4(e),this.setXYZ(t,nr.x,nr.y,nr.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)nr.fromBufferAttribute(this,t),nr.applyNormalMatrix(e),this.setXYZ(t,nr.x,nr.y,nr.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)nr.fromBufferAttribute(this,t),nr.transformDirection(e),this.setXYZ(t,nr.x,nr.y,nr.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Kt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Jt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Kt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Kt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Jt(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=Kt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Jt(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=Kt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array),r=Jt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Ft&&(e.usage=this.usage),e}}class ar extends rr{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class or extends rr{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class sr extends rr{constructor(e,t,n){super(new Float32Array(e),t,n)}}let lr=0;const cr=new oi,hr=new Qi,Ar=new Tn,ur=new Qn,dr=new Qn,pr=new Tn;class fr extends Ht{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:lr++}),this.uuid=qt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this.cubeMapNormalTarget=null}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(an(e)?or:ar)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new nn).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return cr.makeRotationFromQuaternion(e),this.applyMatrix4(cr),this}rotateX(e){return cr.makeRotationX(e),this.applyMatrix4(cr),this}rotateY(e){return cr.makeRotationY(e),this.applyMatrix4(cr),this}rotateZ(e){return cr.makeRotationZ(e),this.applyMatrix4(cr),this}translate(e,t,n){return cr.makeTranslation(e,t,n),this.applyMatrix4(cr),this}scale(e,t,n){return cr.makeScale(e,t,n),this.applyMatrix4(cr),this}lookAt(e){return hr.lookAt(e),hr.updateMatrix(),this.applyMatrix4(hr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ar).negate(),this.translate(Ar.x,Ar.y,Ar.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new sr(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Qn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Tn(-1/0,-1/0,-1/0),new Tn(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];ur.setFromBufferAttribute(n),this.morphTargetsRelative?(pr.addVectors(this.boundingBox.min,ur.min),this.boundingBox.expandByPoint(pr),pr.addVectors(this.boundingBox.max,ur.max),this.boundingBox.expandByPoint(pr)):(this.boundingBox.expandByPoint(ur.min),this.boundingBox.expandByPoint(ur.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Jn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Tn,1/0);if(e){const n=this.boundingSphere.center;if(ur.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];dr.setFromBufferAttribute(n),this.morphTargetsRelative?(pr.addVectors(ur.min,dr.min),ur.expandByPoint(pr),pr.addVectors(ur.max,dr.max),ur.expandByPoint(pr)):(ur.expandByPoint(dr.min),ur.expandByPoint(dr.max))}ur.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)pr.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(pr));if(t)for(let r=0,a=t.length;r<a;r++){const a=t[r],o=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)pr.fromBufferAttribute(a,t),o&&(Ar.fromBufferAttribute(e,t),pr.add(Ar)),i=Math.max(i,n.distanceToSquared(pr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new rr(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new Tn,s[e]=new Tn;const l=new Tn,c=new Tn,h=new Tn,A=new tn,u=new tn,d=new tn,p=new Tn,f=new Tn;function g(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),h.fromBufferAttribute(n,i),A.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,i),c.sub(l),h.sub(l),u.sub(A),d.sub(A);const a=1/(u.x*d.y-d.x*u.y);isFinite(a)&&(p.copy(c).multiplyScalar(d.y).addScaledVector(h,-u.y).multiplyScalar(a),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-d.x).multiplyScalar(a),o[e].add(p),o[t].add(p),o[i].add(p),s[e].add(f),s[t].add(f),s[i].add(f))}let m=this.groups;0===m.length&&(m=[{start:0,count:e.count}]);for(let t=0,n=m.length;t<n;++t){const n=m[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const v=new Tn,E=new Tn,b=new Tn,C=new Tn;function _(e){b.fromBufferAttribute(i,e),C.copy(b);const t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),E.crossVectors(C,t);const n=E.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=m.length;t<n;++t){const n=m[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)_(e.getX(t+0)),_(e.getX(t+1)),_(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new rr(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Tn,r=new Tn,a=new Tn,o=new Tn,s=new Tn,l=new Tn,c=new Tn,h=new Tn;if(e)for(let A=0,u=e.count;A<u;A+=3){const u=e.getX(A+0),d=e.getX(A+1),p=e.getX(A+2);i.fromBufferAttribute(t,u),r.fromBufferAttribute(t,d),a.fromBufferAttribute(t,p),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,u),s.fromBufferAttribute(n,d),l.fromBufferAttribute(n,p),o.add(c),s.add(c),l.add(c),n.setXYZ(u,o.x,o.y,o.z),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,l.x,l.y,l.z)}else for(let e=0,o=t.count;e<o;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)pr.fromBufferAttribute(e,t),pr.normalize(),e.setXYZ(t,pr.x,pr.y,pr.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i);let o=0,s=0;for(let r=0,l=t.length;r<l;r++){o=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)a[s++]=n[o++]}return new rr(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new fr,n=this.index.array,i=this.attributes;for(const r in i){const a=e(i[r],n);t.setAttribute(r,a)}const r=this.morphAttributes;for(const i in r){const a=[],o=r[i];for(let t=0,i=o.length;t<i;t++){const i=e(o[t],n);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let e=0,n=a.length;e<n;e++){const n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let e=0,t=a.length;e<t;e++){const t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}const o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=e.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,null!==e.cubeMapNormalTarget&&this.cubeMapNormalTarget.copy(e.cubeMapNormalTarget),this}dispose(){this.cubeMapNormalTarget&&this.cubeMapNormalTarget.dispose(),this.dispatchEvent({type:"dispose"})}}const gr=new oi,mr=new ai,vr=new Jn,Er=new Tn,br=new Tn,Cr=new Tn,_r=new Tn,Ir=new Tn,xr=new Tn,yr=new tn,Mr=new tn,wr=new tn,Sr=new Tn,Br=new Tn,Tr=new Tn,Rr=new Tn,Dr=new Tn;class Qr extends Qi{constructor(e=new fr,t=new $i){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeOffsets(){this.geometry.computeBoundingBox(),this.geometry.computeBoundingSphere(),this.center=this.geometry.boundingSphere.center,this.offsetMatrix=this._computeOffsetMatrix(),this.offsetMatrixInv.copy(this.offsetMatrix).invert(),this.centerOffset.copy(this.center).applyMatrix4(this.offsetMatrixInv),this.modelOffsetMatrix.copy(this.matrixWorld).multiply(this.offsetMatrix),this.modelOffsetMatrixInv.copy(this.modelOffsetMatrix).invert()}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){xr.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],s=r[n];0!==i&&(Ir.fromBufferAttribute(s,e),a?xr.addScaledVector(Ir,i):xr.addScaledVector(Ir.sub(t),i))}t.add(xr)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),vr.copy(n.boundingSphere),vr.applyMatrix4(r),mr.copy(e.ray).recast(e.near),!1===vr.containsPoint(mr.origin)){if(null===mr.intersectSphere(vr,Er))return;if(mr.origin.distanceToSquared(Er)>(e.far-e.near)**2)return}gr.copy(r).invert(),mr.copy(e.ray).applyMatrix4(gr),null!==n.boundingBox&&!1===mr.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,mr)}}_computeOffsetMatrix(){const e=this.geometry,t=e.getAttribute("position"),n=e.getIndex(),i=new Tn(0,0,0),r=new Tn(0,0,0),a=new Tn(0,0,0),o=new Tn(0,0,0);if(void 0!==n){const s=Math.max(0,e.drawRange.start),l=(Math.min(n.count,e.drawRange.start+e.drawRange.count)-1)/3;for(let e=s;e<l;e+=3){const s=n.getX(e),l=n.getX(e+1),c=n.getX(e+2);r.set(t.getX(s),t.getY(s),t.getZ(s)),a.set(t.getX(l),t.getY(l),t.getZ(l)),o.set(t.getX(c),t.getY(c),t.getZ(c)),a.sub(r),o.sub(r),o.cross(a),o.normalize(),i.add(o)}}else for(let e=0;e<t.count;e+=3)r.set(t.getX(e),t.getY(e),t.getZ(e)),a.set(t.getX(e+1),t.getY(e+1),t.getZ(e+1)),o.set(t.getX(e+2),t.getY(e+2),t.getZ(e+2)),a.sub(r),o.sub(r),o.cross(a),o.normalize(),i.add(o);i.normalize();let s=!0,l=0;for(;s;){const e=l/3;if(n){if(e+1>=n.count)break}else if(e+1>=t.count)break;const r=n?n.getX(e):e,c=n?n.getX(e+1):e+1;a.set(t.getX(r),t.getY(r),t.getZ(r)),o.set(t.getX(c),t.getY(c),t.getZ(c)),a.sub(o),a.normalize();const h=i.dot(a);Math.abs(h-1)>.001&&a.length()>.5&&(s=!1),l+=3}o.crossVectors(a,i),o.normalize(),a.crossVectors(i,o),a.normalize();const c=new oi;c.elements[0]=a.x,c.elements[1]=a.y,c.elements[2]=a.z,c.elements[3]=0,c.elements[4]=i.x,c.elements[5]=i.y,c.elements[6]=i.z,c.elements[7]=0,c.elements[8]=o.x,c.elements[9]=o.y,c.elements[10]=o.z,c.elements[11]=0,c.elements[12]=0,c.elements[13]=0,c.elements[14]=0,c.elements[15]=1;const h=e.boundingSphere.radius,A=(new oi).makeScale(h,h,h);return c.multiply(A),c}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,o=r.index,s=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,A=r.groups,u=r.drawRange;if(null!==o)if(Array.isArray(a))for(let r=0,s=A.length;r<s;r++){const s=A[r],d=a[s.materialIndex];for(let r=Math.max(s.start,u.start),a=Math.min(o.count,Math.min(s.start+s.count,u.start+u.count));r<a;r+=3)i=Lr(this,d,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),s=Math.min(o.count,u.start+u.count);r<s;r+=3)i=Lr(this,a,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i));else if(void 0!==s)if(Array.isArray(a))for(let r=0,o=A.length;r<o;r++){const o=A[r],d=a[o.materialIndex];for(let r=Math.max(o.start,u.start),a=Math.min(s.count,Math.min(o.start+o.count,u.start+u.count));r<a;r+=3)i=Lr(this,d,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),o=Math.min(s.count,u.start+u.count);r<o;r+=3)i=Lr(this,a,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}function Lr(e,t,n,i,r,a,o,s,l,c){e.getVertexPosition(s,br),e.getVertexPosition(l,Cr),e.getVertexPosition(c,_r);const h=function(e,t,n,i,r,a,o,s){let l;if(l=1===t.side?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,0===t.side,s),null===l)return null;Dr.copy(s),Dr.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Dr);return c<n.near||c>n.far?null:{distance:c,point:Dr.clone(),object:e}}(e,t,n,i,br,Cr,_r,Rr);if(h){r&&(yr.fromBufferAttribute(r,s),Mr.fromBufferAttribute(r,l),wr.fromBufferAttribute(r,c),h.uv=Vi.getInterpolation(Rr,br,Cr,_r,yr,Mr,wr,new tn)),a&&(yr.fromBufferAttribute(a,s),Mr.fromBufferAttribute(a,l),wr.fromBufferAttribute(a,c),h.uv1=Vi.getInterpolation(Rr,br,Cr,_r,yr,Mr,wr,new tn)),o&&(Sr.fromBufferAttribute(o,s),Br.fromBufferAttribute(o,l),Tr.fromBufferAttribute(o,c),h.normal=Vi.getInterpolation(Rr,br,Cr,_r,Sr,Br,Tr,new Tn),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:s,b:l,c:c,normal:new Tn,materialIndex:0};Vi.getNormal(br,Cr,_r,e.normal),h.face=e}return h}class Ur extends fr{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const s=[],l=[],c=[],h=[];let A=0,u=0;function d(e,t,n,i,r,a,d,p,f,g,m){const v=a/f,E=d/g,b=a/2,C=d/2,_=p/2,I=f+1,x=g+1;let y=0,M=0;const w=new Tn;for(let a=0;a<x;a++){const o=a*E-C;for(let s=0;s<I;s++){const A=s*v-b;w[e]=A*i,w[t]=o*r,w[n]=_,l.push(w.x,w.y,w.z),w[e]=0,w[t]=0,w[n]=p>0?1:-1,c.push(w.x,w.y,w.z),h.push(s/f),h.push(1-a/g),y+=1}}for(let e=0;e<g;e++)for(let t=0;t<f;t++){const n=A+t+I*e,i=A+t+I*(e+1),r=A+(t+1)+I*(e+1),a=A+(t+1)+I*e;s.push(n,i,a),s.push(i,r,a),M+=6}o.addGroup(u,M,m),u+=M,A+=y}d("z","y","x",-1,-1,n,t,e,a,r,0),d("z","y","x",1,-1,n,t,-e,a,r,1),d("x","z","y",1,1,e,n,t,i,a,2),d("x","z","y",1,-1,e,n,-t,i,a,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.setAttribute("position",new sr(l,3)),this.setAttribute("normal",new sr(c,3)),this.setAttribute("uv",new sr(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ur(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Pr(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function Nr(e){const t={};for(let n=0;n<e.length;n++){const i=Pr(e[n]);for(const e in i)t[e]=i[e]}return t}function Fr(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:pn.workingColorSpace}const Or={clone:Pr,merge:Nr};class kr extends Zi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Pr(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}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;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Gr extends Qi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new oi,this.projectionMatrix=new oi,this.projectionMatrixInverse=new oi,this.coordinateSystem=kt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Hr=new Tn,zr=new tn,Vr=new tn;class Wr extends Gr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Wt*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Vt*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Wt*Math.atan(Math.tan(.5*Vt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Hr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Hr.x,Hr.y).multiplyScalar(-e/Hr.z),Hr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Hr.x,Hr.y).multiplyScalar(-e/Hr.z)}getViewSize(e,t){return this.getViewBounds(e,zr,Vr),t.subVectors(Vr,zr)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Vt*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,o=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/o,i*=a.width/e,n*=a.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const qr=-90;class jr extends Qi{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Wr(qr,1,e,t);i.layers=this.layers,this.add(i);const r=new Wr(qr,1,e,t);r.layers=this.layers,this.add(r);const a=new Wr(qr,1,e,t);a.layers=this.layers,this.add(a);const o=new Wr(qr,1,e,t);o.layers=this.layers,this.add(o);const s=new Wr(qr,1,e,t);s.layers=this.layers,this.add(s);const l=new Wr(qr,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,s]=t;for(const e of t)this.remove(e);if(e===kt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else{if(e!==Gt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,s,l,c]=this.children,h=e.getRenderTarget(),A=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,s),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,A,u),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class Yr extends In{constructor(e,t,n,i,r,a,o,s,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:Ue,n,i,r,a,o,s,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Xr extends Mn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Yr(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:We}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;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Ur(5,5,5),o=new kr({name:"CubemapFromEquirect",uniforms:Pr(n),vertexShader:i,fragmentShader:r,side:1,blending:0});o.uniforms.tEquirect.value=t;const s=new Qr(a,o),l=t.minFilter;return t.minFilter===je&&(t.minFilter=We),new jr(1,10,this).update(e,s),t.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}const Kr=new Tn,Jr=new Tn,Zr=new nn;class $r{constructor(e=new Tn(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Kr.subVectors(n,t).cross(Jr.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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){const n=e.delta(Kr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Zr.getNormalMatrix(e),i=this.coplanarPoint(Kr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const ea=new Jn,ta=new Tn;class na{constructor(e=new $r,t=new $r,n=new $r,i=new $r,r=new $r,a=new $r){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3){const n=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],c=i[5],h=i[6],A=i[7],u=i[8],d=i[9],p=i[10],f=i[11],g=i[12],m=i[13],v=i[14],E=i[15];if(n[0].setComponents(s-r,A-l,f-u,E-g).normalize(),n[1].setComponents(s+r,A+l,f+u,E+g).normalize(),n[2].setComponents(s+a,A+c,f+d,E+m).normalize(),n[3].setComponents(s-a,A-c,f-d,E-m).normalize(),n[4].setComponents(s-o,A-h,f-p,E-v).normalize(),t===kt)n[5].setComponents(s+o,A+h,f+p,E+v).normalize();else{if(t!==Gt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,h,p,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ea.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ea.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ea)}intersectsSprite(e){return ea.center.set(0,0,0),ea.radius=.7071067811865476,ea.applyMatrix4(e.matrixWorld),this.intersectsSphere(ea)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(ta.x=i.normal.x>0?e.max.x:e.min.x,ta.y=i.normal.y>0?e.max.y:e.min.y,ta.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ta)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function ia(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ra(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}n.isInterleavedBufferAttribute&&(n=n.data);const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,a=i.byteLength,o=e.createBuffer();let s;if(e.bindBuffer(n,o),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)s=e.FLOAT;else if(i instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)s=e.SHORT;else if(i instanceof Uint32Array)s=e.UNSIGNED_INT;else if(i instanceof Int32Array)s=e.INT;else if(i instanceof Int8Array)s=e.BYTE;else if(i instanceof Uint8Array)s=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);s=e.UNSIGNED_BYTE}return{buffer:o,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:a}}(n,i));else if(r.version<n.version){if(r.size!==n.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.");!function(t,n,i){const r=n.array,a=n._updateRange,o=n.updateRanges;if(e.bindBuffer(i,t),-1===a.count&&0===o.length&&e.bufferSubData(i,0,r),0!==o.length){for(let t=0,n=o.length;t<n;t++){const n=o[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(i,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count),a.count=-1),n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}class aa extends fr{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(n),s=Math.floor(i),l=o+1,c=s+1,h=e/o,A=t/s,u=[],d=[],p=[],f=[];for(let e=0;e<c;e++){const t=e*A-a;for(let n=0;n<l;n++){const i=n*h-r;d.push(i,-t,0),p.push(0,0,1),f.push(n/o),f.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;u.push(n,i,a),u.push(i,r,a)}this.setIndex(u),this.setAttribute("position",new sr(d,3)),this.setAttribute("normal",new sr(p,3)),this.setAttribute("uv",new sr(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new aa(e.width,e.height,e.widthSegments,e.heightSegments)}}const oa={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cubeNormals_vert:"varying vec3 vNormal;\nvarying vec3 vecPosition;\nuniform mat4 offsetMatrixInv;\nuniform vec3 center;\n#include <morphtarget_pars_vertex>\nvoid main() {\n\tvNormal = normalize((offsetMatrixInv * vec4(normal, 0.)).xyz);\n\t#include <begin_vertex>\n\ttransformed -= center;\n\t#include <morphtarget_vertex>\n\tvec4 offsetPos = offsetMatrixInv * vec4(transformed, 1.);\n\tvecPosition = (modelMatrix * offsetPos).xyz;\n\tgl_Position = projectionMatrix * modelViewMatrix * offsetPos;\n}",cubeNormals_frag:"varying vec3 vNormal;\nvarying vec3 vecPosition;\nuniform float radius;\nvoid main() {\n\tvec3 color = normalize(vNormal);\n\tcolor = color * 0.5 + 0.5;\n\tgl_FragColor = vec4(color.x, color.y, color.z, length(vecPosition) / radius);\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshdiamond_vert:"#ifndef USE_ENVMAP\n\t#define USE_ENVMAP\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vWorldNormal;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\n#ifdef USE_INSTANCING\n\tuniform mat4 inverseModelMatrix;\n\tuniform mat4 modelOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrixInv;\n#endif\n#include <morphtarget_pars_vertex>\n#ifdef USE_MORPHTARGETS\n\tvarying vec3 vCenterOffset;\n\t#ifndef USE_INSTANCING\n\t\tuniform mat4 modelOffsetMatrixInv;\n\t#endif\n#endif\nvoid main() {\n\t#ifdef USE_INSTANCING\n\t\tvWorldNormal = (modelMatrix * instanceMatrix * vec4(normal, 0.0)).xyz;\n\t#else\n\t\tvWorldNormal = (modelMatrix * vec4(normal, 0.0)).xyz;\n\t#endif\n\t#include <beginnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#ifdef USE_MORPHTARGETS\n\t\tvCenterOffset = transformed;\n\t\t#include <morphtarget_vertex>\n\t\tvCenterOffset = transformed - vCenterOffset;\n\t\t#ifndef USE_INSTANCING\n\t\t\tvCenterOffset = (modelOffsetMatrixInv * modelMatrix * vec4(vCenterOffset, 1.0)).xyz;\n\t\t#endif\n\t#endif\n\t#include <project_vertex>\n\tvViewPosition = -mvPosition.xyz;\n\tvUv = uv;\n\t#include <worldpos_vertex>\n\tvWorldPosition = worldPosition.xyz;\n\t#ifdef USE_INSTANCING\n\t\tvModelInstanceOffsetMatrix = modelMatrix * instanceMatrix * inverseModelMatrix * modelOffsetMatrix;\n\t\tvModelInstanceOffsetMatrixInv = inverse(vModelInstanceOffsetMatrix);\n\t\t#ifdef USE_MORPHTARGETS\n\t\t\tvCenterOffset = (vModelInstanceOffsetMatrixInv * modelMatrix * vec4(vCenterOffset, 1.0)).xyz;\n\t\t#endif\n\t#endif\n}",meshdiamond_frag:"varying vec3 vWorldNormal;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform float radius;\nuniform vec3 centerOffset;\n#include <common>\n#ifdef USE_INSTANCING\n\tvarying mat4 vModelInstanceOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrixInv;\n\t#define MODEL_OFFSET_MATRIX vModelInstanceOffsetMatrix\n\t#define INV_MODEL_OFFSET_MATRIX vModelInstanceOffsetMatrixInv\n#else\n\tuniform mat4 modelOffsetMatrixInv;\n\tuniform mat4 modelOffsetMatrix;\n\t#define MODEL_OFFSET_MATRIX modelOffsetMatrix\n\t#define INV_MODEL_OFFSET_MATRIX modelOffsetMatrixInv\n#endif\n#ifdef USE_MORPHTARGETS\n\tvarying vec3 vCenterOffset;\n\t#define CENTER_OFFSET (centerOffset + vCenterOffset)\n#else\n\t#define CENTER_OFFSET (centerOffset)\n#endif\nuniform mat4 projectionMatrix;\nuniform samplerCube tCubeMapNormals;\n#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#else\n\tuniform sampler2D envMap;\n#endif\nuniform float envMapIntensity;\nuniform float transmission;\nuniform vec2 transmissionSamplerSize;\nuniform sampler2D transmissionSamplerMap;\nuniform float ior;\nuniform float rIndexDelta;\nuniform float squashFactor;\nuniform float geometryFactor;\nuniform vec3 color;\nuniform vec3 colorCorrection;\nuniform vec3 boostFactors;\nuniform float gammaFactor;\nuniform float absorptionFactor;\nuniform float envMapRotation;\nuniform vec4 envMapRotationQuat;\nuniform float reflectivity;\nvec3 BRDF_Specular_GGX_Environment(const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness) {\n float dotNV = abs(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nvec2 cartesianToPolar(vec3 n) {\n vec2 uv;\n uv.x = atan(n.z, n.x) / (PI * 2.0) + 0.5;\n uv.y = asin(n.y) / PI + 0.5;\n return uv;\n}\nvec4 sampleEnvMap(vec3 direction) {\n\t#if !defined(USE_ENVMAP)\n\t\treturn vec4(direction, 1);\n\t#else\n\t\tfloat cs = cos(envMapRotation);\n\t\tfloat sn = sin(envMapRotation);\n\t\tfloat temp = cs * direction.x + sn * direction.z;\n\t\tdirection.z = -sn * direction.x + cs * direction.z;\n\t\tdirection.x = temp;\n\t\tdirection.x *= -1.;\n\t\tdirection.y *= -1.;\n\t\tdirection.z *= -1.;\n\t\tvec3 t = 2.0 * cross(envMapRotationQuat.xyz, direction);\n\t\tdirection += envMapRotationQuat.w * t + cross(envMapRotationQuat.xyz, t);\n\t\t#if defined( ENVMAP_TYPE_CUBE )\n\t\t\treturn (textureCube(envMap, direction));\n\t\t#elif defined( ENVMAP_TYPE_TEXTURE_2D )\n\t\t\treturn (texture2D(envMap, cartesianToPolar(direction)));\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\treturn (texture2D(envMap, cartesianToPolar(direction)));\n\t\t#endif\n\t\treturn vec4(1, 0, 1, 1);\n\t#endif\n}\nvec4 SampleSpecularReflection(vec3 direction) {\n\t#if defined(FIX_ENV_DIRECTION)\n\t\tdirection = (viewMatrix * vec4(direction, 0.0)).xyz;\n\t#endif\n\treturn envMapIntensity * (sampleEnvMap(direction));\n}\nvec4 SampleSpecularContribution(vec3 direction) {\n\t#if (DIA_ORIENT_ENVMAP < 1)\n\t\tdirection = mat3(MODEL_OFFSET_MATRIX) * direction;\n\t#endif\n\t#if defined(FIX_ENV_DIRECTION)\n\t\tdirection = (viewMatrix * vec4(direction, 0.0)).xyz;\n\t#endif\n direction = normalize(direction);\n direction.x *= -1.;\n direction.z *= -1.;\n return envMapIntensity * (sampleEnvMap(direction));\n}\nvec4 SampleSpecularContributionRef(vec3 origin, int i) {\n vec4 ndcPos = projectionMatrix * viewMatrix * vec4(origin, 1.);\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n return texture2D(transmissionSamplerMap, refractionCoords);\n}\nvec3 intersectSphere(vec3 origin, vec3 direction) {\n origin -= CENTER_OFFSET;\n direction.y /= squashFactor;\n float A = dot(direction, direction);\n float B = 2. * dot(origin, direction);\n float C = dot(origin, origin) - radius * radius;\n float disc = B * B - 4. * A * C;\n if(disc > 0.) {\n disc = sqrt(disc);\n float t1 = (-B + disc) * geometryFactor / A;\n float t2 = (-B - disc) * geometryFactor / A;\n float t = (t1 > t2) ? t1 : t2;\n direction.y *= squashFactor;\n return vec3(origin + CENTER_OFFSET + direction * t);\n }\n return vec3(0.);\n}\nvec3 linePlaneIntersect(in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal) {\n return lineDirection * (dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\n}\nvec4 getNormalDistance(vec3 d) {\n return textureCube(tCubeMapNormals, d);\n}\nvec3 getSurfaceNormal(vec4 surfaceInfos) {\n vec3 surfaceNormal = surfaceInfos.rgb;\n surfaceNormal = surfaceNormal * 2. - 1.;\n return -normalize(surfaceNormal);\n}\nvec3 intersect(vec3 rayOrigin,vec3 rayDirection) {\n vec3 sphereHitPoint = intersectSphere(rayOrigin, rayDirection);\n vec3 direction1 = normalize(sphereHitPoint - CENTER_OFFSET);\n vec4 normalDistanceData1 = getNormalDistance(direction1);\n float distance1 = normalDistanceData1.a * radius;\n vec3 pointOnPlane1 = CENTER_OFFSET + direction1 * distance1;\n vec3 planeNormal1 = getSurfaceNormal(normalDistanceData1);\n vec3 hitPoint1 = linePlaneIntersect(rayOrigin, rayDirection, pointOnPlane1, planeNormal1);\n vec3 direction2 = normalize(hitPoint1 - CENTER_OFFSET);\n vec4 normalDistanceData2 = getNormalDistance(direction2);\n float distance2 = normalDistanceData2.a * radius;\n vec3 pointOnPlane2 = CENTER_OFFSET + direction2 * distance2;\n vec3 hitPoint = hitPoint1;\n vec3 planeNormal2 = getSurfaceNormal(normalDistanceData2);\n hitPoint = linePlaneIntersect(rayOrigin, rayDirection, pointOnPlane2, planeNormal2);\n return hitPoint;\n}\nvec3 getRefractionColor(vec3 origin, vec3 direction, vec3 normal) {\n vec3 outColor = vec3(0.);\n const float n1 = 1.;\n const float epsilon = 1e-4;\n float f0 = (2.4 - n1) / (2.4 + n1);\n f0 *= f0;\n vec3 attenuationFactor = vec3(1.);\n vec3 newDirection = refract(direction, normal, n1 / ior);\n vec3 brdfRefracted = BRDF_Specular_GGX_Environment(newDirection, -normal, vec3(f0), 0.);\n attenuationFactor *= (vec3(1.) - brdfRefracted);\n int count = 0;\n mat4 invModelOffsetMatrix = INV_MODEL_OFFSET_MATRIX;\n newDirection = normalize((invModelOffsetMatrix * vec4(newDirection, 0.)).xyz);\n origin = (invModelOffsetMatrix * vec4(origin, 1.)).xyz;\n for (int i = 0; i < RAY_BOUNCES; i++) {\n vec3 intersectedPos = intersect(origin, newDirection);\n vec3 dist = intersectedPos - origin;\n vec3 d = normalize(intersectedPos - CENTER_OFFSET);\n vec3 mappedNormal = getNormalDistance(d).rgb;\n mappedNormal = 2. * mappedNormal - 1.;\n mappedNormal = -normalize(mappedNormal);\n float r = length(dist) / radius * absorptionFactor;\n attenuationFactor *= exp(-r * (1. - color));\n origin = intersectedPos;\n vec3 origin2 = (MODEL_OFFSET_MATRIX * vec4(intersectedPos, 1)).xyz;\n vec3 oldDir = newDirection;\n newDirection = refract(newDirection, mappedNormal, ior / n1);\n if (dot(newDirection, newDirection) < epsilon) {\n newDirection = reflect(oldDir, mappedNormal);\n if (i == RAY_BOUNCES - 1) {\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(-oldDir, mappedNormal, vec3(f0), 0.);\n vec3 d1 = mat3(MODEL_OFFSET_MATRIX) * oldDir;\n d1 = normalize(d1);\n float cosT = 1. - dot(direction, d1);\n outColor += ((transmission > 0. && cosT < transmission) ? SampleSpecularContributionRef(origin2 + 0.5 * d1 * cosT, i).rgb : SampleSpecularContribution(oldDir).rgb) * attenuationFactor * colorCorrection * boostFactors * (vec3(1.) - brdfReflected);\n }\n } else {\n vec3 brdfRefracted = vec3(1.) - BRDF_Specular_GGX_Environment(newDirection, -mappedNormal, vec3(f0), 0.);\n vec3 d1 = normalize(mat3(MODEL_OFFSET_MATRIX) * newDirection);\n float cosT = 1. - dot(direction, d1);\n if (transmission > 0. && cosT < transmission) {\n outColor += SampleSpecularContributionRef(origin2 + 0.5 * d1 * cosT, i).rgb * brdfRefracted * attenuationFactor * colorCorrection * boostFactors;\n } else {\n vec3 dir0 = newDirection;\n vec3 dir1 = refract(oldDir, mappedNormal, (ior + rIndexDelta) / n1);\n vec3 dir2 = refract(oldDir, mappedNormal, (ior - rIndexDelta) / n1);\n outColor += vec3(SampleSpecularContribution(dir1).r, SampleSpecularContribution(dir0).g, SampleSpecularContribution(dir2).b) * brdfRefracted * attenuationFactor * colorCorrection * boostFactors;\n }\n newDirection = reflect(oldDir, mappedNormal);\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(newDirection, mappedNormal, vec3(f0), 0.);\n attenuationFactor *= brdfReflected * boostFactors;\n count++;\n }\n }\n return outColor;\n}\nvoid main() {\n vec3 normalizedNormal = normalize(vWorldNormal);\n vec3 viewVector = normalize(vWorldPosition - cameraPosition);\n const float n1 = 1.;\n const float epsilon = 1e-4;\n float f0 = (2.4 - n1) / (2.4 + n1);\n f0 *= f0;\n vec3 attenuationFactor = vec3(1.);\n vec3 reflectedDirection = reflect(viewVector, normalizedNormal);\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(reflectedDirection, normalizedNormal, vec3(f0), 0.);\n vec3 reflectionColor = SampleSpecularReflection(reflectedDirection).rgb * brdfReflected * reflectivity * 2.;\n vec3 refractionColor = getRefractionColor(vWorldPosition, viewVector, normalizedNormal);\n vec3 normal = normalize(vNormal);\n vec3 diffuseColor = vec3(1.);\n gl_FragColor = vec4((refractionColor.rgb + reflectionColor.rgb) * diffuseColor, 1.);\n gl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(gammaFactor));\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n\tgl_FragColor.rgb = max(vec3(0.0), gl_FragColor.rgb);\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},sa={common:{diffuse:{value:new Xi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new nn},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new nn}},envmap:{envMap:{value:null},envMapRotation:{value:new nn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new nn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new nn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new nn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new nn},normalScale:{value:new tn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new nn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new nn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new nn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new nn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Xi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0},uvTransform:{value:new nn}},sprite:{diffuse:{value:new Xi(16777215)},opacity:{value:1},center:{value:new tn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new nn},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0}}},la={basic:{uniforms:Nr([sa.common,sa.specularmap,sa.envmap,sa.aomap,sa.lightmap,sa.fog]),vertexShader:oa.meshbasic_vert,fragmentShader:oa.meshbasic_frag},cubeNormals:{uniforms:Nr([sa.common,{offsetMatrixInv:{value:(new oi).identity()},centerOffset:{value:new Tn(0,0,0)},radius:{value:1}}]),vertexShader:oa.cubeNormals_vert,fragmentShader:oa.cubeNormals_frag},diamond:{uniforms:Nr([sa.common,sa.envmap,{inverseModelMatrix:{value:(new oi).identity()},modelOffsetMatrix:{value:(new oi).identity()},modelOffsetMatrixInv:{value:(new oi).identity()},radius:{value:1},centerOffset:{value:new Tn(0,0,0)},tCubeMapNormals:{value:null},envMapIntensity:{value:1},envMapRotation:{value:0},transmission:{value:0},transmissionSamplerSize:{value:new tn},transmissionSamplerMap:{value:null},rIndexDelta:{value:.012},squashFactor:{value:.98},geometryFactor:{value:.5},color:{value:new Tn(1,1,1)},colorCorrection:{value:new Tn(1,1,1)},boostFactors:{value:new Tn(.892,.892,.98595025)},gammaFactor:{value:1},absorptionFactor:{value:1},envMapRotationQuat:{value:new Bn}}]),vertexShader:oa.meshdiamond_vert,fragmentShader:oa.meshdiamond_frag},lambert:{uniforms:Nr([sa.common,sa.specularmap,sa.envmap,sa.aomap,sa.lightmap,sa.emissivemap,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.fog,sa.lights,{emissive:{value:new Xi(0)}}]),vertexShader:oa.meshlambert_vert,fragmentShader:oa.meshlambert_frag},phong:{uniforms:Nr([sa.common,sa.specularmap,sa.envmap,sa.aomap,sa.lightmap,sa.emissivemap,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.fog,sa.lights,{emissive:{value:new Xi(0)},specular:{value:new Xi(1118481)},shininess:{value:30}}]),vertexShader:oa.meshphong_vert,fragmentShader:oa.meshphong_frag},standard:{uniforms:Nr([sa.common,sa.envmap,sa.aomap,sa.lightmap,sa.emissivemap,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.roughnessmap,sa.metalnessmap,sa.fog,sa.lights,{emissive:{value:new Xi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:oa.meshphysical_vert,fragmentShader:oa.meshphysical_frag},toon:{uniforms:Nr([sa.common,sa.aomap,sa.lightmap,sa.emissivemap,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.gradientmap,sa.fog,sa.lights,{emissive:{value:new Xi(0)}}]),vertexShader:oa.meshtoon_vert,fragmentShader:oa.meshtoon_frag},matcap:{uniforms:Nr([sa.common,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.fog,{matcap:{value:null}}]),vertexShader:oa.meshmatcap_vert,fragmentShader:oa.meshmatcap_frag},points:{uniforms:Nr([sa.points,sa.fog]),vertexShader:oa.points_vert,fragmentShader:oa.points_frag},dashed:{uniforms:Nr([sa.common,sa.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:oa.linedashed_vert,fragmentShader:oa.linedashed_frag},depth:{uniforms:Nr([sa.common,sa.displacementmap]),vertexShader:oa.depth_vert,fragmentShader:oa.depth_frag},normal:{uniforms:Nr([sa.common,sa.bumpmap,sa.normalmap,sa.displacementmap,{opacity:{value:1}}]),vertexShader:oa.meshnormal_vert,fragmentShader:oa.meshnormal_frag},sprite:{uniforms:Nr([sa.sprite,sa.fog]),vertexShader:oa.sprite_vert,fragmentShader:oa.sprite_frag},background:{uniforms:{uvTransform:{value:new nn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:oa.background_vert,fragmentShader:oa.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new nn}},vertexShader:oa.backgroundCube_vert,fragmentShader:oa.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:oa.cube_vert,fragmentShader:oa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:oa.equirect_vert,fragmentShader:oa.equirect_frag},distanceRGBA:{uniforms:Nr([sa.common,sa.displacementmap,{referencePosition:{value:new Tn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:oa.distanceRGBA_vert,fragmentShader:oa.distanceRGBA_frag},shadow:{uniforms:Nr([sa.lights,sa.fog,{color:{value:new Xi(0)},opacity:{value:1}}]),vertexShader:oa.shadow_vert,fragmentShader:oa.shadow_frag}};la.physical={uniforms:Nr([la.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new nn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new nn},clearcoatNormalScale:{value:new tn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new nn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new nn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new nn},sheen:{value:0},sheenColor:{value:new Xi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new nn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new nn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new nn},transmissionSamplerSize:{value:new tn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new nn},attenuationDistance:{value:0},attenuationColor:{value:new Xi(0)},specularColor:{value:new Xi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new nn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new nn},anisotropyVector:{value:new tn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new nn}}]),vertexShader:oa.meshphysical_vert,fragmentShader:oa.meshphysical_frag};const ca={r:0,b:0,g:0},ha=new gi,Aa=new oi;function ua(e,t,n,i,r,a,o){const s=new Xi(0);let l,c,h=!0===a?0:1,A=null,u=0,d=null;function p(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function f(t,n){t.getRGB(ca,Fr(e)),i.buffers.color.setClear(ca.r,ca.g,ca.b,n,o)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),h=t,f(s,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,f(s,h)},render:function(t){let n=!1;const r=p(t);null===r?f(s,h):r&&r.isColor&&(f(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=p(n);i&&(i.isCubeTexture||i.mapping===Fe)?(void 0===c&&(c=new Qr(new Ur(1,1,1),new kr({name:"BackgroundCubeMaterial",uniforms:Pr(la.backgroundCube.uniforms),vertexShader:la.backgroundCube.vertexShader,fragmentShader:la.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),ha.copy(n.backgroundRotation),ha.x*=-1,ha.y*=-1,ha.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(ha.y*=-1,ha.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Aa.makeRotationFromEuler(ha)),c.material.toneMapped=pn.getTransfer(i.colorSpace)!==Mt,A===i&&u===i.version&&d===e.toneMapping||(c.material.needsUpdate=!0,A=i,u=i.version,d=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Qr(new aa(2,2),new kr({name:"BackgroundMaterial",uniforms:Pr(la.background.uniforms),vertexShader:la.background.vertexShader,fragmentShader:la.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=pn.getTransfer(i.colorSpace)!==Mt,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),A===i&&u===i.version&&d===e.toneMapping||(l.material.needsUpdate=!0,A=i,u=i.version,d=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}}}function da(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,o=!1;function s(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){const e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function A(e){u(e,0)}function u(t,n){const i=a.newAttributes,r=a.enabledAttributes,o=a.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function d(){const t=a.newAttributes,n=a.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function p(t,n,i,r,a,o,s){!0===s?e.vertexAttribIPointer(t,n,i,a,o):e.vertexAttribPointer(t,n,i,r,a,o)}function f(){g(),o=!0,a!==r&&(a=r,s(a.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,g){let m=!1;const v=function(t,n,r){const a=!0===r.wireframe;let o=i[t.id];void 0===o&&(o={},i[t.id]=o);let s=o[n.id];void 0===s&&(s={},o[n.id]=s);let l=s[a];return void 0===l&&(l=c(e.createVertexArray()),s[a]=l),l}(f,l,r);a!==v&&(a=v,s(a.object)),m=function(e,t,n,i){const r=a.attributes,o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){const n=r[t];let i=o[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;s++}return a.attributesNum!==s||a.index!==i}(n,f,l,g),m&&function(e,t,n,i){const r={},o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,s++}a.attributes=r,a.attributesNum=s,a.index=i}(n,f,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(m||o)&&(o=!1,function(n,i,r,a){h();const o=a.attributes,s=r.getAttributes(),l=i.defaultAttributeValues;for(const i in s){const r=s[i];if(r.location>=0){let s=o[i];if(void 0===s&&("instanceMatrix"===i&&n.instanceMatrix&&(s=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(s=n.instanceColor)),void 0!==s){const i=s.normalized,o=s.itemSize,l=t.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,d=l.bytesPerElement,f=h===e.INT||h===e.UNSIGNED_INT||1013===s.gpuType;if(s.isInterleavedBufferAttribute){const t=s.data,l=t.stride,g=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)u(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)A(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)p(r.location+e,o/r.locationSize,h,i,l*d,(g+o/r.locationSize*e)*d,f)}else{if(s.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)u(r.location+e,s.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let e=0;e<r.locationSize;e++)A(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)p(r.location+e,o/r.locationSize,h,i,o*d,o/r.locationSize*e*d,f)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}d()}(n,r,l,f),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:h,enableAttribute:A,disableUnusedAttributes:d}}function pa(e,t,n){let i;function r(t,r,a){0!==a&&(e.drawArraysInstanced(i,t,r,a),n.update(r,i,a))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,a);let o=0;for(let e=0;e<a;e++)o+=r[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,a,o,s){if(0===o)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],a[t],s[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,a,0,s,0,o);let t=0;for(let e=0;e<o;e++)t+=a[e];for(let e=0;e<s.length;e++)n.update(t,i,s[e])}}}function fa(e,t,n,i){let r;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const s=a(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===et||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===Ze&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==Ye&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Je&&!r)},precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function ga(e){const t=this;let n=null,i=0,r=!1,a=!1;const o=new $r,s=new nn,l={value:null,needsUpdate:!1};function c(e,n,i,r){const a=null!==e?e.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const t=i+4*a,r=n.matrixWorldInverse;s.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==a;++t,n+=4)o.copy(e[t]).applyMatrix4(r,s),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(o,s,h){const A=o.clippingPlanes,u=o.clipIntersection,d=o.clipShadows,p=e.get(o);if(!r||null===A||0===A.length||a&&!d)a?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{const e=a?0:i,t=4*e;let r=p.clippingState||null;l.value=r,r=c(A,s,t,h);for(let e=0;e!==t;++e)r[e]=n[e];p.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function ma(e){let t=new WeakMap;function n(e,t){return t===Ne?e.mapping=Ue:304===t&&(e.mapping=Pe),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(a===Ne||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const o=new Xr(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}class va extends Gr{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const Ea=[.125,.215,.35,.446,.526,.582],ba=new va,Ca=new Xi;let _a=null,Ia=0,xa=0,ya=!1;const Ma=(1+Math.sqrt(5))/2,wa=1/Ma,Sa=[new Tn(-Ma,wa,0),new Tn(Ma,wa,0),new Tn(-wa,0,Ma),new Tn(wa,0,Ma),new Tn(0,Ma,-wa),new Tn(0,Ma,wa),new Tn(-1,1,-1),new Tn(1,1,-1),new Tn(-1,1,1),new Tn(1,1,1)];class Ba{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){_a=this._renderer.getRenderTarget(),Ia=this._renderer.getActiveCubeFace(),xa=this._renderer.getActiveMipmapLevel(),ya=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Qa(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Da(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(_a,Ia,xa),this._renderer.xr.enabled=ya,e.scissorTest=!1,Ra(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ue||e.mapping===Pe?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),_a=this._renderer.getRenderTarget(),Ia=this._renderer.getActiveCubeFace(),xa=this._renderer.getActiveMipmapLevel(),ya=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:We,minFilter:We,generateMipmaps:!1,type:Ze,format:et,colorSpace:_t,depthBuffer:!1},i=Ta(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Ta(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const a=e-4+1+Ea.length;for(let o=0;o<a;o++){const a=Math.pow(2,r);n.push(a);let s=1/a;o>e-4?s=Ea[o-e+4-1]:0===o&&(s=0),i.push(s);const l=1/(a-2),c=-l,h=1+l,A=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,d=6,p=3,f=2,g=1,m=new Float32Array(p*d*u),v=new Float32Array(f*d*u),E=new Float32Array(g*d*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];m.set(i,p*d*e),v.set(A,f*d*e);const r=[e,e,e,e,e,e];E.set(r,g*d*e)}const b=new fr;b.setAttribute("position",new rr(m,p)),b.setAttribute("uv",new rr(v,f)),b.setAttribute("faceIndex",new rr(E,g)),t.push(b),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new Tn(0,1,0);return new kr({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new Qr(this._lodPlanes[0],e);this._renderer.compile(t,ba)}_sceneToCubeUV(e,t,n,i){const r=new Wr(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.toneMapping;s.getClearColor(Ca),s.toneMapping=0,s.autoClear=!1;const h=new $i({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),A=new Qr(new Ur,h);let u=!1;const d=e.background;d?d.isColor&&(h.color.copy(d),e.background=null,u=!0):(h.color.copy(Ca),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,a[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,a[t]),r.lookAt(0,o[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Ra(i,n*l,t>2?l:0,l,l),s.setRenderTarget(i),u&&s.render(A,r),s.render(e,r)}A.geometry.dispose(),A.material.dispose(),s.toneMapping=c,s.autoClear=l,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Ue||e.mapping===Pe;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Qa()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Da());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Qr(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Ra(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,ba)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=Sa[(i-t-1)%Sa.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Qr(this._lodPlanes[i],l),h=l.uniforms,A=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*A):2*Math.PI/39,d=r/u,p=isFinite(r)?1+Math.floor(3*d):20;p>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e<20;++e){const t=e/d,n=Math.exp(-t*t/2);f.push(n),0===e?g+=n:e<p&&(g+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/g;h.envMap.value=e.texture,h.samples.value=p,h.weights.value=f,h.latitudinal.value="latitudinal"===a,o&&(h.poleAxis.value=o);const{_lodMax:m}=this;h.dTheta.value=u,h.mipInt.value=m-n;const v=this._sizeLods[i];Ra(t,3*v*(i>m-4?i-m+4:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(c,ba)}}function Ta(e,t,n){const i=new Mn(e,t,n);return i.texture.mapping=Fe,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ra(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Da(){return new kr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Qa(){return new kr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function La(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,o=a===Ne||304===a,s=a===Ue||a===Pe;if(o||s){let a=t.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Ba(e)),a=o?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return o&&l&&l.height>0||s&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new Ba(e)),a=o?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Ua(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&cn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Pa(e,t,n,i){const r={},a=new WeakMap;function o(e){const s=e.target;null!==s.index&&t.remove(s.index);for(const e in s.attributes)t.remove(s.attributes[e]);for(const e in s.morphAttributes){const n=s.morphAttributes[e];for(let e=0,i=n.length;e<i;e++)t.remove(n[e])}s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(t.remove(l),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],a=e[t+2];n.push(i,r,r,a,a,i)}}else{if(void 0===r)return;{const e=r.array;o=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const s=new(an(n)?or:ar)(n,1);s.version=o;const l=a.get(e);l&&t.remove(l),a.set(e,s)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER);const r=n.morphAttributes;for(const n in r){const i=r[n];for(let n=0,r=i.length;n<r;n++)t.update(i[n],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function Na(e,t,n){let i,r,a;function o(t,o,s){0!==s&&(e.drawElementsInstanced(i,o,r,t*a,s),n.update(o,i,s))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,o){e.drawElements(i,o,r,t*a),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(e,a,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,r,e,0,o);let s=0;for(let e=0;e<o;e++)s+=a[e];n.update(s,i,1)},this.renderMultiDrawInstances=function(e,s,l,c){if(0===l)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)o(e[t]/a,s[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(i,s,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=s[e];for(let e=0;e<c.length;e++)n.update(t,i,c[e])}}}function Fa(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Oa(e,t,n){const i=new WeakMap,r=new xn;return{update:function(a,o,s){const l=a.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let A=i.get(o);if(void 0===A||A.count!==h){void 0!==A&&A.texture.dispose();const u=void 0!==o.morphAttributes.position,d=void 0!==o.morphAttributes.normal,p=void 0!==o.morphAttributes.color,f=o.morphAttributes.position||[],g=o.morphAttributes.normal||[],m=o.morphAttributes.color||[];let v=0;!0===u&&(v=1),!0===d&&(v=2),!0===p&&(v=3);let E=o.attributes.position.count*v,b=1;E>t.maxTextureSize&&(b=Math.ceil(E/t.maxTextureSize),E=t.maxTextureSize);const C=new Float32Array(E*b*4*h),_=new wn(C,E,b,h);_.type=Je,_.needsUpdate=!0;const I=4*v;for(let y=0;y<h;y++){const M=f[y],w=g[y],S=m[y],B=E*b*4*y;for(let T=0;T<M.count;T++){const R=T*I;!0===u&&(r.fromBufferAttribute(M,T),C[B+R+0]=r.x,C[B+R+1]=r.y,C[B+R+2]=r.z,C[B+R+3]=0),!0===d&&(r.fromBufferAttribute(w,T),C[B+R+4]=r.x,C[B+R+5]=r.y,C[B+R+6]=r.z,C[B+R+7]=0),!0===p&&(r.fromBufferAttribute(S,T),C[B+R+8]=r.x,C[B+R+9]=r.y,C[B+R+10]=r.z,C[B+R+11]=4===S.itemSize?r.w:1)}}function x(){_.dispose(),i.delete(o),o.removeEventListener("dispose",x)}A={count:h,texture:_,size:new tn(E,b)},i.set(o,A),o.addEventListener("dispose",x)}if(!0===a.isInstancedMesh&&null!==a.morphTexture)s.getUniforms().setValue(e,"morphTexture",a.morphTexture,n);else{let D=0;for(let L=0;L<l.length;L++)D+=l[L];const Q=o.morphTargetsRelative?1:1-D;s.getUniforms().setValue(e,"morphTargetBaseInfluence",Q),s.getUniforms().setValue(e,"morphTargetInfluences",l)}s.getUniforms().setValue(e,"morphTargetsTexture",A.texture,n),s.getUniforms().setValue(e,"morphTargetsTextureSize",A.size)}}}function ka(e,t,n,i){let r=new WeakMap;function a(e){const t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){const s=i.render.frame,l=o.geometry,c=t.get(o,l);if(r.get(c)!==s&&(t.update(c),r.set(c,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),r.get(o)!==s&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),r.set(o,s))),o.isSkinnedMesh){const e=o.skeleton;r.get(e)!==s&&(e.update(),r.set(e,s))}return c},dispose:function(){r=new WeakMap}}}class Ga extends In{constructor(e,t,n,i,r,a,o,s,l,c=1026){if(c!==tt&&c!==nt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===tt&&(n=Ke),void 0===n&&c===nt&&(n=$e),super(null,i,r,a,o,s,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==o?o:He,this.minFilter=void 0!==s?s:He,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}const Ha=new In,za=new Ga(1,1);za.compareFunction=515;const Va=new wn,Wa=new Sn,qa=new Yr,ja=[],Ya=[],Xa=new Float32Array(16),Ka=new Float32Array(9),Ja=new Float32Array(4);function Za(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let a=ja[r];if(void 0===a&&(a=new Float32Array(r),ja[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function $a(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function eo(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function to(e,t){let n=Ya[t];void 0===n&&(n=new Int32Array(t),Ya[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function no(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function io(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if($a(n,t))return;e.uniform2fv(this.addr,t),eo(n,t)}}function ro(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if($a(n,t))return;e.uniform3fv(this.addr,t),eo(n,t)}}function ao(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if($a(n,t))return;e.uniform4fv(this.addr,t),eo(n,t)}}function oo(e,t){const n=this.cache,i=t.elements;if(void 0===i){if($a(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),eo(n,t)}else{if($a(n,i))return;Ja.set(i),e.uniformMatrix2fv(this.addr,!1,Ja),eo(n,i)}}function so(e,t){const n=this.cache,i=t.elements;if(void 0===i){if($a(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),eo(n,t)}else{if($a(n,i))return;Ka.set(i),e.uniformMatrix3fv(this.addr,!1,Ka),eo(n,i)}}function lo(e,t){const n=this.cache,i=t.elements;if(void 0===i){if($a(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),eo(n,t)}else{if($a(n,i))return;Xa.set(i),e.uniformMatrix4fv(this.addr,!1,Xa),eo(n,i)}}function co(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function ho(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if($a(n,t))return;e.uniform2iv(this.addr,t),eo(n,t)}}function Ao(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if($a(n,t))return;e.uniform3iv(this.addr,t),eo(n,t)}}function uo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if($a(n,t))return;e.uniform4iv(this.addr,t),eo(n,t)}}function po(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function fo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if($a(n,t))return;e.uniform2uiv(this.addr,t),eo(n,t)}}function go(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if($a(n,t))return;e.uniform3uiv(this.addr,t),eo(n,t)}}function mo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if($a(n,t))return;e.uniform4uiv(this.addr,t),eo(n,t)}}function vo(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r);const a=this.type===e.SAMPLER_2D_SHADOW?za:Ha;n.setTexture2D(t||a,r)}function Eo(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||Wa,r)}function bo(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||qa,r)}function Co(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||Va,r)}function _o(e,t){e.uniform1fv(this.addr,t)}function Io(e,t){const n=Za(t,this.size,2);e.uniform2fv(this.addr,n)}function xo(e,t){const n=Za(t,this.size,3);e.uniform3fv(this.addr,n)}function yo(e,t){const n=Za(t,this.size,4);e.uniform4fv(this.addr,n)}function Mo(e,t){const n=Za(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function wo(e,t){const n=Za(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function So(e,t){const n=Za(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Bo(e,t){e.uniform1iv(this.addr,t)}function To(e,t){e.uniform2iv(this.addr,t)}function Ro(e,t){e.uniform3iv(this.addr,t)}function Do(e,t){e.uniform4iv(this.addr,t)}function Qo(e,t){e.uniform1uiv(this.addr,t)}function Lo(e,t){e.uniform2uiv(this.addr,t)}function Uo(e,t){e.uniform3uiv(this.addr,t)}function Po(e,t){e.uniform4uiv(this.addr,t)}function No(e,t,n){const i=this.cache,r=t.length,a=to(n,r);$a(i,a)||(e.uniform1iv(this.addr,a),eo(i,a));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||Ha,a[e])}function Fo(e,t,n){const i=this.cache,r=t.length,a=to(n,r);$a(i,a)||(e.uniform1iv(this.addr,a),eo(i,a));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||Wa,a[e])}function Oo(e,t,n){const i=this.cache,r=t.length,a=to(n,r);$a(i,a)||(e.uniform1iv(this.addr,a),eo(i,a));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||qa,a[e])}function ko(e,t,n){const i=this.cache,r=t.length,a=to(n,r);$a(i,a)||(e.uniform1iv(this.addr,a),eo(i,a));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||Va,a[e])}class Go{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return no;case 35664:return io;case 35665:return ro;case 35666:return ao;case 35674:return oo;case 35675:return so;case 35676:return lo;case 5124:case 35670:return co;case 35667:case 35671:return ho;case 35668:case 35672:return Ao;case 35669:case 35673:return uo;case 5125:return po;case 36294:return fo;case 36295:return go;case 36296:return mo;case 35678:case 36198:case 36298:case 36306:case 35682:return vo;case 35679:case 36299:case 36307:return Eo;case 35680:case 36300:case 36308:case 36293:return bo;case 36289:case 36303:case 36311:case 36292:return Co}}(t.type)}}class Ho{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return _o;case 35664:return Io;case 35665:return xo;case 35666:return yo;case 35674:return Mo;case 35675:return wo;case 35676:return So;case 5124:case 35670:return Bo;case 35667:case 35671:return To;case 35668:case 35672:return Ro;case 35669:case 35673:return Do;case 5125:return Qo;case 36294:return Lo;case 36295:return Uo;case 36296:return Po;case 35678:case 36198:case 36298:case 36306:case 35682:return No;case 35679:case 36299:case 36307:return Fo;case 35680:case 36300:case 36308:case 36293:return Oo;case 36289:case 36303:case 36311:case 36292:return ko}}(t.type)}}class zo{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(e,t[a.id],n)}}}const Vo=/(\w+)(\])?(\[|\.)?/g;function Wo(e,t){e.seq.push(t),e.map[t.id]=t}function qo(e,t,n){const i=e.name,r=i.length;for(Vo.lastIndex=0;;){const a=Vo.exec(i),o=Vo.lastIndex;let s=a[1];const l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){Wo(n,void 0===c?new Go(s,e,t):new Ho(s,e,t));break}{let e=n.map[s];void 0===e&&(e=new zo(s),Wo(n,e)),n=e}}}class jo{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);qo(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],o=n[a.id];!1!==o.needsUpdate&&a.setValue(e,o.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function Yo(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let Xo=0;function Ko(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e<a;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function Jo(e,t){const n=function(e){const t=pn.getPrimaries(pn.workingColorSpace),n=pn.getPrimaries(e);let i;switch(t===n?i="":t===St&&n===wt?i="LinearDisplayP3ToLinearSRGB":t===wt&&n===St&&(i="LinearSRGBToLinearDisplayP3"),e){case _t:case xt:return[i,"LinearTransferOETF"];case Ct:case It:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function Zo(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function $o(e){return""!==e}function es(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function ts(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const ns=/^[ \t]*#include +<([\w\d./]+)>/gm;function is(e){return e.replace(ns,as)}const rs=new Map;function as(e,t){let n=oa[t];if(void 0===n){const e=rs.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=oa[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return is(n)}const os=/#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 ss(e){return e.replace(os,ls)}function ls(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function cs(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function hs(e,t,n,i){const r=e.getContext(),a=n.defines;let o=n.vertexShader,s=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 300:t="ENVMAP_TYPE_TEXTURE_2D";break;case Ue:case Pe:t="ENVMAP_TYPE_CUBE";break;case Fe:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===Pe&&(t="ENVMAP_MODE_REFRACTION"),t}(n),A=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),u=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),d=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter($o).join("\n")}(n),p=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(a),f=r.createProgram();let g,m,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter($o).join("\n"),g.length>0&&(g+="\n"),m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter($o).join("\n"),m.length>0&&(m+="\n")):(g=[cs(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.fixedEnvMapDirection?"#define FIX_ENV_DIRECTION":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter($o).join("\n"),m=[cs(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+A:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.fixedEnvMapDirection?"#define FIX_ENV_DIRECTION":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?oa.tonemapping_pars_fragment:"",0!==n.toneMapping?Zo("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",oa.colorspace_pars_fragment,Jo("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter($o).join("\n")),o=is(o),o=es(o,n),o=ts(o,n),s=is(s),s=es(s,n),s=ts(s,n),s=function(e,t){return e.replace(/RAY_BOUNCES/g,t.rayBounces)}(s,n),s=function(e,t){return e.replace(/DIA_ORIENT_ENVMAP/g,t.diamondOrientedEnvMap)}(s,n),o=ss(o),s=ss(s),!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=[d,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,m=["#define varying in",n.glslVersion===Ot?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Ot?"":"#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("\n")+"\n"+m);const E=v+g+o,b=v+m+s,C=Yo(r,r.VERTEX_SHADER,E),_=Yo(r,r.FRAGMENT_SHADER,b);function I(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(f).trim(),i=r.getShaderInfoLog(C).trim(),a=r.getShaderInfoLog(_).trim();let o=!0,s=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,f,C,_);else{const e=Ko(r,C,"vertex"),i=Ko(r,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==a||(s=!1);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:a,prefix:m}})}r.deleteShader(C),r.deleteShader(_),x=new jo(r,f),y=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),a=i.name;let o=1;i.type===e.FLOAT_MAT2&&(o=2),i.type===e.FLOAT_MAT3&&(o=3),i.type===e.FLOAT_MAT4&&(o=4),n[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}(r,f)}let x,y;r.attachShader(f,C),r.attachShader(f,_),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===x&&I(this),x},this.getAttributes=function(){return void 0===y&&I(this),y};let M=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===M&&(M=r.getProgramParameter(f,37297)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Xo++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=C,this.fragmentShader=_,this}let As=0;class us{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new ds(e),t.set(e,n)),n}}class ds{constructor(e){this.id=As++,this.code=e,this.usedTimes=0}}function ps(e,t,n,i,r,a,o){const s=new mi,l=new us,c=new Set,h=[],A=r.logarithmicDepthBuffer,u=r.vertexTextures;let d=r.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite",MeshDiamondMaterial:"diamond",CubeNormalsMaterial:"cubeNormals"};function f(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(a,s,h,g,m){const v=g.fog,E=m.geometry,b=a.isMeshStandardMaterial?g.environment:null,C=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),_=C&&C.mapping===Fe?C.image.height:null,I=p[a.type];null!==a.precision&&(d=r.getMaxPrecision(a.precision),d!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",d,"instead."));const x=E.morphAttributes.position||E.morphAttributes.normal||E.morphAttributes.color,y=void 0!==x?x.length:0;let M,w,S,B,T=0;if(void 0!==E.morphAttributes.position&&(T=1),void 0!==E.morphAttributes.normal&&(T=2),void 0!==E.morphAttributes.color&&(T=3),I){const e=la[I];M=e.vertexShader,w=e.fragmentShader}else M=a.vertexShader,w=a.fragmentShader,l.update(a),S=l.getVertexShaderID(a),B=l.getFragmentShaderID(a);const R=e.getRenderTarget(),D=!0===m.isInstancedMesh,Q=!0===m.isBatchedMesh,L=!!a.map,U=!!a.matcap,P=!!C,N=!!a.aoMap,F=!!a.lightMap,O=!!a.bumpMap,k=!!a.normalMap,G=!!a.displacementMap,H=!!a.emissiveMap,z=!!a.metalnessMap,V=!!a.roughnessMap,W=a.anisotropy>0,q=a.clearcoat>0,j=a.dispersion>0,Y=a.iridescence>0,X=a.sheen>0,K=a.transmission>0,J=W&&!!a.anisotropyMap,Z=q&&!!a.clearcoatMap,$=q&&!!a.clearcoatNormalMap,ee=q&&!!a.clearcoatRoughnessMap,te=Y&&!!a.iridescenceMap,ne=Y&&!!a.iridescenceThicknessMap,ie=X&&!!a.sheenColorMap,re=X&&!!a.sheenRoughnessMap,ae=!!a.specularMap,oe=!!a.specularColorMap,se=!!a.specularIntensityMap,le=K&&!!a.transmissionMap,ce=K&&!!a.thicknessMap,he=!!a.gradientMap,Ae=!!a.alphaMap,ue=a.alphaTest>0,de=!!a.alphaHash,pe=!!a.extensions;let fe=0;a.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(fe=e.toneMapping));const ge={shaderID:I,shaderType:a.type,shaderName:a.name,vertexShader:M,fragmentShader:w,defines:a.defines,customVertexShaderID:S,customFragmentShaderID:B,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:d,batching:Q,batchingColor:Q&&null!==m._colorsTexture,instancing:D,instancingColor:D&&null!==m.instanceColor,instancingMorph:D&&null!==m.morphTexture,supportsVertexTextures:u,outputColorSpace:null===R?e.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:_t,alphaToCoverage:!!a.alphaToCoverage,map:L,matcap:U,envMap:P,envMapMode:P&&C.mapping,envMapCubeUVHeight:_,aoMap:N,lightMap:F,bumpMap:O,normalMap:k,displacementMap:u&&G,emissiveMap:H,normalMapObjectSpace:k&&1===a.normalMapType,normalMapTangentSpace:k&&0===a.normalMapType,metalnessMap:z,roughnessMap:V,anisotropy:W,anisotropyMap:J,clearcoat:q,clearcoatMap:Z,clearcoatNormalMap:$,clearcoatRoughnessMap:ee,dispersion:j,iridescence:Y,iridescenceMap:te,iridescenceThicknessMap:ne,sheen:X,sheenColorMap:ie,sheenRoughnessMap:re,specularMap:ae,specularColorMap:oe,specularIntensityMap:se,transmission:K,transmissionMap:le,thicknessMap:ce,gradientMap:he,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:Ae,alphaTest:ue,alphaHash:de,combine:a.combine,mapUv:L&&f(a.map.channel),aoMapUv:N&&f(a.aoMap.channel),lightMapUv:F&&f(a.lightMap.channel),bumpMapUv:O&&f(a.bumpMap.channel),normalMapUv:k&&f(a.normalMap.channel),displacementMapUv:G&&f(a.displacementMap.channel),emissiveMapUv:H&&f(a.emissiveMap.channel),metalnessMapUv:z&&f(a.metalnessMap.channel),roughnessMapUv:V&&f(a.roughnessMap.channel),anisotropyMapUv:J&&f(a.anisotropyMap.channel),clearcoatMapUv:Z&&f(a.clearcoatMap.channel),clearcoatNormalMapUv:$&&f(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&f(a.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&f(a.iridescenceMap.channel),iridescenceThicknessMapUv:ne&&f(a.iridescenceThicknessMap.channel),sheenColorMapUv:ie&&f(a.sheenColorMap.channel),sheenRoughnessMapUv:re&&f(a.sheenRoughnessMap.channel),specularMapUv:ae&&f(a.specularMap.channel),specularColorMapUv:oe&&f(a.specularColorMap.channel),specularIntensityMapUv:se&&f(a.specularIntensityMap.channel),transmissionMapUv:le&&f(a.transmissionMap.channel),thicknessMapUv:ce&&f(a.thicknessMap.channel),alphaMapUv:Ae&&f(a.alphaMap.channel),vertexTangents:!!E.attributes.tangent&&(k||W),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!E.attributes.color&&4===E.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!E.attributes.uv&&(L||Ae),fog:!!v,useFog:!0===a.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:A,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==E.morphAttributes.position,morphNormals:void 0!==E.morphAttributes.normal,morphColors:void 0!==E.morphAttributes.color,morphTargetsCount:y,morphTextureStride:T,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,diamondOrientedEnvMap:a.diamondOrientedEnvMap,rayBounces:a.rayBounces,fixedEnvMapDirection:a.fixedEnvMapDirection,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:fe,decodeVideoTexture:L&&!0===a.map.isVideoTexture&&pn.getTransfer(a.map.colorSpace)===Mt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:pe&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pe&&!0===a.extensions.multiDraw||Q)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ge.vertexUv1s=c.has(1),ge.vertexUv2s=c.has(2),ge.vertexUv3s=c.has(3),c.clear(),ge},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.skinning&&s.enable(4),t.morphTargets&&s.enable(5),t.morphNormals&&s.enable(6),t.morphColors&&s.enable(7),t.premultipliedAlpha&&s.enable(8),t.shadowMapEnabled&&s.enable(9),t.doubleSided&&s.enable(10),t.flipSided&&s.enable(11),t.useDepthPacking&&s.enable(12),t.dithering&&s.enable(13),t.transmission&&s.enable(14),t.sheen&&s.enable(15),t.opaque&&s.enable(16),t.pointsUvs&&s.enable(17),t.decodeVideoTexture&&s.enable(18),t.alphaToCoverage&&s.enable(19),e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=p[e.type];let n;if(t){const e=la[t];n=Or.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e<t;e++){const t=h[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new hs(e,n,t,a),h.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function fs(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function gs(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function ms(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function vs(){const e=[];let t=0;const n=[],i=[],r=[];function a(n,i,r,a,o,s){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,o,s,l,c){const h=a(e,t,o,s,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,s,l,c){const h=a(e,t,o,s,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||gs),i.length>1&&i.sort(t||ms),r.length>1&&r.sort(t||ms)}}}function Es(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new vs,e.set(t,[r])):n>=i.length?(r=new vs,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function bs(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Tn,color:new Xi};break;case"SpotLight":n={position:new Tn,direction:new Tn,color:new Xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Tn,color:new Xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Tn,skyColor:new Xi,groundColor:new Xi};break;case"RectAreaLight":n={color:new Xi,position:new Tn,halfWidth:new Tn,halfHeight:new Tn}}return e[t.id]=n,n}}}let Cs=0;function _s(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Is(e){const t=new bs,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tn,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)i.probe.push(new Tn);const r=new Tn,a=new oi,o=new oi;return{setup:function(r){let a=0,o=0,s=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,A=0,u=0,d=0,p=0,f=0,g=0,m=0,v=0;r.sort(_s);for(let e=0,E=r.length;e<E;e++){const E=r[e],b=E.color,C=E.intensity,_=E.distance,I=E.shadow&&E.shadow.map?E.shadow.map.texture:null;if(E.isAmbientLight)a+=b.r*C,o+=b.g*C,s+=b.b*C;else if(E.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(E.sh.coefficients[e],C);v++}else if(E.isDirectionalLight){const e=t.get(E);if(e.color.copy(E.color).multiplyScalar(E.intensity),E.castShadow){const e=E.shadow,t=n.get(E);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=I,i.directionalShadowMatrix[l]=E.shadow.matrix,d++}i.directional[l]=e,l++}else if(E.isSpotLight){const e=t.get(E);e.position.setFromMatrixPosition(E.matrixWorld),e.color.copy(b).multiplyScalar(C),e.distance=_,e.coneCos=Math.cos(E.angle),e.penumbraCos=Math.cos(E.angle*(1-E.penumbra)),e.decay=E.decay,i.spot[h]=e;const r=E.shadow;if(E.map&&(i.spotLightMap[g]=E.map,g++,r.updateMatrices(E),E.castShadow&&m++),i.spotLightMatrix[h]=r.matrix,E.castShadow){const e=n.get(E);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=I,f++}h++}else if(E.isRectAreaLight){const e=t.get(E);e.color.copy(b).multiplyScalar(C),e.halfWidth.set(.5*E.width,0,0),e.halfHeight.set(0,.5*E.height,0),i.rectArea[A]=e,A++}else if(E.isPointLight){const e=t.get(E);if(e.color.copy(E.color).multiplyScalar(E.intensity),e.distance=E.distance,e.decay=E.decay,E.castShadow){const e=E.shadow,t=n.get(E);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,i.pointShadow[c]=t,i.pointShadowMap[c]=I,i.pointShadowMatrix[c]=E.shadow.matrix,p++}i.point[c]=e,c++}else if(E.isHemisphereLight){const e=t.get(E);e.skyColor.copy(E.color).multiplyScalar(C),e.groundColor.copy(E.groundColor).multiplyScalar(C),i.hemi[u]=e,u++}}A>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=sa.LTC_FLOAT_1,i.rectAreaLTC2=sa.LTC_FLOAT_2):(i.rectAreaLTC1=sa.LTC_HALF_1,i.rectAreaLTC2=sa.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=o,i.ambient[2]=s;const E=i.hash;E.directionalLength===l&&E.pointLength===c&&E.spotLength===h&&E.rectAreaLength===A&&E.hemiLength===u&&E.numDirectionalShadows===d&&E.numPointShadows===p&&E.numSpotShadows===f&&E.numSpotMaps===g&&E.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=A,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=d,i.directionalShadowMap.length=d,i.pointShadow.length=p,i.pointShadowMap.length=p,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=d,i.pointShadowMatrix.length=p,i.spotLightMatrix.length=f+g-m,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=m,i.numLightProbes=v,E.directionalLength=l,E.pointLength=c,E.spotLength=h,E.rectAreaLength=A,E.hemiLength=u,E.numDirectionalShadows=d,E.numPointShadows=p,E.numSpotShadows=f,E.numSpotMaps=g,E.numLightProbes=v,i.version=Cs++)},setupView:function(e,t){let n=0,s=0,l=0,c=0,h=0;const A=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(A),n++}else if(u.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(A),l++}else if(u.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),o.identity(),a.copy(u.matrixWorld),a.premultiply(A),o.extractRotation(a),e.halfWidth.set(.5*u.width,0,0),e.halfHeight.set(0,.5*u.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),c++}else if(u.isPointLight){const e=i.point[s];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),s++}else if(u.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(u.matrixWorld),e.direction.transformDirection(A),h++}}},state:i}}function xs(e){const t=new Is(e),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function ys(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let a;return void 0===r?(a=new xs(e),t.set(n,[a])):i>=r.length?(a=new xs(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}class Ms extends Zi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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}}class ws extends Zi{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 Ss(e,t,n){let i=new na;const r=new tn,a=new tn,o=new xn,s=new Ms({depthPacking:3201}),l=new ws,c={},h=n.maxTextureSize,A={[de]:1,[pe]:0,[fe]:2},u=new kr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new tn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=u.clone();d.defines.HORIZONTAL_PASS=1;const p=new fr;p.setAttribute("position",new rr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new Qr(p,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let m=this.type;function v(n,i){const a=t.update(f);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,d.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,d.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Mn(r.x,r.y)),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,a,u,f,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,a,d,f,null)}function E(t,n,i,r){let a=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?l:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=a.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",C)),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:A[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function b(n,r,a,o,s){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,h=t.length;c<h;c++){const h=t[c],A=l[h.materialIndex];if(A&&A.visible){const t=E(n,A,o,s);n.onBeforeShadow(e,n,r,a,i,t,h),e.renderBufferDirect(a,null,i,t,n,h),n.onAfterShadow(e,n,r,a,i,t,h)}}}else if(l.visible){const t=E(n,l,o,s);n.onBeforeShadow(e,n,r,a,i,t,null),e.renderBufferDirect(a,null,i,t,n,null),n.onAfterShadow(e,n,r,a,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)b(l[e],r,a,o,s)}function C(e){e.target.removeEventListener("dispose",C);for(const t in c){const n=c[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(t,n,s){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),u=e.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const d=3!==m&&3===this.type,p=3===m&&3!==this.type;for(let l=0,c=t.length;l<c;l++){const c=t[l],A=c.shadow;if(void 0===A){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===A.autoUpdate&&!1===A.needsUpdate)continue;r.copy(A.mapSize);const f=A.getFrameExtents();if(r.multiply(f),a.copy(A.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/f.x),r.x=a.x*f.x,A.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/f.y),r.y=a.y*f.y,A.mapSize.y=a.y)),null===A.map||!0===d||!0===p){const e=3!==this.type?{minFilter:He,magFilter:He}:{};null!==A.map&&A.map.dispose(),A.map=new Mn(r.x,r.y,e),A.map.texture.name=c.name+".shadowMap",A.camera.updateProjectionMatrix()}e.setRenderTarget(A.map),e.clear();const g=A.getViewportCount();for(let e=0;e<g;e++){const t=A.getViewport(e);o.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),u.viewport(o),A.updateMatrices(c,e),i=A.getFrustum(),b(n,s,A.camera,c,this.type)}!0!==A.isPointLightShadow&&3===this.type&&v(A,s),A.needsUpdate=!1}m=this.type,g.needsUpdate=!1,e.setRenderTarget(l,c,A)}}function Bs(e){const t=new function(){let t=!1;const n=new xn;let i=null;const r=new xn(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},n=new function(){let t=!1,n=null,i=null,r=null;return{setTest:function(t){t?O(e.DEPTH_TEST):k(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},i=new function(){let t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(n){t||(n?O(e.STENCIL_TEST):k(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap;let o={},s={},l=new WeakMap,c=[],h=null,A=!1,u=null,d=null,p=null,f=null,g=null,m=null,v=null,E=new Xi(0,0,0),b=0,C=!1,_=null,I=null,x=null,y=null,M=null;const w=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let S=!1,B=0;const T=e.getParameter(e.VERSION);-1!==T.indexOf("WebGL")?(B=parseFloat(/^WebGL (\d)/.exec(T)[1]),S=B>=1):-1!==T.indexOf("OpenGL ES")&&(B=parseFloat(/^OpenGL ES (\d)/.exec(T)[1]),S=B>=2);let R=null,D={};const Q=e.getParameter(e.SCISSOR_BOX),L=e.getParameter(e.VIEWPORT),U=(new xn).fromArray(Q),P=(new xn).fromArray(L);function N(t,n,i,r){const a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<i;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return o}const F={};function O(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function k(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}F[e.TEXTURE_2D]=N(e.TEXTURE_2D,e.TEXTURE_2D,1),F[e.TEXTURE_CUBE_MAP]=N(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),F[e.TEXTURE_2D_ARRAY]=N(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),F[e.TEXTURE_3D]=N(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),n.setClear(1),i.setClear(0),O(e.DEPTH_TEST),n.setFunc(3),V(!1),W(1),O(e.CULL_FACE),z(0);const G={[ge]:e.FUNC_ADD,[me]:e.FUNC_SUBTRACT,[ve]:e.FUNC_REVERSE_SUBTRACT};G[103]=e.MIN,G[104]=e.MAX;const H={[Ee]:e.ZERO,[be]:e.ONE,[Ce]:e.SRC_COLOR,[Ie]:e.SRC_ALPHA,[Be]:e.SRC_ALPHA_SATURATE,[we]:e.DST_COLOR,[ye]:e.DST_ALPHA,[_e]:e.ONE_MINUS_SRC_COLOR,[xe]:e.ONE_MINUS_SRC_ALPHA,[Se]:e.ONE_MINUS_DST_COLOR,[Me]:e.ONE_MINUS_DST_ALPHA,[Te]:e.CONSTANT_COLOR,[Re]:e.ONE_MINUS_CONSTANT_COLOR,[De]:e.CONSTANT_ALPHA,[Qe]:e.ONE_MINUS_CONSTANT_ALPHA};function z(t,n,i,r,a,o,s,l,c,h){if(0!==t){if(!1===A&&(O(e.BLEND),A=!0),5===t)a=a||n,o=o||i,s=s||r,n===d&&a===g||(e.blendEquationSeparate(G[n],G[a]),d=n,g=a),i===p&&r===f&&o===m&&s===v||(e.blendFuncSeparate(H[i],H[r],H[o],H[s]),p=i,f=r,m=o,v=s),!1!==l.equals(E)&&c===b||(e.blendColor(l.r,l.g,l.b,c),E.copy(l),b=c),u=t,C=!1;else if(t!==u||h!==C){if(d===ge&&g===ge||(e.blendEquation(e.FUNC_ADD),d=ge,g=ge),h)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}p=null,f=null,m=null,v=null,E.set(0,0,0),b=0,u=t,C=h}}else!0===A&&(k(e.BLEND),A=!1)}function V(t){_!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),_=t)}function W(t){0!==t?(O(e.CULL_FACE),t!==I&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):k(e.CULL_FACE),I=t}function q(t,n,i){t?(O(e.POLYGON_OFFSET_FILL),y===n&&M===i||(e.polygonOffset(n,i),y=n,M=i)):k(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:n,stencil:i},enable:O,disable:k,bindFramebuffer:function(t,n){return s[t]!==n&&(e.bindFramebuffer(t,n),s[t]=n,t===e.DRAW_FRAMEBUFFER&&(s[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(s[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=c,r=!1;if(t){i=l.get(n),void 0===i&&(i=[],l.set(n,i));const a=t.textures;if(i.length!==a.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=a.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:z,setMaterial:function(r,a){2===r.side?k(e.CULL_FACE):O(e.CULL_FACE);let o=1===r.side;a&&(o=!o),V(o),1===r.blending&&!1===r.transparent?z(0):z(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),n.setFunc(r.depthFunc),n.setTest(r.depthTest),n.setMask(r.depthWrite),t.setMask(r.colorWrite);const s=r.stencilWrite;i.setTest(s),s&&(i.setMask(r.stencilWriteMask),i.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),i.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),q(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?O(e.SAMPLE_ALPHA_TO_COVERAGE):k(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:V,setCullFace:W,setLineWidth:function(t){t!==x&&(S&&e.lineWidth(t),x=t)},setPolygonOffset:q,setScissorTest:function(t){t?O(e.SCISSOR_TEST):k(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+w-1),R!==t&&(e.activeTexture(t),R=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===R?e.TEXTURE0+w-1:R);let r=D[i];void 0===r&&(r={type:void 0,texture:void 0},D[i]=r),r.type===t&&r.texture===n||(R!==i&&(e.activeTexture(i),R=i),e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=D[R];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=a.get(n);void 0===i&&(i=new WeakMap,a.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=a.get(n).get(t);r.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),r.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===U.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),U.copy(t))},viewport:function(t){!1===P.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),P.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),o={},R=null,D={},s={},l=new WeakMap,c=[],h=null,A=!1,u=null,d=null,p=null,f=null,g=null,m=null,v=null,E=new Xi(0,0,0),b=0,C=!1,_=null,I=null,x=null,y=null,M=null,U.set(0,0,e.canvas.width,e.canvas.height),P.set(0,0,e.canvas.width,e.canvas.height),t.reset(),n.reset(),i.reset()}}}function Ts(e,t,n,i,r,a,o){const s=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new tn,h=new WeakMap;let A;const u=new WeakMap;let d=!1;try{d="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function p(e,t){return d?new OffscreenCanvas(e,t):on("canvas")}function f(e,t,n){let i=1;const r=k(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===A&&(A=p(n,a));const o=t?p(n,a):A;return o.width=n,o.height=a,o.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function g(e){return e.generateMipmaps&&e.minFilter!==He&&e.minFilter!==We}function m(t){e.generateMipmap(t)}function v(n,i,r,a,o=!1){if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=i;if(i===e.RED&&(r===e.FLOAT&&(s=e.R32F),r===e.HALF_FLOAT&&(s=e.R16F),r===e.UNSIGNED_BYTE&&(s=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(s=e.R8UI),r===e.UNSIGNED_SHORT&&(s=e.R16UI),r===e.UNSIGNED_INT&&(s=e.R32UI),r===e.BYTE&&(s=e.R8I),r===e.SHORT&&(s=e.R16I),r===e.INT&&(s=e.R32I)),i===e.RG&&(r===e.FLOAT&&(s=e.RG32F),r===e.HALF_FLOAT&&(s=e.RG16F),r===e.UNSIGNED_BYTE&&(s=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(s=e.RG8UI),r===e.UNSIGNED_SHORT&&(s=e.RG16UI),r===e.UNSIGNED_INT&&(s=e.RG32UI),r===e.BYTE&&(s=e.RG8I),r===e.SHORT&&(s=e.RG16I),r===e.INT&&(s=e.RG32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),i===e.RGBA){const t=o?yt:pn.getTransfer(a);r===e.FLOAT&&(s=e.RGBA32F),r===e.HALF_FLOAT&&(s=e.RGBA16F),r===e.UNSIGNED_BYTE&&(s=t===Mt?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function E(t,n){let i;return t?null===n||n===Ke||n===$e?i=e.DEPTH24_STENCIL8:n===Je?i=e.DEPTH32F_STENCIL8:n===Xe&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Ke||n===$e?i=e.DEPTH_COMPONENT24:n===Je?i=e.DEPTH_COMPONENT32F:n===Xe&&(i=e.DEPTH_COMPONENT16),i}function b(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==He&&e.minFilter!==We?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function C(e){const t=e.target;t.removeEventListener("dispose",C),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=u.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&I(e),0===Object.keys(r).length&&u.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function _(t){const n=t.target;n.removeEventListener("dispose",_),function(t){const n=i.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function I(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete u.get(r)[n.__cacheKey],o.memory.textures--}let x=0;function y(t,r){const a=i.get(t);if(t.isVideoTexture&&function(e){const t=o.render.frame;h.get(e)!==t&&(h.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void R(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}const M={[Oe]:e.REPEAT,[ke]:e.CLAMP_TO_EDGE,[Ge]:e.MIRRORED_REPEAT},w={[He]:e.NEAREST,[ze]:e.NEAREST_MIPMAP_NEAREST,[Ve]:e.NEAREST_MIPMAP_LINEAR,[We]:e.LINEAR,[qe]:e.LINEAR_MIPMAP_NEAREST,[je]:e.LINEAR_MIPMAP_LINEAR},S={[Tt]:e.NEVER,[Nt]:e.ALWAYS,[Rt]:e.LESS,[Qt]:e.LEQUAL,[Dt]:e.EQUAL,[Pt]:e.GEQUAL,[Lt]:e.GREATER,[Ut]:e.NOTEQUAL};function B(n,a){if(a.type!==Je||!1!==t.has("OES_texture_float_linear")||a.magFilter!==We&&a.magFilter!==qe&&a.magFilter!==Ve&&a.magFilter!==je&&a.minFilter!==We&&a.minFilter!==qe&&a.minFilter!==Ve&&a.minFilter!==je||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,M[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,M[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,M[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,w[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,w[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,S[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===He)return;if(a.minFilter!==Ve&&a.minFilter!==je)return;if(a.type===Je&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function T(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",C));const r=n.source;let a=u.get(r);void 0===a&&(a={},u.set(r,a));const s=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&I(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return i}function R(t,o,s){let l=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=e.TEXTURE_3D);const c=T(t,o),h=o.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+s);const A=i.get(h);if(h.version!==A.__version||!0===c){n.activeTexture(e.TEXTURE0+s);const t=pn.getPrimaries(pn.workingColorSpace),i=o.colorSpace===bt?null:pn.getPrimaries(o.colorSpace),u=o.colorSpace===bt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let d=f(o.image,!1,r.maxTextureSize);d=O(o,d);const p=a.convert(o.format,o.colorSpace),C=a.convert(o.type);let _,I=v(o.internalFormat,p,C,o.colorSpace,o.isVideoTexture);B(l,o);const x=o.mipmaps,y=!0!==o.isVideoTexture,M=void 0===A.__version||!0===c,w=h.dataReady,S=b(o,d);if(o.isDepthTexture)I=E(o.format===nt,o.type),M&&(y?n.texStorage2D(e.TEXTURE_2D,1,I,d.width,d.height):n.texImage2D(e.TEXTURE_2D,0,I,d.width,d.height,0,p,C,null));else if(o.isDataTexture)if(x.length>0){y&&M&&n.texStorage2D(e.TEXTURE_2D,S,I,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)_=x[t],y?w&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,C,_.data):n.texImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,p,C,_.data);o.generateMipmaps=!1}else y?(M&&n.texStorage2D(e.TEXTURE_2D,S,I,d.width,d.height),w&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,d.width,d.height,p,C,d.data)):n.texImage2D(e.TEXTURE_2D,0,I,d.width,d.height,0,p,C,d.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){y&&M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,S,I,x[0].width,x[0].height,d.depth);for(let t=0,i=x.length;t<i;t++)if(_=x[t],o.format!==et)if(null!==p)if(y){if(w)if(o.layerUpdates.size>0){for(const i of o.layerUpdates){const r=_.width*_.height;n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,_.width,_.height,1,p,_.data.slice(r*i,r*(i+1)),0,0)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,d.depth,p,_.data,0,0)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,I,_.width,_.height,d.depth,0,_.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else y?w&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,d.depth,p,C,_.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,I,_.width,_.height,d.depth,0,p,C,_.data)}else{y&&M&&n.texStorage2D(e.TEXTURE_2D,S,I,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)_=x[t],o.format!==et?null!==p?y?w&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,_.data):n.compressedTexImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):y?w&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,C,_.data):n.texImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,p,C,_.data)}else if(o.isDataArrayTexture)if(y){if(M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,S,I,d.width,d.height,d.depth),w)if(o.layerUpdates.size>0){let t;switch(C){case e.UNSIGNED_BYTE:switch(p){case e.ALPHA:case e.LUMINANCE:t=1;break;case e.LUMINANCE_ALPHA:t=2;break;case e.RGB:t=3;break;case e.RGBA:t=4;break;default:throw new Error(`Unknown texel size for format ${p}.`)}break;case e.UNSIGNED_SHORT_4_4_4_4:case e.UNSIGNED_SHORT_5_5_5_1:case e.UNSIGNED_SHORT_5_6_5:t=1;break;default:throw new Error(`Unknown texel size for type ${C}.`)}const i=d.width*d.height*t;for(const t of o.layerUpdates)n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,t,d.width,d.height,1,p,C,d.data.slice(i*t,i*(t+1)));o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,d.width,d.height,d.depth,p,C,d.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,I,d.width,d.height,d.depth,0,p,C,d.data);else if(o.isData3DTexture)y?(M&&n.texStorage3D(e.TEXTURE_3D,S,I,d.width,d.height,d.depth),w&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,d.width,d.height,d.depth,p,C,d.data)):n.texImage3D(e.TEXTURE_3D,0,I,d.width,d.height,d.depth,0,p,C,d.data);else if(o.isFramebufferTexture){if(M)if(y)n.texStorage2D(e.TEXTURE_2D,S,I,d.width,d.height);else{let t=d.width,i=d.height;for(let r=0;r<S;r++)n.texImage2D(e.TEXTURE_2D,r,I,t,i,0,p,C,null),t>>=1,i>>=1}}else if(x.length>0){if(y&&M){const t=k(x[0]);n.texStorage2D(e.TEXTURE_2D,S,I,t.width,t.height)}for(let t=0,i=x.length;t<i;t++)_=x[t],y?w&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,p,C,_):n.texImage2D(e.TEXTURE_2D,t,I,p,C,_);o.generateMipmaps=!1}else if(y){if(M){const t=k(d);n.texStorage2D(e.TEXTURE_2D,S,I,t.width,t.height)}w&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p,C,d)}else n.texImage2D(e.TEXTURE_2D,0,I,p,C,d);g(o)&&m(l),A.__version=h.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function D(t,r,o,l,c,h){const A=a.convert(o.format,o.colorSpace),u=a.convert(o.type),d=v(o.internalFormat,A,u,o.colorSpace);if(!i.get(r).__hasExternalTextures){const t=Math.max(1,r.width>>h),i=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,h,d,t,i,r.depth,0,A,u,null):n.texImage2D(c,h,d,t,i,0,A,u,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),F(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,i.get(o).__webglTexture,0,N(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,i.get(o).__webglTexture,h),n.bindFramebuffer(e.FRAMEBUFFER,null)}function Q(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,o=E(n.stencilBuffer,a),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=N(n);F(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,o,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r<t.length;r++){const o=t[r],l=a.convert(o.format,o.colorSpace),c=a.convert(o.type),h=v(o.internalFormat,l,c,o.colorSpace),A=N(n);i&&!1===F(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,A,h,n.width,n.height):F(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,A,h,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,h,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function L(t){const r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),y(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture,o=N(r);if(r.depthTexture.format===tt)F(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==nt)throw new Error("Unknown depthTexture format");F(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=e.createRenderbuffer(),Q(r.__webglDepthbuffer[i],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),Q(r.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}const U=[],P=[];function N(e){return Math.min(r.maxSamples,e.samples)}function F(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function O(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==_t&&n!==bt&&(pn.getTransfer(n)===Mt?i===et&&r===Ye||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function k(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){const e=x;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),x+=1,e},this.resetTextureUnits=function(){x=0},this.setTexture2D=y,this.setTexture2DArray=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,o){const s=i.get(t);t.version>0&&s.__version!==t.version?function(t,o,s){if(6!==o.image.length)return;const l=T(t,o),c=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+s);const t=pn.getPrimaries(pn.workingColorSpace),i=o.colorSpace===bt?null:pn.getPrimaries(o.colorSpace),A=o.colorSpace===bt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,A);const u=o.isCompressedTexture||o.image[0].isCompressedTexture,d=o.image[0]&&o.image[0].isDataTexture,p=[];for(let e=0;e<6;e++)p[e]=u||d?d?o.image[e].image:o.image[e]:f(o.image[e],!0,r.maxCubemapSize),p[e]=O(o,p[e]);const E=p[0],C=a.convert(o.format,o.colorSpace),_=a.convert(o.type),I=v(o.internalFormat,C,_,o.colorSpace),x=!0!==o.isVideoTexture,y=void 0===h.__version||!0===l,M=c.dataReady;let w,S=b(o,E);if(B(e.TEXTURE_CUBE_MAP,o),u){x&&y&&n.texStorage2D(e.TEXTURE_CUBE_MAP,S,I,E.width,E.height);for(let t=0;t<6;t++){w=p[t].mipmaps;for(let i=0;i<w.length;i++){const r=w[i];o.format!==et?null!==C?x?M&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,C,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,I,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,C,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,I,r.width,r.height,0,C,_,r.data)}}}else{if(w=o.mipmaps,x&&y){w.length>0&&S++;const t=k(p[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,S,I,t.width,t.height)}for(let t=0;t<6;t++)if(d){x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,p[t].width,p[t].height,C,_,p[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,I,p[t].width,p[t].height,0,C,_,p[t].data);for(let i=0;i<w.length;i++){const r=w[i].image[t].image;x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,C,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,I,r.width,r.height,0,C,_,r.data)}}else{x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,C,_,p[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,I,C,_,p[t]);for(let i=0;i<w.length;i++){const r=w[i];x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,C,_,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,I,C,_,r.image[t])}}}g(o)&&m(e.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}(s,t,o):n.bindTexture(e.TEXTURE_CUBE_MAP,s.__webglTexture,e.TEXTURE0+o)},this.rebindTextures=function(t,n,r){const a=i.get(t);void 0!==n&&D(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&L(t)},this.setupRenderTarget=function(t){const r=t.texture,s=i.get(t),l=i.get(r);t.addEventListener("dispose",_);const c=t.textures,h=!0===t.isWebGLCubeRenderTarget,A=c.length>1;if(A||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,o.memory.textures++),h){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)s.__webglFramebuffer[t][n]=e.createFramebuffer()}else s.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)s.__webglFramebuffer[t]=e.createFramebuffer()}else s.__webglFramebuffer=e.createFramebuffer();if(A)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&!1===F(t)){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];s.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer[n]);const r=a.convert(i.format,i.colorSpace),o=a.convert(i.type),l=v(i.internalFormat,r,o,i.colorSpace,!0===t.isXRRenderTarget),h=N(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,s.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),Q(s.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),B(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)D(s.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else D(s.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&m(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(A){for(let r=0,a=c.length;r<a;r++){const a=c[r],o=i.get(a);n.bindTexture(e.TEXTURE_2D,o.__webglTexture),B(e.TEXTURE_2D,a),D(s.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),g(a)&&m(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),B(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)D(s.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else D(s.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);g(r)&&m(i),n.unbindTexture()}t.depthBuffer&&L(t)},this.updateRenderTargetMipmap=function(t){const r=t.textures;for(let a=0,o=r.length;a<o;a++){const o=r[a];if(g(o)){const r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=i.get(o).__webglTexture;n.bindTexture(r,a),m(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===F(t)){const r=t.textures,a=t.width,o=t.height;let s=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),A=r.length>1;if(A)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),A){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),!0===l&&(U.length=0,P.length=0,U.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(U.push(c),P.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,P)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,U))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),A)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);const a=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=L,this.setupFrameBufferTexture=D,this.useMultisampledRTT=F}function Rs(e,t){return{convert:function(n,i=""){let r;const a=pn.getTransfer(i);if(n===Ye)return e.UNSIGNED_BYTE;if(1017===n)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===n)return e.UNSIGNED_INT_5_9_9_9_REV;if(1010===n)return e.BYTE;if(1011===n)return e.SHORT;if(n===Xe)return e.UNSIGNED_SHORT;if(1013===n)return e.INT;if(n===Ke)return e.UNSIGNED_INT;if(n===Je)return e.FLOAT;if(n===Ze)return e.HALF_FLOAT;if(1021===n)return e.ALPHA;if(1022===n)return e.RGB;if(n===et)return e.RGBA;if(1024===n)return e.LUMINANCE;if(1025===n)return e.LUMINANCE_ALPHA;if(n===tt)return e.DEPTH_COMPONENT;if(n===nt)return e.DEPTH_STENCIL;if(n===it)return e.RED;if(1029===n)return e.RED_INTEGER;if(n===rt)return e.RG;if(1031===n)return e.RG_INTEGER;if(1033===n)return e.RGBA_INTEGER;if(n===at||n===ot||n===st||n===lt)if(a===Mt){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===at)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ot)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===lt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===at)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ot)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===st)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===lt)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ct||35841===n||n===ht||35843===n){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===ct)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ht)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===At||n===ut||n===dt){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===At||n===ut)return a===Mt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===dt)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===pt||37809===n||37810===n||37811===n||n===ft||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===pt)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ft)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===gt||36494===n||36495===n){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===gt)return a===Mt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===n)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===n)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||36284===n||36285===n||36286===n){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===gt)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===n)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===n)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===n)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===$e?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class Ds extends Wr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Qs extends Qi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ls={type:"move"};class Us{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Qs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Qs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Tn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Tn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Qs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Tn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Tn),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null;const o=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),s=.02,c=.005;l.inputState.pinching&&o>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1));null!==o&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ls)))}return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Qs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Ps{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new In;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new kr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Qr(new aa(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Ns extends Ht{constructor(e,t){super();const n=this;let i=null,r=1,a=null,o="local-floor",s=1,l=null,c=null,h=null,A=null,u=null,d=null;const p=new Ps,f=t.getContextAttributes();let g=null,m=null;const v=[],E=[],b=new tn;let C=null;const _=new Wr;_.layers.enable(1),_.viewport=new xn;const I=new Wr;I.layers.enable(2),I.viewport=new xn;const x=[_,I],y=new Ds;y.layers.enable(1),y.layers.enable(2);let M=null,w=null;function S(e){const t=E.indexOf(e.inputSource);if(-1===t)return;const n=v[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function B(){i.removeEventListener("select",S),i.removeEventListener("selectstart",S),i.removeEventListener("selectend",S),i.removeEventListener("squeeze",S),i.removeEventListener("squeezestart",S),i.removeEventListener("squeezeend",S),i.removeEventListener("end",B),i.removeEventListener("inputsourceschange",T);for(let e=0;e<v.length;e++){const t=E[e];null!==t&&(E[e]=null,v[e].disconnect(t))}M=null,w=null,p.reset(),e.setRenderTarget(g),u=null,A=null,h=null,i=null,m=null,U.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(b.width,b.height,!1),n.dispatchEvent({type:"sessionend"})}function T(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=E.indexOf(n);i>=0&&(E[i]=null,v[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=E.indexOf(n);if(-1===i){for(let e=0;e<v.length;e++){if(e>=E.length){E.push(n),i=e;break}if(null===E[e]){E[e]=n,i=e;break}}if(-1===i)break}const r=v[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return void 0===t&&(t=new Us,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return void 0===t&&(t=new Us,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return void 0===t&&(t=new Us,v[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==A?A:u},this.getBinding=function(){return h},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=e.getRenderTarget(),i.addEventListener("select",S),i.addEventListener("selectstart",S),i.addEventListener("selectend",S),i.addEventListener("squeeze",S),i.addEventListener("squeezestart",S),i.addEventListener("squeezeend",S),i.addEventListener("end",B),i.addEventListener("inputsourceschange",T),!0!==f.xrCompatible&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(b),void 0===i.renderState.layers){const n={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),m=new Mn(u.framebufferWidth,u.framebufferHeight,{format:et,type:Ye,colorSpace:e.outputColorSpace,stencilBuffer:f.stencil})}else{let n=null,a=null,o=null;f.depth&&(o=f.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=f.stencil?nt:tt,a=f.stencil?$e:Ke);const s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:r};h=new XRWebGLBinding(i,t),A=h.createProjectionLayer(s),i.updateRenderState({layers:[A]}),e.setPixelRatio(1),e.setSize(A.textureWidth,A.textureHeight,!1),m=new Mn(A.textureWidth,A.textureHeight,{format:et,type:Ye,depthTexture:new Ga(A.textureWidth,A.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,colorSpace:e.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===A.ignoreDepthValues})}m.isXRRenderTarget=!0,this.setFoveation(s),l=null,a=await i.requestReferenceSpace(o),U.setContext(i),U.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};const R=new Tn,D=new Tn;function Q(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===i)return;null!==p.texture&&(e.near=p.depthNear,e.far=p.depthFar),y.near=I.near=_.near=e.near,y.far=I.far=_.far=e.far,M===y.near&&w===y.far||(i.updateRenderState({depthNear:y.near,depthFar:y.far}),M=y.near,w=y.far,_.near=M,_.far=w,I.near=M,I.far=w,_.updateProjectionMatrix(),I.updateProjectionMatrix(),e.updateProjectionMatrix());const t=e.parent,n=y.cameras;Q(y,t);for(let e=0;e<n.length;e++)Q(n[e],t);2===n.length?function(e,t,n){R.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);const i=R.distanceTo(D),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],A=(a[8]+1)/a[0],u=o*h,d=o*A,p=i/(-h+A),f=p*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const g=o+p,m=s+p,v=u-f,E=d+(i-f),b=l*s/m*g,C=c*s/m*g;e.projectionMatrix.makePerspective(v,E,b,C,g,m),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(y,_,I):y.projectionMatrix.copy(_.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*Wt*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,y,t)},this.getCamera=function(){return y},this.getFoveation=function(){if(null!==A||null!==u)return s},this.setFoveation=function(e){s=e,null!==A&&(A.fixedFoveation=e),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==p.texture},this.getDepthSensingMesh=function(){return p.getMesh(y)};let L=null;const U=new ia;U.setAnimationLoop(function(t,r){if(c=r.getViewerPose(l||a),d=r,null!==c){const t=c.views;null!==u&&(e.setRenderTargetFramebuffer(m,u.framebuffer),e.setRenderTarget(m));let n=!1;t.length!==y.cameras.length&&(y.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let a=null;if(null!==u)a=u.getViewport(r);else{const t=h.getViewSubImage(A,r);a=t.viewport,0===i&&(e.setRenderTargetTextures(m,t.colorTexture,A.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(m))}let o=x[i];void 0===o&&(o=new Wr,o.layers.enable(i),o.viewport=new xn,x[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),0===i&&(y.matrix.copy(o.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale)),!0===n&&y.cameras.push(o)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")){const n=h.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&p.init(e,n,i.renderState)}}for(let e=0;e<v.length;e++){const t=E[e],n=v[e];null!==t&&void 0!==n&&n.update(t,r,l||a)}L&&L(t,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),d=null}),this.setAnimationLoop=function(e){L=e},this.dispose=function(){}}}const Fs=new gi,Os=new oi;function ks(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,o=r.envMapRotation;a&&(e.envMap.value=a,Fs.copy(o),Fs.x*=-1,Fs.y*=-1,Fs.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Fs.y*=-1,Fs.z*=-1),e.envMapRotation.value.setFromMatrix4(Os.makeRotationFromEuler(Fs)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Fr(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,o,s,l){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,s)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial?r.uniformsNeedUpdate=!1:r.isMeshDiamondMaterial&&function(e,n,i,r){e.opacity.value=n.opacity,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.radius.value=n.radius,e.squashFactor.value=n.squashFactor,e.geometryFactor.value=n.geometryFactor,e.gammaFactor.value=n.gammaFactor,e.absorptionFactor.value=n.absorptionFactor,e.rIndexDelta.value=n.rIndexDelta,n.boostFactors&&e.boostFactors.value.copy(n.boostFactors),n.colorCorrection&&e.colorCorrection.value.set(n.colorCorrection.r,n.colorCorrection.g,n.colorCorrection.b),n.color&&(e.diffuse.value.copy(n.color),e.color.value.set(n.color.r,n.color.g,n.color.b));const a=t.get(n).envMap;a&&(e.envMap.value=a,e.envMapRotation.value=n.envMapRotation,e.envMapIntensity.value=n.envMapIntensity),n.transmission>0&&(e.transmission.value=n.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height)),r&&(e.tCubeMapNormals.value=r.texture)}(e,r,s,l)}}}function Gs(e,t,n,i){let r={},a={},o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){const n=t.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,A){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e<i;e++){const i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){const t=i[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){const i=c(r[e]),a=n%16;0!==a&&16-a<i.boundary&&(n+=16-a),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e<s;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=u,n.addEventListener("dispose",h));const d=A.program;i.updateUBOMapping(n,d);const p=t.render.frame;a[n.id]!==p&&(function(t){const n=r[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,a)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let a=0;a<n.length;a++){const o=n[a],s=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=s.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);o=[],r={},a={}}}}class Hs extends kr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class zs extends Zi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Xi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}class Vs extends Zi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Xi(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 Xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new tn(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 gi,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}}class Ws extends Vs{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new tn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Xi(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Xi(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Xi(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class qs extends Zi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xi(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}}class js extends Zi{constructor(e){super(),this.isMeshDiamondMaterial=!0,this.type="MeshDiamondMaterial",this.defines={RAY_BOUNCES:5},this.color=new Xi(16777215),this.map=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=0,this.envMapRotationQuat=(new Bn).identity(),this.envMapIntensity=.01,this.ior=2.4,this.reflectivity=.5,this.roughness=1,this.metalness=0,this.radius=1,this.transmission=0,this.squashFactor=.98,this.geometryFactor=.5,this.gammaFactor=1,this.absorptionFactor=1,this.rIndexDelta=.012,this.diamondOrientedEnvMap=0,this.boostFactors=new Tn(1,1,1),this.fixedEnvMapDirection=!1,this.rayBounces=5,this.colorCorrection=new Xi(16777215),this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.defines=Object.assign({},e.defines),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation=e.envMapRotation,this.envMapRotationQuat.copy(e.envMapRotationQuat),this.envMapIntensity=e.envMapIntensity,this.ior=e.ior,this.reflectivity=e.reflectivity,this.roughness=e.roughness,this.metalness=e.metalness,this.radius=e.radius,this.transmission=e.transmission,this.squashFactor=e.squashFactor,this.geometryFactor=e.geometryFactor,this.gammaFactor=e.gammaFactor,this.absorptionFactor=e.absorptionFactor,this.colorCorrection=e.colorCorrection,this.rIndexDelta=e.rIndexDelta,this.diamondOrientedEnvMap=e.diamondOrientedEnvMap,this.boostFactors.copy(e.boostFactors),this.fixedEnvMapDirection=e.fixedEnvMapDirection,this.rayBounces=e.rayBounces,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}class Ys extends Zi{constructor(e){super(),this.isCubeNormalsMaterial=!0,this.type="CubeNormalsMaterial",this.radius=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.radius=e.radius,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}class Xs extends Qi{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 gi,this.environmentIntensity=1,this.environmentRotation=new gi,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Ks{constructor(e={}){const{canvas:t=sn(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1}=e;let A;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=n.getContextAttributes().alpha}else A=a;const u=new Uint32Array(4),d=new Int32Array(4);let p=null,f=null;const g=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ct,this.toneMapping=0,this.toneMappingExposure=1;const v=this;let E=!1,b=0,C=0,_=null,I=-1,x=null;const y=new xn,M=new xn;let w=null;const S=new Xi(0);let B=0,T=t.width,R=t.height,D=1,Q=null,L=null;const U=new xn(0,0,T,R),P=new xn(0,0,T,R);let N=!1;const F=new na;let O=!1,k=!1;const G=new oi,H=new Tn,z=new xn,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let W=!1;function q(){return null===_?D:1}let j,Y,X,K,J,Z,$,ee,te,ne,ie,re,ae,oe,se,le,ce,he,Ae,de,pe,fe,ge,me,ve=n;function Ee(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ue}`),t.addEventListener("webglcontextlost",_e,!1),t.addEventListener("webglcontextrestored",Ie,!1),t.addEventListener("webglcontextcreationerror",xe,!1),null===ve){const t="webgl2";if(ve=Ee(t,e),null===ve)throw Ee(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function be(){j=new Ua(ve),j.init(),fe=new Rs(ve,j),Y=new fa(ve,j,e,fe),X=new Bs(ve),K=new Fa(ve),J=new fs,Z=new Ts(ve,j,X,J,Y,fe,K),$=new ma(v),ee=new La(v),te=new ra(ve),ge=new da(ve,te),ne=new Pa(ve,te,K,ge),ie=new ka(ve,ne,te,K),Ae=new Oa(ve,Y,Z),le=new ga(J),re=new ps(v,$,ee,j,Y,ge,le),ae=new ks(v,J),oe=new Es,se=new ys(j),he=new ua(v,$,ee,X,ie,A,s),ce=new Ss(v,ie,Y),me=new Gs(ve,K,Y,X),de=new pa(ve,j,K),pe=new Na(ve,j,K),K.programs=re.programs,v.capabilities=Y,v.extensions=j,v.properties=J,v.renderLists=oe,v.shadowMap=ce,v.state=X,v.info=K}be();const Ce=new Ns(v,ve);function _e(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function Ie(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;const e=K.autoReset,t=ce.enabled,n=ce.autoUpdate,i=ce.needsUpdate,r=ce.type;be(),K.autoReset=e,ce.enabled=t,ce.autoUpdate=n,ce.needsUpdate=i,ce.type=r}function xe(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ye(e){const t=e.target;t.removeEventListener("dispose",ye),function(e){(function(e){const t=J.get(e).programs;void 0!==t&&(t.forEach(function(e){re.releaseProgram(e)}),e.isShaderMaterial&&re.releaseShaderCache(e))})(e),J.remove(e)}(t)}function Me(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,Pe(e,t,n),e.side=0,e.needsUpdate=!0,Pe(e,t,n),e.side=2):Pe(e,t,n)}this.xr=Ce,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.getContextAttributes()},this.forceContextLoss=function(){const e=j.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=j.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(e){void 0!==e&&(D=e,this.setSize(T,R,!1))},this.getSize=function(e){return e.set(T,R)},this.setSize=function(e,n,i=!0){Ce.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=e,R=n,t.width=Math.floor(e*D),t.height=Math.floor(n*D),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(T*D,R*D).floor()},this.setDrawingBufferSize=function(e,n,i){T=e,R=n,D=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(y)},this.getViewport=function(e){return e.copy(U)},this.setViewport=function(e,t,n,i){e.isVector4?U.set(e.x,e.y,e.z,e.w):U.set(e,t,n,i),X.viewport(y.copy(U).multiplyScalar(D).round())},this.getScissor=function(e){return e.copy(P)},this.setScissor=function(e,t,n,i){e.isVector4?P.set(e.x,e.y,e.z,e.w):P.set(e,t,n,i),X.scissor(M.copy(P).multiplyScalar(D).round())},this.getScissorTest=function(){return N},this.setScissorTest=function(e){X.setScissorTest(N=e)},this.setOpaqueSort=function(e){Q=e},this.setTransparentSort=function(e){L=e},this.getClearColor=function(e){return e.copy(he.getClearColor())},this.setClearColor=function(){he.setClearColor.apply(he,arguments)},this.getClearAlpha=function(){return he.getClearAlpha()},this.setClearAlpha=function(){he.setClearAlpha.apply(he,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==_){const t=_.texture.format;e=1033===t||1031===t||1029===t}if(e){const e=_.texture.type,t=e===Ye||e===Ke||e===Xe||e===$e||1017===e||1018===e,n=he.getClearColor(),i=he.getClearAlpha(),r=n.r,a=n.g,o=n.b;t?(u[0]=r,u[1]=a,u[2]=o,u[3]=i,ve.clearBufferuiv(ve.COLOR,0,u)):(d[0]=r,d[1]=a,d[2]=o,d[3]=i,ve.clearBufferiv(ve.COLOR,0,d))}else i|=ve.COLOR_BUFFER_BIT}t&&(i|=ve.DEPTH_BUFFER_BIT),n&&(i|=ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ve.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",_e,!1),t.removeEventListener("webglcontextrestored",Ie,!1),t.removeEventListener("webglcontextcreationerror",xe,!1),oe.dispose(),se.dispose(),J.dispose(),$.dispose(),ee.dispose(),ie.dispose(),ge.dispose(),me.dispose(),re.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",Se),Ce.removeEventListener("sessionend",Be),Te.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=V);const o=r.isMesh&&r.matrixWorld.determinant()<0,s=function(e,t,n,i,r){!0!==t.isScene&&(t=V),Z.resetTextureUnits();const a=t.fog,o=i.isMeshStandardMaterial?t.environment:null,s=null===_?v.outputColorSpace:!0===_.isXRRenderTarget?_.texture.colorSpace:_t,l=(i.isMeshStandardMaterial?ee:$).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),A=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,d=!!n.morphAttributes.color;let p=0;i.toneMapped&&(null!==_&&!0!==_.isXRRenderTarget||(p=v.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==g?g.length:0,E=J.get(i),b=f.state.lights;if(!0===O&&(!0===k||e!==x)){const t=e===x&&i.id===I;le.setState(i,e,t)}let C=!1;i.version===E.__version?E.needsLights&&E.lightsStateVersion!==b.state.version||E.outputColorSpace!==s||r.isBatchedMesh&&!1===E.batching?C=!0:r.isBatchedMesh||!0!==E.batching?r.isBatchedMesh&&!0===E.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===E.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===E.instancing?C=!0:r.isInstancedMesh||!0!==E.instancing?r.isSkinnedMesh&&!1===E.skinning?C=!0:r.isSkinnedMesh||!0!==E.skinning?r.isInstancedMesh&&!0===E.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===E.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===E.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===E.instancingMorph&&null!==r.morphTexture||E.envMap!==l||!0===i.fog&&E.fog!==a?C=!0:void 0===E.numClippingPlanes||E.numClippingPlanes===le.numPlanes&&E.numIntersection===le.numIntersection?(E.vertexAlphas!==c||E.vertexTangents!==h||E.morphTargets!==A||E.morphNormals!==u||E.morphColors!==d||E.toneMapping!==p||E.morphTargetsCount!==m)&&(C=!0):C=!0:C=!0:C=!0:C=!0:(C=!0,E.__version=i.version);let y=E.currentProgram;!0===C&&(y=Pe(i,t,r));let M=!1,w=!1,S=!1;const B=y.getUniforms(),T=E.uniforms;if(X.useProgram(y.program)&&(M=!0,w=!0,S=!0),i.id!==I&&(I=i.id,w=!0),n.cubeMapNormalTarget&&(w=!0),M||x!==e){B.setValue(ve,"projectionMatrix",e.projectionMatrix),B.setValue(ve,"viewMatrix",e.matrixWorldInverse);const t=B.map.cameraPosition;void 0!==t&&t.setValue(ve,H.setFromMatrixPosition(e.matrixWorld)),Y.logarithmicDepthBuffer&&B.setValue(ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&B.setValue(ve,"isOrthographic",!0===e.isOrthographicCamera),x!==e&&(x=e,w=!0,S=!0)}if(r.isSkinnedMesh){B.setOptional(ve,r,"bindMatrix"),B.setOptional(ve,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),B.setValue(ve,"boneTexture",e.boneTexture,Z))}r.isBatchedMesh&&(B.setOptional(ve,r,"batchingTexture"),B.setValue(ve,"batchingTexture",r._matricesTexture,Z),B.setOptional(ve,r,"batchingIdTexture"),B.setValue(ve,"batchingIdTexture",r._indirectTexture,Z),B.setOptional(ve,r,"batchingColorTexture"),null!==r._colorsTexture&&B.setValue(ve,"batchingColorTexture",r._colorsTexture,Z));const Q=n.morphAttributes;var L,U;if(void 0===Q.position&&void 0===Q.normal&&void 0===Q.color||Ae.update(r,n,y),(w||E.receiveShadow!==r.receiveShadow)&&(E.receiveShadow=r.receiveShadow,B.setValue(ve,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(T.envMap.value=l,T.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(T.envMapIntensity.value=t.environmentIntensity),w&&(B.setValue(ve,"toneMappingExposure",v.toneMappingExposure),E.needsLights&&(U=S,(L=T).ambientLightColor.needsUpdate=U,L.lightProbe.needsUpdate=U,L.directionalLights.needsUpdate=U,L.directionalLightShadows.needsUpdate=U,L.pointLights.needsUpdate=U,L.pointLightShadows.needsUpdate=U,L.spotLights.needsUpdate=U,L.spotLightShadows.needsUpdate=U,L.rectAreaLights.needsUpdate=U,L.hemisphereLights.needsUpdate=U),a&&!0===i.fog&&ae.refreshFogUniforms(T,a),ae.refreshMaterialUniforms(T,i,D,R,f.state.transmissionRenderTarget[e.id],n.cubeMapNormalTarget),jo.upload(ve,Ne(E),T,Z)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(jo.upload(ve,Ne(E),T,Z),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&B.setValue(ve,"center",r.center),B.setValue(ve,"modelViewMatrix",r.modelViewMatrix),B.setValue(ve,"normalMatrix",r.normalMatrix),B.setValue(ve,"modelMatrix",r.matrixWorld),B.setValue(ve,"inverseModelMatrix",r.matrixWorldInv),B.setValue(ve,"offsetMatrixInv",r.offsetMatrixInv),B.setValue(ve,"offsetMatrix",r.offsetMatrix),B.setValue(ve,"centerOffset",r.centerOffset),(i.isCubeNormalsMaterial||i.isMeshDiamondMaterial)&&B.setValue(ve,"center",r.center),i.isMeshDiamondMaterial&&(r.modelOffsetMatrix.copy(r.matrixWorld).multiply(r.offsetMatrix),B.setValue(ve,"modelOffsetMatrix",r.modelOffsetMatrix),r.modelOffsetMatrixInv.copy(r.modelOffsetMatrix).invert(),B.setValue(ve,"modelOffsetMatrixInv",r.modelOffsetMatrixInv)),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];me.update(n,y),me.bind(n,y)}}return y}(e,t,n,i,r);X.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=ne.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,A=n.attributes.position;let u=h.start*c,d=(h.start+h.count)*c;null!==a&&(u=Math.max(u,a.start*c),d=Math.min(d,(a.start+a.count)*c)),null!==l?(u=Math.max(u,0),d=Math.min(d,l.count)):null!=A&&(u=Math.max(u,0),d=Math.min(d,A.count));const p=d-u;if(p<0||p===1/0)return;let g;ge.setup(r,i,s,n,l);let m=de;if(null!==l&&(g=te.get(l),m=pe,m.setIndex(g)),r.isMesh)!0===i.wireframe?(X.setLineWidth(i.wireframeLinewidth*q()),m.setMode(ve.LINES)):m.setMode(ve.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),X.setLineWidth(e*q()),r.isLineSegments?m.setMode(ve.LINES):r.isLineLoop?m.setMode(ve.LINE_LOOP):m.setMode(ve.LINE_STRIP)}else r.isPoints?m.setMode(ve.POINTS):r.isSprite&&m.setMode(ve.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(j.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,a=l?te.get(l).bytesPerElement:1,o=J.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(ve,"_gl_DrawID",i),m.render(e[i]/a,t[i])}else if(r.isInstancedMesh)m.renderInstances(u,p,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);m.renderInstances(u,p,t)}else m.render(u,p)},this.compile=function(e,t,n=null){null===n&&(n=e),f=se.get(n),f.init(t),m.push(f),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),f.setupLights();const i=new Set;return e.traverse(function(e){const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const a=t[r];Me(a,n,e),i.add(a)}else Me(t,n,e),i.add(t)}),m.pop(),f=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise(t=>{function n(){i.forEach(function(e){J.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==j.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let we=null;function Se(){Te.stop()}function Be(){Te.start()}const Te=new ia;function Re(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||F.intersectsSprite(e)){i&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=ie.update(e),r=e.material;r.visible&&p.push(e,t,r,n,z.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||F.intersectsObject(e))){const t=ie.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),z.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),z.copy(t.boundingSphere.center)),z.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let a=0,o=i.length;a<o;a++){const o=i[a],s=r[o.materialIndex];s&&s.visible&&p.push(e,t,s,n,z.z,o)}}else r.visible&&p.push(e,t,r,n,z.z,null)}const r=e.children;for(let e=0,a=r.length;e<a;e++)Re(r[e],t,n,i)}function De(e,t,n,i){const r=e.opaque,a=e.transmissive,o=e.transparent;f.setupLightsView(n),!0===O&&le.setGlobalState(v.clippingPlanes,n),i&&X.viewport(y.copy(i)),r.length>0&&Le(r,t,n),a.length>0&&Le(a,t,n),o.length>0&&Le(o,t,n),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function Qe(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===f.state.transmissionRenderTarget[i.id]&&(f.state.transmissionRenderTarget[i.id]=new Mn(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?Ze:Ye,minFilter:je,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:pn.workingColorSpace}));const a=f.state.transmissionRenderTarget[i.id],o=i.viewport||y;a.setSize(o.z,o.w);const s=v.getRenderTarget();v.setRenderTarget(a),v.getClearColor(S),B=v.getClearAlpha(),B<1&&v.setClearColor(16777215,.5),W?he.render(n):v.clear();const l=v.toneMapping;v.toneMapping=0;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),f.setupLightsView(i),!0===O&&le.setGlobalState(v.clippingPlanes,i),Le(e,n,i),Z.updateMultisampleRenderTarget(a),Z.updateRenderTargetMipmap(a),!1===j.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r<a;r++){const a=t[r],o=a.object,s=a.geometry,l=a.material,c=a.group;if(2===l.side&&o.layers.test(i.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,Ue(o,n,i,s,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(Z.updateMultisampleRenderTarget(a),Z.updateRenderTargetMipmap(a))}v.setRenderTarget(s),v.setClearColor(S,B),void 0!==c&&(i.viewport=c),v.toneMapping=l}function Le(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){const a=e[r],o=a.object,s=a.geometry,l=null===i?a.material:i,c=a.group;o.layers.test(n.layers)&&Ue(o,t,n,s,l,c)}}function Ue(e,t,n,i,r,a){e.onBeforeRender(v,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(v,t,n,i,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,a),r.side=0,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,a),r.side=2):v.renderBufferDirect(n,t,i,r,e,a),e.onAfterRender(v,t,n,i,r,a)}function Pe(e,t,n){!0!==t.isScene&&(t=V);const i=J.get(e),r=f.state.lights,a=f.state.shadowsArray,o=r.state.version,s=re.getParameters(e,r.state,a,t,n),l=re.getProgramCacheKey(s);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?ee:$).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",ye),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return Fe(e,s),h}else s.uniforms=re.getUniforms(e),e.onBuild(n,s,v),e.onBeforeCompile(s,v),h=re.acquireProgram(s,l),c.set(l,h),i.uniforms=s.uniforms;const A=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(A.clippingPlanes=le.uniform),Fe(e,s),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(A.ambientLightColor.value=r.state.ambient,A.lightProbe.value=r.state.probe,A.directionalLights.value=r.state.directional,A.directionalLightShadows.value=r.state.directionalShadow,A.spotLights.value=r.state.spot,A.spotLightShadows.value=r.state.spotShadow,A.rectAreaLights.value=r.state.rectArea,A.ltc_1.value=r.state.rectAreaLTC1,A.ltc_2.value=r.state.rectAreaLTC2,A.pointLights.value=r.state.point,A.pointLightShadows.value=r.state.pointShadow,A.hemisphereLights.value=r.state.hemi,A.directionalShadowMap.value=r.state.directionalShadowMap,A.directionalShadowMatrix.value=r.state.directionalShadowMatrix,A.spotShadowMap.value=r.state.spotShadowMap,A.spotLightMatrix.value=r.state.spotLightMatrix,A.spotLightMap.value=r.state.spotLightMap,A.pointShadowMap.value=r.state.pointShadowMap,A.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Ne(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=jo.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function Fe(e,t){const n=J.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Te.setAnimationLoop(function(e){we&&we(e)}),"undefined"!=typeof self&&Te.setContext(self),this.setAnimationLoop=function(e){we=e,Ce.setAnimationLoop(e),null===e?Te.stop():Te.start()},Ce.addEventListener("sessionstart",Se),Ce.addEventListener("sessionend",Be),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===E)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Ce.enabled&&!0===Ce.isPresenting&&(!0===Ce.cameraAutoUpdate&&Ce.updateCamera(t),t=Ce.getCamera()),!0===e.isScene&&e.onBeforeRender(v,e,t,_),f=se.get(e,m.length),f.init(t),m.push(f),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromProjectionMatrix(G),k=this.localClippingEnabled,O=le.init(this.clippingPlanes,k),p=oe.get(e,g.length),p.init(),g.push(p),!0===Ce.enabled&&!0===Ce.isPresenting){const e=v.xr.getDepthSensingMesh();null!==e&&Re(e,t,-1/0,v.sortObjects)}Re(e,t,0,v.sortObjects),p.finish(),!0===v.sortObjects&&p.sort(Q,L),W=!1===Ce.enabled||!1===Ce.isPresenting||!1===Ce.hasDepthSensing(),W&&he.addToRenderList(p,e),this.info.render.frame++,!0===O&&le.beginShadows();const n=f.state.shadowsArray;ce.render(n,e,t),!0===O&&le.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=p.opaque,r=p.transmissive;if(f.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,a=n.length;t<a;t++)Qe(i,r,e,n[t]);W&&he.render(e);for(let t=0,i=n.length;t<i;t++){const i=n[t];De(p,e,i,i.viewport)}}else r.length>0&&Qe(i,r,e,t),W&&he.render(e),De(p,e,t);null!==_&&(Z.updateMultisampleRenderTarget(_),Z.updateRenderTargetMipmap(_)),!0===e.isScene&&e.onAfterRender(v,e,t),ge.resetDefaultState(),I=-1,x=null,m.pop(),m.length>0?(f=m[m.length-1],!0===O&&le.setGlobalState(v.clippingPlanes,f.state.camera)):f=null,g.pop(),p=g.length>0?g[g.length-1]:null},this.renderCubeMapNormals=function(e){const t=function(e){const t=new Set;return e.traverse(e=>{e.isMesh&&e.geometry&&e.material&&e.material.isMeshDiamondMaterial&&t.add(e.geometry)}),t}(e);if(0===t.size)return;const n=new Ys;n.side=2;const i=new Xs;for(const e of t)if(!e.cubeMapNormalTarget){const t=new Xr(512,{type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?Ze:Ye,magFilter:He,minFilter:He});e.cubeMapNormalTarget=t;const r=new jr(1e-4,100,t),a=new Qr(e);a.material=n,a.computeOffsets(),i.add(a),i.add(r),r.update(this,i),i.remove(a),i.remove(r),a.geometry=null,a.material=null}},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(e,t,n){J.get(e.texture).__webglTexture=t,J.get(e.depthTexture).__webglTexture=n;const i=J.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===j.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=J.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){_=e,b=t,C=n;let i=!0,r=null,a=!1,o=!1;if(e){const s=J.get(e);void 0!==s.__useDefaultFramebuffer?(X.bindFramebuffer(ve.FRAMEBUFFER,null),i=!1):void 0===s.__webglFramebuffer?Z.setupRenderTarget(e):s.__hasExternalTextures&&Z.rebindTextures(e,J.get(e.texture).__webglTexture,J.get(e.depthTexture).__webglTexture);const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=J.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],a=!0):r=e.samples>0&&!1===Z.useMultisampledRTT(e)?J.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,y.copy(e.viewport),M.copy(e.scissor),w=e.scissorTest}else y.copy(U).multiplyScalar(D).floor(),M.copy(P).multiplyScalar(D).floor(),w=N;if(X.bindFramebuffer(ve.FRAMEBUFFER,r)&&i&&X.drawBuffers(e,r),X.viewport(y),X.scissor(M),X.setScissorTest(w),a){const i=J.get(e.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=J.get(e.texture),r=t||0;ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}I=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){X.bindFramebuffer(ve.FRAMEBUFFER,s);try{const o=e.texture,s=o.format,l=o.type;if(!Y.textureFormatReadable(s))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!Y.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ve.readPixels(t,n,i,r,fe.convert(s),fe.convert(l),a)}finally{const e=null!==_?J.get(_).__webglFramebuffer:null;X.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,o){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){X.bindFramebuffer(ve.FRAMEBUFFER,s);try{const o=e.texture,s=o.format,l=o.type;if(!Y.textureFormatReadable(s))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Y.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){const e=ve.createBuffer();ve.bindBuffer(ve.PIXEL_PACK_BUFFER,e),ve.bufferData(ve.PIXEL_PACK_BUFFER,a.byteLength,ve.STREAM_READ),ve.readPixels(t,n,i,r,fe.convert(s),fe.convert(l),0),ve.flush();const o=ve.fenceSync(ve.SYNC_GPU_COMMANDS_COMPLETE,0);await function(e,t){return new Promise(function(n,i){setTimeout(function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}},4)})}(ve,o);try{ve.bindBuffer(ve.PIXEL_PACK_BUFFER,e),ve.getBufferSubData(ve.PIXEL_PACK_BUFFER,0,a)}finally{ve.deleteBuffer(e),ve.deleteSync(o)}return a}}finally{const e=null!==_?J.get(_).__webglFramebuffer:null;X.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),o=null!==t?t.x:0,s=null!==t?t.y:0;Z.setTexture2D(e,0),ve.copyTexSubImage2D(ve.TEXTURE_2D,n,0,0,o,s,r,a),X.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,r=0){let a,o,s,l,c,h;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],r=arguments[3]||0,n=null),null!==n?(a=n.max.x-n.min.x,o=n.max.y-n.min.y,s=n.min.x,l=n.min.y):(a=e.image.width,o=e.image.height,s=0,l=0),null!==i?(c=i.x,h=i.y):(c=0,h=0);const A=fe.convert(t.format),u=fe.convert(t.type);Z.setTexture2D(t,0),ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const d=ve.getParameter(ve.UNPACK_ROW_LENGTH),p=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),f=ve.getParameter(ve.UNPACK_SKIP_PIXELS),g=ve.getParameter(ve.UNPACK_SKIP_ROWS),m=ve.getParameter(ve.UNPACK_SKIP_IMAGES),v=e.isCompressedTexture?e.mipmaps[r]:e.image;ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,v.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,s),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,l),e.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,r,c,h,a,o,A,u,v.data):e.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,r,c,h,v.width,v.height,A,v.data):ve.texSubImage2D(ve.TEXTURE_2D,r,c,h,A,u,v),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,d),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,p),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,f),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,g),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,m),0===r&&t.generateMipmaps&&ve.generateMipmap(ve.TEXTURE_2D),X.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){let a,o,s,l,c,h,A,u,d;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0);const p=e.isCompressedTexture?e.mipmaps[r]:e.image;null!==n?(a=n.max.x-n.min.x,o=n.max.y-n.min.y,s=n.max.z-n.min.z,l=n.min.x,c=n.min.y,h=n.min.z):(a=p.width,o=p.height,s=p.depth,l=0,c=0,h=0),null!==i?(A=i.x,u=i.y,d=i.z):(A=0,u=0,d=0);const f=fe.convert(t.format),g=fe.convert(t.type);let m;if(t.isData3DTexture)Z.setTexture3D(t,0),m=ve.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Z.setTexture2DArray(t,0),m=ve.TEXTURE_2D_ARRAY}ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const v=ve.getParameter(ve.UNPACK_ROW_LENGTH),E=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),b=ve.getParameter(ve.UNPACK_SKIP_PIXELS),C=ve.getParameter(ve.UNPACK_SKIP_ROWS),_=ve.getParameter(ve.UNPACK_SKIP_IMAGES);ve.pixelStorei(ve.UNPACK_ROW_LENGTH,p.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,p.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,l),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,c),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,h),e.isDataTexture||e.isData3DTexture?ve.texSubImage3D(m,r,A,u,d,a,o,s,f,g,p.data):t.isCompressedArrayTexture?ve.compressedTexSubImage3D(m,r,A,u,d,a,o,s,f,p.data):ve.texSubImage3D(m,r,A,u,d,a,o,s,f,g,p),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,E),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,b),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,C),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,_),0===r&&t.generateMipmaps&&ve.generateMipmap(m),X.unbindTexture()},this.initRenderTarget=function(e){void 0===J.get(e).__webglFramebuffer&&Z.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Z.setTextureCube(e,0):e.isData3DTexture?Z.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Z.setTexture2DArray(e,0):Z.setTexture2D(e,0),X.unbindTexture()},this.resetState=function(){b=0,C=0,_=null,X.reset(),ge.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return kt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===It?"display-p3":"srgb",t.unpackColorSpace=pn.workingColorSpace===xt?"display-p3":"srgb"}}class Js{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Ft,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=qt()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return cn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Zs=new Tn;class $s{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Zs.fromBufferAttribute(this,t),Zs.applyMatrix4(e),this.setXYZ(t,Zs.x,Zs.y,Zs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Zs.fromBufferAttribute(this,t),Zs.applyNormalMatrix(e),this.setXYZ(t,Zs.x,Zs.y,Zs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Zs.fromBufferAttribute(this,t),Zs.transformDirection(e),this.setXYZ(t,Zs.x,Zs.y,Zs.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Kt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Jt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Kt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Kt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Kt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Kt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array),r=Jt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new rr(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new $s(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const el=new Tn,tl=new xn,nl=new xn,il=new Tn,rl=new oi,al=new Tn,ol=new Jn,sl=new oi,ll=new ai;class cl extends Qr{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Le,this.bindMatrix=new oi,this.bindMatrixInverse=new oi,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Qn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,al),this.boundingBox.expandByPoint(al)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Jn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,al),this.boundingSphere.expandByPoint(al)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),ol.copy(this.boundingSphere),ol.applyMatrix4(i),!1!==e.ray.intersectsSphere(ol)&&(sl.copy(i).invert(),ll.copy(e.ray).applyMatrix4(sl),null!==this.boundingBox&&!1===ll.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,ll)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new xn,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Le?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;tl.fromBufferAttribute(i.attributes.skinIndex,e),nl.fromBufferAttribute(i.attributes.skinWeight,e),el.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=nl.getComponent(e);if(0!==i){const r=tl.getComponent(e);rl.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(il.copy(el).applyMatrix4(rl),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class hl extends Qi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Al extends In{constructor(e=null,t=1,n=1,i,r,a,o,s,l=1003,c=1003,h,A){super(null,a,o,s,l,c,i,r,h,A),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const ul=new oi,dl=new oi;class pl{constructor(e=[],t=[]){this.uuid=qt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new oi)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new oi;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:dl;ul.multiplyMatrices(r,t[i]),ul.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new pl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Al(t,e,e,et,Je);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new hl),this.bones.push(r),this.boneInverses.push((new oi).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class fl extends rr{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const gl=new oi,ml=new oi,vl=[],El=new Qn,bl=new oi,Cl=new Qr,_l=new Jn;class Il extends Qr{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new fl(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,bl)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Qn),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,gl),El.copy(e.boundingBox).applyMatrix4(gl),this.boundingBox.union(El)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Jn),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,gl),_l.copy(e.boundingSphere).applyMatrix4(gl),this.boundingSphere.union(_l)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Cl.geometry=this.geometry,Cl.material=this.material,void 0!==Cl.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),_l.copy(this.boundingSphere),_l.applyMatrix4(n),!1!==e.ray.intersectsSphere(_l)))for(let r=0;r<i;r++){this.getMatrixAt(r,gl),ml.multiplyMatrices(n,gl),Cl.matrixWorld=ml,Cl.raycast(e,vl);for(let e=0,n=vl.length;e<n;e++){const n=vl[e];n.instanceId=r,n.object=this,t.push(n)}vl.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new fl(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new Al(new Float32Array(i*this.count),i,this.count,it,Je));const r=this.morphTexture.source.data.data;let a=0;for(let e=0;e<n.length;e++)a+=n[e];const o=this.geometry.morphTargetsRelative?1:1-a,s=i*e;r[s]=o,r.set(n,s+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const xl=new Tn,yl=new Tn,Ml=new oi,wl=new ai,Sl=new Jn,Bl=new Tn,Tl=new Tn;class Rl extends Qi{constructor(e=new fr,t=new qs){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)xl.fromBufferAttribute(t,e-1),yl.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=xl.distanceTo(yl);e.setAttribute("lineDistance",new sr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Sl.copy(n.boundingSphere),Sl.applyMatrix4(i),Sl.radius+=r,!1===e.ray.intersectsSphere(Sl))return;Ml.copy(i).invert(),wl.copy(e.ray).applyMatrix4(Ml);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=c.getX(r),i=c.getX(r+1),a=Dl(this,e,wl,s,n,i);a&&t.push(a)}if(this.isLineLoop){const r=c.getX(i-1),a=c.getX(n),o=Dl(this,e,wl,s,r,a);o&&t.push(o)}}else{const n=Math.max(0,a.start),i=Math.min(h.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=Dl(this,e,wl,s,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=Dl(this,e,wl,s,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Dl(e,t,n,i,r,a){const o=e.geometry.attributes.position;if(xl.fromBufferAttribute(o,r),yl.fromBufferAttribute(o,a),n.distanceSqToSegment(xl,yl,Bl,Tl)>i)return;Bl.applyMatrix4(e.matrixWorld);const s=t.ray.origin.distanceTo(Bl);return s<t.near||s>t.far?void 0:{distance:s,point:Tl.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,object:e}}const Ql=new Tn,Ll=new Tn;class Ul extends Rl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)Ql.fromBufferAttribute(t,e),Ll.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Ql.distanceTo(Ll);e.setAttribute("lineDistance",new sr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Pl extends Rl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}const Nl=new oi,Fl=new ai,Ol=new Jn,kl=new Tn;class Gl extends Qi{constructor(e=new fr,t=new zs){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ol.copy(n.boundingSphere),Ol.applyMatrix4(i),Ol.radius+=r,!1===e.ray.intersectsSphere(Ol))return;Nl.copy(i).invert(),Fl.copy(e.ray).applyMatrix4(Nl);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);n<r;n++){const r=l.getX(n);kl.fromBufferAttribute(c,r),Hl(kl,r,s,i,e,t,this)}else for(let n=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);n<r;n++)kl.fromBufferAttribute(c,n),Hl(kl,n,s,i,e,t,this)}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Hl(e,t,n,i,r,a,o){const s=Fl.distanceSqToPoint(e);if(s<n){const n=new Tn;Fl.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o})}}class zl extends In{constructor(e,t,n,i,r,a,o,s,l,c,h,A){super(null,a,o,s,l,c,i,r,h,A),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Vl extends zl{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ke,this.layerUpdates=new Set}addLayerUpdates(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Wl extends zl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Ue),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}function ql(e,t,n){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function jl(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function Yl(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,o=0;o!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r}function Xl(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let o=a[i];if(void 0!==o)if(Array.isArray(o))do{o=a[i],void 0!==o&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{o=a[i],void 0!==o&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{o=a[i],void 0!==o&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}class Kl{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let a=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(e>=r)break e;{const o=t[1];e<o&&(n=2,r=o);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0}}for(;n<a;){const i=n+a>>>1;e<t[i]?a=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Jl extends Kl{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,A=this._weightPrev,u=this._weightNext,d=(n-t)/(i-t),p=d*d,f=p*d,g=-A*f+2*A*p-A*d,m=(1+A)*f+(-1.5-2*A)*p+(-.5+A)*d+1,v=(-1-u)*f+(1.5+u)*p+.5*d,E=u*f-u*p;for(let e=0;e!==o;++e)r[e]=g*a[c+e]+m*a[l+e]+v*a[s+e]+E*a[h+e];return r}}class Zl extends Kl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==o;++e)r[e]=a[l+e]*h+a[s+e]*c;return r}}class $l extends Kl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class ec{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ql(t,this.TimeBufferType),this.values=ql(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ql(e.times,Array),values:ql(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new $l(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Zl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Jl(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case mt:t=this.InterpolantFactoryMethodDiscrete;break;case vt:t=this.InterpolantFactoryMethodLinear;break;case Et:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return mt;case this.InterpolantFactoryMethodLinear:return vt;case this.InterpolantFactoryMethodSmooth:return Et}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&(o=i,ArrayBuffer.isView(o)&&!(o instanceof DataView)))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}var o;return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Et,r=e.length-1;let a=1;for(let o=1;o<r;++o){let r=!1;const s=e[o];if(s!==e[o+1]&&(1!==o||s!==e[0]))if(i)r=!0;else{const e=o*n,i=e-n,a=e+n;for(let o=0;o!==n;++o){const n=t[e+o];if(n!==t[i+o]||n!==t[a+o]){r=!0;break}}}if(r){if(o!==a){e[a]=e[o];const i=o*n,r=a*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*n,i=a*n,o=0;o!==n;++o)t[i+o]=t[e+o];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}ec.prototype.TimeBufferType=Float32Array,ec.prototype.ValueBufferType=Float32Array,ec.prototype.DefaultInterpolation=vt;class tc extends ec{constructor(e,t,n){super(e,t,n)}}tc.prototype.ValueTypeName="bool",tc.prototype.ValueBufferType=Array,tc.prototype.DefaultInterpolation=mt,tc.prototype.InterpolantFactoryMethodLinear=void 0,tc.prototype.InterpolantFactoryMethodSmooth=void 0;class nc extends ec{}nc.prototype.ValueTypeName="color";class ic extends ec{}ic.prototype.ValueTypeName="number";class rc extends Kl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)Bn.slerpFlat(r,0,a,l-o,a,l,s);return r}}class ac extends ec{InterpolantFactoryMethodLinear(e){return new rc(this.times,this.values,this.getValueSize(),e)}}ac.prototype.ValueTypeName="quaternion",ac.prototype.InterpolantFactoryMethodSmooth=void 0;class oc extends ec{constructor(e,t,n){super(e,t,n)}}oc.prototype.ValueTypeName="string",oc.prototype.ValueBufferType=Array,oc.prototype.DefaultInterpolation=mt,oc.prototype.InterpolantFactoryMethodLinear=void 0,oc.prototype.InterpolantFactoryMethodSmooth=void 0;class sc extends ec{}sc.prototype.ValueTypeName="vector";class lc{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=qt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(cc(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(ec.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let e=0;e<r;e++){let o=[],s=[];o.push((e+r-1)%r,e,(e+1)%r),s.push(0,1,0);const l=jl(o);o=Yl(o,1,l),s=Yl(s,1,l),i||0!==o[0]||(o.push(r),s.push(s[0])),a.push(new ic(".morphTargetInfluences["+t[e].name+"]",o,s).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=n.name.match(r);if(a&&a.length>1){const e=a[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const a=[];for(const e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],o=[];Xl(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let s=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],a=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),a.push(i.morphTarget===n?1:0)}i.push(new ic(".morphTargetInfluence["+n+"]",e,a))}s=e.length*a}else{const a=".bones["+t[e].name+"]";n(sc,a+".position",r,"pos",i),n(ac,a+".quaternion",r,"rot",i),n(sc,a+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,s,i,o)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function cc(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ic;case"vector":case"vector2":case"vector3":case"vector4":return sc;case"color":return nc;case"quaternion":return ac;case"bool":case"boolean":return tc;case"string":return oc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Xl(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const hc={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};const Ac=new class{constructor(e,t,n){const i=this;let r,a=!1,o=0,s=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){s++,!1===a&&void 0!==i.onStart&&i.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}};class uc{constructor(e){this.manager=void 0!==e?e:Ac,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}uc.DEFAULT_MATERIAL_NAME="__DEFAULT";const dc={};class pc extends Error{constructor(e,t){super(e),this.response=t}}class fc extends uc{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=hc.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==dc[e])return void dc[e].push({onLoad:t,onProgress:n,onError:i});dc[e]=[],dc[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=dc[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,o=0!==a;let s=0;const l=new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:r})=>{if(i)e.close();else{s+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new pc(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,o));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{hc.add(e,t);const n=dc[e];delete dc[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{const n=dc[e];if(void 0===n)throw this.manager.itemError(e),t;delete dc[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class gc extends uc{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=hc.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const o=on("img");function s(){c(),hc.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class mc extends uc{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Al,o=new fc(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:ke,a.wrapT=void 0!==n.wrapT?n.wrapT:ke,a.magFilter=void 0!==n.magFilter?n.magFilter:We,a.minFilter=void 0!==n.minFilter?n.minFilter:We,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(a.colorSpace=n.colorSpace),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=je),1===n.mipmapCount&&(a.minFilter=We),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,i),a}}class vc extends uc{constructor(e){super(e)}load(e,t,n,i){const r=new In,a=new gc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}class Ec extends Qi{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Xi(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}const bc=new oi,Cc=new Tn,_c=new Tn;class Ic{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new tn(512,512),this.map=null,this.mapPass=null,this.matrix=new oi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new na,this._frameExtents=new tn(1,1),this._viewportCount=1,this._viewports=[new xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Cc.setFromMatrixPosition(e.matrixWorld),t.position.copy(Cc),_c.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(_c),t.updateMatrixWorld(),bc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(bc)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class xc extends Ic{constructor(){super(new Wr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*Wt*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class yc extends Ec{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Qi.DEFAULT_UP),this.updateMatrix(),this.target=new Qi,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new xc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Mc=new oi,wc=new Tn,Sc=new Tn;class Bc extends Ic{constructor(){super(new Wr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new tn(4,2),this._viewportCount=6,this._viewports=[new xn(2,1,1,1),new xn(0,1,1,1),new xn(3,1,1,1),new xn(1,1,1,1),new xn(3,0,1,1),new xn(1,0,1,1)],this._cubeDirections=[new Tn(1,0,0),new Tn(-1,0,0),new Tn(0,0,1),new Tn(0,0,-1),new Tn(0,1,0),new Tn(0,-1,0)],this._cubeUps=[new Tn(0,1,0),new Tn(0,1,0),new Tn(0,1,0),new Tn(0,1,0),new Tn(0,0,1),new Tn(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),wc.setFromMatrixPosition(e.matrixWorld),n.position.copy(wc),Sc.copy(n.position),Sc.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Sc),n.updateMatrixWorld(),i.makeTranslation(-wc.x,-wc.y,-wc.z),Mc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Mc)}}class Tc extends Ec{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Bc}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Rc extends Ic{constructor(){super(new va(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Dc extends Ec{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Qi.DEFAULT_UP),this.updateMatrix(),this.target=new Qi,this.shadow=new Rc}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Qc{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Lc extends uc{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=hc.get(e);if(void 0!==a)return r.manager.itemStart(e),a.then?void a.then(n=>{t&&t(n),r.manager.itemEnd(e)}).catch(e=>{i&&i(e)}):(setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){return hc.add(e,n),t&&t(n),r.manager.itemEnd(e),n}).catch(function(t){i&&i(t),hc.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});hc.add(e,s),r.manager.itemStart(e)}}class Uc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Pc(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Pc();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Pc(){return("undefined"==typeof performance?Date:performance).now()}const Nc="\\[\\]\\.:\\/",Fc=new RegExp("["+Nc+"]","g"),Oc="[^"+Nc+"]",kc="[^"+Nc.replace("\\.","")+"]",Gc=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Oc)+/(WCOD+)?/.source.replace("WCOD",kc)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Oc)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Oc)+"$"),Hc=["material","materials","bones","map"];class zc{constructor(e,t,n){this.path=t,this.parsedPath=n||zc.parseTrackName(t),this.node=zc.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new zc.Composite(e,t,n):new zc(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Fc,"")}static parseTrackName(e){const t=Gc.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Hc.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const a=n(r.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=zc.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const a=e[i];if(void 0===a){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let o=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}s=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(s=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}zc.Composite=class{constructor(e,t,n){const i=n||zc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},zc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},zc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},zc.prototype.GetterByBindingType=[zc.prototype._getValue_direct,zc.prototype._getValue_array,zc.prototype._getValue_arrayElement,zc.prototype._getValue_toArray],zc.prototype.SetterByBindingTypeAndVersioning=[[zc.prototype._setValue_direct,zc.prototype._setValue_direct_setNeedsUpdate,zc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[zc.prototype._setValue_array,zc.prototype._setValue_array_setNeedsUpdate,zc.prototype._setValue_array_setMatrixWorldNeedsUpdate],[zc.prototype._setValue_arrayElement,zc.prototype._setValue_arrayElement_setNeedsUpdate,zc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[zc.prototype._setValue_fromArray,zc.prototype._setValue_fromArray_setNeedsUpdate,zc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Vc{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(jt(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ue}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ue);const Wc=["Glasses","Shoes","Watches","Handbags","Rings","Bottles","Bracelets","Scarves","Hats","Necklaces","Earrings"],qc=["Linear","ACES","Neutral"],jc=["none","pan-x","pan-y"];function Yc(e){return Wc.includes(e)}const Xc={Glasses:new Tn(67.5,15,90),Shoes:new Tn(-55,30,30),Watches:new Tn(0,-10,40),Handbags:new Tn(40,0,0),Rings:new Tn(0,0,10),Bottles:new Tn(40,0,0),Bracelets:new Tn(0,0,40),Hats:new Tn(40,0,0),Scarves:new Tn(40,0,0),Necklaces:new Tn(40,0,0),Earrings:new Tn(40,0,0)},Kc="Shoes",Jc=[1e3,2e3,4e3],Zc=Jc.length;function $c(e){return k(this,arguments,void 0,function*(e,t=0){try{return yield e()}catch(n){if(t>=Zc)throw n;return yield new Promise(e=>setTimeout(e,Jc[t])),$c(e,t+1)}})}function eh(e){return`Resource unavailable: ${e}`}function th(){return eh("Network error.")}function nh(){return eh("Request aborted.")}function ih(){return eh("Request timeout.")}function rh(e){return`Resource download failed with status ${e}.`}function ah(e){return`Resource has invalid body: ${e}`}function oh(){return ah("Response is null.")}function sh(){return ah("Response is not an ArrayBuffer.")}function lh(){return ah("Response is empty.")}function ch(e,t){return k(this,void 0,void 0,function*(){return $c(()=>k(this,void 0,void 0,function*(){return new Promise((n,i)=>{const r=new XMLHttpRequest;r.open("GET",e),r.responseType="arraybuffer",r.onprogress=n=>{const i=function(e,t){var n;if(e.lengthComputable&&e.total>0)return e.total;const i=parseInt(null!==(n=t.getResponseHeader("x-amz-meta-content-length"))&&void 0!==n?n:"",10);return i>0?i:null}(n,r);null!=i&&(null==t||t.updateProgress(e,n.loaded,i))},r.onload=()=>{r.status<200||r.status>=300?i(new Error(rh(r.status))):r.response?r.response instanceof ArrayBuffer?0!==r.response.byteLength?n(r.response):i(new Error(lh())):i(new Error(sh())):i(new Error(oh()))},r.onerror=()=>i(new Error(th())),r.onabort=()=>i(new Error(nh())),r.ontimeout=()=>i(new Error(ih())),r.send()})}))})}const hh=[Uint8Array,Uint32Array],Ah=hh.length-2,uh=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","open","requestAnimationFrame","send"],dh=[2,12,7,1],ph=(window[uh[dh[dh[Ah]]]][uh[dh[dh[dh.length-1]]]].charCodeAt(Ah),0),fh=new hh[1]([ph]);function gh(e,t,n,i){return k(this,void 0,void 0,function*(){let r=uh[15].charCodeAt(2)-10,a=uh[5].charCodeAt(6)-14;r>>=1,r+=a;const o=String.fromCharCode,s=o(r-26);a>>=2,r-=a;const l=o(r-18);a|=9,r^=a;const c=`${s}${l}`,h=o(++r);a>>=1,r^=a+2;const A=o(r-3);r^=a+29;const u="object"[(+!+[]+ +!+[])*(+!+[]+ +!+[])+r^114],d=`${h}${A}`,p=o(r-2);a<<=3,r|=a;const f=o(r-3);a^=r+9;const g=o(r+c.length),m="object"[3*+!+[]],v=`${m}${p}${g}`,E=o(a+6),b=`${u}${u}${f}${E}`,C=o(r),_=`${m}${C}${u}`;a>>=1,r-=a;const I=o(r-6);a-=7,r^=a;const x=`${I}${o(r-13)}`,y=o(r+x.length);r+=a;const M=o(r+1),w="object"[+!+[]-+!+[]];a++;const S=o(r-(a>>3)+1),B=`${w}${S}`,T=`${M}${m}${C}${f}`;a-=T.length,r+=a>>2;const R=o(r+1),D=`${y}${R}${f}`;a>>=1,r-=a;const Q=o(r-T.length),L=`${g}${Q}${Q}${m}${M}`;a-=L.length,r-=a;const U=o(r+1),P=o(r),N=`${P}${u}`;a+=r>>2,r-=a;const F=o(r+2),O=o(r+1),G=`${M}${P}${R}`,H=`${m}${M}${M}`,z=`${w}${g}${u}`;r^=a+L.length;const V=o(r+3),W=r-2<<1,q=(a<<3)+(36&r),j=yield $c(()=>k(this,void 0,void 0,function*(){return new Promise((t,n)=>{const r=new window[`${d}${c}${b}${v}${_}`];r[uh[14]](`${x}${y}`,e),r[`${T}${B}${C}${m}${D}${m}`]=`${P}${M}${G}${U}${L}`,r[`${B}${f}${M}${w}g${M}${m}${C}${C}`]=t=>{const n=t[`${u}${w}${u}${P}l`];t[`l${m}${S}g${u}hC${w}m${f}${g}${u}${P}${U}l${m}`]&&n>0&&(null==i||i[`${g}${f}d${N}${m}P${M}${w}g${M}${m}s${C}`](e,t[`l${w}${P}d${m}d`],n))},r[`${B}l${w}${P}d`]=()=>{const e=r[`${C}${u}${N}${g}${C}`];if(e<W||e>=q)return void n(new Error(rh(e)));const i=r[`${T}${B}${C}${m}`];i?i instanceof window[`${O}${M}${G}${F}${L}`]?0!==i[`${U}${R}${u}${m}${s}${m}${S}g${u}h`]?t(new hh[0](i)):n(new Error(lh())):n(new Error(sh())):n(new Error(oh()))},r[`${B}${H}${w}${M}`]=()=>n(new Error(th())),r[`${B}${P}${U}${w}${M}${u}`]=()=>n(new Error(nh())),r[`${B}${u}${V}m${m}${z}`]=()=>n(new Error(ih())),r[uh[16]]()})}));n+=a;const Y=j[`${U}${R}${u}${m}${s}${m}${S}g${u}h`];if(fh[ph]=Math.min(76,t)*((r>>5)-1),152===fh[ph]&&(fh[ph]=Y),n==ph)return j;n=ph,n^=ph;for(let e=0,t=j.length;e<t;e++)fh[ph]^=fh[n]<<13,fh[ph]^=fh[n]>>17,fh[ph]^=fh[n]<<5,j[e]=j[e]^fh[ph];return n^=fh[0],n^=fh[1],n^=fh[2],j})}const mh={},vh={};function Eh(e,t,n){return n?(null==mh[e]&&(mh[e]=ch(e,t).catch(t=>{throw delete mh[e],t}).finally(()=>{t.completeTask(e)})),mh[e]):ch(e,t).finally(()=>{t.completeTask(e)})}function bh(e,t,n,i,r){return r?(null==vh[e]&&(vh[e]=gh(e,t,n,i).catch(t=>{throw delete vh[e],t}).finally(()=>{i.completeTask(e)})),vh[e]):gh(e,t,n,i).finally(()=>{i.completeTask(e)})}var Ch,_h,Ih,xh,yh;class Mh{constructor(){Ch.add(this),_h.set(this,new Map),Ih.set(this,null),xh.set(this,0)}setOnProgress(e){H(this,Ih,e)}updateProgress(e,t,n){const i=G(this,_h,"f").get(e);(null==i?void 0:i.completed)||(i?(i.loaded=t,i.total=n):G(this,_h,"f").set(e,{loaded:t,total:n,completed:!1}),G(this,Ch,"m",yh).call(this))}completeTask(e){const t=G(this,_h,"f").get(e);t&&(t.loaded=t.total,t.completed=!0),G(this,Ch,"m",yh).call(this)}}_h=new WeakMap,Ih=new WeakMap,xh=new WeakMap,Ch=new WeakSet,yh=function(){if(null==G(this,Ih,"f"))return;let e=0,t=0,n=!0;for(const i of G(this,_h,"f").values())e+=i.loaded,t+=i.total,i.completed||(n=!1);if(G(this,_h,"f").size>0&&n)return G(this,_h,"f").clear(),H(this,xh,0),void G(this,Ih,"f").call(this,1);const i=t>0?Math.min(e/t,1):0;H(this,xh,Math.max(G(this,xh,"f"),i)),G(this,Ih,"f").call(this,G(this,xh,"f"))};class wh extends mc{constructor(e){super(e),this.type=Ze}parse(e){const t=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},n=function(e,t,n){t=t||1024;let i=e.pos,r=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));for(;0>(r=s.indexOf("\n"))&&a<t&&i<e.byteLength;)o+=s,a+=s.length,i+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return-1<r&&(e.pos+=a+r+1,o+s.slice(0,r))},i=function(e,t,n,i){const r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=e[t+0]*a,n[i+1]=e[t+1]*a,n[i+2]=e[t+2]*a,n[i+3]=1},r=function(e,t,n,i){const r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=tr(Math.min(e[t+0]*a,65504)),n[i+1]=tr(Math.min(e[t+1]*a,65504)),n[i+2]=tr(Math.min(e[t+2]*a,65504)),n[i+3]=tr(1)},a=new Uint8Array(e);a.pos=0;const o=function(e){const i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,s={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;for((e.pos>=e.byteLength||!(l=n(e)))&&t(1,"no header found"),(c=l.match(/^#\?(\S+)/))||t(3,"bad initial token"),s.valid|=1,s.programtype=c[1],s.string+=l+"\n";l=n(e),!1!==l;)if(s.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(i))&&(s.gamma=parseFloat(c[1])),(c=l.match(r))&&(s.exposure=parseFloat(c[1])),(c=l.match(a))&&(s.valid|=2,s.format=c[1]),(c=l.match(o))&&(s.valid|=4,s.height=parseInt(c[1],10),s.width=parseInt(c[2],10)),2&s.valid&&4&s.valid)break}else s.comments+=l+"\n";return 2&s.valid||t(3,"missing format specifier"),4&s.valid||t(3,"missing image size specifier"),s}(a),s=o.width,l=o.height,c=function(e,n,i){const r=n;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");const a=new Uint8Array(4*n*i);a.length||t(4,"unable to allocate buffer space");let o=0,s=0;const l=4*r,c=new Uint8Array(4),h=new Uint8Array(l);let A=i;for(;A>0&&s<e.byteLength;){s+4>e.byteLength&&t(1),c[0]=e[s++],c[1]=e[s++],c[2]=e[s++],c[3]=e[s++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||t(3,"bad rgbe scanline format");let n,i=0;for(;i<l&&s<e.byteLength;){n=e[s++];const r=n>128;if(r&&(n-=128),(0===n||i+n>l)&&t(3,"bad scanline data"),r){const t=e[s++];for(let e=0;e<n;e++)h[i++]=t}else h.set(e.subarray(s,s+n),i),i+=n,s+=n}const u=r;for(let e=0;e<u;e++){let t=0;a[o]=h[e+t],t+=r,a[o+1]=h[e+t],t+=r,a[o+2]=h[e+t],t+=r,a[o+3]=h[e+t],o+=4}A--}return a}(a.subarray(a.pos),s,l);let h,A,u;switch(this.type){case Je:u=c.length/4;const e=new Float32Array(4*u);for(let t=0;t<u;t++)i(c,4*t,e,4*t);h=e,A=Je;break;case Ze:u=c.length/4;const t=new Uint16Array(4*u);for(let e=0;e<u;e++)r(c,4*e,t,4*e);h=t,A=Ze;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:s,height:l,data:h,header:o.string,gamma:o.gamma,exposure:o.exposure,type:A}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){switch(e.type){case Je:case Ze:e.colorSpace=_t,e.minFilter=We,e.magFilter=We,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,n)},n,i)}}
7
7
  /*!
8
8
  fflate - fast JavaScript compression/decompression
9
9
  <https://101arrowz.github.io/fflate>
10
10
  Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
11
11
  version 0.8.2
12
- */var Sh=Uint8Array,Bh=Uint16Array,Th=Int32Array,Rh=new Sh([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Dh=new Sh([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Qh=new Sh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Uh=function(e,t){for(var n=new Bh(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Th(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)r[a]=a-n[i]<<5|i;return{b:n,r:r}},Lh=Uh(Rh,2),Ph=Lh.b,Nh=Lh.r;Ph[28]=258,Nh[258]=28;for(var Fh=Uh(Dh,0).b,Oh=new Bh(32768),kh=0;kh<32768;++kh){var Gh=(43690&kh)>>1|(21845&kh)<<1;Gh=(61680&(Gh=(52428&Gh)>>2|(13107&Gh)<<2))>>4|(3855&Gh)<<4,Oh[kh]=((65280&Gh)>>8|(255&Gh)<<8)>>1}var Hh=function(e,t,n){for(var i=e.length,r=0,a=new Bh(t);r<i;++r)e[r]&&++a[e[r]-1];var s,o=new Bh(t);for(r=1;r<t;++r)o[r]=o[r-1]+a[r-1]<<1;s=new Bh(1<<t);var l=15-t;for(r=0;r<i;++r)if(e[r])for(var c=r<<4|e[r],h=t-e[r],A=o[e[r]-1]++<<h,u=A|(1<<h)-1;A<=u;++A)s[Oh[A]>>l]=c;return s},zh=new Sh(288);for(kh=0;kh<144;++kh)zh[kh]=8;for(kh=144;kh<256;++kh)zh[kh]=9;for(kh=256;kh<280;++kh)zh[kh]=7;for(kh=280;kh<288;++kh)zh[kh]=8;var Vh=new Sh(32);for(kh=0;kh<32;++kh)Vh[kh]=5;var Wh=Hh(zh,9),qh=Hh(Vh,5),jh=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Yh=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},Xh=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Kh=function(e){return(e+7)/8|0},Jh=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Zh=function(e,t,n){var i=new Error(t||Jh[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,Zh),!n)throw i;return i},$h=new Sh(0);function eA(e,t){return function(e,t,n,i){var r=e.length;if(!r||t.f&&!t.l)return n||new Sh(0);var a=!n,s=a||2!=t.i,o=t.i;a&&(n=new Sh(3*r));var l=function(e){var t=n.length;if(e>t){var i=new Sh(Math.max(2*t,e));i.set(n),n=i}},c=t.f||0,h=t.p||0,A=t.b||0,u=t.l,d=t.d,p=t.m,f=t.n,g=8*r;do{if(!u){c=Yh(e,h,1);var m=Yh(e,h+1,3);if(h+=3,!m){var v=e[(B=Kh(h)+4)-4]|e[B-3]<<8,E=B+v;if(E>r){o&&Zh(0);break}s&&l(A+v),n.set(e.subarray(B,E),A),t.b=A+=v,t.p=h=8*E,t.f=c;continue}if(1==m)u=Wh,d=qh,p=9,f=5;else if(2==m){var b=Yh(e,h,31)+257,C=Yh(e,h+10,15)+4,_=b+Yh(e,h+5,31)+1;h+=14;for(var I=new Sh(_),x=new Sh(19),y=0;y<C;++y)x[Qh[y]]=Yh(e,h+3*y,7);h+=3*C;var w=jh(x),M=(1<<w)-1,S=Hh(x,w);for(y=0;y<_;){var B,T=S[Yh(e,h,M)];if(h+=15&T,(B=T>>4)<16)I[y++]=B;else{var R=0,D=0;for(16==B?(D=3+Yh(e,h,3),h+=2,R=I[y-1]):17==B?(D=3+Yh(e,h,7),h+=3):18==B&&(D=11+Yh(e,h,127),h+=7);D--;)I[y++]=R}}var Q=I.subarray(0,b),U=I.subarray(b);p=jh(Q),f=jh(U),u=Hh(Q,p),d=Hh(U,f)}else Zh(1);if(h>g){o&&Zh(0);break}}s&&l(A+131072);for(var L=(1<<p)-1,P=(1<<f)-1,N=h;;N=h){var F=(R=u[Xh(e,h)&L])>>4;if((h+=15&R)>g){o&&Zh(0);break}if(R||Zh(2),F<256)n[A++]=F;else{if(256==F){N=h,u=null;break}var O=F-254;if(F>264){var k=Rh[y=F-257];O=Yh(e,h,(1<<k)-1)+Ph[y],h+=k}var G=d[Xh(e,h)&P],H=G>>4;if(G||Zh(3),h+=15&G,U=Fh[H],H>3&&(k=Dh[H],U+=Xh(e,h)&(1<<k)-1,h+=k),h>g){o&&Zh(0);break}s&&l(A+131072);var z=A+O;if(A<U){var V=0-U,W=Math.min(U,z);for(V+A<0&&Zh(3);A<W;++A)n[A]=i[V+A]}for(;A<z;++A)n[A]=n[A-U]}}t.l=u,t.p=N,t.b=A,t.f=c,u&&(c=1,t.m=p,t.d=d,t.n=f)}while(!c);return A!=n.length&&a?function(e,t,n){return(null==n||n>e.length)&&(n=e.length),new Sh(e.subarray(0,n))}(n,0,A):n.subarray(0,A)}(e.subarray((i=t,(8!=(15&(n=e)[0])||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Zh(6,"invalid zlib data"),(n[1]>>5&1)==+!i&&Zh(6,"invalid zlib data: "+(32&n[1]?"need":"unexpected")+" dictionary"),2+(n[1]>>3&4)),-4),{i:2},t,t);var n,i}var tA="undefined"!=typeof TextDecoder&&new TextDecoder;try{tA.decode($h,{stream:!0})}catch(Zd){}class nA extends mc{constructor(e){super(e),this.type=Ze}parse(e){const t=65536,n=14,i=65537,r=Math.pow(2.7182818,2.2),a={l:0,c:0,lc:0};function s(e,t,n,i,r){for(;n<e;)t=t<<8|k(i,r),n+=8;n-=e,a.l=t>>n&(1<<e)-1,a.c=t,a.lc=n}const o=new Array(59);function l(e,t,n,r,l,c){const h=t;let A=0,u=0;for(;r<=l;r++){if(h.value-t.value>n)return!1;s(6,A,u,e,h);const i=a.l;if(A=a.c,u=a.lc,c[r]=i,63==i){if(h.value-t.value>n)throw new Error("Something wrong with hufUnpackEncTable");s(8,A,u,e,h);let i=a.l+6;if(A=a.c,u=a.lc,r+i>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;i--;)c[r++]=0;r--}else if(i>=59){let e=i-59+2;if(r+e>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;e--;)c[r++]=0;r--}}!function(e){for(let e=0;e<=58;++e)o[e]=0;for(let t=0;t<i;++t)o[e[t]]+=1;let t=0;for(let e=58;e>0;--e){const n=t+o[e]>>1;o[e]=t,t=n}for(let t=0;t<i;++t){const n=e[t];n>0&&(e[t]=n|o[n]++<<6)}}(c)}function c(e){return 63&e}function h(e){return e>>6}const A={c:0,lc:0};function u(e,t,n,i){e=e<<8|k(n,i),t+=8,A.c=e,A.lc=t}const d={c:0,lc:0};function p(e,t,n,i,r,a,s,o,l){if(e==t){i<8&&(u(n,i,r,a),n=A.c,i=A.lc);let e=n>>(i-=8);if(e=new Uint8Array([e])[0],o.value+e>l)return!1;const t=s[o.value-1];for(;e-- >0;)s[o.value++]=t}else{if(!(o.value<l))return!1;s[o.value++]=e}d.c=n,d.lc=i}function f(e){return 65535&e}function g(e){const t=f(e);return t>32767?t-65536:t}const m={a:0,b:0};function v(e,t){const n=g(e),i=g(t),r=n+(1&i)+(i>>1),a=r,s=r-i;m.a=a,m.b=s}function E(e,t){const n=f(e),i=f(t),r=n-(i>>1)&65535,a=i+r-32768&65535;m.a=a,m.b=r}function b(e,t,n,i,r,a,s){const o=s<16384,l=n>r?r:n;let c,h,A=1;for(;A<=l;)A<<=1;for(A>>=1,c=A,A>>=1;A>=1;){h=0;const s=h+a*(r-c),l=a*A,u=a*c,d=i*A,p=i*c;let f,g,b,C;for(;h<=s;h+=u){let r=h;const a=h+i*(n-c);for(;r<=a;r+=p){const n=r+d,i=r+l,a=i+d;o?(v(e[r+t],e[i+t]),f=m.a,b=m.b,v(e[n+t],e[a+t]),g=m.a,C=m.b,v(f,g),e[r+t]=m.a,e[n+t]=m.b,v(b,C),e[i+t]=m.a,e[a+t]=m.b):(E(e[r+t],e[i+t]),f=m.a,b=m.b,E(e[n+t],e[a+t]),g=m.a,C=m.b,E(f,g),e[r+t]=m.a,e[n+t]=m.b,E(b,C),e[i+t]=m.a,e[a+t]=m.b)}if(n&A){const n=r+l;o?v(e[r+t],e[n+t]):E(e[r+t],e[n+t]),f=m.a,e[n+t]=m.b,e[r+t]=f}}if(r&A){let r=h;const a=h+i*(n-c);for(;r<=a;r+=p){const n=r+d;o?v(e[r+t],e[n+t]):E(e[r+t],e[n+t]),f=m.a,e[n+t]=m.b,e[r+t]=f}}c=A,A>>=1}return h}function C(e,t,r,a,s,o){const f=r.value,g=O(t,r),m=O(t,r);r.value+=4;const v=O(t,r);if(r.value+=4,g<0||g>=i||m<0||m>=i)throw new Error("Something wrong with HUF_ENCSIZE");const E=new Array(i),b=new Array(16384);if(function(e){for(let t=0;t<16384;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(b),l(e,r,a-(r.value-f),g,m,E),v>8*(a-(r.value-f)))throw new Error("Something wrong with hufUncompress");!function(e,t,i,r){for(;t<=i;t++){const i=h(e[t]),a=c(e[t]);if(i>>a)throw new Error("Invalid table entry");if(a>n){const e=r[i>>a-n];if(e.len)throw new Error("Invalid table entry");if(e.lit++,e.p){const t=e.p;e.p=new Array(e.lit);for(let n=0;n<e.lit-1;++n)e.p[n]=t[n]}else e.p=new Array(1);e.p[e.lit-1]=t}else if(a){let e=0;for(let s=1<<n-a;s>0;s--){const s=r[(i<<n-a)+e];if(s.len||s.p)throw new Error("Invalid table entry");s.len=a,s.lit=t,e++}}}}(E,g,m,b),function(e,t,i,r,a,s,o,l,f){let g=0,m=0;const v=o,E=Math.trunc(r.value+(a+7)/8);for(;r.value<E;)for(u(g,m,i,r),g=A.c,m=A.lc;m>=n;){const a=t[g>>m-n&16383];if(a.len)m-=a.len,p(a.lit,s,g,m,i,r,l,f,v),g=d.c,m=d.lc;else{if(!a.p)throw new Error("hufDecode issues");let t;for(t=0;t<a.lit;t++){const n=c(e[a.p[t]]);for(;m<n&&r.value<E;)u(g,m,i,r),g=A.c,m=A.lc;if(m>=n&&h(e[a.p[t]])==(g>>m-n&(1<<n)-1)){m-=n,p(a.p[t],s,g,m,i,r,l,f,v),g=d.c,m=d.lc;break}}if(t==a.lit)throw new Error("hufDecode issues")}}const b=8-a&7;for(g>>=b,m-=b;m>0;){const e=t[g<<n-m&16383];if(!e.len)throw new Error("hufDecode issues");m-=e.len,p(e.lit,s,g,m,i,r,l,f,v),g=d.c,m=d.lc}}(E,b,e,r,v,m,o,s,{value:0})}function _(e){for(let t=1;t<e.length;t++){const n=e[t-1]+e[t]-128;e[t]=n}}function I(e,t){let n=0,i=Math.floor((e.length+1)/2),r=0;const a=e.length-1;for(;!(r>a||(t[r++]=e[n++],r>a));)t[r++]=e[i++]}function x(e){let t=e.byteLength;const n=new Array;let i=0;const r=new DataView(e);for(;t>0;){const e=r.getInt8(i++);if(e<0){const a=-e;t-=a+1;for(let e=0;e<a;e++)n.push(r.getUint8(i++))}else{const a=e;t-=2;const s=r.getUint8(i++);for(let e=0;e<a+1;e++)n.push(s)}}return n}function y(e,t,n){let i,r=1;for(;r<64;)i=t[e.value],65280==i?r=64:i>>8==255?r+=255&i:(n[r]=i,r++),e.value++}function w(e,t){t[0]=W(e[0]),t[1]=W(e[1]),t[2]=W(e[5]),t[3]=W(e[6]),t[4]=W(e[14]),t[5]=W(e[15]),t[6]=W(e[27]),t[7]=W(e[28]),t[8]=W(e[2]),t[9]=W(e[4]),t[10]=W(e[7]),t[11]=W(e[13]),t[12]=W(e[16]),t[13]=W(e[26]),t[14]=W(e[29]),t[15]=W(e[42]),t[16]=W(e[3]),t[17]=W(e[8]),t[18]=W(e[12]),t[19]=W(e[17]),t[20]=W(e[25]),t[21]=W(e[30]),t[22]=W(e[41]),t[23]=W(e[43]),t[24]=W(e[9]),t[25]=W(e[11]),t[26]=W(e[18]),t[27]=W(e[24]),t[28]=W(e[31]),t[29]=W(e[40]),t[30]=W(e[44]),t[31]=W(e[53]),t[32]=W(e[10]),t[33]=W(e[19]),t[34]=W(e[23]),t[35]=W(e[32]),t[36]=W(e[39]),t[37]=W(e[45]),t[38]=W(e[52]),t[39]=W(e[54]),t[40]=W(e[20]),t[41]=W(e[22]),t[42]=W(e[33]),t[43]=W(e[38]),t[44]=W(e[46]),t[45]=W(e[51]),t[46]=W(e[55]),t[47]=W(e[60]),t[48]=W(e[21]),t[49]=W(e[34]),t[50]=W(e[37]),t[51]=W(e[47]),t[52]=W(e[50]),t[53]=W(e[56]),t[54]=W(e[59]),t[55]=W(e[61]),t[56]=W(e[35]),t[57]=W(e[36]),t[58]=W(e[48]),t[59]=W(e[49]),t[60]=W(e[57]),t[61]=W(e[58]),t[62]=W(e[62]),t[63]=W(e[63])}function M(e){const t=.5*Math.cos(.7853975),n=.5*Math.cos(3.14159/16),i=.5*Math.cos(3.14159/8),r=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(.981746875),s=.5*Math.cos(3*3.14159/8),o=.5*Math.cos(1.374445625),l=new Array(4),c=new Array(4),h=new Array(4),A=new Array(4);for(let u=0;u<8;++u){const d=8*u;l[0]=i*e[d+2],l[1]=s*e[d+2],l[2]=i*e[d+6],l[3]=s*e[d+6],c[0]=n*e[d+1]+r*e[d+3]+a*e[d+5]+o*e[d+7],c[1]=r*e[d+1]-o*e[d+3]-n*e[d+5]-a*e[d+7],c[2]=a*e[d+1]-n*e[d+3]+o*e[d+5]+r*e[d+7],c[3]=o*e[d+1]-a*e[d+3]+r*e[d+5]-n*e[d+7],h[0]=t*(e[d+0]+e[d+4]),h[3]=t*(e[d+0]-e[d+4]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],A[0]=h[0]+h[1],A[1]=h[3]+h[2],A[2]=h[3]-h[2],A[3]=h[0]-h[1],e[d+0]=A[0]+c[0],e[d+1]=A[1]+c[1],e[d+2]=A[2]+c[2],e[d+3]=A[3]+c[3],e[d+4]=A[3]-c[3],e[d+5]=A[2]-c[2],e[d+6]=A[1]-c[1],e[d+7]=A[0]-c[0]}for(let u=0;u<8;++u)l[0]=i*e[16+u],l[1]=s*e[16+u],l[2]=i*e[48+u],l[3]=s*e[48+u],c[0]=n*e[8+u]+r*e[24+u]+a*e[40+u]+o*e[56+u],c[1]=r*e[8+u]-o*e[24+u]-n*e[40+u]-a*e[56+u],c[2]=a*e[8+u]-n*e[24+u]+o*e[40+u]+r*e[56+u],c[3]=o*e[8+u]-a*e[24+u]+r*e[40+u]-n*e[56+u],h[0]=t*(e[u]+e[32+u]),h[3]=t*(e[u]-e[32+u]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],A[0]=h[0]+h[1],A[1]=h[3]+h[2],A[2]=h[3]-h[2],A[3]=h[0]-h[1],e[0+u]=A[0]+c[0],e[8+u]=A[1]+c[1],e[16+u]=A[2]+c[2],e[24+u]=A[3]+c[3],e[32+u]=A[3]-c[3],e[40+u]=A[2]-c[2],e[48+u]=A[1]-c[1],e[56+u]=A[0]-c[0]}function S(e){for(let t=0;t<64;++t){const n=e[0][t],i=e[1][t],r=e[2][t];e[0][t]=n+1.5747*r,e[1][t]=n-.1873*i-.4682*r,e[2][t]=n+1.8556*i}}function B(e,t,n){for(let i=0;i<64;++i)t[n+i]=tr(T(e[i]))}function T(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(r,Math.abs(e)-1)}function R(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function D(e){const t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),n=new Uint8Array(x(t)),i=new Uint8Array(n.length);return _(n),I(n,i),new DataView(i.buffer)}function Q(e){const t=eA(e.array.slice(e.offset.value,e.offset.value+e.size)),n=new Uint8Array(t.length);return _(t),I(t,n),new DataView(n.buffer)}function U(e){const n=e.viewer,i={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),a=new Uint8Array(8192);let s=0;const o=new Array(e.inputChannels.length);for(let t=0,n=e.inputChannels.length;t<n;t++)o[t]={},o[t].start=s,o[t].end=o[t].start,o[t].nx=e.columns,o[t].ny=e.lines,o[t].size=e.type,s+=o[t].nx*o[t].ny*o[t].size;const l=q(n,i),c=q(n,i);if(c>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(l<=c)for(let e=0;e<c-l+1;e++)a[e+l]=G(n,i);const h=new Uint16Array(t),A=function(e,n){let i=0;for(let r=0;r<t;++r)(0==r||e[r>>3]&1<<(7&r))&&(n[i++]=r);const r=i-1;for(;i<t;)n[i++]=0;return r}(a,h),u=O(n,i);C(e.array,n,i,u,r,s);for(let t=0;t<e.inputChannels.length;++t){const e=o[t];for(let n=0;n<o[t].size;++n)b(r,e.start+n,e.nx,e.size,e.ny,e.nx*e.size,A)}!function(e,t,n){for(let i=0;i<n;++i)t[i]=e[t[i]]}(h,r,s);let d=0;const p=new Uint8Array(r.buffer.byteLength);for(let t=0;t<e.lines;t++)for(let t=0;t<e.inputChannels.length;t++){const e=o[t],n=e.nx*e.size,i=new Uint8Array(r.buffer,2*e.end,2*n);p.set(i,d),d+=2*n,e.end+=n}return new DataView(p.buffer)}function L(e){const t=eA(e.array.slice(e.offset.value,e.offset.value+e.size)),n=e.inputChannels.length*e.lines*e.columns*e.totalBytes,i=new ArrayBuffer(n),r=new DataView(i);let a=0,s=0;const o=new Array(4);for(let n=0;n<e.lines;n++)for(let n=0;n<e.inputChannels.length;n++){let i=0;switch(e.inputChannels[n].pixelType){case 1:o[0]=a,o[1]=o[0]+e.columns,a=o[1]+e.columns;for(let n=0;n<e.columns;++n)i+=t[o[0]++]<<8|t[o[1]++],r.setUint16(s,i,!0),s+=2;break;case 2:o[0]=a,o[1]=o[0]+e.columns,o[2]=o[1]+e.columns,a=o[2]+e.columns;for(let n=0;n<e.columns;++n)i+=t[o[0]++]<<24|t[o[1]++]<<16|t[o[2]++]<<8,r.setUint32(s,i,!0),s+=4}}return r}function P(e){const t=e.viewer,n={value:e.offset.value},i=new Uint8Array(e.columns*e.lines*(e.inputChannels.length*e.type*2)),r={version:H(t,n),unknownUncompressedSize:H(t,n),unknownCompressedSize:H(t,n),acCompressedSize:H(t,n),dcCompressedSize:H(t,n),rleCompressedSize:H(t,n),rleUncompressedSize:H(t,n),rleRawSize:H(t,n),totalAcUncompressedCount:H(t,n),totalDcUncompressedCount:H(t,n),acCompression:H(t,n)};if(r.version<2)throw new Error("EXRLoader.parse: "+te.compression+" version "+r.version+" is unsupported");const a=new Array;let s=q(t,n)-2;for(;s>0;){const e=N(t.buffer,n),i=G(t,n),r=i>>2&3,o=new Int8Array([(i>>4)-1])[0],l=G(t,n);a.push({name:e,index:o,type:l,compression:r}),s-=e.length+3}const o=te.channels,l=new Array(e.inputChannels.length);for(let t=0;t<e.inputChannels.length;++t){const n=l[t]={},i=o[t];n.name=i.name,n.compression=0,n.decoded=!1,n.type=i.pixelType,n.pLinear=i.pLinear,n.width=e.columns,n.height=e.lines}const c={idx:new Array(3)};for(let t=0;t<e.inputChannels.length;++t){const e=l[t];for(let n=0;n<a.length;++n){const i=a[n];e.name==i.name&&(e.compression=i.compression,i.index>=0&&(c.idx[i.index]=t),e.offset=t)}}let h,A,u;if(r.acCompressedSize>0)switch(r.acCompression){case 0:h=new Uint16Array(r.totalAcUncompressedCount),C(e.array,t,n,r.acCompressedSize,h,r.totalAcUncompressedCount);break;case 1:const i=eA(e.array.slice(n.value,n.value+r.totalAcUncompressedCount));h=new Uint16Array(i.buffer),n.value+=r.totalAcUncompressedCount}if(r.dcCompressedSize>0){const t={array:e.array,offset:n,size:r.dcCompressedSize};A=new Uint16Array(Q(t).buffer),n.value+=r.dcCompressedSize}r.rleRawSize>0&&(u=x(eA(e.array.slice(n.value,n.value+r.rleCompressedSize)).buffer),n.value+=r.rleCompressedSize);let d=0;const p=new Array(l.length);for(let e=0;e<p.length;++e)p[e]=new Array;for(let t=0;t<e.lines;++t)for(let t=0;t<l.length;++t)p[t].push(d),d+=l[t].width*e.type*2;!function(e,t,n,i,r,a){let s=new DataView(a.buffer);const o=n[e.idx[0]].width,l=n[e.idx[0]].height,c=Math.floor(o/8),h=Math.ceil(o/8),A=Math.ceil(l/8),u=o-8*(h-1),d=l-8*(A-1),p={value:0},f=new Array(3),g=new Array(3),m=new Array(3),v=new Array(3),E=new Array(3);for(let n=0;n<3;++n)E[n]=t[e.idx[n]],f[n]=n<1?0:f[n-1]+h*A,g[n]=new Float32Array(64),m[n]=new Uint16Array(64),v[n]=new Uint16Array(64*h);for(let t=0;t<A;++t){let a=8;t==A-1&&(a=d);let o=8;for(let e=0;e<h;++e){e==h-1&&(o=u);for(let e=0;e<3;++e)m[e].fill(0),m[e][0]=r[f[e]++],y(p,i,m[e]),w(m[e],g[e]),M(g[e]);S(g);for(let t=0;t<3;++t)B(g[t],v[t],64*e)}let l=0;for(let i=0;i<3;++i){const r=n[e.idx[i]].type;for(let e=8*t;e<8*t+a;++e){l=E[i][e];for(let t=0;t<c;++t){const n=64*t+8*(7&e);s.setUint16(l+0*r,v[i][n+0],!0),s.setUint16(l+2*r,v[i][n+1],!0),s.setUint16(l+4*r,v[i][n+2],!0),s.setUint16(l+6*r,v[i][n+3],!0),s.setUint16(l+8*r,v[i][n+4],!0),s.setUint16(l+10*r,v[i][n+5],!0),s.setUint16(l+12*r,v[i][n+6],!0),s.setUint16(l+14*r,v[i][n+7],!0),l+=16*r}}if(c!=h)for(let e=8*t;e<8*t+a;++e){const t=E[i][e]+8*c*2*r,n=64*c+8*(7&e);for(let e=0;e<o;++e)s.setUint16(t+2*e*r,v[i][n+e],!0)}}}const b=new Uint16Array(o);s=new DataView(a.buffer);for(let t=0;t<3;++t){n[e.idx[t]].decoded=!0;const i=n[e.idx[t]].type;if(2==n[t].type)for(let e=0;e<l;++e){const n=E[t][e];for(let e=0;e<o;++e)b[e]=s.getUint16(n+2*e*i,!0);for(let e=0;e<o;++e)s.setFloat32(n+2*e*i,W(b[e]),!0)}}}(c,p,l,h,A,i);for(let t=0;t<l.length;++t){const n=l[t];if(!n.decoded){if(2!==n.compression)throw new Error("EXRLoader.parse: unsupported channel compression");{let r=0,a=0;for(let s=0;s<e.lines;++s){let e=p[t][r];for(let t=0;t<n.width;++t){for(let t=0;t<2*n.type;++t)i[e++]=u[a+t*n.width*n.height];a++}r++}}}}return new DataView(i.buffer)}function N(e,t){const n=new Uint8Array(e);let i=0;for(;0!=n[t.value+i];)i+=1;const r=(new TextDecoder).decode(n.slice(t.value,t.value+i));return t.value=t.value+i+1,r}function F(e,t){const n=e.getInt32(t.value,!0);return t.value=t.value+4,n}function O(e,t){const n=e.getUint32(t.value,!0);return t.value=t.value+4,n}function k(e,t){const n=e[t.value];return t.value=t.value+1,n}function G(e,t){const n=e.getUint8(t.value);return t.value=t.value+1,n}const H=function(e,t){let n;return n="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,n};function z(e,t){const n=e.getFloat32(t.value,!0);return t.value+=4,n}function V(e,t){return tr(z(e,t))}function W(e){const t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:Math.pow(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}function q(e,t){const n=e.getUint16(t.value,!0);return t.value+=2,n}function j(e,t){return W(q(e,t))}function Y(e,t,n,i,r){return"string"===i||"stringvector"===i||"iccProfile"===i?function(e,t,n){const i=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+n));return t.value=t.value+n,i}(t,n,r):"chlist"===i?function(e,t,n,i){const r=n.value,a=[];for(;n.value<r+i-1;){const i=N(t,n),r=F(e,n),s=G(e,n);n.value+=3;const o=F(e,n),l=F(e,n);a.push({name:i,pixelType:r,pLinear:s,xSampling:o,ySampling:l})}return n.value+=1,a}(e,t,n,r):"chromaticities"===i?function(e,t){return{redX:z(e,t),redY:z(e,t),greenX:z(e,t),greenY:z(e,t),blueX:z(e,t),blueY:z(e,t),whiteX:z(e,t),whiteY:z(e,t)}}(e,n):"compression"===i?function(e,t){return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][G(e,t)]}(e,n):"box2i"===i?function(e,t){return{xMin:F(e,t),yMin:F(e,t),xMax:F(e,t),yMax:F(e,t)}}(e,n):"envmap"===i?function(e,t){return["ENVMAP_LATLONG","ENVMAP_CUBE"][G(e,t)]}(e,n):"tiledesc"===i?function(e,t){const n=O(e,t),i=O(e,t),r=G(e,t);return{xSize:n,ySize:i,levelMode:["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"][15&r],roundingMode:["ROUND_DOWN","ROUND_UP"][r>>4]}}(e,n):"lineOrder"===i?function(e,t){return["INCREASING_Y","DECREASING_Y","RANDOM_Y"][G(e,t)]}(e,n):"float"===i?z(e,n):"v2f"===i?function(e,t){return[z(e,t),z(e,t)]}(e,n):"v3f"===i?function(e,t){return[z(e,t),z(e,t),z(e,t)]}(e,n):"int"===i?F(e,n):"rational"===i?function(e,t){return[F(e,t),O(e,t)]}(e,n):"timecode"===i?function(e,t){return[O(e,t),O(e,t)]}(e,n):"preview"===i?(n.value+=r,"skipped"):void(n.value+=r)}function X(e,t,n,i){const r=new Array(e);for(let a=0;a<e;a++){const e=1<<a;let s=t/e|0;"ROUND_UP"==i&&s*e<t&&(s+=1);const o=Math.max(s,1);r[a]=(o+n-1)/n|0}return r}function K(){const e=this,t=e.offset,n={value:0};for(let i=0;i<e.tileCount;i++){const i=F(e.viewer,t),r=F(e.viewer,t);t.value+=8,e.size=O(e.viewer,t);const a=i*e.blockWidth,s=r*e.blockHeight;e.columns=a+e.blockWidth>e.width?e.width-a:e.blockWidth,e.lines=s+e.blockHeight>e.height?e.height-s:e.blockHeight;const o=e.columns*e.totalBytes,l=e.size<e.lines*o?e.uncompress(e):R(e);t.value+=e.size;for(let t=0;t<e.lines;t++){const i=t*e.columns*e.totalBytes;for(let r=0;r<e.inputChannels.length;r++){const o=te.channels[r].name,c=e.channelByteOffsets[o]*e.columns,h=e.decodeChannels[o];if(void 0===h)continue;n.value=i+c;const A=(e.height-(1+s+t))*e.outLineWidth;for(let t=0;t<e.columns;t++){const i=A+(t+a)*e.outputChannels+h;e.byteArray[i]=e.getter(l,n)}}}}}function J(){const e=this,t=e.offset,n={value:0};for(let i=0;i<e.height/e.blockHeight;i++){const r=F(e.viewer,t)-te.dataWindow.yMin;e.size=O(e.viewer,t),e.lines=r+e.blockHeight>e.height?e.height-r:e.blockHeight;const a=e.columns*e.totalBytes,s=e.size<e.lines*a?e.uncompress(e):R(e);t.value+=e.size;for(let t=0;t<e.blockHeight;t++){const r=i*e.blockHeight,o=t+e.scanOrder(r);if(o>=e.height)continue;const l=t*a,c=(e.height-1-o)*e.outLineWidth;for(let t=0;t<e.inputChannels.length;t++){const i=te.channels[t].name,r=e.channelByteOffsets[i]*e.columns,a=e.decodeChannels[i];if(void 0!==a){n.value=l+r;for(let t=0;t<e.columns;t++){const i=c+t*e.outputChannels+a;e.byteArray[i]=e.getter(s,n)}}}}}}const Z={value:0},$=new DataView(e),ee=new Uint8Array(e),te=function(e,t,n){const i={};if(20000630!=e.getUint32(0,!0))throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");i.version=e.getUint8(4);const r=e.getUint8(5);i.spec={singleTile:!!(2&r),longName:!!(4&r),deepFormat:!!(8&r),multiPart:!!(16&r)},n.value=8;let a=!0;for(;a;){const r=N(t,n);if(0==r)a=!1;else{const a=N(t,n),s=Y(e,t,n,a,O(e,n));void 0===s?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${a}'.`):i[r]=s}}if(-7&r)throw console.error("THREE.EXRHeader:",i),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return i}($,e,Z),ne=function(e,t,n,i,r){const a={size:0,viewer:t,array:n,offset:i,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,inputChannels:e.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:_t};switch(e.compression){case"NO_COMPRESSION":a.blockHeight=1,a.uncompress=R;break;case"RLE_COMPRESSION":a.blockHeight=1,a.uncompress=D;break;case"ZIPS_COMPRESSION":a.blockHeight=1,a.uncompress=Q;break;case"ZIP_COMPRESSION":a.blockHeight=16,a.uncompress=Q;break;case"PIZ_COMPRESSION":a.blockHeight=32,a.uncompress=U;break;case"PXR24_COMPRESSION":a.blockHeight=16,a.uncompress=L;break;case"DWAA_COMPRESSION":a.blockHeight=32,a.uncompress=P;break;case"DWAB_COMPRESSION":a.blockHeight=256,a.uncompress=P;break;default:throw new Error("EXRLoader.parse: "+e.compression+" is unsupported")}const s={};for(const t of e.channels)switch(t.name){case"Y":case"R":case"G":case"B":case"A":s[t.name]=!0,a.type=t.pixelType}let o=!1;if(s.R&&s.G&&s.B)o=!s.A,a.outputChannels=4,a.decodeChannels={R:0,G:1,B:2,A:3};else{if(!s.Y)throw new Error("EXRLoader.parse: file contains unsupported data channels.");a.outputChannels=1,a.decodeChannels={Y:0}}if(1==a.type)switch(r){case Je:a.getter=j;break;case Ze:a.getter=q}else{if(2!=a.type)throw new Error("EXRLoader.parse: unsupported pixelType "+a.type+" for "+e.compression+".");switch(r){case Je:a.getter=z;break;case Ze:a.getter=V}}a.columns=a.width;const l=a.width*a.height*a.outputChannels;switch(r){case Je:a.byteArray=new Float32Array(l),o&&a.byteArray.fill(1,0,l);break;case Ze:a.byteArray=new Uint16Array(l),o&&a.byteArray.fill(15360,0,l);break;default:console.error("THREE.EXRLoader: unsupported type: ",r)}let c=0;for(const t of e.channels)void 0!==a.decodeChannels[t.name]&&(a.channelByteOffsets[t.name]=c),c+=2*t.pixelType;if(a.totalBytes=c,a.outLineWidth=a.width*a.outputChannels,"INCREASING_Y"===e.lineOrder?a.scanOrder=e=>e:a.scanOrder=e=>a.height-1-e,4==a.outputChannels?(a.format=et,a.colorSpace=_t):(a.format=it,a.colorSpace=bt),e.spec.singleTile){a.blockHeight=e.tiles.ySize,a.blockWidth=e.tiles.xSize;const n=function(e,t,n){let i=0;switch(e.levelMode){case"ONE_LEVEL":i=1;break;case"MIPMAP_LEVELS":i=function(e,t){const n=Math.log2(e);return"ROUND_DOWN"==t?Math.floor(n):Math.ceil(n)}(Math.max(t,n),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return i}(e.tiles,a.width,a.height),r=X(n,a.width,e.tiles.xSize,e.tiles.roundingMode),s=X(n,a.height,e.tiles.ySize,e.tiles.roundingMode);a.tileCount=r[0]*s[0];for(let e=0;e<n;e++)for(let n=0;n<s[e];n++)for(let n=0;n<r[e];n++)H(t,i);a.decode=K.bind(a)}else{a.blockWidth=a.width;const e=Math.ceil(a.height/a.blockHeight);for(let n=0;n<e;n++)H(t,i);a.decode=J.bind(a)}return a}(te,$,ee,Z,this.type);return ne.decode(),{header:te,width:ne.width,height:ne.height,data:ne.byteArray,format:ne.format,colorSpace:ne.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){e.colorSpace=n.colorSpace,e.minFilter=We,e.magFilter=We,e.generateMipmaps=!1,e.flipY=!1,t&&t(e,n)},n,i)}}let iA,rA=!1;function aA(e){rA||(iA=new Mh,new nA,rA=!0);const t=function(e){const t=new Al(e.data,e.width,e.height,void 0,e.type,void 0,ke,ke,We,We,1,_t);return t.flipY=!0,t.generateMipmaps=!1,t.needsUpdate=!0,t}(iA.parse(e));return t.mapping=Ne,t.colorSpace=_t,t}var sA=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var n,i=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",r=WebAssembly.instantiate(a(i),{}).then(function(e){(n=e.instance).exports.__wasm_call_ctors()});function a(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var r=e.charCodeAt(i);n[i]=r>96?r-97:r>64?r-39:r+4}var a=0;for(i=0;i<e.length;++i)n[a++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,a)}function s(e,t,i,r,a,s){var o=n.exports.sbrk,l=i+3&-4,c=o(l*r),h=o(a.length),A=new Uint8Array(n.exports.memory.buffer);A.set(a,h);var u=e(c,i,r,h,a.length);if(0==u&&s&&s(c,l,r),t.set(A.subarray(c,c+i*r)),o(c-o(0)),0!=u)throw new Error("Malformed buffer data: "+u)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},c=[],h=0;function A(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function u(e){r.then(function(){var t=e.data;try{var i=new Uint8Array(t.count*t.size);s(n.exports[t.mode],i,t.count,t.size,t.source,n.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:i},[i.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:"reject",value:e})}})}return{ready:r,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(a(i))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+s.toString()+u.toString(),n=new Blob([t],{type:"text/javascript"}),r=URL.createObjectURL(n),o=0;o<e;++o)c[o]=A(r);URL.revokeObjectURL(r)}(e)},decodeVertexBuffer:function(e,t,i,r,a){s(n.exports.meshopt_decodeVertexBuffer,e,t,i,r,n.exports[o[a]])},decodeIndexBuffer:function(e,t,i,r){s(n.exports.meshopt_decodeIndexBuffer,e,t,i,r)},decodeIndexSequence:function(e,t,i,r){s(n.exports.meshopt_decodeIndexSequence,e,t,i,r)},decodeGltfBuffer:function(e,t,i,r,a,c){s(n.exports[l[a]],e,t,i,r,n.exports[o[c]])},decodeGltfBufferAsync:function(e,t,i,a,A){return c.length>0?function(e,t,n,i,r){for(var a=c[0],s=1;s<c.length;++s)c[s].pending<a.pending&&(a=c[s]);return new Promise(function(s,o){var l=new Uint8Array(n),c=h++;a.pending+=e,a.requests[c]={resolve:s,reject:o},a.object.postMessage({id:c,count:e,size:t,source:l,mode:i,filter:r},[l.buffer])})}(e,t,i,l[a],o[A]):r.then(function(){var r=new Uint8Array(e*t);return s(n.exports[l[a]],r,e,t,i,n.exports[o[A]]),r})}}}();const oA=new WeakMap;class lA extends uc{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const r=new fc(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,e=>{this.parse(e,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,Ct,n).catch(n)}decodeDracoFile(e,t,n,i,r=_t,a=()=>{}){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,s).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(oA.has(e)){const t=oA.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(r,a).then(n=>(i=n,new Promise((n,a)=>{i._callbacks[r]={resolve:n,reject:a},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),oA.set(e,{key:n,promise:s}),s}_createGeometry(e){const t=new fr;e.index&&t.setIndex(new rr(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,a=i.array,s=i.itemSize,o=new rr(a,s);"color"===r&&(this._assignVertexColorSpace(o,i.vertexColorSpace),o.normalized=a instanceof Float32Array==0),t.setAttribute(r,o)}return t}_assignVertexColorSpace(e,t){if(t!==Ct)return;const n=new Xi;for(let t=0,i=e.count;t<i;t++)n.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new fc(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((t,i)=>{n.load(e,t,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=cA.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function cA(){let e,t;function n(e,t,n,i,r,a){const s=a.num_components(),o=n.num_points()*s,l=o*r.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,r),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,a,c,l,h);const A=new r(e.HEAPF32.buffer,h,o).slice();return e._free(h),{name:i,array:A,itemSize:s}}onmessage=function(i){const r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":const i=r.buffer,a=r.taskConfig;t.then(e=>{const t=e.draco,s=new t.Decoder;try{const e=function(e,t,i,r){const a=r.attributeIDs,s=r.attributeTypes;let o,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)o=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,o);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,o)}if(!l.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in a){const l=self[s[i]];let c,A;if(r.useUniqueIDs)A=a[i],c=t.GetAttributeByUniqueId(o,A);else{if(A=t.GetAttributeId(o,e[a[i]]),-1===A)continue;c=t.GetAttribute(o,A)}const u=n(e,t,o,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,a=e._malloc(r);t.GetTrianglesUInt32Array(n,r,a);const s=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:s,itemSize:1}}(e,t,o)),e.destroy(o),h}(t,s,new Int8Array(i),a),o=e.attributes.map(e=>e.array.buffer);e.index&&o.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},o)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(s)}})}}}function hA(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(2===t)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=e.clone();return a.setIndex(r),a.clearGroups(),a}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}class AA extends uc{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new bA(e)}),this.register(function(e){return new mA(e)}),this.register(function(e){return new vA(e)}),this.register(function(e){return new SA(e)}),this.register(function(e){return new BA(e)}),this.register(function(e){return new TA(e)}),this.register(function(e){return new CA(e)}),this.register(function(e){return new _A(e)}),this.register(function(e){return new IA(e)}),this.register(function(e){return new xA(e)}),this.register(function(e){return new gA(e)}),this.register(function(e){return new yA(e)}),this.register(function(e){return new EA(e)}),this.register(function(e){return new MA(e)}),this.register(function(e){return new wA(e)}),this.register(function(e){return new pA(e)}),this.register(function(e){return new RA(e)}),this.register(function(e){return new DA(e)})}load(e,t,n,i){const r=this;let a;if(""!==this.resourcePath)a=this.resourcePath;else if(""!==this.path){const t=Qc.extractUrlBase(e);a=Qc.resolveURL(t,this.path)}else a=Qc.extractUrlBase(e);this.manager.itemStart(e);const s=function(t){i?i(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},o=new fc(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(n){try{r.parse(n,a,function(n){t(n),r.manager.itemEnd(e)},s)}catch(e){s(e)}},n,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const a={},s={},o=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===QA){try{a[dA.KHR_BINARY_GLTF]=new UA(e)}catch(e){return void(i&&i(e))}r=JSON.parse(a[dA.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(e));else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new iu(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[t.name]=t,a[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){const t=r.extensionsUsed[e],n=r.extensionsRequired||[];switch(t){case dA.KHR_MATERIALS_UNLIT:a[t]=new fA;break;case dA.KHR_DRACO_MESH_COMPRESSION:a[t]=new LA(r,this.dracoLoader);break;case dA.KHR_TEXTURE_TRANSFORM:a[t]=new PA;break;case dA.KHR_MESH_QUANTIZATION:a[t]=new NA;break;default:n.indexOf(t)>=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function uA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const dA={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing",DEEPAR_MATERIALS_DIAMOND:"DEEPAR_materials_diamond"};class pA{constructor(e){this.parser=e,this.name=dA.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let s;const o=new Xi(16777215);void 0!==a.color&&o.setRGB(a.color[0],a.color[1],a.color[2],_t);const l=void 0!==a.range?a.range:0;switch(a.type){case"directional":s=new Dc(o),s.target.position.set(0,0,-1),s.add(s.target);break;case"point":s=new Tc(o),s.distance=l;break;case"spot":s=new yc(o),s.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,s.angle=a.spot.outerConeAngle,s.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,s.target.position.set(0,0,-1),s.add(s.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return s.position.set(0,0,0),s.decay=2,JA(s,a),void 0!==a.intensity&&(s.intensity=a.intensity),s.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(s),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(e){return n._getNodeRef(t.cache,r,e)})}}class fA{constructor(){this.name=dA.KHR_MATERIALS_UNLIT}getMaterialType(){return $i}extendParams(e,t,n){const i=[];e.color=new Xi(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],_t),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,Ct))}return Promise.all(i)}}class gA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class mA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){const e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new tn(e,e)}return Promise.all(r)}}class vA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class EA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class bA{constructor(e){this.parser=e,this.name=dA.DEEPAR_MATERIALS_DIAMOND}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?jo:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();t.envMapIntensity=1,t.envMapRotation=0,t.rIndexDelta=.012,t.squashFactor=.98,t.geometryFactor=.5,t.gammaFactor=1,t.absorptionFactor=1,t.reflectivity=.5,t.diamondOrientedEnvMap=0,t.boostFactors=new Tn(1,1,1),t.fixedEnvMapDirection=!1,t.rayBounces=5,t.defines={RAY_BOUNCES:5};const i=n.extensions[this.name];if(void 0!==i.envMapIntensity&&(t.envMapIntensity=i.envMapIntensity),void 0!==i.envMapRotationOffset&&(t.envMapRotation=i.envMapRotationOffset),void 0!==i.dispersion&&(t.rIndexDelta=i.dispersion),void 0!==i.squashFactor&&(t.squashFactor=i.squashFactor),void 0!==i.geometryFactor&&(t.geometryFactor=i.geometryFactor),void 0!==i.gammaFactor&&(t.gammaFactor=i.gammaFactor),void 0!==i.absorptionFactor&&(t.absorptionFactor=i.absorptionFactor),void 0!==i.reflectivity&&(t.reflectivity=i.reflectivity),void 0!==i.diamondOrientedEnvMap&&(t.diamondOrientedEnvMap=i.diamondOrientedEnvMap),void 0!==i.boostFactors){const e=i.boostFactors;t.boostFactors.set(e[0],e[1],e[2])}return void 0!==i.fixedEnvMapDirection&&(t.fixedEnvMapDirection=i.fixedEnvMapDirection),void 0!==i.rayBounces&&(t.rayBounces=i.rayBounces,t.defines={RAY_BOUNCES:i.rayBounces}),Promise.resolve()}}class CA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new Xi(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(void 0!==a.sheenColorFactor){const e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],_t)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,Ct)),void 0!==a.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class _A{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class IA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const s=a.attenuationColor||[1,1,1];return t.attenuationColor=(new Xi).setRGB(s[0],s[1],s[2],_t),Promise.all(r)}}class xA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class yA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const s=a.specularColorFactor||[1,1,1];return t.specularColor=(new Xi).setRGB(s[0],s[1],s[2],_t),void 0!==a.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,Ct)),Promise.all(r)}}class wA{constructor(e){this.parser=e,this.name=dA.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class MA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Wo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class SA{constructor(e){this.parser=e,this.name=dA.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class BA{constructor(e){this.parser=e,this.name=dA.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class TA{constructor(e){this.parser=e,this.name=dA.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class RA{constructor(e){this.name=dA.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(t){const n=e.byteOffset||0,i=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){const t=new ArrayBuffer(a*s);return r.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}return null}}class DA{constructor(e){this.name=dA.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==GA.TRIANGLES&&e.mode!==GA.TRIANGLE_STRIP&&e.mode!==GA.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,a=[],s={};for(const e in r)a.push(this.parser.getDependency("accessor",r[e]).then(t=>(s[e]=t,s[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new si,n=new Tn,a=new Bn,o=new Tn(1,1,1),l=new Il(e.geometry,e.material,i);for(let e=0;e<i;e++)s.TRANSLATION&&n.fromBufferAttribute(s.TRANSLATION,e),s.ROTATION&&a.fromBufferAttribute(s.ROTATION,e),s.SCALE&&o.fromBufferAttribute(s.SCALE,e),l.setMatrixAt(e,t.compose(n,a,o));for(const t in s)if("_COLOR_0"===t){const e=s[t];l.instanceColor=new fl(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,s[t]);Qi.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]}))}}const QA="glTF";class UA{constructor(e){this.name=dA.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==QA)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let a=0;for(;a<i;){const t=r.getUint32(a,!0);a+=4;const i=r.getUint32(a,!0);if(a+=4,1313821514===i){const i=new Uint8Array(e,12+a,t);this.content=n.decode(i)}else if(5130562===i){const n=12+a;this.body=e.slice(n,n+t)}a+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class LA{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=dA.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(const e in a){const t=qA[e]||e.toLowerCase();s[t]=a[e]}for(const t in e.attributes){const i=qA[t]||t.toLowerCase();if(void 0!==a[t]){const r=n.accessors[e.attributes[t]],a=HA[r.componentType];l[i]=a.name,o[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then(function(e){return new Promise(function(t,n){i.decodeDracoFile(e,function(e){for(const t in e.attributes){const n=e.attributes[t],i=o[t];void 0!==i&&(n.normalized=i)}t(e)},s,l,_t,n)})})}}class PA{constructor(){this.name=dA.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class NA{constructor(){this.name=dA.KHR_MESH_QUANTIZATION}}class FA extends Kl{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,c=i-t,h=(n-t)/c,A=h*h,u=A*h,d=e*l,p=d-l,f=-2*u+3*A,g=u-A,m=1-f,v=g-A+h;for(let e=0;e!==s;e++){const t=a[p+e+s],n=a[p+e+o]*c,i=a[d+e+s],l=a[d+e]*c;r[e]=m*t+v*n+f*i+g*l}return r}}const OA=new Bn;class kA extends FA{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return OA.fromArray(r).normalize().toArray(r),r}}const GA={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},HA={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},zA={9728:He,9729:We,9984:1004,9985:qe,9986:Ve,9987:je},VA={33071:ke,33648:Ge,10497:Oe},WA={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},qA={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},jA={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},YA={CUBICSPLINE:void 0,LINEAR:vt,STEP:mt};function XA(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new Vo({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function KA(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function JA(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ZA(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function $A(e){let t;const n=e.extensions&&e.extensions[dA.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+eu(n.attributes):e.indices+":"+eu(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+eu(e.targets[n]);return t}function eu(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function tu(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const nu=new si;class iu{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new uA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,r=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&r<98?this.textureLoader=new vc(this.options.manager):this.textureLoader=new Uc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new fc(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){const a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return KA(r,a,i),JA(a,i),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(const e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":i=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map(function(t,i){return n.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[dA.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(e,r){n.load(Qc.resolveURL(t.uri,i.path),e,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=WA[i.type],t=HA[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new rr(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(e){const r=e[0],a=WA[i.type],s=HA[i.componentType],o=s.BYTES_PER_ELEMENT,l=o*a,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,A=!0===i.normalized;let u,d;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(u=new s(r,e*h,i.count*h/o),l=new Jo(u,h/o),t.cache.add(n,l)),d=new $o(l,a,c%h/o,A)}else u=null===r?new s(i.count*a):new s(r,c,i.count*a),d=new rr(u,a,A);if(void 0!==i.sparse){const t=WA.SCALAR,n=HA[i.sparse.indices.componentType],o=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(e[1],o,i.sparse.count*t),h=new s(e[2],l,i.sparse.count*a);null!==r&&(d=new rr(d.array.slice(),d.itemSize,d.normalized));for(let e=0,t=c.length;e<t;e++){const t=c[e];if(d.setX(t,h[e*a]),a>=2&&d.setY(t,h[e*a+1]),a>=3&&d.setZ(t,h[e*a+2]),a>=4&&d.setW(t,h[e*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return d})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],s=r.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);const n=(r.samplers||{})[a.sampler]||{};return t.magFilter=zA[n.magFilter]||We,t.minFilter=zA[n.minFilter]||je,t.wrapS=VA[n.wrapS]||Oe,t.wrapT=VA[n.wrapT]||Oe,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const r=n.images[e],a=self.URL||self.webkitURL;let s=r.uri||"",o=!1;if(void 0!==r.bufferView)s=this.getDependency("bufferView",r.bufferView).then(function(e){o=!0;const t=new Blob([e],{type:r.mimeType});return s=a.createObjectURL(t),s});else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new In(e);t.needsUpdate=!0,n(t)}),t.load(Qc.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),JA(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[dA.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[dA.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(a);a=r.extensions[dA.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new zo,Zi.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new qo,Zi.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Vo}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const s={},o=[];if((r.extensions||{})[dA.KHR_MATERIALS_UNLIT]){const e=i[dA.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),o.push(e.extendParams(s,r,t))}else{const n=r.pbrMetallicRoughness||{};if(s.color=new Xi(1,1,1),s.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],_t),s.opacity=e[3]}void 0!==n.baseColorTexture&&o.push(t.assignTexture(s,"map",n.baseColorTexture,Ct)),s.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,s.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(t.assignTexture(s,"metalnessMap",n.metallicRoughnessTexture)),o.push(t.assignTexture(s,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===r.doubleSided&&(s.side=2);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===l&&(s.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&a!==$i&&(o.push(t.assignTexture(s,"normalMap",r.normalTexture)),s.normalScale=new tn(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&a!==$i&&(o.push(t.assignTexture(s,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(s.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&a!==$i){const e=r.emissiveFactor;s.emissive=(new Xi).setRGB(e[0],e[1],e[2],_t)}return void 0!==r.emissiveTexture&&a!==$i&&o.push(t.assignTexture(s,"emissiveMap",r.emissiveTexture,Ct)),Promise.all(o).then(function(){const n=new a(s);return r.name&&(n.name=r.name),JA(n,r),t.associations.set(n,{materials:e}),r.extensions&&KA(i,n,r),n})}createUniqueName(e){const t=zc.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[dA.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return ru(n,e,t)})}const a=[];for(let n=0,s=e.length;n<s;n++){const s=e[n],o=$A(s),l=i[o];if(l)a.push(l.promise);else{let e;e=s.extensions&&s.extensions[dA.KHR_DRACO_MESH_COMPRESSION]?r(s):ru(new fr,s,t),i[o]={primitive:s,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,s=[];for(let e=0,t=a.length;e<t;e++){const t=void 0===a[e].material?XA(this.cache):this.getDependency("material",a[e].material);s.push(t)}return s.push(t.loadGeometries(a)),Promise.all(s).then(function(n){const s=n.slice(0,n.length-1),o=n[n.length-1],l=[];for(let n=0,c=o.length;n<c;n++){const c=o[n],h=a[n];let A;const u=s[n];if(h.mode===GA.TRIANGLES||h.mode===GA.TRIANGLE_STRIP||h.mode===GA.TRIANGLE_FAN||void 0===h.mode)A=!0===r.isSkinnedMesh?new cl(c,u):new Qr(c,u),!0===A.isSkinnedMesh&&A.normalizeSkinWeights(),h.mode===GA.TRIANGLE_STRIP?A.geometry=hA(A.geometry,1):h.mode===GA.TRIANGLE_FAN&&(A.geometry=hA(A.geometry,2));else if(h.mode===GA.LINES)A=new Ll(c,u);else if(h.mode===GA.LINE_STRIP)A=new Rl(c,u);else if(h.mode===GA.LINE_LOOP)A=new Pl(c,u);else{if(h.mode!==GA.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);A=new Gl(c,u)}Object.keys(A.geometry.morphAttributes).length>0&&ZA(A,r),A.name=t.createUniqueName(r.name||"mesh_"+e),JA(A,r),h.extensions&&KA(i,A,h),t.assignFinalMaterial(A),A.computeOffsets(),l.push(A)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&KA(i,l[0],r),l[0];const c=new Qo;r.extensions&&KA(i,c,r),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new Wr(en(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new va(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),JA(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){const n=e.pop(),i=e,r=[],a=[];for(let e=0,s=i.length;e<s;e++){const s=i[e];if(s){r.push(s);const t=new si;null!==n&&t.fromArray(n.array,16*e),a.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new pl(r,a)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],s=[],o=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){const t=i.channels[e],n=i.samplers[t.sampler],r=t.target,h=r.node,A=void 0!==i.parameters?i.parameters[n.input]:n.input,u=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(a.push(this.getDependency("node",h)),s.push(this.getDependency("accessor",A)),o.push(this.getDependency("accessor",u)),l.push(n),c.push(r))}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(o),Promise.all(l),Promise.all(c)]).then(function(e){const t=e[0],i=e[1],a=e[2],s=e[3],o=e[4],l=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],c=i[e],h=a[e],A=s[e],u=o[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const d=n._createAnimationTracks(r,c,h,A,u);if(d)for(let e=0;e<d.length;e++)l.push(d[e])}return new lc(r,void 0,l)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then(function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],a=n.children||[];for(let e=0,n=a.length;e<n;e++)r.push(t.getDependency("node",a[e]));const s=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),s]).then(function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(i,nu)});for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",s=[],o=i._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&s.push(o),void 0!==r.camera&&s.push(i.getDependency("camera",r.camera).then(function(e){return i._getNodeRef(i.cameraCache,r.camera,e)})),i._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){s.push(e)}),this.nodeCache[e]=Promise.all(s).then(function(t){let s;if(s=!0===r.isBone?new hl:t.length>1?new Qo:1===t.length?t[0]:new Qi,s!==t[0])for(let e=0,n=t.length;e<n;e++)s.add(t[e]);if(r.name&&(s.userData.name=r.name,s.name=a),JA(s,r),r.extensions&&KA(n,s,r),void 0!==r.matrix){const e=new si;e.fromArray(r.matrix),s.applyMatrix4(e)}else void 0!==r.translation&&s.position.fromArray(r.translation),void 0!==r.rotation&&s.quaternion.fromArray(r.rotation),void 0!==r.scale&&s.scale.fromArray(r.scale);return i.associations.has(s)||i.associations.set(s,{}),i.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Qo;n.name&&(r.name=i.createUniqueName(n.name)),JA(r,n),n.extensions&&KA(t,r,n);const a=n.nodes||[],s=[];for(let e=0,t=a.length;e<t;e++)s.push(i.getDependency("node",a[e]));return Promise.all(s).then(function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[e,n]of i.associations)(e instanceof Zi||e instanceof In)&&t.set(e,n);return e.traverse(e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)}),t})(r),r.userData.isDiamondScene=i._sceneContainsDiamondMaterial(r),r})}_sceneContainsDiamondMaterial(e){let t=!1;return e.traverse(e=>{e.material&&e.material.isMeshDiamondMaterial&&(t=!0)}),t}_createAnimationTracks(e,t,n,i,r){const a=[],s=e.name?e.name:e.uuid,o=[];let l;switch(jA[r.path]===jA.weights?e.traverse(function(e){e.morphTargetInfluences&&o.push(e.name?e.name:e.uuid)}):o.push(s),jA[r.path]){case jA.weights:l=ic;break;case jA.rotation:l=ac;break;case jA.position:case jA.scale:l=oc;break;default:l=1===n.itemSize?ic:oc}const c=void 0!==i.interpolation?YA[i.interpolation]:vt,h=this._getArrayFromAccessor(n);for(let e=0,n=o.length;e<n;e++){const n=new l(o[e]+"."+jA[r.path],t.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=tu(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof ac?kA:FA)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function ru(e,t,n){const i=t.attributes,r=[];function a(t,i){return n.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}for(const t in i){const n=qA[t]||t.toLowerCase();n in e.attributes||r.push(a(i[t],n))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(i)}return pn.workingColorSpace!==_t&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${pn.workingColorSpace}" not supported.`),JA(e,t),function(e,t,n){const i=t.attributes,r=new Qn;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Tn(t[0],t[1],t[2]),new Tn(a[0],a[1],a[2])),e.normalized){const t=tu(HA[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const a=t.targets;if(void 0!==a){const e=new Tn,t=new Tn;for(let i=0,r=a.length;i<r;i++){const r=a[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],a=i.min,s=i.max;if(void 0!==a&&void 0!==s){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(s[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(s[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(s[2]))),i.normalized){const e=tu(HA[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;const s=new Jn;r.getCenter(s.center),s.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=s}(e,t,n),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,a=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(a=!0),i&&r&&a)break}if(!i&&!r&&!a)return Promise.resolve(e);const s=[],o=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):e.attributes.position;s.push(t)}if(r){const t=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):e.attributes.normal;o.push(t)}if(a){const t=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(l)]).then(function(t){const n=t[0],s=t[1],o=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=s),a&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,n):e})}class au{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:t,msg:n,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(n,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const su=9,ou=15,lu=16,cu=22,hu=37,Au=43,uu=76,du=83,pu=97,fu=100,gu=103,mu=109,vu=165,Eu=166;class bu{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Cu{constructor(e,t,n,i){this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}const _u=[171,75,84,88,32,50,48,187,13,10,26,10];function Iu(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}let xu,yu,wu;const Mu={env:{emscripten_notify_memory_growth:function(e){wu=new Uint8Array(yu.exports.memory.buffer)}}};class Su{init(){return xu||(xu="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Bu).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Mu)).then(this._init):WebAssembly.instantiate(Buffer.from(Bu,"base64"),Mu).then(this._init),xu)}_init(e){yu=e.instance,Mu.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!yu)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=yu.exports.malloc(n);wu.set(e,i),t=t||Number(yu.exports.ZSTD_findDecompressedSize(i,n));const r=yu.exports.malloc(t),a=yu.exports.ZSTD_decompress(r,t,i,n),s=wu.slice(r,r+a);return yu.exports.free(i),yu.exports.free(r),s}}const Bu="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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",Tu=new WeakMap;let Ru,Du=0;class Qu extends uc{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new au,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new fc(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new fc(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then(([e,t])=>{const n=Qu.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Qu.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Qu.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Qu.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),Du>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Du++}return this.transcoderPending}load(e,t,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new fc(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,e=>{if(Tu.has(e))return Tu.get(e).promise.then(t).catch(i);this._createTexture(e).then(e=>t?t(e):null).catch(i)},n,i)}_createTextureFrom(e,t){const{faces:n,width:i,height:r,format:a,type:s,error:o,dfdFlags:l}=e;if("error"===s)return Promise.reject(o);let c;if(6===t.faceCount)c=new Wl(n,a,Ye);else{const e=n[0].mipmaps;c=t.layerCount>1?new Vl(e,i,r,t.layerCount,a,Ye):new zl(e,i,r,a,Ye)}return c.minFilter=1===n[0].mipmaps.length?We:je,c.magFilter=We,c.generateMipmaps=!1,c.needsUpdate=!0,c.colorSpace=Nu(t),c.premultiplyAlpha=!!(1&l),c}async _createTexture(e,t={}){const n=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,_u.length);if(t[0]!==_u[0]||t[1]!==_u[1]||t[2]!==_u[2]||t[3]!==_u[3]||t[4]!==_u[4]||t[5]!==_u[5]||t[6]!==_u[6]||t[7]!==_u[7]||t[8]!==_u[8]||t[9]!==_u[9]||t[10]!==_u[10]||t[11]!==_u[11])throw new Error("Missing KTX 2.0 identifier.");const n=new bu,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Cu(e,_u.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const a=r._nextUint32();n.supercompressionScheme=r._nextUint32();const s=r._nextUint32(),o=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),A=r._nextUint64(),u=new Cu(e,_u.length+i,3*a*8,!0);for(let t=0;t<a;t++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});const d=new Cu(e,s,o,!0),p={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},f=(p.descriptorBlockSize/4-6)/4;for(let e=0;e<f;e++){const t={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=d._nextInt32(),t.sampleUpper=d._nextInt32()):(t.sampleLower=d._nextUint32(),t.sampleUpper=d._nextUint32()),p.samples[e]=t}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(p);const g=new Cu(e,l,c,!0);for(;g._offset<c;){const e=g._nextUint32(),t=g._scan(e),i=Iu(t),r=g._scan(e-t.byteLength);n.keyValue[i]=i.match(/^ktx/i)?Iu(r):r,g._offset%4&&g._skip(4-g._offset%4)}if(A<=0)return n;const m=new Cu(e,h,A,!0),v=m._nextUint16(),E=m._nextUint16(),b=m._nextUint32(),C=m._nextUint32(),_=m._nextUint32(),I=m._nextUint32(),x=[];for(let e=0;e<a;e++)x.push({imageFlags:m._nextUint32(),rgbSliceByteOffset:m._nextUint32(),rgbSliceByteLength:m._nextUint32(),alphaSliceByteOffset:m._nextUint32(),alphaSliceByteLength:m._nextUint32()});const y=h+m._offset,w=y+b,M=w+C,S=M+_,B=new Uint8Array(e.buffer,e.byteOffset+y,b),T=new Uint8Array(e.buffer,e.byteOffset+w,C),R=new Uint8Array(e.buffer,e.byteOffset+M,_),D=new Uint8Array(e.buffer,e.byteOffset+S,I);return n.globalData={endpointCount:v,selectorCount:E,imageDescs:x,endpointsData:B,selectorsData:T,tablesData:R,extendedData:D},n}(new Uint8Array(e));if(0!==n.vkFormat)return async function(e){const{vkFormat:t}=e;if(void 0===Lu[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===e.supercompressionScheme&&(Ru||(Ru=new Promise(async e=>{const t=new Su;await t.init(),e(t)})),n=await Ru);const i=[];for(let r=0;r<e.levels.length;r++){const a=Math.max(1,e.pixelWidth>>r),s=Math.max(1,e.pixelHeight>>r),o=e.pixelDepth?Math.max(1,e.pixelDepth>>r):0,l=e.levels[r];let c,h;if(0===e.supercompressionScheme)c=l.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=Pu[t]===Je?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Pu[t]===Ze?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:a,height:s,depth:o})}let r;if(Uu.has(Lu[t]))r=0===e.pixelDepth?new Al(i[0].data,e.pixelWidth,e.pixelHeight):new Sn(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new zl(i,e.pixelWidth,e.pixelHeight)}return r.mipmaps=i,r.type=Pu[t],r.format=Lu[t],r.colorSpace=Nu(e),r.needsUpdate=!0,Promise.resolve(r)}(n);const i=t,r=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])).then(e=>this._createTextureFrom(e.data,n));return Tu.set(e,{promise:r}),r}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Du--,this}}Qu.BasisFormat={ETC1S:0,UASTC_4x4:1},Qu.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Qu.EngineFormat={RGBAFormat:et,RGBA_ASTC_4x4_Format:pt,RGBA_BPTC_Format:gt,RGBA_ETC2_EAC_Format:dt,RGBA_PVRTC_4BPPV1_Format:ht,RGBA_S3TC_DXT5_Format:lt,RGB_ETC1_Format:At,RGB_ETC2_Format:ut,RGB_PVRTC_4BPPV1_Format:ct,RGBA_S3TC_DXT1_Format:st},Qu.BasisWorker=function(){let e,t,n;const i=_EngineFormat,r=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(s){const A=s.data;switch(A.type){case"init":e=A.config,u=A.transcoderBinary,t=new Promise(e=>{n={wasmBinary:u,onRuntimeInitialized:e},BASIS(n)}).then(()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{const{faces:t,buffers:s,width:u,height:d,hasAlpha:p,format:f,dfdFlags:g}=function(t){const s=new n.KTX2File(new Uint8Array(t));function A(){s.close(),s.delete()}if(!s.isValid())throw A(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const u=s.isUASTC()?a.UASTC_4x4:a.ETC1S,d=s.getWidth(),p=s.getHeight(),f=s.getLayers()||1,g=s.getLevels(),m=s.getFaces(),v=s.getHasAlpha(),E=s.getDFDFlags(),{transcoderFormat:b,engineFormat:C}=function(t,n,s,h){let A,u;const d=t===a.ETC1S?o:l;for(let i=0;i<d.length;i++){const r=d[i];if(e[r.if]&&r.basisFormat.includes(t)&&!(h&&r.transcoderFormat.length<2)&&(!r.needsPowerOfTwo||c(n)&&c(s)))return A=r.transcoderFormat[h?1:0],u=r.engineFormat[h?1:0],{transcoderFormat:A,engineFormat:u}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=r.RGBA32,u=i.RGBAFormat,{transcoderFormat:A,engineFormat:u}}(u,d,p,v);if(!d||!p||!g)throw A(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw A(),new Error("THREE.KTX2Loader: .startTranscoding failed");const _=[],I=[];for(let e=0;e<m;e++){const t=[];for(let n=0;n<g;n++){const i=[];let r,a;for(let t=0;t<f;t++){const o=s.getImageLevelInfo(n,t,e);0!==e||0!==n||0!==t||o.origWidth%4==0&&o.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),g>1?(r=o.origWidth,a=o.origHeight):(r=o.width,a=o.height);const l=new Uint8Array(s.getImageTranscodedSizeInBytes(n,t,0,b));if(!s.transcodeImage(l,n,t,e,b,0,-1,-1))throw A(),new Error("THREE.KTX2Loader: .transcodeImage failed.");i.push(l)}const o=h(i);t.push({data:o,width:r,height:a}),I.push(o.buffer)}_.push({mipmaps:t,width:d,height:p,format:C})}return A(),{faces:_,buffers:I,width:d,height:p,hasAlpha:v,format:C,dfdFlags:E}}(A.buffer);self.postMessage({type:"transcode",id:A.id,faces:t,width:u,height:d,hasAlpha:p,format:f,dfdFlags:g},s)}catch(e){console.error(e),self.postMessage({type:"error",id:A.id,error:e.message})}})}var u});const s=[{if:"astcSupported",basisFormat:[a.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],o=s.sort(function(e,t){return e.priorityETC1S-t.priorityETC1S}),l=s.sort(function(e,t){return e.priorityUASTC-t.priorityUASTC});function c(e){return e<=2||!(e&e-1)&&0!==e}function h(e){if(1===e.length)return e[0];let t=0;for(let n=0;n<e.length;n++)t+=e[n].byteLength;const n=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];n.set(r,i),i+=r.byteLength}return n}};const Uu=new Set([et,rt,it]),Lu={[mu]:et,[pu]:et,[hu]:et,[Au]:et,[gu]:rt,[du]:rt,[lu]:rt,[cu]:rt,[fu]:it,[uu]:it,[ou]:it,[su]:it,[Eu]:ft,[vu]:ft},Pu={[mu]:Je,[pu]:Ze,[hu]:Ye,[Au]:Ye,[gu]:Je,[du]:Ze,[lu]:Ye,[cu]:Ye,[fu]:Je,[uu]:Ze,[ou]:Ye,[su]:Ye,[Eu]:Ye,[vu]:Ye};function Nu(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?Ct:_t:10===t.colorPrimaries?2===t.transferFunction?It:xt:(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),bt)}let Fu=null;const Ou=e=>{Fu=null==e?null:e.endsWith("/")?e.substring(0,e.length-1):e},ku=()=>null!=Fu?`${Fu}/libs`:"https://cdn.jsdelivr.net/npm/three@0.165.0/examples/jsm/libs",Gu=(()=>{const e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;const t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const e of t)if("viewport"===e.name)return!0;return!1})();return e||console.error('No <meta name="viewport"> detected. This might cause ShopAR to crash on iOS.\nPlease add the following line to your HTML:\n<meta name="viewport" content="width=device-width, initial-scale=1.0">'),()=>e?Math.min(window.devicePixelRatio||1,2):1})(),Hu=new Xi(16777215);let zu,Vu,Wu=!1,qu=1,ju=1,Yu=1;function Xu(){return Ku(),zu}function Ku(){if(Wu)return;Yu=Gu(),Vu=document.createElement("canvas");const e=Vu.style;e.position="absolute",e.top="0",e.left="0",e.width="100%",e.height="100%",zu=new Ko({powerPreference:"high-performance",canvas:Vu,antialias:!0,alpha:!0}),zu.outputColorSpace=Ct,zu.toneMapping=4,zu.setClearColor(new Xi(16777215),0),Wu=!0}function Ju(e,t,n,i,r){const{width:a,height:s}=t,o=zu.toneMapping,l=zu.toneMappingExposure;if(zu.toneMapping=i,zu.toneMappingExposure=r,zu.setViewport(0,0,a,s),zu.setClearColor(Hu,n),e.setSize(a,s),e.render(),zu.toneMapping=o,zu.toneMappingExposure=l,t.isBlitted()){const{context2d:e}=t;if(null==e)return;e.clearRect(0,0,a,s),Vu.width>0&&Vu.height>0&&e.drawImage(Vu,0,ju-s,a,s,0,0,a,s)}}function Zu(e,t){const n=Gu();e=Math.ceil(e*n),t=Math.ceil(t*n),e===qu&&t===ju&&n===Yu||(qu=e,ju=t,Yu=n,Xu().setSize(qu,ju,!1))}function $u(e,t){Xu().renderCubeMapNormals(e),e.traverse(e=>{e instanceof Qr&&e.material&&e.material.isMeshDiamondMaterial&&(e.material.envMap=t)})}let ed,td=!1;function nd(e){return td||id(),ed.parseAsync(e.buffer,"")}function id(){if(td)return;const e=(new lA).setDecoderPath(`${ku()}/draco/gltf/`);e.preload();const t=(new Qu).setTranscoderPath(`${ku()}/basis/`).detectSupport(Xu());ed=(new AA).setDRACOLoader(e).setKTX2Loader(t).setMeshoptDecoder(sA),td=!0}function rd(e){null!=e&&(Object.values(e).forEach(e=>{(null==e?void 0:e.dispose)instanceof Function&&e.dispose()}),e.dispose())}function ad(e,t,n,i,r,a){if(null==e)return new Tn;const s=sd(e,i,r,new Tn),o=od(e);sd(e,s.scale,s.quaternion,s.position);const l=o.getSize(new Tn),c=o.getCenter(new Tn);let h=0;return h=l.x/2+t/2,n&&(h=-h),new Tn(-c.x+h,-c.y+l.y/2,-c.z)}function sd(e,t,n,i){let r,a,s;return null!=t&&(r=e.scale.x,e.scale.set(t,t,t)),null!=n&&(a=e.quaternion.clone(),e.quaternion.copy(n)),null!=i&&(s=e.position.clone(),e.position.copy(i)),{scale:r,quaternion:a,position:s}}function od(e){return(new Qn).setFromObject(e,!0)}function ld(e){e.traverse(e=>{var t;e instanceof Qr&&(null===(t=e.geometry)||void 0===t||t.dispose(),Array.isArray(e.material)?e.material.forEach(rd):rd(e.material))}),e.clear()}const cd={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class hd{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Ad=new va(-1,1,1,-1,0,1),ud=new class extends fr{constructor(){super(),this.setAttribute("position",new or([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new or([0,2,0,0,2,0],2))}};class dd{constructor(e){this._mesh=new Qr(ud,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Ad)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class pd extends hd{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof kr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Or.clone(e.uniforms),this.material=new kr({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new dd(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class fd extends hd{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),r=e.state;let a,s;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0),this.inverse?(a=0,s=1):(a=1,s=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),r.buffers.stencil.setFunc(i.ALWAYS,a,4294967295),r.buffers.stencil.setClear(s),r.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.color.setMask(!0),r.buffers.depth.setMask(!0),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(i.EQUAL,1,4294967295),r.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),r.buffers.stencil.setLocked(!0)}}class gd extends hd{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class md{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const n=e.getSize(new tn);this._width=n.width,this._height=n.height,(t=new wn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Ze})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new pd(cd),this.copyPass.material.blending=0,this.clock=new Lc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let t=0,i=this.passes.length;t<i;t++){const i=this.passes[t];if(!1!==i.enabled){if(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),i.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),i.needsSwap){if(n){const t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==fd&&(i instanceof fd?n=!0:i instanceof gd&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new tn);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}const vd={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:"\n\t\tprecision highp float;\n\n\t\tuniform mat4 modelViewMatrix;\n\t\tuniform mat4 projectionMatrix;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\t#include <tonemapping_pars_fragment>\n\t\t#include <colorspace_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// tone mapping\n\n\t\t\t#ifdef LINEAR_TONE_MAPPING\n\n\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = OptimizedCineonToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( AGX_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\n\t\t\t#endif\n\n\t\t\t// color space\n\n\t\t\t#ifdef SRGB_TRANSFER\n\n\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n\t\t\t#endif\n\n\t\t}"};class Ed extends hd{constructor(){super();const e=vd;this.uniforms=Or.clone(e.uniforms),this.material=new Ho({name:e.name,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.fsQuad=new dd(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,this._outputColorSpace===e.outputColorSpace&&this._toneMapping===e.toneMapping||(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},pn.getTransfer(this._outputColorSpace)===wt&&(this.material.defines.SRGB_TRANSFER=""),1===this._toneMapping?this.material.defines.LINEAR_TONE_MAPPING="":2===this._toneMapping?this.material.defines.REINHARD_TONE_MAPPING="":3===this._toneMapping?this.material.defines.CINEON_TONE_MAPPING="":4===this._toneMapping?this.material.defines.ACES_FILMIC_TONE_MAPPING="":6===this._toneMapping?this.material.defines.AGX_TONE_MAPPING="":7===this._toneMapping&&(this.material.defines.NEUTRAL_TONE_MAPPING=""),this.material.needsUpdate=!0),!0===this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class bd extends hd{constructor(e,t,n=null,i=null,r=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=r,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Xi}render(e,t,n){const i=e.autoClear;let r,a;e.autoClear=!1,null!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),null!==this.clearAlpha&&(r=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),1==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(r),null!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}const Cd={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Xi(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\t\t\tgl_FragColor.rgb = max( gl_FragColor.rgb, vec3( 0.0 ) );\n\n\t\t}"};class _d extends hd{constructor(e,t,n,i){super(),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=i,this.resolution=void 0!==e?new tn(e.x,e.y):new tn(256,256),this.clearColor=new Xi(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new wn(r,a,{type:Ze}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new wn(r,a,{type:Ze});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const n=new wn(r,a,{type:Ze});n.texture.name="UnrealBloomPass.v"+e,n.texture.generateMipmaps=!1,this.renderTargetsVertical.push(n),r=Math.round(r/2),a=Math.round(a/2)}const s=Cd;this.highPassUniforms=Or.clone(s.uniforms),this.highPassUniforms.luminosityThreshold.value=i,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new kr({uniforms:this.highPassUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader}),this.separableBlurMaterials=[];const o=[3,5,7,9,11];r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(o[e])),this.separableBlurMaterials[e].uniforms.invSize.value=new tn(1/r,1/a),r=Math.round(r/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new Tn(1,1,1),new Tn(1,1,1),new Tn(1,1,1),new Tn(1,1,1),new Tn(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const l=cd;this.copyUniforms=Or.clone(l.uniforms),this.blendMaterial=new kr({uniforms:this.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Xi,this.oldClearAlpha=1,this.basic=new $i,this.fsQuad=new dd(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(n,i);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(n,i),this.renderTargetsVertical[e].setSize(n,i),this.separableBlurMaterials[e].uniforms.invSize.value=new tn(1/n,1/i),n=Math.round(n/2),i=Math.round(i/2)}render(e,t,n,i,r){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),r&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let s=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[t].uniforms.direction.value=_d.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=_d.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),s=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new kr({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new tn(.5,.5)},direction:{value:new tn(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 invSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float gaussianCoefficients[KERNEL_RADIUS];\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat weightSum = gaussianCoefficients[0];\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianCoefficients[i];\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}getCompositeMaterial(e){return new kr({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}_d.BlurDirectionX=new tn(1,0),_d.BlurDirectionY=new tn(0,1);const Id="backgroundTexture",xd=`\n uniform sampler2D ${Id};\n uniform sampler2D bloomTexture;\n uniform sampler2D objectMaskTexture;\n\n varying vec2 vUv;\n\n void main() {\n gl_FragColor = texture2D( ${Id}, vUv );\n gl_FragColor.rgb += texture2D( bloomTexture, vUv ).rgb * texture2D( objectMaskTexture, vUv ).a;\n }\n`;class yd extends pd{constructor(e,t){super(new kr({uniforms:{[Id]:{value:null},bloomTexture:{value:e},objectMaskTexture:{value:t}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:xd}),Id)}}var wd,Md,Sd,Bd,Td,Rd,Dd,Qd,Ud,Ld,Pd,Nd,Fd,Od,kd,Gd,Hd,zd;const Vd="neverDarken",Wd="shadowObject";class qd{constructor(e,t){wd.set(this,void 0),Md.set(this,void 0),Sd.set(this,!1),Bd.set(this,.25),Td.set(this,0),Rd.set(this,2),Dd.set(this,null),Qd.set(this,null),Ud.set(this,null),Ld.set(this,null),Pd.set(this,null),Nd.set(this,null),Fd.set(this,null),Od.set(this,null),kd.set(this,null),Gd.set(this,{}),Hd.set(this,null),zd.set(this,new Xi),H(this,wd,e),H(this,Md,t)}set strength(e){H(this,Bd,e),null!=G(this,Ud,"f")&&(G(this,Ud,"f").strength=G(this,Bd,"f"))}set radius(e){H(this,Td,e),null!=G(this,Ud,"f")&&(G(this,Ud,"f").radius=G(this,Td,"f"))}set threshold(e){H(this,Rd,e),null!=G(this,Ud,"f")&&(G(this,Ud,"f").threshold=G(this,Rd,"f"))}init(){G(this,Sd,"f")||(H(this,Dd,new md(Xu())),H(this,Qd,new bd(G(this,wd,"f"),G(this,Md,"f"))),G(this,Qd,"f").clearColor=new Xi(0),G(this,Qd,"f").clearAlpha=0,G(this,Dd,"f").addPass(G(this,Qd,"f")),H(this,Ud,new _d(new tn(256,256),G(this,Bd,"f"),G(this,Td,"f"),G(this,Rd,"f"))),G(this,Dd,"f").addPass(G(this,Ud,"f")),H(this,Ld,new Ed),G(this,Ld,"f").needsSwap=!1,G(this,Dd,"f").addPass(G(this,Ld,"f")),G(this,Dd,"f").renderToScreen=!1,H(this,Od,new md(Xu())),H(this,kd,new bd(G(this,wd,"f"),G(this,Md,"f"))),G(this,Od,"f").addPass(G(this,kd,"f")),G(this,Od,"f").renderToScreen=!1,H(this,Pd,new md(Xu())),H(this,Nd,new bd(G(this,wd,"f"),G(this,Md,"f"))),G(this,Pd,"f").addPass(G(this,Nd,"f")),H(this,Fd,new yd(G(this,Dd,"f").renderTarget1.texture,G(this,Od,"f").renderTarget2.texture)),G(this,Pd,"f").addPass(G(this,Fd,"f")),H(this,Hd,new $i({color:0})),H(this,Sd,!0))}destroy(){G(this,Sd,"f")&&(G(this,Hd,"f").dispose(),H(this,Hd,null),G(this,Fd,"f").dispose(),H(this,Fd,null),G(this,Nd,"f").dispose(),H(this,Nd,null),G(this,Pd,"f").dispose(),H(this,Pd,null),G(this,kd,"f").dispose(),H(this,kd,null),G(this,Od,"f").dispose(),H(this,Od,null),G(this,Ld,"f").dispose(),H(this,Ld,null),G(this,Ud,"f").dispose(),H(this,Ud,null),G(this,Qd,"f").dispose(),H(this,Qd,null),G(this,Dd,"f").dispose(),H(this,Dd,null),H(this,Sd,!1))}setSize(e,t){null!=G(this,Dd,"f")&&null!=G(this,Od,"f")&&null!=G(this,Pd,"f")&&(G(this,Dd,"f").setSize(e,t),G(this,Od,"f").setSize(e,t),G(this,Pd,"f").setSize(e,t))}render(){null!=G(this,Dd,"f")&&null!=G(this,Od,"f")&&null!=G(this,kd,"f")&&null!=G(this,Pd,"f")&&null!=G(this,Nd,"f")&&(G(this,Dd,"f").render(),this.darkenMaterials(),this.hideShadow(),G(this,kd,"f").clearColor=Xu().getClearColor(G(this,zd,"f")),G(this,kd,"f").clearAlpha=Xu().getClearAlpha(),G(this,Od,"f").render(),this.showShadow(),G(this,Nd,"f").clearColor=Xu().getClearColor(G(this,zd,"f")),G(this,Nd,"f").clearAlpha=Xu().getClearAlpha(),G(this,Pd,"f").render(),this.restoreDarkenedMaterials())}hideShadow(){G(this,wd,"f").traverse(e=>{e instanceof Qr&&e.material.userData[Wd]&&(e.visible=!1)})}showShadow(){G(this,wd,"f").traverse(e=>{e instanceof Qr&&e.material.userData[Wd]&&(e.visible=!0)})}onSceneUpdate(){Xu().renderCubeMapNormals(G(this,wd,"f"))}darkenMaterials(){G(this,wd,"f").traverse(e=>{if(e instanceof Qr){if(e.material.userData[Vd])return;G(this,Gd,"f")[e.uuid]=e.material,e.material=G(this,Hd,"f")}})}restoreDarkenedMaterials(){G(this,wd,"f").traverse(e=>{if(e instanceof Qr){if(e.material!==G(this,Hd,"f"))return;e.material=G(this,Gd,"f")[e.uuid],delete G(this,Gd,"f")[e.uuid]}})}}var jd,Yd,Xd,Kd,Jd,Zd;wd=new WeakMap,Md=new WeakMap,Sd=new WeakMap,Bd=new WeakMap,Td=new WeakMap,Rd=new WeakMap,Dd=new WeakMap,Qd=new WeakMap,Ud=new WeakMap,Ld=new WeakMap,Pd=new WeakMap,Nd=new WeakMap,Fd=new WeakMap,Od=new WeakMap,kd=new WeakMap,Gd=new WeakMap,Hd=new WeakMap,zd=new WeakMap,(Zd=Jd||(Jd={}))[Zd.Direct=0]="Direct",Zd[Zd.Postprocessed=1]="Postprocessed";class $d{constructor(e,t){jd.set(this,void 0),Yd.set(this,void 0),Xd.set(this,Jd.Direct),Kd.set(this,void 0),H(this,jd,e),H(this,Yd,t),H(this,Kd,new qd(G(this,jd,"f"),G(this,Yd,"f")))}get bloomEnabled(){return G(this,Xd,"f")===Jd.Postprocessed}set bloomEnabled(e){e?(G(this,Kd,"f").init(),H(this,Xd,Jd.Postprocessed)):(G(this,Kd,"f").destroy(),H(this,Xd,Jd.Direct))}set bloomStrength(e){G(this,Kd,"f").strength=e}set bloomRadius(e){G(this,Kd,"f").radius=e}set bloomThreshold(e){G(this,Kd,"f").threshold=e}dispose(){G(this,Kd,"f").destroy(),H(this,Xd,Jd.Direct)}setSize(e,t){G(this,Kd,"f").setSize(e,t)}render(){G(this,Xd,"f")===Jd.Direct?Xu().render(G(this,jd,"f"),G(this,Yd,"f")):G(this,Xd,"f")===Jd.Postprocessed&&G(this,Kd,"f").render()}}jd=new WeakMap,Yd=new WeakMap,Xd=new WeakMap,Kd=new WeakMap;const ep={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},tp={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};let np,ip,rp,ap=!1;const sp=300,op=2*Math.PI/32,lp=ce("hold"),cp=ce("sine"),hp=ce("sine-in"),Ap=ce("sine-out");function up(){let e=!0,t=!1,n=null,i=null,r=null;return{get custom(){return t},set:e=>{const{theta:a,phi:s,fov:o}=e;n=a,i=s,r=o,t=null!=a||null!=s||null!=o},reset:e=>{var a;t?(null==n||n.reset(),null==i||i.reset(),null==r||r.reset()):(n=Z([{time:0,value:a=e,interpolation:lp},{time:sp,value:a,interpolation:Ap},{time:800,value:a+op,interpolation:cp},{time:1800,value:a-op,interpolation:hp},{time:2300,value:a,interpolation:lp},{time:4300,value:a,interpolation:lp}]),i=null,r=null)},get running(){return e},set running(t){e=t},update:t=>{e&&(null==n||n.update(t),null==i||i.update(t),null==r||r.update(t))},get theta(){return null==n?void 0:n.get()},get phi(){return null==i?void 0:i.get()},get fov(){return null==r?void 0:r.get()}}}var dp;!function(e){e[e.NONE=0]="NONE",e[e.USER_INTERACTION=1]="USER_INTERACTION",e[e.AUTOMATIC=2]="AUTOMATIC"}(dp||(dp={}));const pp="pan-y",fp=1e-6,gp=Math.PI/8,mp=new Tn;class vp extends Ht{constructor(e,t){super(),this.touchAction_=pp,this.enablePan=!0,this.screenSpacePanning=!0,this.enableZoom_=!0,this.enableKeyControls=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.defaultFov=16,this.minFovFactor=.2,this.maxFovFactor=1.6,this.minFov=this.defaultFov*this.minFovFactor,this.maxFov=this.defaultFov*this.maxFovFactor,this.fovMultiplier_=1,this.enableDamping=!0,this.dampingFactor=.3,this.interactionEnabled=!1,this.userInteracted=!1,this.target=new Tn,this.panSphereCenter=new Tn,this.panSphereRadius=1/0,this.spherical=new Vc,this.goalSpherical=new Vc,this.fov=this.defaultFov,this.panOffset=new Tn,this.fovDelta=0,this.lastPosition=new Tn,this.lastQuaternion=new Bn,this.lastTargetPosition=new Tn,this.lastFov=this.fov,this.changeSource=dp.NONE,this.panInProgress=!1,this.touchMode=null,this.pointers=[],this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.passiveTouchHandler=()=>{},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY);try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),"touch"===e.pointerType?(this.changeSource=e.altKey?dp.AUTOMATIC:dp.USER_INTERACTION,this.onTouchChange()):(this.changeSource=dp.USER_INTERACTION,this.onMouseDown(e))},this.onPointerMove=e=>{const t=this.pointers.find(t=>t.id===e.pointerId);if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const n=this.pointers.length,i=(e.clientX-t.clientX)/n,r=(e.clientY-t.clientY)/n;0===i&&0===r||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?dp.AUTOMATIC:dp.USER_INTERACTION,null!==this.touchMode&&this.touchMode(i,r)):(this.changeSource=dp.USER_INTERACTION,this.panInProgress?this.pan(i,r):this.handleSinglePointerMove(i,r)))},this.onPointerUp=e=>{const t=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==t&&this.pointers.splice(t,1);const{element:n}=this;0===this.pointers.length?(n.removeEventListener("pointermove",this.onPointerMove),n.removeEventListener("pointerup",this.onPointerUp),n.removeEventListener("touchmove",this.disableScroll)):null!==this.touchMode&&this.onTouchChange(),n.style.cursor="grab",this.panInProgress=!1},this.onWheel=e=>{this.changeSource=dp.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*.2/30;this.userAdjustOrbit(0,0,t),e.preventDefault()},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=dp.USER_INTERACTION,(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?e.preventDefault():this.changeSource=t},this.disableScroll=e=>{e.preventDefault()},this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.onTouchChange=()=>{if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(!this.enableZoom_)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=bp(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&this.initializePan()}},this.onMouseDown=e=>{this.panInProgress=!1,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&this.initializePan(),this.element.style.cursor="grabbing"},this.touchModeZoom=(e,t)=>{if(this.enableZoom_){const e=bp(this.pointers[0],this.pointers[1]),t=.2*(this.lastSeparation-e)*35/this.element.clientHeight;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panInProgress&&this.pan(e,t)},this.touchModeRotate=(e,t)=>{if(!this.touchDecided){this.touchDecided=!0;const n=Math.abs(e),i=Math.abs(t),r="pan-x"===this.touchAction_&&n>i,a="pan-y"===this.touchAction_&&i>n;if(this.changeSource===dp.USER_INTERACTION&&(r||a))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.camera=e,this.element=t,this.quat=(new Bn).setFromUnitVectors(e.up,new Tn(0,1,0)),this.quatInverse=this.quat.clone().invert(),this.update(0)}set touchAction(e){this.touchAction_=null!=e?e:pp,this.updateTouchActionStyle()}set enableZoom(e){this.enableZoom_!=e&&(this.enableZoom_=e,e?this.element.addEventListener("wheel",this.onWheel):this.element.removeEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}set minZoom(e){this.maxFovFactor=null!=e?1/e:1.6,this.maxFov=this.defaultFov*this.fovMultiplier_*this.maxFovFactor,this.fov=Ep(this.fov,this.minFov,this.maxFov)}set maxZoom(e){this.minFovFactor=null!=e?1/e:.2,this.minFov=this.defaultFov*this.fovMultiplier_*this.minFovFactor,this.fov=Ep(this.fov,this.minFov,this.maxFov)}set fovMultiplier(e){this.fovMultiplier_=e,this.fov=this.defaultFov*this.fovMultiplier_,this.minFov=this.fov*this.minFovFactor,this.maxFov=this.fov*this.maxFovFactor}reset(e,t,n,i,r){i||(this.fov=this.defaultFov*this.fovMultiplier_,this.minFov=this.fov*this.minFovFactor,this.maxFov=this.fov*this.maxFovFactor,this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*Zt)/this.camera.aspect)*$t:this.fov,this.camera.updateProjectionMatrix()),r?mp.copy(this.target).sub(this.panSphereCenter).divideScalar(this.panSphereRadius):mp.set(0,0,0),this.panSphereCenter.set(e.x,e.y,e.z);const a=t/Math.tan(this.defaultFov/2*Zt);this.panSphereRadius=Math.min(t,a-t),mp.multiplyScalar(this.panSphereRadius);const s=e.clone().addScaledVector(n,a).add(mp);this.camera.position.set(s.x,s.y,s.z),this.target.set(e.x,e.y,e.z).add(mp),this.camera.lookAt(this.target),mp.copy(this.camera.position).sub(this.target),mp.applyQuaternion(this.quat),this.spherical.setFromVector3(mp),this.goalSpherical.copy(this.spherical),this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.lastTargetPosition.copy(this.target),this.lastFov=this.fov,this.userInteracted=!1}hasUserInteracted(){return this.userInteracted}update(e){this.spherical.theta+=(this.goalSpherical.theta-this.spherical.theta)*Math.min(.03*e,1),this.spherical.phi+=(this.goalSpherical.phi-this.spherical.phi)*Math.min(.03*e,1),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this.panOffset,this.dampingFactor):this.target.add(this.panOffset),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),mp.setFromSpherical(this.spherical),mp.applyQuaternion(this.quatInverse),this.camera.position.copy(this.target).add(mp),this.camera.lookAt(this.target),this.fov=Math.pow(Math.sqrt(this.fov)+this.fovDelta,2),this.fov=Ep(this.fov,this.minFov,this.maxFov),this.fovDelta=0,!0===this.enableDamping?this.panOffset.multiplyScalar(1-this.dampingFactor):this.panOffset.set(0,0,0);let t=!1;const{aspect:n}=this.camera,i=this.element.clientWidth/this.element.clientHeight;i!==n&&(this.camera.aspect=i,t=!0);const r=Math.abs(this.lastFov-this.fov)>fp;return(t||r)&&(this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*Zt)/this.camera.aspect)*$t:this.fov),this.camera.updateProjectionMatrix(),(this.lastPosition.distanceToSquared(this.camera.position)>fp||8*(1-this.lastQuaternion.dot(this.camera.quaternion))>fp||this.lastTargetPosition.distanceToSquared(this.target)>0||r)&&(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.lastTargetPosition.copy(this.target),this.lastFov=this.fov,t=!0),this.userInteracted=!1,t}getPose(e){return e.copy(this.camera.position),e.sub(this.target),e.normalize(),e}getTheta(){const e=this.camera.position;return mp.copy(e).sub(this.target),mp.applyQuaternion(this.quat),this.spherical.setFromVector3(mp),this.spherical.theta}set(e,t,n){return null!=e&&this.setTheta(e),null!=t&&this.setPhi(t),null!=n&&this.setFovRadians(n),null!=e||null!=t||null!=n}setTheta(e){const t=this.camera.position;mp.copy(t).sub(this.target),mp.applyQuaternion(this.quat),this.spherical.setFromVector3(mp),this.spherical.theta=e,this.spherical.makeSafe(),this.goalSpherical.copy(this.spherical),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),mp.setFromSpherical(this.spherical),mp.applyQuaternion(this.quatInverse),t.copy(this.target).add(mp),this.camera.lookAt(this.target),this.lastPosition.copy(t),this.lastQuaternion.copy(this.camera.quaternion),this.camera.updateProjectionMatrix()}setPhi(e){const t=this.camera.position;mp.copy(t).sub(this.target),mp.applyQuaternion(this.quat),this.spherical.setFromVector3(mp),this.spherical.phi=e,this.spherical.makeSafe(),this.goalSpherical.copy(this.spherical),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),mp.setFromSpherical(this.spherical),mp.applyQuaternion(this.quatInverse),t.copy(this.target).add(mp),this.camera.lookAt(this.target),this.lastPosition.copy(t),this.lastQuaternion.copy(this.camera.quaternion),this.camera.updateProjectionMatrix()}setFovRadians(e){this.fov=e*this.fovMultiplier_*$t,this.fov=Ep(this.fov,this.minFov,this.maxFov),this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*Zt)/this.camera.aspect)*$t:this.fov,this.lastFov=this.fov}setInteractionEnabled(e){e?this.enableInteraction():this.disableInteraction()}enableInteraction(){if(!1===this.interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this.enableZoom_&&e.addEventListener("wheel",this.onWheel),this.enableKeyControls&&(e.tabIndex=1,e.addEventListener("keydown",this.onKeyDown)),e.addEventListener("touchmove",this.passiveTouchHandler,{passive:!1}),e.addEventListener("contextmenu",this.onContext),e.style.cursor="grab",this.interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this.interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.tabIndex=-1,e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("touchmove",this.passiveTouchHandler),e.removeEventListener("touchmove",this.disableScroll),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this.interactionEnabled=!1,this.updateTouchActionStyle()}}dispose(){this.disableInteraction(),this.pointers.length=0}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,.2);break;case"PageDown":this.userAdjustOrbit(0,0,-.2);break;case"ArrowUp":this.userAdjustOrbit(0,-gp,0);break;case"ArrowDown":this.userAdjustOrbit(0,gp,0);break;case"ArrowLeft":this.userAdjustOrbit(-gp,0,0);break;case"ArrowRight":this.userAdjustOrbit(gp,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.pan(0,10);break;case"ArrowDown":this.pan(0,-10);break;case"ArrowLeft":this.pan(10,0);break;case"ArrowRight":this.pan(-10,0);break;default:t=!1}return t}initializePan(){this.panInProgress=!0}pan(e,t){const n=this.element,i=this.camera.position;mp.copy(i).sub(this.target);let r=mp.length();r*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(2*e*r/n.clientHeight,this.camera.matrix),this.panUp(2*t*r/n.clientHeight,this.camera.matrix)}panLeft(e,t){mp.setFromMatrixColumn(t,0),mp.multiplyScalar(-e),this.panOffset.add(mp)}panUp(e,t){!0===this.screenSpacePanning?mp.setFromMatrixColumn(t,1):(mp.setFromMatrixColumn(t,0),mp.crossVectors(this.camera.up,mp)),mp.multiplyScalar(e),this.panOffset.add(mp)}handleSinglePointerMove(e,t){const n=this.pixelLengthToSphericalAngle(e),i=this.pixelLengthToSphericalAngle(t);this.userAdjustOrbit(n,i,0)}userAdjustOrbit(e,t,n){this.goalSpherical.theta+=.5*e*this.fovMultiplier_,this.goalSpherical.phi+=.5*t*this.fovMultiplier_,this.goalSpherical.makeSafe(),this.fovDelta+=n,this.userInteracted=!0}pixelLengthToSphericalAngle(e){return-2*Math.PI*e/Math.min(this.element.clientHeight,this.element.clientWidth)}updateTouchActionStyle(){const{style:e}=this.element;this.interactionEnabled?this.enableZoom_?e.touchAction=this.touchAction_:e.touchAction="manipulation":e.touchAction=""}}function Ep(e,t,n){return Math.max(t,Math.min(n,e))}function bp(e,t){const{clientX:n,clientY:i}=e,{clientX:r,clientY:a}=t,s=r-n,o=a-i;return Math.sqrt(s*s+o*o)}const Cp=new Map;let _p=null;function Ip(){Xu().setAnimationLoop(xp)}function xp(e){!function(){for(const e of Cp.values())e.prepareResize()}(),function(e){for(const t of Cp.values())t.update(e)}(e);let t=function(){let e=null;for(const t of Cp.values())if(t.needsRender){if(null!=e)return null;e=t}return e}();null!=_p&&t!==_p&&(_p.ensureBlittedMode(),t=null),_p=t,0!==function(){let e=0;for(const t of Cp.values())t.needsRender&&e++;return e}()&&(null!=t?(t.ensureDirectMode(),yp(),Zu(t.width,t.height),wp()):(function(){for(const e of Cp.values())e.needsRender&&e.ensureBlittedMode()}(),yp(),Zu(function(){let e=0;for(const t of Cp.values())t.needsRender&&(e=Math.max(e,t.width));return e}(),function(){let e=0;for(const t of Cp.values())t.needsRender&&(e=Math.max(e,t.height));return e}()),wp()))}function yp(){for(const e of Cp.values())e.commitResize()}function wp(){for(const e of Cp.values())e.render()}function Mp(){let e=null,t=null;return{reset:()=>{e=Z([{time:0,value:0,interpolation:lp},{time:sp,value:1,interpolation:lp},{time:2300,value:0,interpolation:lp},{time:4300,value:0,interpolation:lp}]),t=Z([{time:0,value:0,interpolation:lp},{time:sp,value:0,interpolation:Ap},{time:800,value:-.05,interpolation:cp},{time:1800,value:.05,interpolation:hp},{time:2300,value:0,interpolation:lp},{time:4300,value:0,interpolation:lp}])},clear:()=>{e=null,t=null},update:n=>{null==e||e.update(n),null==t||t.update(n)},get visibility(){return null==e?void 0:e.get()},get position(){return null==t?void 0:t.get()}}}const Sp=2e3,Bp=2*Math.PI,Tp=Bp/12,Rp=Bp/60,Dp=Bp/60;function Qp(e){return Z([{time:0,value:0,interpolation:{type:"bezier",x1:.9,y1:0,x2:.6,y2:1}},{time:Sp,value:e,interpolation:{type:"hold"}}])}function Up(e,t,n){return-1*Tp*(e%12+t/60+n/3600)}function Lp(e,t){return-1*Rp*(e+t/60)}function Pp(e,t){return-1*Dp*(e+t/1e3)}function Np(e,t){let n,i,r,a,s,o,l,c,h,A,u,d,p,f=!1,g=null,m=new Tn(1,0,0),v=!1,E=!1,b=!1,C=!0,_=!1,I=!1,x=4,y=1,w=!0,M=!1,S=null,B=!1,T=!1,R=!1,D=0,Q=0,U=0,L=0,P=0;const N={get paused(){return C},get needsRender(){return!(!f||C)&&_},ensureDirectMode:()=>{e.isDirect()||(_=!0),e.ensureDirectMode()},ensureBlittedMode:()=>{e.isBlitted()||(_=!0),e.ensureBlittedMode()},update:t=>{if(M||!f||C||null==s||!function(e){const t=e.getBoundingClientRect();return t.bottom>0&&t.top<Math.max(document.documentElement.clientHeight,window.innerHeight)&&t.right>0&&t.left<Math.max(document.documentElement.clientWidth,window.innerWidth)}(e.element))return;let n=0!==P?t-P:0;P=t,0===L?_=!0:L<3&&(n=0),L++,B||(a.hasUserInteracted()?(B=!0,u.running=!1,d.clear(),I=!0):(u.update(n),d.update(n),u.running&&a.set(u.theta,u.phi,u.fov)&&(_=!0),null==d.visibility&&null==d.position||(I=!0))),a.update(n)&&(_=!0,T=!0),0!==n&&p.update()&&(_=!0)},render:()=>{if(!M&&f&&!C){if(_){if(Ju(n,e,!E&&!n.bloomEnabled||b?0:1,x,y),_=!1,!R&&null!=S&&T&&B){const e=performance.now();U>0&&(D++,Q+=e-U),U=e,Q>=2e3&&(R=!0,S({fps:D/Q*1e3}))}else U=0;T=!1,null==h||h()}I&&(t.visible=w&&!B,null!=d.visibility&&(t.opacity=`${d.visibility}`),null!=d.position&&(t.transform=`translateX(${d.position*Math.min(e.width,e.height)}px)`),I=!1)}},get width(){return e.element.clientWidth},get height(){return e.element.clientHeight},prepareResize:()=>{const{clientWidth:t,clientHeight:n}=e.element;e.clientWidth=t,e.clientHeight=n,e.dpr=Yu,e.sizeDirty&&(_=!0)},commitResize:()=>{e.commitResize()}},F=(e,t)=>{const n=l.min.clone().add(l.max).divideScalar(2),i=Math.sqrt(function(e,t){let n=0;const i=new Tn;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{const{geometry:r}=e;if(void 0!==r){const{position:a}=r.attributes;if(void 0!==a)for(let r=0,s=a.count;r<s;r++)e.isMesh?e.getVertexPosition(r,i):i.fromBufferAttribute(a,r),e.isSkinnedMesh||i.applyMatrix4(e.matrixWorld),n=t(n,i)}}),n}(e,(e,t)=>Math.max(e,n.distanceToSquared(t))));a.reset(n,i,t?a.getPose(new Tn):m,t,t),null!=u&&(u.reset(a.getTheta()),a.set(u.theta,u.phi,u.fov))},O={init:()=>{f||(function(e,t){Cp.set(e,t),1===Cp.size&&(Ku(),ap||(np=new wo,np.userData.darkness={value:1},np.onBeforeCompile=e=>{e.uniforms.darkness=np.userData.darkness;const t=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );");e.fragmentShader=`uniform float darkness;\n${t}`},np.depthTest=!1,np.depthWrite=!1,ip=new kr(ep),ip.depthTest=!1,rp=new kr(tp),rp.depthTest=!1,ap=!0))}(e.element,N),i=new Xo,r=new Wr(25,1,.5),a=new vp(r,e.element),a.setInteractionEnabled(w),n=new $d(i,r),c=function(e){let t,n,i,r,a,s,o,l,c=!1;function h(e){o.visible=!0,ip.uniforms.tDiffuse.value=t.texture,ip.uniforms.h.value=1*e/256,o.material=ip;const i=Xu();i.setRenderTarget(n),i.render(o,l),rp.uniforms.tDiffuse.value=n.texture,rp.uniforms.v.value=1*e/256,o.material=rp,i.setRenderTarget(t),i.render(o,l),o.visible=!1}return{init:()=>{c||(t=new wn(512,512),t.texture.generateMipmaps=!1,n=new wn(512,512),n.texture.generateMipmaps=!1,i=new Qo,i.position.y=-.7,r=new aa(45,45).rotateX(Math.PI/2),a=new $i({map:t.texture,opacity:.5,transparent:!0,depthWrite:!1,userData:{[Vd]:!0,[Wd]:!0}}),s=new Qr(r,a),s.renderOrder=1,s.scale.y=-1,i.add(s),o=new Qr(r),o.visible=!1,i.add(o),l=new va(-22.5,22.5,22.5,-22.5,0,3),l.rotation.x=Math.PI/2,i.add(l),c=!0)},destroy:()=>{c&&(l=null,o.clear(),o=null,s.clear(),s=null,rd(a),a=null,r.dispose(),r=null,i.clear(),i=null,n.dispose(),n=null,t.dispose(),t=null,c=!1)},get group(){return i},render:()=>{const n=e.background;e.background=null,e.overrideMaterial=np;const i=Xu(),r=i.getClearAlpha();i.setClearAlpha(0),i.setRenderTarget(t),i.render(e,l),e.overrideMaterial=null,h(1.5),h(.4*1.5),i.setRenderTarget(null),i.setClearAlpha(r),e.background=n}}}(i),c.init(),u=up(),d=Mp(),p=function(){let e,t,n,i,r=!1,a=null;return{clear:()=>{r=!1,e=void 0,t=void 0,n=void 0,a=null},reset:i=>{r=!0,e=i.getObjectByName("hours"),t=i.getObjectByName("minutes"),n=i.getObjectByName("seconds"),a=function(e,t,n){let i,r,a,s,o=!1,l=!1;return{update:c=>{if(!o){i=new Date(c),i.setMilliseconds(i.getMilliseconds()+Sp);const e=i.getHours(),t=i.getMinutes(),n=i.getSeconds(),l=i.getMilliseconds();r=Qp(Up(e,t,n)),a=Qp(Lp(t,n)),s=Qp(Pp(n,l)),o=!0}if(l)return;const h=i.getTime()-c.getTime(),A=Sp-h;h<=0?l=!0:(null!=e&&(r.seek(A),e.rotation.y=r.get()),null!=t&&(a.seek(A),t.rotation.y=a.get()),null!=n&&(s.seek(A),n.rotation.y=s.get()))},get done(){return l}}}(e,t,n)},update:()=>{if(!r)return!1;const s=new Date;if(null==i&&(i=new Date),null!=a){if(a.update(s),!a.done)return i=s,!0;a=null}if(Math.abs(s.getTime()-i.getTime())<125)return!1;const o=s.getHours(),l=s.getMinutes(),c=s.getSeconds(),h=s.getMilliseconds();return null!=e&&(e.rotation.y=Up(o,l,c)),null!=t&&(t.rotation.y=Lp(l,c)),null!=n&&(n.rotation.y=Pp(c,h)),i=s,!0}}}(),f=!0)},destroy:()=>{var t;f&&(null===(t=i.environment)||void 0===t||t.dispose(),i.environment=null,p=null,d=null,u=null,c.destroy(),c=null,n.dispose(),n=null,null!=A&&a.removeEventListener("change",A),A=null,a.dispose(),a=null,r=null,ld(i),i=null,function(e){Cp.delete(e),0===Cp.size&&(ap&&(rd(rp),rp=null,rd(ip),ip=null,rd(np),np=null,ap=!1),_p=null,Wu&&(zu.dispose(),zu=null,Vu=null,qu=1,ju=1,Yu=1,Wu=!1))}(e.element),f=!1)},set gltfScene(e){s=e,ld(i),null!=s&&(i.add(s),this.isDiamondScene&&$u(s,o),l=(new Qn).setFromObject(s),c.group.position.y=l.min.y-0,i.add(c.group),c.render(),E=function(e){let t=!1;return e.traverse(e=>{if(!t&&e instanceof Qr){const n=e.material;Array.isArray(n)?n.forEach(e=>{e.transmission>0&&(t=!0)}):n.transmission>0&&(t=!0)}}),t}(i),F(s,v&&B),u.reset(a.getTheta()),d.reset(),p.clear(),"Watches"===g&&p.reset(s),C||Ip()),L=0,_=!0},get isDiamondScene(){var e;return!!(null===(e=null==s?void 0:s.userData)||void 0===e?void 0:e.isDiamondScene)},set environment(e){var t;null===(t=i.environment)||void 0===t||t.dispose(),i.environment=e},set diamondEnvironment(e){o=e,this.isDiamondScene&&null!=s&&$u(s,e)},set environmentRotation(e){i.environmentRotation.y=e*Math.PI/180,_=!0},updateOnce:e=>{f&&!C&&(B||(u.update(e),u.running&&a.set(u.theta,u.phi,u.fov)&&(_=!0)),0!==e&&p.update()&&(_=!0))},renderOnce:()=>{N.prepareResize(),N.ensureBlittedMode(),N.commitResize(),Zu(N.width,N.height),B||a.set(u.theta,u.phi,u.fov),Ju(n,e,!E&&!n.bloomEnabled||b?0:1,x,y),null==h||h()},get category(){return g},set category(e){g=e},set initialPose(e){m=e},set toneMapping(e){const t={ACES:4,Linear:1,Neutral:7};null!=t[e]&&(x=t[e]),_=!0},set toneMappingExposure(e){y=e,_=!0},set paused(e){e?(C=!0,a.setInteractionEnabled(!1),function(){for(const{paused:e}of Cp.values())if(!e)return!1;return!0}()&&Xu().setAnimationLoop(null),t.opacity="0",t.visible=!1):(C=!1,a.setInteractionEnabled(w),null!=s&&(F(s,!1),_=!0,Ip()),P=0)},set interactive(e){w=e,a.setInteractionEnabled(e)},set touchAction(e){a.touchAction=e},set zoomEnabled(e){a.enableZoom=e},set minZoom(e){a.minZoom=e},set maxZoom(e){a.maxZoom=e},set preserveCameraOnReload(e){v=e},set forcedTransparency(e){b=e,_=!0},set defaultFov(e){a.defaultFov=e},set fovMultiplier(e){a.fovMultiplier=e,_=!0},set bloomEnabled(e){n.bloomEnabled=e,_=!0},set bloomStrength(e){n.bloomStrength=e,_=!0},set bloomRadius(e){n.bloomRadius=e,_=!0},set bloomThreshold(e){n.bloomThreshold=e,_=!0},set nonLiveRendering(e){M=e},set onRendered(e){h=e},set onInteracted(e){null!=A&&a.removeEventListener("change",A),A=e,null!=e&&a.addEventListener("change",e)},set onInteractionPerf(e){S=e},setAnimationConfig:e=>{u.set(e),null!=s&&F(s,!0),u.custom||(u.reset(a.getTheta()),d.reset()),_=!0}};return O}function Fp(e){return t=>k(this,void 0,void 0,function*(){try{yield t()}catch(t){e(t)}})}const Op={initialized:!1,paused:!1,posterUrl:null,glbUrl:null,envUrl:null,diamondEnvUrl:null,envRotation:null,toneMapping:null,toneMappingExposure:null,bloomEnabled:null,bloomStrength:null,bloomRadius:null,bloomThreshold:null,category:null,glbLocal:!1,interactive:!1,touchAction:null,zoomEnabled:!1,minZoom:null,maxZoom:null,preserveCameraOnReload:!1,alwaysTransparentBackground:!1,defaultFov:null,fovMultiplier:null,defaultCameraPositions:null,interactionPromptUrl:null,interactionPromptSize:null,nonLiveRendering:null,baseUrl:null,downloadCacheEnabled:!1,onModelLoaded:null,onRendered:null,onInteracted:null,onInteractionPerf:null,animation:null,thetaAnimation:null,phiAnimation:null,fovAnimation:null};function kp(e,t){const n=e,i=t,r=Np(i.canvasWrapper,i.prompt),a=function(){const e=Object.assign({},Xc);return{set vectors(t){for(const i of Object.keys(e)){if(!Yc(i))continue;const r=null==t?void 0:t[i];e[i]=null!=r?new Tn((n=r)[0],n[1],n[2]):Xc[i]}var n},getVector:t=>{var n;return(null==t?e.Glasses:null!==(n=e[t])&&void 0!==n?n:e.Glasses).normalize()}}}();let s=()=>{};const o=[],l=new wh;let c,h,A,u,d,p,f,g,m,v,E,b,C,_,I,x;l.setOnProgress(e=>{i.loading.progress=e,e>0&&(i.loading.visible=!0)});const y=function(){const e=Object.keys(Op).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:0}),{});return t=>{const n=++e[t];return()=>n!==e[t]}}(),w=function(){const e=Object.keys(Op).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:!1}),{});return{lock:t=>{e[t]=!0},unlock:t=>{e[t]=!1},anyLocked:()=>Object.values(e).some(e=>e),locks_:e}}(),M=function(e,t){return n=>{t.length>0?(t.forEach(e=>e.reject(n)),t.length=0):e.onError?e.onError(n):console.error(n)}}(n,o),S=function(e,t){return(n,i)=>k(this,void 0,void 0,function*(){const r=Fp(t),a=function(e,t){const n=e(t);return e=>k(this,void 0,void 0,function*(){yield e(n)})}(e,n);yield r(()=>a(i))})}(y,M),B=function(e,t,n,i){return(r,a)=>k(this,void 0,void 0,function*(){const s=function(e,t){return n=>k(this,void 0,void 0,function*(){e.lock(t),yield n(),e.unlock(t)})}(e,r),o=Fp(i),l=function(e,t,n,i){const r=t(i);return t=>k(this,void 0,void 0,function*(){yield Promise.resolve(),r()||(yield t(r))&&(e.unlock(i),e.anyLocked()||n())})}(e,t,n,r);yield s(()=>o(()=>l(a)))})}(w,y,()=>{void 0!==E&&(r.category=E,r.initialPose=a.getVector(null!=E?E:Kc)),void 0!==c&&(r.gltfScene=c),void 0!==h&&(r.environment=h),void 0!==A&&(r.diamondEnvironment=A),void 0!==u&&(r.environmentRotation=null!=u?u:0),void 0!==f&&(r.bloomEnabled=null!=f&&f),void 0!==g&&(r.bloomStrength=null!=g?g:.25),void 0!==m&&(r.bloomRadius=null!=m?m:0),void 0!==v&&(r.bloomThreshold=null!=v?v:2),null==s||s(),void 0!==x&&r.setAnimationConfig(x),void 0!==d&&(r.toneMapping=null!=d?d:"Neutral"),void 0!==p&&(r.toneMappingExposure=null!=p?p:1),void 0!==b&&(r.forcedTransparency=b),void 0!==C&&(r.onRendered=C),void 0!==_&&(r.onInteracted=_),void 0!==I&&(r.onInteractionPerf=I),r.renderOnce(),i.canvasVisible=!0,i.posterVisible=!1,i.loading.visible=!1,o.forEach(e=>e.resolve()),o.length=0,c=void 0,h=void 0,A=void 0,d=void 0,p=void 0,E=void 0,b=void 0,C=void 0,_=void 0,I=void 0},M);return n.onInitializedChange=e=>S("initialized",t=>k(this,void 0,void 0,function*(){e?(r.init(),r.paused=n.paused):r.destroy()})),n.onPausedChange=e=>S("paused",t=>k(this,void 0,void 0,function*(){r.paused=e})),n.onPosterUrlChange=e=>S("posterUrl",t=>k(this,void 0,void 0,function*(){i.loadPoster(e),i.posterVisible=w.anyLocked(),i.canvasVisible=!w.anyLocked()})),n.onGlbUrlChange=t=>B("glbUrl",r=>k(this,void 0,void 0,function*(){if(r()||!n.initialized)return!1;if(null!=t)if(id(),"string"==typeof t){null!=n.posterUrl&&(i.posterVisible=!0,i.canvasVisible=!1);const a=255,s=Gp(e.glbLocal)?new Uint8Array(yield Eh(t,l,n.downloadCacheEnabled)):yield bh(t,(new Date).getTime()+a,Math.random()*a,l,n.downloadCacheEnabled);if(r()||!n.initialized)return!1;const o=yield nd(s);if(r()||!n.initialized)return!1;c=o.scene}else{const i=255,a=Gp(e.glbLocal,"left")?Eh(t.left,l,n.downloadCacheEnabled).then(e=>new Uint8Array(e)):bh(t.left,(new Date).getTime()+i,Math.random()*i,l,n.downloadCacheEnabled),s=Gp(e.glbLocal,"right")?Eh(t.right,l,n.downloadCacheEnabled).then(e=>new Uint8Array(e)):bh(t.right,(new Date).getTime()+i,Math.random()*i,l,n.downloadCacheEnabled),o=yield a;if(r()||!n.initialized)return!1;const h=yield s;if(r()||!n.initialized)return!1;const A=(yield nd(o)).scene;if(r()||!n.initialized)return!1;const u=(yield nd(h)).scene;if(r()||!n.initialized)return!1;c=function(e,t){const n=new Qo,i=od(e).getSize(new Tn),r=od(t).getSize(new Tn),a=.075*Math.max(i.z,r.z),s=ad(e,a,!1,void 0,new Bn(0,0,0,1));e.position.set(s.x,s.y,s.z);const o=ad(t,a,!0,void 0,new Bn(0,0,0,1));return t.position.set(o.x,o.y,o.z),n.add(e,t),n}(A,u)}else c=null;return!0})),n.onEnvUrlChange=e=>B("envUrl",t=>k(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null!=e){const i=yield Eh(e,l,n.downloadCacheEnabled);if(t()||!n.initialized)return!1;h=aA(i)}else h=null;return!0})),n.onDiamondEnvUrlChange=e=>B("diamondEnvUrl",t=>k(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null!=e){const i=yield Eh(e,l,n.downloadCacheEnabled);if(t()||!n.initialized)return!1;A=aA(i)}else A=null;return!0})),n.onEnvRotationChange=e=>B("envRotation",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(u=e,0))})),n.onToneMappingChange=e=>B("toneMapping",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(d=e,0))})),n.onToneMappingExposureChange=e=>B("toneMappingExposure",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(p=e,0))})),n.onBloomEnabledChange=e=>B("bloomEnabled",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(f=e,0))})),n.onBloomStrengthChange=e=>B("bloomStrength",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(g=e,0))})),n.onBloomRadiusChange=e=>B("bloomRadius",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(m=e,0))})),n.onBloomThresholdChange=e=>B("bloomThreshold",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(v=e,0))})),n.onCategoryChange=e=>B("category",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(E=e,0))})),n.onInteractiveChange=e=>S("interactive",t=>k(this,void 0,void 0,function*(){r.interactive=e})),n.onTouchActionChange=e=>S("touchAction",t=>k(this,void 0,void 0,function*(){r.touchAction=e})),n.onZoomEnabledChange=e=>S("zoomEnabled",t=>k(this,void 0,void 0,function*(){r.zoomEnabled=e})),n.onMinZoomChange=e=>S("minZoom",t=>k(this,void 0,void 0,function*(){r.minZoom=e})),n.onMaxZoomChange=e=>S("maxZoom",t=>k(this,void 0,void 0,function*(){r.maxZoom=e})),n.onPreserveCameraOnReloadChange=e=>S("preserveCameraOnReload",t=>k(this,void 0,void 0,function*(){r.preserveCameraOnReload=e})),n.onAlwaysTransparentBackgroundChange=e=>B("alwaysTransparentBackground",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(b=e,0))})),n.onDefaultFovChange=e=>S("defaultFov",t=>k(this,void 0,void 0,function*(){r.defaultFov=null!=e?e:16})),n.onFovMultiplierChange=e=>S("fovMultiplier",t=>k(this,void 0,void 0,function*(){r.fovMultiplier=null!=e?e:1})),n.onDefaultCameraPositionsChange=e=>S("defaultCameraPositions",t=>k(this,void 0,void 0,function*(){var t;a.vectors=e,r.initialPose=a.getVector(null!==(t=r.category)&&void 0!==t?t:Kc)})),n.onInteractionPromptUrlChange=e=>S("interactionPromptUrl",t=>k(this,void 0,void 0,function*(){i.prompt.imageUrl=e})),n.onInteractionPromptSizeChange=e=>S("interactionPromptSize",t=>k(this,void 0,void 0,function*(){i.prompt.imageSize=e})),n.onNonLiveRenderingChange=e=>S("nonLiveRendering",t=>k(this,void 0,void 0,function*(){r.nonLiveRendering=!!e})),n.onBaseUrlChange=e=>S("baseUrl",t=>k(this,void 0,void 0,function*(){Ou(e)})),n.onOnModelLoadedChange=e=>S("onModelLoaded",t=>k(this,void 0,void 0,function*(){s=e})),n.onOnRenderedChange=e=>B("onRendered",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(C=e,0))})),n.onOnInteractedChange=e=>B("onInteracted",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(_=e,0))})),n.onOnInteractionPerfChange=e=>B("onInteractionPerf",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(I=e,0))})),n.onAnimationChange=e=>B("animation",t=>k(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null==e)return x={theta:null,phi:null,fov:null},!0;const i=se(e);return x={theta:null!=i.theta?Z(i.theta):null,phi:null!=i.phi?Z(i.phi):null,fov:null!=i.fov?Z(i.fov):null},!0})),{render:e=>{r.updateOnce(e),r.renderOnce()},flushChanges:()=>new Promise((e,t)=>{w.anyLocked()?o.push({resolve:e,reject:t}):e()})}}function Gp(e,t){if(null==t){if("boolean"==typeof e)return e;const t=e.left||e.right;return console.warn(`Expected 'glbLocal' to be boolean, but got object (treating as ${t}).`),t}return"boolean"==typeof e?e:e[t]}var Hp,zp,Vp,Wp,qp,jp,Yp,Xp,Kp,Jp,Zp,$p;!function(e){e[e.Empty=0]="Empty",e[e.Direct=1]="Direct",e[e.Blitted=2]="Blitted"}($p||($p={}));class ef{constructor(){Hp.add(this),zp.set(this,document.createElement("div")),Vp.set(this,$p.Empty),Wp.set(this,null),qp.set(this,1),jp.set(this,1),Yp.set(this,1),Xp.set(this,1),Kp.set(this,1),Jp.set(this,!1);const{style:e}=G(this,zp,"f");e.position="absolute",e.top="0",e.left="0",e.width="100%",e.height="100%",e.pointerEvents="auto"}get element(){return G(this,zp,"f")}isDirect(){return G(this,Vp,"f")===$p.Direct}ensureDirectMode(){if(G(this,Vp,"f")===$p.Direct)return;H(this,Vp,$p.Direct);const e=Xu().domElement;document.contains(e)&&console.warn("[ShopAR 3D] Direct rendering not working properly!"),G(this,zp,"f").replaceChildren(e),H(this,Wp,null),H(this,Jp,!0)}isBlitted(){return G(this,Vp,"f")===$p.Blitted}ensureBlittedMode(){G(this,Vp,"f")!==$p.Blitted&&(H(this,Vp,$p.Blitted),H(this,Wp,function(){const e=document.createElement("canvas"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",e}()),G(this,zp,"f").replaceChildren(G(this,Wp,"f")),H(this,Jp,!0))}set visible(e){G(this,zp,"f").style.visibility=e?"visible":"hidden"}get width(){return G(this,Yp,"f")}get height(){return G(this,Xp,"f")}set clientWidth(e){e!==G(this,qp,"f")&&H(this,Jp,!0),H(this,qp,e)}set clientHeight(e){e!==G(this,jp,"f")&&H(this,Jp,!0),H(this,jp,e)}get dpr(){return G(this,Kp,"f")}set dpr(e){e!==this.dpr&&H(this,Jp,!0),H(this,Kp,e)}get sizeDirty(){return G(this,Jp,"f")}commitResize(){if(!G(this,Jp,"f"))return;H(this,Jp,!1);const e=G(this,Hp,"m",Zp).call(this);null!=e&&(H(this,Yp,Math.ceil(G(this,qp,"f")*G(this,Kp,"f"))),H(this,Xp,Math.ceil(G(this,jp,"f")*G(this,Kp,"f"))),e.width=G(this,Yp,"f"),e.height=G(this,Xp,"f"))}get context2d(){var e,t;return null!==(t=null===(e=G(this,Wp,"f"))||void 0===e?void 0:e.getContext("2d"))&&void 0!==t?t:null}}function tf(e){return`var(${e.var}, ${e.default})`}zp=new WeakMap,Vp=new WeakMap,Wp=new WeakMap,qp=new WeakMap,jp=new WeakMap,Yp=new WeakMap,Xp=new WeakMap,Kp=new WeakMap,Jp=new WeakMap,Hp=new WeakSet,Zp=function(){return G(this,Vp,"f")===$p.Direct?Xu().domElement:G(this,Vp,"f")===$p.Blitted?G(this,Wp,"f"):null};const nf="--shopar-3d",rf={display:{var:`${nf}-loading-display`,default:"block"},top:{var:`${nf}-loading-top`,default:"0"},bottom:{var:`${nf}-loading-bottom`,default:"auto"},height:{var:`${nf}-loading-height`,default:"0.375rem"},radius:{var:`${nf}-loading-radius`,default:"calc(infinity * 1px)"},fg:{var:`${nf}-loading-fg`,default:"linear-gradient(90deg, #773cd8, #5fb9ec)"},bg:{var:`${nf}-loading-bg`,default:"#e5e7eb"}},af="width 0.05s ease-out";const sf="data:image/svg+xml,%3csvg width='869' height='1251' viewBox='0 0 869 1251' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_894_1533)'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M303.44 353.132C304.829 314.64 330.051 282.714 363.992 272.987C371.106 271.049 378.436 270.01 385.808 269.895C391.367 269.895 396.717 270.486 401.893 271.424C439.69 278.372 467.899 309.36 467.899 346.462V654.953H511.671C613.911 606.665 685.371 500.36 685.371 376.165C685.571 306.213 662.333 238.211 619.365 183.01L604.427 165.64C577.851 136.528 545.96 112.766 510.212 96.1603C473.492 79.1377 432.881 69.4105 390.012 69.4105C347.143 69.4105 306.636 79.0683 269.812 96.1603C234.029 112.766 202.173 136.528 175.666 165.64L160.728 183.01C117.761 238.211 94.5225 306.213 94.722 376.165C94.714 391.336 95.8054 406.487 97.9875 421.5C99.0297 428.796 101.045 435.744 102.504 442.935L107.228 464.613C110.112 474.548 114.037 484.067 117.824 493.516L122.132 505.085C127.341 516.473 133.246 527.53 139.814 538.192L142.073 542.43C171.755 590.029 214.112 628.416 264.392 653.286L302.954 671.941V353.097L303.44 353.132Z' fill='white' fill-opacity='0.5'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M797.001 876.074L701.118 1144.96C695.143 1161.81 677.634 1172.75 657.589 1172.75H425.283C369.49 1172.75 317.867 1149.13 287.018 1109.53C231.711 1038.38 160.321 976.75 74.7561 926.447C71.4558 924.536 69.5451 921.687 69.4757 918.456C69.3367 914.982 71.0737 911.647 76.1805 908.139C95.6349 894.486 119.05 887.295 143.09 887.295C151.152 887.279 159.195 888.083 167.095 889.692L338.085 924.223V346.427C338.085 323.395 359.45 304.635 385.679 304.635C411.908 304.635 433.377 323.395 433.377 346.427V689.728H535.964C545.448 689.728 554.481 692.264 562.263 697.024L779.631 831.606C780.569 832.197 781.194 833.065 782.063 833.691C796.306 843.974 802.42 860.441 796.862 876.074M142.499 542.431C141.665 541.041 141.04 539.547 140.241 538.192C133.666 527.534 127.76 516.477 122.558 505.085C120.891 501.368 119.779 497.338 118.251 493.517L107.655 464.613C105.64 457.595 104.528 450.161 102.93 442.935L98.4141 421.501C96.2308 406.488 95.1394 391.336 95.1485 376.165C95.1485 302.968 119.953 235.815 161.155 183.011L176.093 165.641C202.634 136.459 234.525 112.731 270.238 96.1605C306.993 79.1379 347.569 69.4107 390.439 69.4107C433.308 69.4107 473.884 79.1379 510.639 96.1605C546.421 112.731 578.278 136.459 604.854 165.641L619.723 183.011C662.719 238.184 685.972 306.182 685.763 376.13C685.763 500.395 614.338 606.665 512.063 654.953H468.291V346.393C468.291 309.325 439.735 278.302 402.285 271.354C397.074 270.382 391.724 269.826 386.2 269.826C378.557 269.826 371.366 271.111 364.384 272.952C330.443 282.68 305.221 314.571 303.832 353.063V671.907L265.27 653.251C214.758 628.725 172.376 590.58 142.499 542.431ZM798.043 802.147L580.71 667.564C577.166 665.375 573.136 664.16 569.245 662.562C662.453 600.03 720.503 493.899 720.503 376.2C720.503 359.316 719.218 342.71 716.89 326.521C709.659 275.243 691.021 226.238 662.348 183.115L652.1 168.941L649.807 165.745C639.725 152.491 628.708 139.976 616.839 128.295C604.958 116.692 592.243 105.957 578.834 96.2647C538.709 67.2916 492.261 47.2118 441.958 38.9437L416.528 35.8866L390.543 34.8444C373.298 34.8447 356.082 36.2272 339.058 38.9785C288.789 47.2466 242.272 67.3263 202.182 96.2995C192.322 103.7 182.893 111.657 173.939 120.131C163.518 129.655 153.713 139.831 144.584 150.598L131.209 165.779L118.702 183.149L108.697 199.408L94.1758 226.436L92.7862 229.562C72.1854 274.029 60.478 323.708 60.478 376.234C60.478 509.358 136.281 631.295 253.632 686.741L303.554 710.364V882.188L173.765 855.994C163.608 853.965 153.273 852.964 142.916 853.006C142.325 853.006 141.735 853.11 141.179 853.11C132.425 853.249 123.705 854.257 115.124 855.89C112.364 856.472 109.619 857.121 106.891 857.835C100.186 859.433 93.62 861.552 87.1583 864.088C84.5528 865.13 81.9473 866.068 79.3418 867.562C70.6568 871.523 62.1803 876.039 54.2248 881.632C47.9431 885.96 42.8502 891.798 39.4144 898.609C35.9785 905.42 34.3099 912.986 34.562 920.61C34.9201 928.091 37.1618 935.359 41.079 941.742C44.9961 948.125 50.4619 953.415 56.9693 957.122C139.025 1004.85 207.116 1063.53 259.677 1131.24C264.329 1137.24 269.365 1142.94 274.754 1148.3C312.482 1185.88 367.024 1207.81 425.04 1207.88H657.693C683.679 1207.84 707.372 1196.31 722.24 1177.58C727.173 1171.33 731.134 1164.38 733.913 1156.67L829.691 887.781C832.957 878.749 834.207 869.369 833.582 860.197C832.957 851.026 830.525 842.133 826.53 833.795C820.225 820.757 810.33 809.79 798.008 802.182' fill='black' fill-opacity='0.6'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M779.738 831.676L562.37 697.093C554.446 692.276 545.346 689.739 536.072 689.763H433.485V346.532C433.485 323.499 412.085 304.74 385.787 304.74C359.489 304.74 338.193 323.499 338.193 346.532V924.71L167.203 890.178C159.291 888.569 151.236 887.766 143.163 887.781C119.267 887.676 95.9182 894.929 76.2881 908.555C71.1813 912.099 69.4096 915.434 69.5485 918.908C69.6875 922.174 71.5635 925.022 74.8638 926.898C160.394 977.202 231.784 1038.76 287.125 1109.98C317.94 1149.58 369.563 1173.2 425.39 1173.2H657.662C677.707 1173.2 695.181 1161.88 701.191 1145.41L797.074 876.525C802.632 860.962 796.483 844.46 782.274 834.142C781.406 833.448 780.781 832.649 779.843 832.058L779.738 831.676Z' fill='white'/%3e%3cmask id='mask0_894_1533' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='869' height='1243'%3e%3cpath d='M0.0664062 0.0349731H868.462V1242.62H0.0664062V0.0349731Z' fill='white'/%3e%3c/mask%3e%3cg mask='url(%23mask0_894_1533)'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M833.58 860.197C834.209 869.559 832.897 878.95 829.724 887.781L733.911 1156.67C731.132 1164.31 727.172 1171.36 722.239 1177.58C707.405 1196.34 683.677 1207.81 657.727 1207.88H425.038C367.022 1207.81 312.481 1185.88 274.753 1148.3C269.403 1142.95 264.331 1137.25 259.676 1131.27C207.114 1063.57 139.024 1004.89 57.2458 956.809C43.8709 948.993 35.4985 935.34 34.8385 920.332C34.5864 912.708 36.255 905.143 39.6909 898.332C43.1267 891.521 48.2196 885.682 54.5013 881.354C62.4292 875.912 70.8363 871.202 79.6183 867.284L87.4348 863.81C93.8598 861.272 100.453 859.183 107.167 857.557L115.401 855.612C124.016 854.014 132.771 853.006 141.456 852.833C142.081 852.833 142.637 852.728 143.193 852.728C153.719 852.694 163.932 853.666 174.111 855.716L303.413 881.84V710.399L253.527 686.775C136.21 631.33 60.3724 509.393 60.3724 376.269C60.3724 323.812 72.045 274.134 92.6806 229.597C93.2017 228.555 93.5491 227.513 94.0702 226.47C98.4821 217.195 103.38 208.232 108.591 199.443C111.822 193.884 115.053 188.465 118.597 183.184C120.785 179.884 123.217 176.723 125.545 173.561L131.138 165.675C135.237 160.291 140.17 155.601 144.513 150.494C153.753 140.072 163.411 129.511 173.868 120.027C182.822 111.552 192.251 103.596 202.112 96.1953C242.202 67.2569 288.753 47.2119 339.022 38.8743C356.034 36.1219 373.239 34.7394 390.472 34.7402C399.145 34.7313 407.815 35.0906 416.457 35.8172C425.038 36.512 433.48 37.5542 441.922 38.8743C492.225 47.1424 538.707 67.2221 578.797 96.1953C592.242 105.923 604.922 116.622 616.803 128.226C628.681 139.898 639.699 152.413 649.771 165.675L652.064 168.871C655.607 173.492 659.116 178.182 662.312 183.045C690.997 226.166 709.647 275.171 716.889 326.452C719.182 342.676 720.467 359.281 720.467 376.13C720.467 493.829 662.451 600.307 569.244 662.492C573.065 664.09 577.13 665.271 580.708 667.495L798.041 802.077C810.895 810.068 820.449 821.184 826.528 833.343C830.523 841.681 832.955 850.644 833.58 859.746M857.794 818.231C848.588 799.124 834.275 783.248 816.315 772.166L631.394 657.628C709.732 586.863 755.207 484.971 755.207 375.748C755.207 299.667 733.078 226.227 691.285 163.348C686.908 156.817 682.253 150.494 677.389 144.171C654.982 114.712 628.684 88.5872 599.155 67.6043C537.561 23.5887 465.337 0.0349731 390.472 0.0349731C315.457 0.0670918 242.383 23.8817 181.754 68.0559C152.294 89.3863 125.961 115.163 103.485 144.658C98.7601 150.911 94.0354 157.268 89.6582 163.765C47.7965 226.679 25.6671 300.119 25.6671 376.2C25.6671 522.733 109.286 656.899 238.728 718.111L268.708 732.354V839.77L180.99 822.053C168.622 819.621 156.081 818.37 143.609 818.37C104.55 818.376 66.4474 830.462 34.5258 852.971C11.8406 868.952 -0.978479 894.729 0.133201 921.861C0.732449 935.148 4.66826 948.071 11.5776 959.437C18.4869 970.803 28.1472 980.245 39.6673 986.894C117.485 1032.68 182.31 1088.44 232.231 1152.67C276.004 1208.95 348.02 1242.65 425.038 1242.72H657.727C707.057 1242.68 750.83 1212.84 766.602 1168.45L862.484 899.558C871.933 873.26 870.266 844.53 857.829 818.787' fill='black' fill-opacity='0.05'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0_894_1533'%3e%3crect width='868.5' height='1250.64' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",of="2rem";function lf(e){const t=function(){const e=document.createElement("div"),{style:t}=e;return t.position="relative",t.width="100%",t.height="100%",t.pointerEvents="none",e}(),n=function(){const e=document.createElement("div");e.draggable=!1;const{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.objectFit="contain",t.visibility="hidden",t.backgroundSize="contain",t.backgroundRepeat="no-repeat",t.backgroundPosition="center",e}();t.appendChild(n);const i=new ef;t.appendChild(i.element);const r=function(){const e=function(){const e=document.createElement("div"),{style:t}=e;return t.display=tf(rf.display),t.opacity="0",t.transition="opacity 0.2s ease-out",t.position="absolute",t.top=tf(rf.top),t.bottom=tf(rf.bottom),t.left="0",t.width="100%",t.height=tf(rf.height),t.overflow="hidden",e}(),t=function(){const e=document.createElement("div"),{style:t}=e;return t.position="absolute",t.width="100%",t.height="100%",t.background=tf(rf.bg),e}(),n=function(){const e=document.createElement("div"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="0%",t.height="100%",t.background=tf(rf.fg),t.borderRadius=tf(rf.radius),t.transition=af,e}();t.appendChild(n),e.appendChild(t);let i=0;return{get container(){return e},set progress(e){e<i?(n.style.transition="none",n.style.width=100*e+"%",n.offsetWidth,n.style.transition=af):n.style.width=100*e+"%",i=e},set visible(t){e.style.opacity=t?"1":"0"}}}();t.appendChild(r.container);const a=function(){const e=function(){const e=document.createElement("div"),{style:t}=e;return t.visibility="hidden",t.position="absolute",t.width="100%",t.height="100%",t.display="flex",t.justifyContent="center",t.alignItems="center",e}(),t=function(){const e=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width",e),t.setAttribute("height",e),t}(of),{style:t}=e;return t.transition="opacity 0.3s",t.opacity="0",e}(),n=function(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","image");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t),n.setAttribute("width",e),n.setAttribute("height",e),n}(of,sf);return t.appendChild(n),e.appendChild(t),{get container(){return e},get svg(){return t},set imageUrl(e){n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",null!=e?e:sf)},set imageSize(e){const i=null!=e?e:of;t.setAttribute("width",i),t.setAttribute("height",i),n.setAttribute("width",i),n.setAttribute("height",i)},set visible(t){e.style.visibility=t?"visible":"hidden"},set opacity(e){t.style.opacity=e},set transform(e){t.style.transform=e}}}();return t.appendChild(a.container),{get root(){return t},get canvasWrapper(){return i},get loading(){return r},get prompt(){return a},set canvasVisible(e){i.visible=e},set posterVisible(e){n.style.visibility=e?"visible":"hidden"},loadPoster:e=>{n.style.backgroundImage=e?`url(${e})`:""}}}var cf,hf,Af,uf;class df extends HTMLElement{constructor(){super(),cf.add(this),hf.set(this,void 0),Af.set(this,void 0),H(this,hf,function(){let e,t,n,i,r,a,s,o,l,c,h,A,u,d,p,f,g,m,v,E,b,C,_,I,x,y,w,M,S,B,T,R,D,Q,U,L,P=()=>{},N=()=>{},F=()=>{},O=()=>{},k=()=>{},G=()=>{},H=()=>{},z=()=>{},V=()=>{},W=()=>{},q=()=>{},j=()=>{},Y=()=>{},X=()=>{},K=()=>{},J=()=>{},Z=()=>{},$=()=>{},ee=()=>{},te=()=>{},ne=()=>{},ie=()=>{},re=()=>{},ae=()=>{},se=()=>{},oe=()=>{},le=()=>{},ce=()=>{},he=()=>{},Ae=()=>{},ue=()=>{},de=()=>{},pe=()=>{},fe=()=>{},ge=()=>{},me=()=>{};function ve(){e=!1,t=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null,h=null,A=null,u=null,d=null,p=!1,f=!0,g=null,m=null,v=null,E=null,b=null,C=null,_=!0,I=null,x=null,y=!1,w=!1,M=null,S=null,B=null,T=null,R=null,D=null,Q=null,U=null,L=!1}return ve(),{get initialized(){return e},set initialized(t){const n=t!==e;e=t,t||ve(),n&&(null==P||P(e))},set onInitializedChange(e){P=e},get paused(){return t},set paused(e){const n=e!==t;t=e,n&&(null==N||N(t))},set onPausedChange(e){N=e},get posterUrl(){return n},set posterUrl(e){const t=e!==n;n=e,t&&(null==F||F(e))},set onPosterUrlChange(e){F=e},set glbUrl(e){const t=e!==i;i=e,t&&(null==O||O(i))},set onGlbUrlChange(e){O=e},set envUrl(e){const t=e!==r;r=e,t&&(null==k||k(r))},set onEnvUrlChange(e){k=e},set diamondEnvUrl(e){const t=e!==a;a=e,t&&(null==G||G(a))},set onDiamondEnvUrlChange(e){G=e},set envRotation(e){const t=e!==s;s=e,t&&(null==H||H(s))},set onEnvRotationChange(e){H=e},set toneMapping(e){const t=e!==o;o=e,t&&(null==z||z(o))},set onToneMappingChange(e){z=e},set toneMappingExposure(e){const t=e!==l;l=e,t&&(null==V||V(l))},set onToneMappingExposureChange(e){V=e},set bloomEnabled(e){const t=e!==c;c=e,t&&(null==W||W(c))},set onBloomEnabledChange(e){W=e},set bloomStrength(e){const t=e!==h;h=e,t&&(null==q||q(h))},set onBloomStrengthChange(e){q=e},set bloomRadius(e){const t=e!==A;A=e,t&&(null==j||j(A))},set onBloomRadiusChange(e){j=e},set bloomThreshold(e){const t=e!==u;u=e,t&&(null==Y||Y(u))},set onBloomThresholdChange(e){Y=e},set category(e){const t=e!==d;d=e,t&&(null==X||X(d))},set onCategoryChange(e){X=e},get glbLocal(){return p},set glbLocal(e){const t=e!==p;p=e,t&&(null==K||K(p))},set onGlbLocalChange(e){K=e},set interactive(e){const t=e!==f;f=e,t&&(null==J||J(f))},set onInteractiveChange(e){J=e},set onModelLoaded(e){const t=e!==g;g=e,t&&(null==Z||Z(g))},set onOnModelLoadedChange(e){Z=e},set onRendered(e){const t=e!==m;m=e,t&&(null==$||$(m))},set onOnRenderedChange(e){$=e},set onInteracted(e){const t=e!==v;v=e,t&&(null==ee||ee(v))},set onOnInteractedChange(e){ee=e},set onInteractionPerf(e){const t=e!==E;E=e,t&&(null==te||te(E))},set onOnInteractionPerfChange(e){te=e},get onError(){return b},set onError(e){const t=e!==b;b=e,t&&(null==ne||ne(b))},set onOnErrorChange(e){ne=e},set touchAction(e){const t=e!==C;C=e,t&&(null==ie||ie(C))},set onTouchActionChange(e){ie=e},set zoomEnabled(e){const t=e!==_;_=e,t&&(null==re||re(_))},set onZoomEnabledChange(e){re=e},set minZoom(e){const t=e!==I;I=e,t&&(null==ae||ae(I))},set onMinZoomChange(e){ae=e},set maxZoom(e){const t=e!==x;x=e,t&&(null==se||se(x))},set onMaxZoomChange(e){se=e},set preserveCameraOnReload(e){const t=e!==y;y=e,t&&(null==oe||oe(y))},set onPreserveCameraOnReloadChange(e){oe=e},set alwaysTransparentBackground(e){const t=e!==w;w=e,t&&(null==le||le(w))},set onAlwaysTransparentBackgroundChange(e){le=e},set defaultFov(e){const t=e!==M;M=e,t&&(null==ce||ce(M))},set onDefaultFovChange(e){ce=e},set fovMultiplier(e){const t=e!==S;S=e,t&&(null==he||he(S))},set onFovMultiplierChange(e){he=e},set defaultCameraPositions(e){const t=e!==B;B=e,t&&(null==Ae||Ae(B))},set onDefaultCameraPositionsChange(e){Ae=e},set interactionPromptUrl(e){const t=e!==T;T=e,t&&(null==ue||ue(T))},set onInteractionPromptUrlChange(e){ue=e},set interactionPromptSize(e){const t=e!==R;R=e,t&&(null==de||de(R))},set onInteractionPromptSizeChange(e){de=e},set animation(e){const t=e!==D;D=e,t&&(null==pe||pe(D))},set onAnimationChange(e){pe=e},set nonLiveRendering(e){const t=e!==Q;Q=e,t&&(null==fe||fe(Q))},set onNonLiveRenderingChange(e){fe=e},set baseUrl(e){const t=e!==U;U=e,t&&(null==ge||ge(U))},set onBaseUrlChange(e){ge=e},get downloadCacheEnabled(){return L},set downloadCacheEnabled(e){const t=e!==L;L=e,t&&(null==me||me(L))},set onDownloadCacheEnabledChange(e){me=e}}}());const e=lf(G(this,hf,"f"));H(this,Af,kp(G(this,hf,"f"),e)),this.attachShadow({mode:"open"}).appendChild(e.root)}connectedCallback(){G(this,hf,"f").initialized=!0}disconnectedCallback(){G(this,hf,"f").paused=!0,G(this,hf,"f").initialized=!1}attributeChangedCallback(e,t,n){var i,r;if(G(this,hf,"f").initialized)if("paused"===e)G(this,hf,"f").paused=pf(n);else if("poster-url"===e)G(this,hf,"f").posterUrl=n;else if("glb-url"===e)G(this,hf,"f").glbUrl=function(e){if(null==e?void 0:e.includes("|")){const[t,n]=e.split("|",2);return{left:t,right:n}}return e}(n);else if("env-url"===e)G(this,hf,"f").envUrl=n;else if("diamond-env-url"===e)G(this,hf,"f").diamondEnvUrl=n;else if("env-rotation"===e)G(this,hf,"f").envRotation=ff(n);else if("tone-mapping"===e)G(this,hf,"f").toneMapping=(r=i=n,qc.includes(r)?i:null);else if("tone-mapping-exposure"===e)G(this,hf,"f").toneMappingExposure=ff(n);else if("bloom-enabled"===e)G(this,hf,"f").bloomEnabled=pf(n);else if("bloom-strength"===e)G(this,hf,"f").bloomStrength=ff(n);else if("bloom-radius"===e)G(this,hf,"f").bloomRadius=ff(n);else if("bloom-threshold"===e)G(this,hf,"f").bloomThreshold=ff(n);else if("category"===e)G(this,hf,"f").category=function(e){return Yc(e)?e:null}(n);else if("glb-local"===e)G(this,hf,"f").glbLocal=function(e){if(null==e?void 0:e.includes("|")){const[t,n]=e.split("|",2);return{left:"true"===t,right:"true"===n}}return pf(e)}(n);else if("interactivity-disabled"===e)G(this,hf,"f").interactive=!pf(n);else if("touch-action"===e)G(this,hf,"f").touchAction=function(e){return function(e){return jc.includes(e)}(e)?e:null}(n);else if("zoom-disabled"===e)G(this,hf,"f").zoomEnabled=!pf(n);else if("min-zoom"===e)G(this,hf,"f").minZoom=ff(n);else if("max-zoom"===e)G(this,hf,"f").maxZoom=ff(n);else if("preserve-camera-on-reload"===e)G(this,hf,"f").preserveCameraOnReload=pf(n);else if("always-transparent-background"===e)G(this,hf,"f").alwaysTransparentBackground=pf(n);else if("default-fov"===e)G(this,hf,"f").defaultFov=ff(n);else if("fov-multiplier"===e)G(this,hf,"f").fovMultiplier=ff(n);else if("interaction-prompt-url"===e)G(this,hf,"f").interactionPromptUrl=n;else if("interaction-prompt-size"===e)G(this,hf,"f").interactionPromptSize=n;else if("non-live-rendering"===e)G(this,hf,"f").nonLiveRendering=pf(n);else if("base-url"===e)G(this,hf,"f").baseUrl=n;else{if("download-cache-enabled"!==e)throw new Error(`Unknown attribute: ${e} (changed from '${t}' to '${n}')`);G(this,hf,"f").downloadCacheEnabled=pf(n)}}set paused(e){G(this,cf,"m",uf).call(this,"paused",e?"":null)}set posterUrl(e){G(this,cf,"m",uf).call(this,"poster-url",e)}set glbUrl(e){G(this,cf,"m",uf).call(this,"glb-url","string"==typeof e||null==e?e:`${e.left}|${e.right}`)}set envUrl(e){G(this,cf,"m",uf).call(this,"env-url",e)}set diamondEnvUrl(e){G(this,cf,"m",uf).call(this,"diamond-env-url",e)}set envRotation(e){G(this,cf,"m",uf).call(this,"env-rotation",null!=e?`${e}`:null)}set toneMapping(e){G(this,cf,"m",uf).call(this,"tone-mapping",e)}set toneMappingExposure(e){G(this,cf,"m",uf).call(this,"tone-mapping-exposure",`${e}`)}set bloomEnabled(e){G(this,cf,"m",uf).call(this,"bloom-enabled",e?"":null)}set bloomStrength(e){G(this,cf,"m",uf).call(this,"bloom-strength",null!=e?`${e}`:null)}set bloomRadius(e){G(this,cf,"m",uf).call(this,"bloom-radius",null!=e?`${e}`:null)}set bloomThreshold(e){G(this,cf,"m",uf).call(this,"bloom-threshold",null!=e?`${e}`:null)}set category(e){G(this,cf,"m",uf).call(this,"category",e)}set animation(e){G(this,hf,"f").animation=e}set glbLocal(e){G(this,cf,"m",uf).call(this,"glb-local","boolean"==typeof e||null==e?e?"":null:`${e.left}|${e.right}`)}set interactivityDisabled(e){G(this,cf,"m",uf).call(this,"interactivity-disabled",e?"":null)}set touchAction(e){G(this,cf,"m",uf).call(this,"touch-action",e)}set zoomDisabled(e){G(this,cf,"m",uf).call(this,"zoom-disabled",e?"":null)}set minZoom(e){G(this,cf,"m",uf).call(this,"min-zoom",null!=e?`${e}`:null)}set maxZoom(e){G(this,cf,"m",uf).call(this,"max-zoom",null!=e?`${e}`:null)}set preserveCameraOnReload(e){G(this,cf,"m",uf).call(this,"preserve-camera-on-reload",e?"":null)}set alwaysTransparentBackground(e){G(this,cf,"m",uf).call(this,"always-transparent-background",e?"":null)}set defaultFov(e){G(this,cf,"m",uf).call(this,"default-fov",`${e}`)}set fovMultiplier(e){G(this,cf,"m",uf).call(this,"fov-multiplier",`${e}`)}set defaultCameraPositions(e){G(this,hf,"f").defaultCameraPositions=e}set interactionPromptUrl(e){G(this,cf,"m",uf).call(this,"interaction-prompt-url",e)}set interactionPromptSize(e){G(this,cf,"m",uf).call(this,"interaction-prompt-size",e)}set nonLiveRendering(e){G(this,cf,"m",uf).call(this,"non-live-rendering",e?"":null)}set baseUrl(e){G(this,cf,"m",uf).call(this,"base-url",e)}set downloadCacheEnabled(e){G(this,cf,"m",uf).call(this,"download-cache-enabled",e?"":null)}set onModelLoaded(e){G(this,hf,"f").onModelLoaded=e}set onRendered(e){G(this,hf,"f").onRendered=e}set onInteracted(e){G(this,hf,"f").onInteracted=e}set onInteractionPerf(e){G(this,hf,"f").onInteractionPerf=e}set onError(e){G(this,hf,"f").onError=e}render(e){G(this,Af,"f").render(e)}flushChanges(){return G(this,Af,"f").flushChanges()}}function pf(e){return null!=e}function ff(e){return null==e?null:Number.parseFloat(e)}if(hf=new WeakMap,Af=new WeakMap,cf=new WeakSet,uf=function(e,t){null==t?this.removeAttribute(e):this.setAttribute(e,t)},df.observedAttributes=["paused","poster-url","glb-url","env-url","diamond-env-url","env-rotation","tone-mapping","tone-mapping-exposure","category","glb-local","interactivity-disabled","touch-action","zoom-disabled","min-zoom","max-zoom","preserve-camera-on-reload","always-transparent-background","default-fov","fov-multiplier","interaction-prompt-url","interaction-prompt-size","bloom-enabled","bloom-strength","bloom-radius","bloom-threshold","non-live-rendering","base-url","download-cache-enabled"],null==window)throw new Error("window is not defined. ShopAR 3D only works in a browser environment.");const{customElements:gf}=window;try{gf.define("shopar-3d",df)}catch(Zd){console.error(Zd)}const mf={bg:{var:`${D}-3d-bg`,default:"#ffffff"}};function vf(e){var t,n;const i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("width",null!==(t=e.getAttribute("width"))&&void 0!==t?t:"1rem"),i.setAttribute("height",null!==(n=e.getAttribute("height"))&&void 0!==n?n:"1rem"),i.appendChild(e),i}function Ef(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","image");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22/%3E"),n.setAttribute("width",e),n.setAttribute("height",e),n}var bf;function Cf(){const e=function(){const e=document.createElement("div");e.id="shopar-main";const t=e.style;return t.position="absolute",t.top="0",t.bottom="0",t.left="0",t.right="0",t.pointerEvents="none",e}(),t=function(){const e=document.createElement("div");return e.style.textAlign="center",e}(),n=function(){const e=new Image;e.draggable=!1;const t=e.style;return t.maxWidth="100%",t.maxHeight="100%",e}(),i=function(e,t){const n=document.createElement("div"),i=n.style;i.position="absolute",i.top="0",i.left="0",i.width="100%",i.height="100%",i.display="none",i.pointerEvents="auto",i.userSelect="none";const r=document.createElement("div"),a=r.style;a.position="relative",a.top="0",a.left="0",a.width="100%",a.height="100%",a.display="flex",a.flexDirection="column",a.justifyContent="center",a.alignItems="center",a.background=Q(O.bg),n.appendChild(r),r.appendChild(e);const s=document.createElement("div");return s.appendChild(t),r.appendChild(s),n}(t,n);e.appendChild(i);const r=function(){const e=document.createElement("div"),t=e.style;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.display="none",t.pointerEvents="auto",e}();e.appendChild(r);const a=document.createElement("div");a.dataset.placeholder="shopar-3d",e.appendChild(a);let s=null;const o=function(){const e=document.createElement("div");return e.style.textAlign="center",e.style.color=Q(N.textColor),e}(),l=function(){const e=new Image,{style:t}=e;return t.maxWidth=Q(N.imgMaxWidth),t.maxHeight=Q(N.imgMaxHeight),t.objectFit="contain",e}(),c=function(e,t){const n=document.createElement("div"),{style:i}=n;return i.position="absolute",i.width="100%",i.height="100%",i.opacity="0",i.display="flex",i.flexDirection="column",i.justifyContent="center",i.alignItems="center",i.gap=Q(N.gap),i.backgroundColor=Q(N.bg),i.transition="0.3s ease-in-out opacity",n.appendChild(e),n.appendChild(t),n}(o,l);e.appendChild(c);const h=function(){const e=document.createElement("div"),t=e.style;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.pointerEvents="auto",t.userSelect="none",t.display=Q(F.containerDisplay),t.flexDirection="column",t.justifyContent="center",t.alignItems="center",t.gap=Q(F.containerGap),t.backgroundColor=Q(F.containerBg),e}(),A=function(e){const t=document.createElement("div");return t.textContent=e,t.style.textAlign="center",t}(T["loading.ar"]);h.appendChild(A);const u=function(){const e=document.createElement("div"),t=e.style;return t.position="relative",t.overflow="hidden",t.width=Q(F.barWidth),t.height=Q(F.barHeight),t.backgroundColor=Q(F.barBg),t.borderRadius=Q(F.barRadius),e}(),d=function(){const e=document.createElement("div"),t=e.style;return t.height="100%",t.width="0%",t.background=Q(F.barFg),t.borderRadius=Q(F.barRadius),t.transition="width 0.05s ease-out",e}(),p=function(){const e=document.createElement("div");return e.textContent="0%",e.style.textAlign="center",e}();u.appendChild(d),h.appendChild(u),h.appendChild(p),e.appendChild(h);const f=function(){const e=document.createElement("div");return e.style.textAlign="center",e}(),g=function(e){const t=document.createElement("div"),n=t.style;n.position="absolute",n.width="100%",n.height="100%",n.display="none",n.pointerEvents="auto",n.userSelect="none";const i=document.createElement("div"),r=i.style;return r.position="absolute",r.width="100%",r.height="100%",r.backgroundColor="#ffffff",r.display="flex",r.flexDirection="column",r.justifyContent="center",r.alignItems="center",t.appendChild(i),i.appendChild(e),t}(f);e.appendChild(g);const m=function(){const e=document.createElement("div");e.role="group",e.ariaLabel="Preview type chooser";const{style:t}=e;return t.display="none",t.position="absolute",t.width="100%",t.bottom="0",t.paddingBottom=Q(P.paddingBottom),t.justifyContent="center",t.gap=Q(P.gap),e}();e.appendChild(m);const v=Ef("1.75rem"),E=L("Try-on","Launch ShopAR virtual try-on",vf(v));m.appendChild(E);const b=Ef("1.75rem"),C=L("3D","Launch ShopAR 3D preview",vf(b));m.appendChild(C);const _=Ef("1.75rem"),I=L("Close","Close ShopAR view",vf(_));m.append(I);let x,y,M=bf.None,S=!1,B=!1,R=!1,D=!1;function U(){d.style.width="100%",p.textContent="100%",h.style.visibility="hidden",d.style.width="0%",p.textContent="0%"}return{setTargetElement:function(t){t.style.position="relative",t.appendChild(e)},getQRTarget:function(){return i},getQRImage:function(){return n},getDeepARTarget:function(){return r},getDeepARPrompt:function(){return c},getThreeTarget:function(){return null==s&&(s=function(){const e=document.createElement("shopar-3d"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.pointerEvents="auto",t.display="none",t.background=Q(mf.bg),e}(),a.replaceWith(s)),s},hasThreeTarget:function(){return null!=s},removeThreeTarget:function(){null!=s&&(s.replaceWith(a),s=null)},customizeDeepARPrompt:function(e,t){o.textContent=e,l.src=t},customizeCameraError:function(e){f.textContent=null!=e?e:"Please reload page and allow camera access to continue"},customizeQRPrompt:function(e){t.textContent=null!=e?e:"Scan on mobile or tablet to try on"},setVisibilityParameters:function(e,t,n,i,r,a){var s;S=e,B=t,R=n,D=i,x=r,y=a,If(m,S),If(E,S&&(R||B)&&M===bf.None),If(C,S&&D&&M===bf.None),If(I,S&&M!==bf.None),U(),S||""===(s=g).style.display&&_f(s,!1)},getUIState:function(){return M},setUIState:function(e){M=e,M===bf.None?(U(),S&&(_f(g,!1),If(I,!1),(B||R)&&If(E,!0),D&&If(C,!0))):M===bf.QR||M===bf.AR?S&&(_f(g,!1),If(E,!1),If(C,D&&"AR"===y),If(I,"AR"!==y)):M===bf.Preview&&S&&(_f(g,!1),If(E,(B||R)&&"3D"===y),If(C,!1),If(I,"3D"!==y))},setDefaultUIActions:function(e,t,n){S&&((B||R)&&(!function(e){const t={Glasses:"glasses.svg",Shoes:"shoe.svg",Watches:"watch.svg",Bracelets:"watch.svg",Scarves:"glasses.svg",Hats:"glasses.svg",Necklaces:"glasses.svg"},n=null!=e&&t[e]||t.Glasses,i=`${w()}/img/icons/${n}`;v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i)}(x),E.onclick=e),D&&(b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${w()}/img/icons/cube.svg`),C.onclick=t),_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${w()}/img/icons/close.svg`),I.onclick=n)},startDeepARLoading:function(){d.style.width="0%",h.style.visibility="visible"},stopDeepARLoading:U,updateDeepARLoadingProgress:function(e){d.style.width=`${e}%`,p.textContent=`${Math.floor(e)}%`},showCameraError:function(){S&&_f(g,!0)}}}function _f(e,t){e.style.display=t?"":"none"}function If(e,t){e.style.display=t?"flex":"none"}!function(e){e[e.None=0]="None",e[e.QR=1]="QR",e[e.AR=2]="AR",e[e.Preview=3]="Preview"}(bf||(bf={}));const xf=new Map;function yf(e){let t=xf.get(e);return null==t?(t=function(){let e=0,t=null,n=null,i=!0;const r=()=>(null==t&&(t=Cf()),t);return{getSetupId:()=>e,incrementSetupId_:()=>e++,getUI_:()=>t,findUI:r,findQR:()=>{if(null==n){const{getQRTarget:e,getQRImage:t}=r();n=B(e(),t())}return n},isInteractive:()=>i,setInteractive:e=>{i=e,(null==t?void 0:t.hasThreeTarget())&&(t.getThreeTarget().interactivityDisabled=!e)}}}(),xf.set(e,t)):t.incrementSetupId_(),t}function wf(e){for(const t of xf.values()){if(t===e)continue;const n=t.getUI_();if(null==n)continue;const{getUIState:i,setUIState:r}=n;i()===bf.AR&&r(bf.None)}}const Mf=[];for(let e=0;e<256;++e)Mf.push((e+256).toString(16).slice(1));let Sf;const Bf=new Uint8Array(16);var Tf={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Rf(e,t,n){const i=(e=e||{}).random??e.rng?.()??function(){if(!Sf){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Sf=crypto.getRandomValues.bind(crypto)}return Sf(Bf)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(Mf[e[t+0]]+Mf[e[t+1]]+Mf[e[t+2]]+Mf[e[t+3]]+"-"+Mf[e[t+4]]+Mf[e[t+5]]+"-"+Mf[e[t+6]]+Mf[e[t+7]]+"-"+Mf[e[t+8]]+Mf[e[t+9]]+"-"+Mf[e[t+10]]+Mf[e[t+11]]+Mf[e[t+12]]+Mf[e[t+13]]+Mf[e[t+14]]+Mf[e[t+15]]).toLowerCase()}(i)}function Df(e,t,n){return Tf.randomUUID&&!e?Tf.randomUUID():Rf(e)}var Qf="undefined"!=typeof Float32Array?Float32Array:Array;function Uf(){var e=new Qf(16);return Qf!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Lf(e,t){var n=t[0],i=t[1],r=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],h=t[8],A=t[9],u=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=t[15],v=n*o-i*s,E=n*l-r*s,b=n*c-a*s,C=i*l-r*o,_=i*c-a*o,I=r*c-a*l,x=h*f-A*p,y=h*g-u*p,w=h*m-d*p,M=A*g-u*f,S=A*m-d*f,B=u*m-d*g,T=v*B-E*S+b*M+C*w-_*y+I*x;return T?(T=1/T,e[0]=(o*B-l*S+c*M)*T,e[1]=(r*S-i*B-a*M)*T,e[2]=(f*I-g*_+m*C)*T,e[3]=(u*_-A*I-d*C)*T,e[4]=(l*w-s*B-c*y)*T,e[5]=(n*B-r*w+a*y)*T,e[6]=(g*b-p*I-m*E)*T,e[7]=(h*I-u*b+d*E)*T,e[8]=(s*S-o*w+c*x)*T,e[9]=(i*w-n*S-a*x)*T,e[10]=(p*_-f*b+m*v)*T,e[11]=(A*b-h*_-d*v)*T,e[12]=(o*y-s*M-l*x)*T,e[13]=(n*M-i*y+r*x)*T,e[14]=(f*E-p*C-g*v)*T,e[15]=(h*C-A*E+u*v)*T,e):null}function Pf(e,t,n){var i=t[0],r=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],A=t[8],u=t[9],d=t[10],p=t[11],f=t[12],g=t[13],m=t[14],v=t[15],E=n[0],b=n[1],C=n[2],_=n[3];return e[0]=E*i+b*o+C*A+_*f,e[1]=E*r+b*l+C*u+_*g,e[2]=E*a+b*c+C*d+_*m,e[3]=E*s+b*h+C*p+_*v,E=n[4],b=n[5],C=n[6],_=n[7],e[4]=E*i+b*o+C*A+_*f,e[5]=E*r+b*l+C*u+_*g,e[6]=E*a+b*c+C*d+_*m,e[7]=E*s+b*h+C*p+_*v,E=n[8],b=n[9],C=n[10],_=n[11],e[8]=E*i+b*o+C*A+_*f,e[9]=E*r+b*l+C*u+_*g,e[10]=E*a+b*c+C*d+_*m,e[11]=E*s+b*h+C*p+_*v,E=n[12],b=n[13],C=n[14],_=n[15],e[12]=E*i+b*o+C*A+_*f,e[13]=E*r+b*l+C*u+_*g,e[14]=E*a+b*c+C*d+_*m,e[15]=E*s+b*h+C*p+_*v,e}function Nf(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Ff(e,t){var n=t[0],i=t[1],r=t[2],a=t[4],s=t[5],o=t[6],l=t[8],c=t[9],h=t[10];return e[0]=Math.hypot(n,i,r),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(l,c,h),e}function Of(e,t){var n=new Qf(3);Ff(n,t);var i=1/n[0],r=1/n[1],a=1/n[2],s=t[0]*i,o=t[1]*r,l=t[2]*a,c=t[4]*i,h=t[5]*r,A=t[6]*a,u=t[8]*i,d=t[9]*r,p=t[10]*a,f=s+h+p,g=0;return f>0?(g=2*Math.sqrt(f+1),e[3]=.25*g,e[0]=(A-d)/g,e[1]=(u-l)/g,e[2]=(o-c)/g):s>h&&s>p?(g=2*Math.sqrt(1+s-h-p),e[3]=(A-d)/g,e[0]=.25*g,e[1]=(o+c)/g,e[2]=(u+l)/g):h>p?(g=2*Math.sqrt(1+h-s-p),e[3]=(u-l)/g,e[0]=(o+c)/g,e[1]=.25*g,e[2]=(A+d)/g):(g=2*Math.sqrt(1+p-s-h),e[3]=(o-c)/g,e[0]=(u+l)/g,e[1]=(A+d)/g,e[2]=.25*g),e}function kf(){var e=new Qf(3);return Qf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gf(e,t,n){var i=new Qf(3);return i[0]=e,i[1]=t,i[2]=n,i}function Hf(e,t){var n=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2];return Math.hypot(n,i,r)}function zf(e,t,n){var i=t[0],r=t[1],a=t[2],s=n[3]*i+n[7]*r+n[11]*a+n[15];return s=s||1,e[0]=(n[0]*i+n[4]*r+n[8]*a+n[12])/s,e[1]=(n[1]*i+n[5]*r+n[9]*a+n[13])/s,e[2]=(n[2]*i+n[6]*r+n[10]*a+n[14])/s,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Vf(){var e=new Qf(4);return Qf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}kf(),function(){var e,t=(e=new Qf(4),Qf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();var Wf;kf(),Gf(1,0,0),Gf(0,1,0),Vf(),Vf(),Wf=new Qf(9),Qf!=Float32Array&&(Wf[1]=0,Wf[2]=0,Wf[3]=0,Wf[5]=0,Wf[6]=0,Wf[7]=0),Wf[0]=1,Wf[4]=1,Wf[8]=1;async function qf(){const e=await async function(){const e=await fetch("data:application/octet-stream;base64,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");return await function(e={}){var t,n,i,r,a,s=e,o=new Promise((e,n)=>{t=e}),l={1076:e=>{const t=[e,Date.now()],n=t.length-2,r=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame","navigator","userAgent"],a=[2,12,7,1],s=window[r[r[a[a[a.length-1]]+2].length-a[t.length]+1]][r[Math.pow(a[n],r[a.length].length)]]||"no user agent",o=c(32);for(let e=0;e<32;++e)i[o+e]=s.charCodeAt(e%s.length);return o},1870:e=>{var t,n=function(){var e;try{e=Function('return (function() {}.constructor("return this")( ));')()}catch(t){e=window}return e}(),r=Date.now();for(var a in n)if(8==a.length&&110==a.charCodeAt(7)&&105==a.charCodeAt(5)&&97==a.charCodeAt(3)&&108==a.charCodeAt(0)){r=a,t=e;break}for(var s in n[r])if(8==s.length&&97==s.charCodeAt(5)&&104==s.charCodeAt(0)){t=s;break}const o=n[r][t]||"no hostname",l=c(32);for(let e=0;e<32;++e)i[l+e]=o.charCodeAt(e%o.length);return l}};s.noExitRuntime;var c,h=[],A=(e,t,s)=>{var o=((e,t)=>{var s;for(h.length=0;s=i[e++];){var o=105!=s;t+=(o&=112!=s)&&t%8?4:0,h.push(112==s?r[t>>2]:105==s?n[t>>2]:a[t>>3]),t+=o?8:4}return h})(t,s);return l[e](...o)},u={a:{a:(e,t,n)=>A(e,t,n),c:()=>Date.now(),b:e=>{i.length,function(){throw"OOM"}()}}};return WebAssembly.instantiate(s.wasm,u).then(e=>{var o,l=e.instance.exports;s._magic=l.f,s._free=l.g,s._malloc=c=l.i,o=l.d.buffer,s.HEAPU8=i=new Uint8Array(o),n=new Int32Array(o),r=new Uint32Array(o),a=new Float64Array(o),function(e){e.e()}(l),t(s)}),o}({wasm:await e.arrayBuffer()})}();return function(t){const n=e._malloc(32);for(let i=0;i<t.size()&&i<32;i++)e.HEAPU8[n+i]=t.get(i);const i=e._malloc(64);e._magic(n,i);const r=new Uint8Array(64);for(let t=0;t<64;++t)r[t]=e.HEAPU8[i+t];return e._free(n),e._free(i),r}}let jf,Yf,Xf,Kf,Jf,Zf,$f=!1,eg=null,tg=[],ng=[];function ig(e){return c(this,void 0,void 0,function*(){$f=!1;const{ShopAR__TrueScale:t}=window;yield t.initialize(`${w()}/wasm/mediapipe`,e),eg&&clearInterval(eg);const n=[],i=[];eg=setInterval(()=>c(this,void 0,void 0,function*(){if($f)return;const{error:e,faceWidth:r,ipd:a,translation:s,rotation:o}=yield t.predict(performance.now());$f||(null!=s&&null!=o&&function(e){for(let t of tg)t(e)}({translation:s,rotation:o}),null==e&&(n.push(r),i.push(a),n.length<10||(n.shift(),i.shift(),function(e,t){for(let n of ng)n({faceWidth:e,IPD:t})}(ag(n),ag(i)))))}),200)})}function rg(){ng=[],tg=[],$f=!0}function ag(e){let t=0;const n=e.length;for(let i=0;i<n;i++)t+=e[i];return t/n}let sg=null;const og=new Set;let lg,cg,hg,Ag,ug,dg,pg=!1;function fg(){null==jf&&(jf=M(`${w()}/shopar-deepar.js`,"ShopAR__DeepAR"))}function gg(){null==Yf&&(Yf=M(`${w()}/shopar-true-scale.js`,"ShopAR__TrueScale"))}function mg(e){return c(this,void 0,void 0,function*(){const{licenseKey:t,truescaleUsecase:n,onProgress:i,effectUrl:r,effectOptions:a}=e;a&&null==a.envmap&&(a.envmap=`${w()}/deepar/default_envmap.webp`),ug=n;const s=null!=e.videoConfig;return null==lg&&(lg=(()=>c(this,void 0,void 0,function*(){pg=!1;const n=function(e){var t;const n={Glasses:"user",Shoes:"environment",Watches:"environment",Bracelets:"environment",Hats:"user",Scarves:"user",Necklaces:"user"};return null==e?"user":null!==(t=n[e])&&void 0!==t?t:"user"}(Jf);try{Xf=yield window.ShopAR__DeepAR.deepar.initialize({licenseKey:t||"your_license_key_goes_here",previewElement:Zf,effect:r,effectOptions:a,rootPath:`${w()}/deepar`,additionalOptions:{hint:dg,cameraConfig:{disableDefaultCamera:s,facingMode:n},pixelRatio:Math.min(window.devicePixelRatio,2),onVerify:yield qf()},onProgress:i})}catch(e){throw lg=null,e}Xf.setWatchTicking("Watches"===Jf),s&&Xf.setVideoElement(e.videoConfig.video,null==e?void 0:e.videoConfig.mirror),"Glasses"===Jf&&null==e.customTrueScaleFaceWidth?(yield Yf,Kf=Xf.getVideoElement(),ig(Kf),"DetectionLoop"!==ug&&Og(e=>{Ag=e.faceWidth})):"Glasses"===Jf&&null!=e.customTrueScaleFaceWidth&&(Ag=e.customTrueScaleFaceWidth),pg=!0,Tg(),Zf.style.display=""}))()),lg})}function vg(e,t){t=null!=t?t:function(e){const t={Glasses:["rigidFaceTrackingInit","faceInit"],Shoes:["footInit"],Watches:["wristInit"],Bracelets:["wristInit"],Hats:["rigidFaceTrackingInit","faceInit"],Scarves:["rigidFaceTrackingInit","faceInit"],Necklaces:["rigidFaceTrackingInit","faceInit"]};return null==e?void 0:t[e]}(e),e===Jf&&function(e,t){return e===t||null!=e&&null!=t&&e.length===t.length&&e.every(e=>t.find(t=>e===t))&&t.every(t=>e.find(e=>e===t))}(t,dg)||(Jf=e,dg=t)}function Eg(e){Rg(),e!==Zf&&(Zf=e,null!=Xf&&Xf.changePreviewElement(Zf,Math.min(window.devicePixelRatio,2)))}function bg(e){sg=e}function Cg(e,t){Xf.callbacks.onFaceTracked=n=>{var i;if(n.some(e=>e.detected)){if(Ag){const e=137/(Ag+5);Xf.changeParameterVector("GLASSES","","scale",e,e,e,0),Xf.changeParameterVector("shopar_glasses","","scale",e,e,e,0),function(e){const t=[-8.362421,4.549,-9.275],n=[8.362421,4.549,-9.275];try{const i=Xf.getTransformationBetween("face_position","temples"),r=Ng(i,"temple_left","temple_left_outer","temple_tip_outer_left",n,e).map(Qg),a=Ng(i,"temple_right","temple_right_outer","temple_tip_outer_right",t,e).map(Qg);Xf.changeParameterVector("temple_left","","rotation",r[0],r[1],r[2],0),Xf.changeParameterVector("temple_right","","rotation",a[0],a[1],a[2],0)}catch(e){return}}(e),rg(),Ag=null}e(),Dg("Glasses")}null===(i=null==t?void 0:t.onFaceTracked)||void 0===i||i.call(t,n)},Xf.callbacks.onFeetTracked=(n,i)=>{var r;(n.detected||i.detected)&&(e(),Dg("Shoes")),null===(r=null==t?void 0:t.onFeetTracked)||void 0===r||r.call(t,n,i)},Xf.callbacks.onWristTracked=n=>{var i;n.detected&&(e(),Dg("Watches")),null===(i=null==t?void 0:t.onWristTracked)||void 0===i||i.call(t,n)}}function _g(e){Ag=e}function Ig(e){null==Xf||Xf.setStatsCapture(e)}function xg(e,t,n){return c(this,void 0,void 0,function*(){return null!=cg&&hg===n||(yield cg,t.trackingInit={face:(null==dg?void 0:dg.includes("rigidFaceTrackingInit"))||(null==dg?void 0:dg.includes("faceInit")),foot:null==dg?void 0:dg.includes("footInit"),wrist:null==dg?void 0:dg.includes("wristInit")},null==t.envmap&&(t.envmap=`${w()}/deepar/default_envmap.webp`),cg=Xf.switchEffect(e,t),Xf.setWatchTicking("Watches"===Jf),hg=n,Tg(),Zf.style.display=""),cg})}function yg(e,t){null!=e&&null!=t&&(Xf.setToneMapping(e),Xf.setExposure(t))}function wg(e,t,n,i){Xf.setBloomEnabled(!!e),null!=t&&Xf.setBloomStrength(t),null!=n&&Xf.setBloomRadius(n),null!=i&&Xf.setBloomThreshold(i)}function Mg(){null!=Xf&&(rg(),null!=Kf&&null!=Kf.srcObject&&Kf.srcObject instanceof MediaStream&&(Kf.srcObject.getTracks().forEach(e=>e.stop()),Kf=null),Xf.shutdown(),Rg(),pg=!1,Xf=null,lg=null,Zf.style.display="none")}function Sg(){return pg}function Bg(e){Xf.setVideoElement(e.video,e.mirror)}function Tg(){null!=sg&&(null==Jf||og.has(Jf)||(sg.style.visibility="visible",sg.style.opacity="1"))}function Rg(){null!=sg&&(sg.style.visibility="hidden",sg.style.opacity="0")}function Dg(e){null!=sg&&(og.has(e)||(og.add(e),sg.style.opacity="0"))}function Qg(e){return 180*e/Math.PI}function Ug(e,t){let n=t[0],i=t[1],r=t[2],a=t[3],s=n*n,o=i*i,l=r*r;return e[0]=Math.atan2(2*(a*n+i*r),1-2*(s+o)),e[1]=-Math.PI/2+2*Math.atan2(Math.sqrt(1+2*(a*i-n*r)),Math.sqrt(1-2*(a*i-n*r))),e[2]=Math.atan2(2*(a*r+n*i),1-2*(o+l)),e}function Lg(e,t,n){const i=Lf(Uf(),e),r=function(e,t){var n=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(Uf(),-n),a=Pf(Uf(),i,r),s=Pf(Uf(),a,e),o=Pf(Uf(),s,t),l=Of(Vf(),o);return Ug(kf(),l)}function Pg(e,t){let n=Xf.getTransformationBetween("face_position",t);const i=Ug(kf(),Of(Vf(),n)).map(Qg);n=function(e,t,n,i){var r=t[0],a=t[1],s=t[2],o=t[3],l=r+r,c=a+a,h=s+s,A=r*l,u=r*c,d=r*h,p=a*c,f=a*h,g=s*h,m=o*l,v=o*c,E=o*h,b=i[0],C=i[1],_=i[2];return e[0]=(1-(p+g))*b,e[1]=(u+E)*b,e[2]=(d-v)*b,e[3]=0,e[4]=(u-E)*C,e[5]=(1-(A+g))*C,e[6]=(f+m)*C,e[7]=0,e[8]=(d+v)*_,e[9]=(f-m)*_,e[10]=(1-(A+p))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}(Uf(),function(e,t,n,i){var r=.5*Math.PI/180;t*=r,n*=r,i*=r;var a=Math.sin(t),s=Math.cos(t),o=Math.sin(n),l=Math.cos(n),c=Math.sin(i),h=Math.cos(i);return e[0]=a*l*h-s*o*c,e[1]=s*o*h+a*l*c,e[2]=s*l*c-a*o*h,e[3]=s*l*h+a*o*c,e}(Vf(),i[0],0,i[2]),Nf(kf(),n),Ff(kf(),n));const r=Lf(Uf(),e);return Pf(Uf(),r,n)}function Ng(e,t,n,i,r,a){let s=Pg(e,t);const o=Pf(Uf(),e,s),l=zf(kf(),Nf(kf(),o),function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(Uf(),[a,a,a])),c=Math.atan2(r[0]-l[0],Math.abs(r[2]-l[2]));let h;try{h=Xf.getTransformationBetween(t,n)}catch(t){return Lg(e,s,c)}const A=Pf(Uf(),o,h),u=Gf(l[0],r[1],r[2]),d=zf(kf(),u,Lf(Uf(),A));let p=Xf.getClosestPointOnMesh(n,d);try{const e=Xf.getClosestPointOnMesh(i,d);Hf(d,e)<Hf(d,p)&&(p=e)}catch(e){}const f=zf(kf(),p,A);return Lg(e,s,c-Math.atan2(f[0]-l[0],Math.abs(f[2]-l[2])))}function Fg(e){!function(e){tg.push(e)}(e)}function Og(e){!function(e){ng.push(e)}(e)}function kg(e){let t,n=!1,i=!1;return{onTracked(r,a){if(!n&&a)if(i){if(r-t>=2e3){const{Fps:t,"Engine update":r,"Face tracking":a,"Foot tracking time":s,"Wrist tracking time":o}=null==Xf?void 0:Xf.getStats();Ig(!1),n=!0,i=!1,e({fps:t,tickDuration:r.avg,faceTrackDuration:a.avg,footTrackDuration:s.avg,wristTrackDuration:o.avg})}}else i=!0,t=r,Ig(!0);i&&!a&&(i=!1,Ig(!1))}}}function Gg(){let e=!1,t=0,n=0;return{get dirty(){return e},clearDirty(){e=!1},get engagementMs(){return Math.round(t)},interact(i){const r=i-n;n=i,r<200&&(t+=r,e=!0)}}}function Hg(){let e,t,n=0,i=0,r=2e3;return{set debounceDurationMs(e){r=null!=e?e:2e3},set onDebouncedEngagement(e){t=e},interact(a){const s=a-i;i=a,s<200&&(n+=s),e&&clearTimeout(e),e=setTimeout(()=>{n>0&&t&&(t(Math.round(n)),n=0,i=0),e=void 0},r)},flush(){e&&(clearTimeout(e),e=void 0,n>0&&t&&(t(Math.round(n)),n=0,i=0))}}}const zg="arRecord",Vg="previewPerf",Wg=45e3;function qg(e){let t=0,n=0;const i=[],r=[],a=[];let s,o=1,l=1,c=1,h=-1,A=Wg,u=!1;function d(){let e=0;for(let t=0;t<i.length;t++)e+=+i[t].detected,e+=+r[t].detected;const n=5*i.length+28*e,s=new ArrayBuffer(n),h=new DataView(s);let A=0;for(let e=0;e<i.length;e++){const t=i[e],n=r[e];h.setFloat32(A,a[e],!0),A+=4,h.setUint8(A++,+t.detected+(+n.detected<<1)),t.detected&&(h.setFloat32(A+0,t.position[0],!0),h.setFloat32(A+4,t.position[1],!0),h.setFloat32(A+8,t.position[2],!0),A+=12,h.setFloat32(A+0,t.rotation[0],!0),h.setFloat32(A+4,t.rotation[1],!0),h.setFloat32(A+8,t.rotation[2],!0),h.setFloat32(A+12,t.rotation[3],!0),A+=16),n.detected&&(h.setFloat32(A+0,n.position[0],!0),h.setFloat32(A+4,n.position[1],!0),h.setFloat32(A+8,n.position[2],!0),A+=12,h.setFloat32(A+0,n.rotation[0],!0),h.setFloat32(A+4,n.rotation[1],!0),h.setFloat32(A+8,n.rotation[2],!0),h.setFloat32(A+12,n.rotation[3],!0),A+=16)}if(0===t){const e=function(){var e,t,n,i;return{width:null!==(t=null===(e=null==Xf?void 0:Xf.getVideoElement())||void 0===e?void 0:e.videoWidth)&&void 0!==t?t:0,height:null!==(i=null===(n=null==Xf?void 0:Xf.getVideoElement())||void 0===n?void 0:n.videoHeight)&&void 0!==i?i:0}}(),t=function(){var e,t,n,i;return{width:null!==(t=null===(e=null==Xf?void 0:Xf.getCanvas())||void 0===e?void 0:e.width)&&void 0!==t?t:0,height:null!==(i=null===(n=null==Xf?void 0:Xf.getCanvas())||void 0===n?void 0:n.height)&&void 0!==i?i:0}}();o=e.width/e.height,l=t.width/t.height,c=function(){var e;return null!==(e=null==Xf?void 0:Xf.getFov())&&void 0!==e?e:85}()}return{recordType:"FOOT",idx:t++,arRecord:btoa(String.fromCharCode.apply(null,new Uint8Array(s))),cameraAspect:o,canvasAspect:l,fov:c}}function p(){if(i.length>0){const t=d();e(t),i.length=0,r.length=0,a.length=0}}return{start(e=45e3){u||(A=e>Wg?Wg:e,u=!0,s=window.setInterval(()=>{p()},1e3))},stop(){u&&(p(),clearInterval(s),t=0,n=0,i.length=0,r.length=0,a.length=0,u=!1)},onFeetTracked(e,s){if(!u)return;const o=performance.now();h<0&&(h=o),o-h>A?stop():(i.push(e),r.push(s),0===t&&0===a.length?a.push(0):a.push(o-n),n=o)}}}let jg,Yg,Xg=!1;const Kg=window.navigator.userAgent||"no user agent",Jg=[];function Zg(){null==jg&&(Yg=Df(),jg=M(`${w()}/shopar-analytics.js`,"ShopAR__analytics"),jg.then(()=>{Xg=!0,window.ShopAR__analytics.initializeImpl(),Jg.forEach(e=>e())}))}function $g(e,t){const n=performance.now(),i=Df(),r=Gg(),a=Gg(),s=Hg(),o=Hg();window.setInterval(()=>{if(r.dirty||a.dirty){const e=r.engagementMs,t=a.engagementMs,n=e+t;r.clearDirty(),a.clearDirty(),h("heartbeat",{engagementTotal:n,engagementAR:e,engagement3D:t})}},1e3);const l=(r,a={})=>({name:r,props:a=Object.assign(Object.assign({},a),{userAgent:Kg,hostname:window.location.hostname,href:window.location.href,pluginVersion:I,sessionId:Yg,setupId:i,timeSinceSetup:performance.now()-n,sku:e,apiKey:t})}),c=({name:e,props:t})=>{em(()=>{window.ShopAR__analytics.trackEventImpl(e,t)})},h=(e,t={})=>{c(l(e,t))},A=function(e){const t=kg(e),n=kg(e),i=kg(e);return{onFaceTracked(e){e.length>0&&t.onTracked(performance.now(),e[0].detected)},onFeetTracked(e,t){n.onTracked(performance.now(),e.detected&&t.detected)},onWristTracked(e){i.onTracked(performance.now(),e.detected)}}}(e=>{h("arPerf",e)}),{footRecorder:u,onFeetTracked:d}=function(e){const t=qg(e);return{footRecorder:t,onFeetTracked(e,n){t.onFeetTracked(e,n)}}}(e=>{0===e.idx?h(zg,e):((e,t={})=>{c({name:e,props:Object.assign(Object.assign({},t),{sessionId:Yg,setupId:i})})})(zg,{idx:e.idx,arRecord:e.arRecord})}),p=(f=[A,{onFeetTracked:d}],{onFaceTracked:e=>{var t;for(const n of f)null===(t=n.onFaceTracked)||void 0===t||t.call(n,e)},onFeetTracked:(e,t)=>{var n;for(const i of f)null===(n=i.onFeetTracked)||void 0===n||n.call(i,e,t)},onWristTracked:e=>{var t;for(const n of f)null===(t=n.onWristTracked)||void 0===t||t.call(n,e)}});var f;return{prepareEvent:l,submitEvent:c,trackEvent:h,arInteracted:()=>{const e=performance.now();r.interact(e),s.interact(e)},previewInteracted:()=>{const e=performance.now();a.interact(e),o.interact(e)},setDebounceAREngagementMs:e=>{s.debounceDurationMs=e},setOnDebouncedAREngagement:e=>{s.onDebouncedEngagement=e},setDebouncePreviewEngagementMs:e=>{o.debounceDurationMs=e},setOnDebouncedPreviewEngagement:e=>{o.onDebouncedEngagement=e},flushEngagementCallbacks:()=>{s.flush(),o.flush()},arTrackingEvents:p,footRecorder:u}}function em(e){Xg?e():Jg.push(e)}function tm(e,t,n,i,r,a){let s,o,l=0,c=0;return{launched(){s=performance.now(),l=0,c=0,r(e)},loaded(){o=performance.now(),r(t,{duration:o-s})},failed(e){r(n,{errorName:h(e),errorMessage:A(e),errorStack:u(e),duration:performance.now()-s})},interacted(){if(null==a||a(),null==s)return;const e=performance.now(),t=e-c;c=e,t<200&&(l+=t)},closed(e){if(null==s)return;const t=null!=o;r(i,{duration:t?performance.now()-o:void 0,engagement:t?Math.round(l):void 0,trigger:e,loaded:t}),s=void 0,o=void 0,l=0,c=0}}}const nm=.1,im="function"==typeof Float32Array;function rm(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return hm;const r=im?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)r[t]=lm(t*nm,e,n);function a(t){let i=0,a=1;for(;10!==a&&r[a]<=t;++a)i+=nm;--a;const s=i+(t-r[a])/(r[a+1]-r[a])*nm,o=cm(s,e,n);return o>=.001?function(e,t,n,i){for(let r=0;r<4;++r){const r=cm(t,n,i);if(0===r)return t;t-=(lm(t,n,i)-e)/r}return t}(t,s,e,n):0===o?s:function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=lm(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,i,i+nm,e,n)}return function(e){return 0===e||1===e?e:lm(a(e),t,i)}}function am(e,t){return 1-3*t+3*e}function sm(e,t){return 3*t-6*e}function om(e){return 3*e}function lm(e,t,n){return((am(t,n)*e+sm(t,n))*e+om(t))*e}function cm(e,t,n){return 3*am(t,n)*e*e+2*sm(t,n)*e+om(t)}function hm(e){return e}function Am(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=rm(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function um(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort((e,t)=>e.time-t.time).map(({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:Am(n)}));let i=0,r=n[0].value;return{reset:()=>{i=0},update:e=>{for(i+=e;i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}},get:()=>r}}const dm="time",pm="interpolation",fm="pitch",gm=[dm,"yaw",fm,"fov",pm],mm="s",vm="ms",Em=Math.PI/180,bm="ease-in-out",Cm="cubic-bezier(";function _m(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map(e=>function(e){const t=e.indexOf("#");return(-1!==t?e.substring(0,t):e).trim()}(e)).filter(e=>""!==e)}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!gm.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(dm))throw new Error(`Missing required token: '${dm}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=Im(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:s}=i;if(null==e)throw new Error("Time missing.");const o=ym(null!==(t=i.interpolation)&&void 0!==t?t:bm);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*Em,interpolation:o})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*Em,interpolation:o})),null!=s&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:s*Em,interpolation:o}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every(t=>t.length!==e.length))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function Im(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter(e=>!(null==n?void 0:n.includes(e))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter(t=>!e.includes(t)).join(", ")}'.`);const i=e.indexOf(dm),r=function(e){if(e.endsWith(vm))return Mm(e.substring(0,e.length-2));if(e.endsWith(mm))return 1e3*Mm(e.substring(0,e.length-1));return Mm(e)}(n[i]),a=e.indexOf(pm),s=ym(-1===a?bm:n[a]),o={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case"yaw":o.theta={time:r,value:xm(c),interpolation:s};break;case fm:o.phi={time:r,value:xm(c),interpolation:s};break;case"fov":o.fov={time:r,value:xm(c),interpolation:s};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return o}function xm(e){return e.endsWith("deg")?Mm(e.substring(0,e.length-3))*Em:e.endsWith("rad")?Mm(e.substring(0,e.length-3)):Mm(e)*Em}function ym(e){if("hold"===e)return{type:"hold"};if("linear"===e)return wm(0,0,1,1);if("sine"===e)return wm(.37,0,.63,1);if("sine-in"===e)return wm(.12,0,.39,0);if("sine-out"===e)return wm(.61,1,.88,1);if("ease"===e)return wm(.25,.1,.25,1);if("ease-in"===e)return wm(.42,0,1,1);if("ease-out"===e)return wm(0,0,.58,1);if("ease-in-out"===e)return wm(.42,0,.58,1);if(e.startsWith(Cm)&&e.endsWith(")")){const t=e.substring(13,e.length-1).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:Mm(t[0]),y1:Mm(t[1]),x2:Mm(t[2]),y2:Mm(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function wm(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function Mm(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}var Sm;function Bm(){return[Sm.Android,Sm.iOS,Sm.Tablet].includes(function(){if("undefined"!=typeof window&&window.navigator){const e=window.navigator.userAgent,t=window.navigator.platform||"",n=["Macintosh","MacIntel","MacPPC","Mac68K"],i=["Win32","Win64","Windows","WinCE"],r=["iPhone","iPod","iPad"],a="ontouchstart"in window||navigator.maxTouchPoints>0;return-1!==r.indexOf(t)?Sm.iOS:-1!==n.indexOf(t)?a?Sm.Tablet:Sm.MacOS:-1!==i.indexOf(t)?Sm.Windows:/Android/.test(e)?Sm.Android:/Linux/.test(t)?Sm.Linux:a?Sm.Tablet:Sm.Unknown}return Sm.Unknown}())}!function(e){e[e.Unknown=0]="Unknown",e[e.Android=1]="Android",e[e.iOS=2]="iOS",e[e.Tablet=3]="Tablet",e[e.MacOS=4]="MacOS",e[e.Windows=5]="Windows",e[e.Linux=6]="Linux"}(Sm||(Sm={}));const Tm=["demo.deepar.ai","dbeochk72stb2.cloudfront.net","d1q93hnxt3ps3w.cloudfront.net","dj5e08oeu5ym4.cloudfront.net"];function Rm(e,{trustUrls:t=!1}={}){const n=Object.assign({},e);if(n.category&&!Wc.includes(n.category))throw new r(`Invalid response category: ${e.category}`);if(n.arToneMapping&&!qc.includes(n.arToneMapping))throw new r(`Invalid tone mapping: ${e.arToneMapping}`);if(n.previewToneMapping&&!qc.includes(n.previewToneMapping))throw new r(`Invalid tone mapping: ${e.previewToneMapping}`);const i=t?Dm:Qm;return n.arUrl=n.arUrl?i(n.arUrl):void 0,n.arEnvUrl=n.arEnvUrl?i(n.arEnvUrl):void 0,n.arDiamondEnvUrl=n.arDiamondEnvUrl?i(n.arDiamondEnvUrl):void 0,n.arPromptImage=n.arPromptImage?i(n.arPromptImage):void 0,n.previewUrl=n.previewUrl?i(n.previewUrl):void 0,n.previewEnvUrl=n.previewEnvUrl?i(n.previewEnvUrl):void 0,n.previewDiamondEnvUrl=n.previewDiamondEnvUrl?i(n.previewDiamondEnvUrl):void 0,n.previewPosterUrl=n.previewPosterUrl?i(n.previewPosterUrl):void 0,n}function Dm(e){if(null==e||"string"!=typeof e)throw new r(`Invalid url: ${e}.`);let t;try{t=new URL(e)}catch(t){throw new r(`Invalid url: ${e}. ${t.message}`)}if("https:"!==t.protocol)throw new r(`Invalid url: ${e}.`);return t.toString()}function Qm(e){const t=Dm(e);if(!function(e){return Tm.includes(e)}(new URL(t).hostname))throw new r(`Invalid url: ${e}.`);return t}const Um=[1e3,2e3,4e3],Lm=Um.length;function Pm(e){return c(this,arguments,void 0,function*(e,t=0){try{return yield e()}catch(n){if(t>=Lm)throw n;return yield new Promise(e=>setTimeout(e,Um[t])),Pm(e,t+1)}})}const Nm={};function Fm(e){const t=function(e){const{apiKey:t,sku:n,yaw:i,pitch:r,fov:a,forcedTransparency:s}=e,o=[];o.push(`apiKey=${t}`),o.push(`sku=${n}`),null!=i&&o.push(`yaw=${i}`);null!=r&&o.push(`pitch=${r}`);null!=a&&o.push(`fov=${a}`);null!=s&&o.push(`forcedTransparency=${s}`);return o.join("&")}(e),n=null!=Nm[t];return n||(Nm[t]=function(e){return c(this,void 0,void 0,function*(){return Rm(yield Pm(()=>c(this,void 0,void 0,function*(){const t=yield fetch(`https://dashboard.shopar.ai/plugin?${new URLSearchParams(e)}`).catch(e=>{throw new i(`API unavailable: ${A(e)}`)});if(!t.ok)throw new i("API response not OK.",t.status);const n=t.headers.get("content-length");if(n&&parseInt(n)>1048576)throw new i("API response too large.");try{return yield t.json()}catch(e){throw new i(`API returned invalid body: ${A(e)}`)}})))})}(e).catch(e=>{throw delete Nm[t],e})),{promise:Nm[t],cacheHit:n}}function Om(e,t){if(null==e)throw new n(`'${t}' not specified.`)}function km(e,t){if("boolean"!=typeof e)throw new n(`'${t}' must be a boolean.`)}function Gm(e,t){if("number"!=typeof e)throw new n(`'${t}' must be a number.`)}function Hm(e,t,i,r){if("number"!=typeof e)throw new n(`'${t}' must be a number.`);if(e<i)throw new n(`'${t}' must be greater than ${i}.`);if(e>r)throw new n(`'${t}' must be less than ${r}.`)}function zm(e,t){if("string"!=typeof e)throw new n(`'${t}' must be a string.`)}function Vm(e,t,i){if("string"!=typeof e)throw new n(`'${t}' must be a string.`);if(!i.includes(e))throw new n(`'${t}' must be ${i.join("' or '")}.`)}function Wm(e,t){if(!(e instanceof HTMLElement))throw new n(`'${t}' must be an HTMLElement.`)}function qm(e,t){if("function"!=typeof e)throw new n(`'${t}' must be a function.`)}function jm(t){const{apiKey:i,sku:r,skuData:a,targetElement:s,initialState:o,initialAnimation:l,baseUrl:c,defaultUI:h,interactive:A,touchAction:u,zoomEnabled:d,minZoom:p,maxZoom:f,alwaysTransparentBackground:g,strings:m,debounceAREngagementMs:v,onDebouncedAREngagement:E,debounce3DEngagementMs:b,onDebounced3DEngagement:C,customArVideo:_,customTrueScaleFaceWidth:I}=t;Ym(i),function(e){Om(e,"sku"),zm(e,"sku"),function(e){if(0===e.length||e.length>100||!/^[\p{L}0-9 ./_-]+$/u.test(e))throw new n("Invalid 'sku'.")}(e)}(r),null!=a&&function(e,t){if("object"!=typeof e)throw new n(`'${t}' must be an object.`)}(a,"skuData"),Om(s,"targetElement"),Wm(s,"targetElement"),null!=o&&Vm(o,"initialState",e),null!=l&&function(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new n(`'${t}' must be a string or array.`)}(l,"initialAnimation"),null!=c&&zm(c,"baseUrl"),null!=h&&km(h,"defaultUI"),null!=A&&km(A,"interactive"),null!=u&&Vm(u,"touchAction",jc),null!=d&&km(d,"zoomEnabled"),null!=p&&Hm(p,"minZoom",.1,1),null!=f&&Hm(f,"maxZoom",1,1/0),null!=g&&km(g,"alwaysTransparentBackground"),null!=m&&function(e,t,i){for(const r of i){const i=e[r];if(null!=i&&"string"!=typeof i)throw new n(`Value for key '${r}' in '${t}' must be a string or undefined.`)}}(m,"strings",R),null!=v&&Gm(v,"debounceAREngagementMs"),null!=E&&qm(E,"onDebouncedAREngagement"),null!=b&&Gm(b,"debounce3DEngagementMs"),null!=C&&qm(C,"onDebounced3DEngagement"),null!=_&&(Om(_.video,"customArVideo.video"),function(e,t){if(!(e instanceof HTMLVideoElement))throw new n(`'${t}' must be an HTMLVideoElement.`)}(_.video,"customArVideo.video"),Om(_.mirror,"customArVideo.mirror"),km(_.mirror,"customArVideo.mirror")),null!=I&&Gm(I,"customTrueScaleFaceWidth")}function Ym(e){Om(e,"apiKey"),zm(e,"apiKey"),function(e){if(!function(e){return 24===e.length&&/^[0-9a-fA-F]{24}$/.test(e)}(e))throw new n("Invalid 'apiKey'.")}(e)}let Xm=!1;function Km(e){return c(this,void 0,void 0,function*(){!function(e){const{apiKey:t,targetElement:n}=e;Ym(t),Om(n,"targetElement"),Wm(n,"targetElement")}(e);const{targetElement:t}=e;y(e.baseUrl),Zg();const{trackEvent:n}=function(e){const t=performance.now(),n=Df();return{trackEvent:(i,r={})=>{r=Object.assign(Object.assign({},r),{userAgent:Kg,hostname:window.location.hostname,href:window.location.href,pluginVersion:I,sessionId:Yg,setupId:n,timeSinceSetup:performance.now()-t,apiKey:e}),em(()=>{window.ShopAR__analytics.trackEventImpl(i,r)})}}}(e.apiKey);n("visionSetup");const r=yield function(e){return c(this,void 0,void 0,function*(){return yield Pm(()=>c(this,void 0,void 0,function*(){const t=yield fetch(`https://dashboard.shopar.ai/plugin/vision?${new URLSearchParams({apiKey:e,sid:v()})}`).catch(e=>{throw new i(`API unavailable: ${A(e)}`)});if(!t.ok)throw new i("API response not OK.",t.status);const n=t.headers.get("content-length");if(n&&parseInt(n)>1048576)throw new i("API response too large.");try{return yield t.json()}catch(e){throw new i(`API returned invalid body: ${A(e)}`)}}))})}(e.apiKey);n("visionApiResponse",r);const{arKey:a}=r,s=yf(t),{getSetupId:o,findUI:l}=s,u=o();fg(),gg();const{setTargetElement:d,getDeepARTarget:p,setVisibilityParameters:f,getUIState:g,setUIState:m,startDeepARLoading:E,stopDeepARLoading:b,showCameraError:C}=l();if(g()!=bf.None)throw Error("UI state is not None, this is weird..");m(bf.AR),d(t),f(!1,!1,!0,!1,void 0,void 0),E(),yield jf,Jm(o(),u);try{n("visionArLaunch"),vg("Glasses",["faceInit"]),Eg(p()),yield mg({licenseKey:a,truescaleUsecase:"DetectionLoop"}),Jm(o(),u),Jm(o(),u)}catch(e){const t=A(e);throw n("visionArLaunchFailure",{errorName:h(e),errorMessage:t}),C(),new Error(`AR failed: ${t}`)}finally{b()}return Xm=!0,{registerFacePoseListener:e=>{Xm&&(n("registerFacePoseListener"),Fg(e))},registerFaceMeasurementListener:e=>{Xm&&(n("registerFaceMeasurementListener"),Og(e))},switchEffect:e=>c(this,void 0,void 0,function*(){Xm&&(n("switchEffect",{arUrl:e}),function(e){Xf.switchEffect(e)}(e))}),clearEffect:()=>{Xm&&(n("clearEffect"),Xf.clearEffect())},close:()=>{if(Xm){if(Xm=!1,n("visionClose"),g()!==bf.AR)throw new Error("AR not launched.");m(bf.None)}}}})}function Jm(e,t){if(e!==t)throw new Error("Setup cancelled. Please ensure that setup is only called once.")}function Zm(e){return c(this,void 0,void 0,function*(){var t,r,u,p;jm(e);const{apiKey:f,sku:g,skuData:m,targetElement:I,initialState:x,initialAnimation:M}=e,S=e.touchAction,B=null==e.zoomEnabled||e.zoomEnabled,R=e.minZoom,D=e.maxZoom,Q=!0===e.alwaysTransparentBackground;!function(e){const t=getComputedStyle(e);if(!["static","relative"].includes(t.position))throw new n(`Invalid targetElement's position. Expected 'static' or 'relative', but found '${t.position}'.`)}(I),y(e.baseUrl),function(e){if(null!=e)for(const t of Object.keys(e)){if(!Object.prototype.hasOwnProperty.call(T,t)){console.warn(`String for key '${t}' will be ignored.`);continue}const n=e[t];null!=n&&(T[t]=n)}}(e.strings);const U=null!=M?_m(M):null,L=null!=(null==U?void 0:U.theta)?um(U.theta):null,P=null!=(null==U?void 0:U.phi)?um(U.phi):null,N=null!=(null==U?void 0:U.fov)?um(U.fov):null,F=function(e,t){if(null!=e)return{apiUsed:!1,skuData:Rm(e,{trustUrls:!0})};const n=performance.now(),{promise:i,cacheHit:r}=Fm(t);return{apiUsed:!0,promise:i,startTimestamp:n,cacheHit:r}}(m,function(e,t,n,i,r,a){return Object.assign(Object.assign(Object.assign(Object.assign({apiKey:e,sku:t,sid:v(),initialFov:"16"},null!=n&&{yaw:`${b(E(n))}`}),null!=i&&{pitch:`${b(E(i))}`}),null!=r&&{fov:`${b(E(r))}`}),a&&{forcedTransparency:`${a}`})}(f,g,null==L?void 0:L.get(),null==P?void 0:P.get(),null==N?void 0:N.get(),Q)),O=yf(I),{getSetupId:k,findUI:G,findQR:H,isInteractive:z,setInteractive:V}=O,W=k();Zg();const{prepareEvent:q,submitEvent:j,trackEvent:Y,arInteracted:X,previewInteracted:K,setDebounceAREngagementMs:J,setOnDebouncedAREngagement:Z,setDebouncePreviewEngagementMs:$,setOnDebouncedPreviewEngagement:ee,flushEngagementCallbacks:te,arTrackingEvents:ne,footRecorder:ie}=$g(g,f),re=q("setup");J(e.debounceAREngagementMs),Z(e.onDebouncedAREngagement),$(e.debounce3DEngagementMs),ee(e.onDebounced3DEngagement);let ae,se=!1;if(F.apiUsed){try{ae=yield F.promise}catch(e){const t=A(e),n=performance.now()-F.startTimestamp;throw Y("apiError",{errorName:h(e),errorMessage:t,errorStatusCode:e instanceof i?e.status:void 0,duration:n}),e instanceof i?e:new i(t)}$m(k(),W)}else ae=F.skuData;const{category:oe,arUrl:le,arEnvUrl:ce,arDiamondEnvUrl:he,arToneMapping:Ae,arToneMappingExposure:ue,arBloomEnabled:de,arBloomStrength:pe,arBloomRadius:fe,arBloomThreshold:ge,arKey:me,arPromptEnabled:ve,arPromptText:Ee,arPromptImage:be,previewUrl:Ce,previewEnvUrl:_e,previewDiamondEnvUrl:Ie,previewToneMapping:xe,previewToneMappingExposure:ye,previewBloomEnabled:we,previewBloomStrength:Me,previewBloomRadius:Se,previewBloomThreshold:Be,previewPosterUrl:Te,cameraErrorText:Re,qrPromptText:De,arSessionRecording:Qe,arSessionRecordingMaxDurationMs:Ue}=ae;if(F.apiUsed){const e=performance.now()-F.startTimestamp;null!=le||null!=Ce?(j(re),Y("apiResponse",Object.assign(Object.assign({},ae),{duration:e,cacheHit:F.cacheHit}))):(Y("apiResponseFailure",Object.assign(Object.assign({},ae),{duration:e,cacheHit:F.cacheHit})),Le="SKU not found (or both 3D and AR disabled).",console.error(`ShopAR Plugin: ${Le}`))}var Le;const Pe=null!=le&&function(e){return null!=e&&C.includes(e)}(oe),Ne=null==(null===(t=e._internalOptions)||void 0===t?void 0:t.qrEnabled)||(null===(r=e._internalOptions)||void 0===r?void 0:r.qrEnabled),Fe=Pe&&function(e){return null!=e&&_.includes(e)}(oe),Oe=Ne&&Fe&&!Bm(),ke=Pe&&!Oe,Ge=null!=Ce;$m(k(),W);const{setTargetElement:He,getDeepARTarget:ze,getDeepARPrompt:Ve,getThreeTarget:We,removeThreeTarget:qe,customizeDeepARPrompt:je,customizeCameraError:Ye,customizeQRPrompt:Xe,setVisibilityParameters:Ke,getUIState:Je,setUIState:Ze,setDefaultUIActions:$e,startDeepARLoading:et,stopDeepARLoading:tt,showCameraError:nt,updateDeepARLoadingProgress:it}=G();He(I);Ke(null==e.defaultUI||e.defaultUI,Oe,ke,Ge,oe,x),je(null!==(p=null!==(u=function(e){switch(e){case"Glasses":return T["prompt.ar.glasses"];case"Shoes":return T["prompt.ar.shoes"];case"Watches":return T["prompt.ar.watches"];case"Bracelets":return T["prompt.ar.bracelets"];case"Scarves":return T["prompt.ar.scarves"];case"Hats":return T["prompt.ar.hats"];case"Necklaces":return T["prompt.ar.necklaces"];default:return}}(oe))&&void 0!==u?u:Ee)&&void 0!==p?p:"",null!=be?be:F.apiUsed?"":`${w()}/img/prompt/ar-foot.webp`),Ye(Re),Xe(De);const rt=tm("qrLaunch","qrLaunchSuccess","qrLaunchFailure","qrClose",Y),at=tm("arLaunch","arLaunchSuccess","arLaunchFailure","arClose",Y,X),st=tm("previewLaunch","previewLaunchSuccess","previewLaunchFailure","previewClose",Y,K);!function(e,t){const n=e.parentNode;if(null==n)throw new Error("Parent node missing.");new MutationObserver(n=>{for(const i of n)for(const n of i.removedNodes)if(n===e)return void t()}).observe(n,{childList:!0})}(I,()=>{te(),Je()===bf.QR?(rt.closed("detach"),ot()||ct()):Je()===bf.AR?(at.closed("detach"),Sg()&&(ie.stop(),Mg())):Je()===bf.Preview&&(st.closed("detach"),qe()),Ze(bf.None),function(e){xf.delete(e)}(I)});const{qrPaused:ot,qrDraw:lt,qrPause:ct}=H(),ht=null==e.interactive||e.interactive;let At=0;if(Je()===bf.QR){if(!ot())if(Oe){rt.launched();try{yield lt(f,g)}catch(e){const t=A(e);throw new l(t)}rt.loaded()}else ct(),Ze(bf.None)}else if(Je()===bf.AR){if(Sg())if(ke&&!Xm){at.launched(),ie.stop(),et(),fg(),"Glasses"===oe&&gg(),wf(O),Eg(ze()),vg(oe),bg(ve?Ve():null);const t=e=>{it(e.loaded/e.total*100)};null!=e.customArVideo&&Bg(e.customArVideo),yield xg(le,{envmap:ce,diamondEnvMap:he,onProgress:t},`${le}${ce}${he}`),yg(Ae,ue),wg(de,pe,fe,ge),Cg(at.interacted,ne),Qe&&"Shoes"===oe&&F.apiUsed&&ie.start(Ue),$m(k(),W),tt(),null!=e.customTrueScaleFaceWidth&&_g(e.customTrueScaleFaceWidth),at.loaded()}else ie.stop(),Mg(),Ze(bf.None)}else if(Je()===bf.Preview)if(Ge){st.launched(),yield customElements.whenDefined("shopar-3d");const e=We();e.baseUrl=`${w()}/3d`,e.interactivityDisabled=!ht,e.posterUrl=null!=Te?Te:null,e.glbUrl=Ce,e.envUrl=null!=_e?_e:`${w()}/env/default.hdr`,e.diamondEnvUrl=null!=Ie?Ie:null,e.category=null!=oe?oe:null,e.touchAction=null!=S?S:null,e.zoomDisabled=!B,e.minZoom=null!=R?R:null,e.maxZoom=null!=D?D:null,e.alwaysTransparentBackground=Q,e.toneMapping=null!=xe?xe:"ACES",e.toneMappingExposure=null!=ye?ye:1,e.bloomEnabled=null!=we?we:null,e.bloomStrength=null!=Me?Me:null,e.bloomRadius=null!=Se?Se:null,e.bloomThreshold=null!=Be?Be:null,e.onInteracted=st.interacted,e.onInteractionPerf=se?null:t=>{se=!0,e.onInteractionPerf=null,Y(Vg,t)},e.animation=null!=M?M:null,e.paused=!1,e.style.display="",yield e.flushChanges(),st.loaded()}else qe(),Ze(bf.None);const ut=()=>c(this,void 0,void 0,function*(){if(Oe){rt.launched();try{const e=++At;if(Je()===bf.Preview&&(st.closed("switch"),qe()),Ze(bf.QR),yield lt(f,g),At!==e)return;return $m(k(),W),void rt.loaded()}catch(e){throw rt.failed(e),new l(A(e))}}if(!ke)throw new s("Model does not have AR enabled.");at.launched();try{const t=++At;if(Je()===bf.Preview&&(st.closed("switch"),qe()),wf(O),Ze(bf.AR),fg(),"Glasses"===oe&&gg(),et(),yield jf,At!==t)return;$m(k(),W),vg(oe),Eg(ze()),bg(ve?Ve():null);const n=e=>{it(e.loaded/e.total*100)};if(ie.stop(),Sg())null!=e.customArVideo&&Bg(e.customArVideo),yield xg(le,{envmap:ce,diamondEnvMap:he,onProgress:n},`${le}${ce}${he}`),null!=e.customTrueScaleFaceWidth&&_g(e.customTrueScaleFaceWidth);else{if(yield mg({licenseKey:me,effectUrl:le,effectOptions:{envmap:ce,diamondEnvMap:he},onProgress:n,videoConfig:e.customArVideo,customTrueScaleFaceWidth:e.customTrueScaleFaceWidth}),At!==t)return;$m(k(),W)}if(yg(Ae,ue),wg(de,pe,fe,ge),Cg(at.interacted,ne),Qe&&"Shoes"===oe&&F.apiUsed&&ie.start(Ue),At!==t)return;if($m(k(),W),At!==t)return;$m(k(),W),at.loaded()}catch(e){at.failed(e),nt();const t=A(e);if("CameraPermissionDeniedError"===h(e))throw new o(t);throw new s(t)}finally{tt()}}),dt=()=>c(this,void 0,void 0,function*(){if(!Ge)throw new a("Model does not have 3D enabled.");st.launched();try{Je()===bf.AR&&(at.closed("switch"),ie.stop(),Mg(),ct()),Ze(bf.Preview),yield customElements.whenDefined("shopar-3d");const e=We();e.baseUrl=`${w()}/3d`,e.interactivityDisabled=!ht,e.posterUrl=null!=Te?Te:null,e.glbUrl=Ce,e.envUrl=null!=_e?_e:`${w()}/env/default.hdr`,e.diamondEnvUrl=null!=Ie?Ie:null,e.category=null!=oe?oe:null,e.touchAction=null!=S?S:null,e.zoomDisabled=!B,e.minZoom=null!=R?R:null,e.maxZoom=null!=D?D:null,e.alwaysTransparentBackground=Q,e.toneMapping=null!=xe?xe:"ACES",e.toneMappingExposure=null!=ye?ye:1,e.bloomEnabled=null!=we?we:null,e.bloomStrength=null!=Me?Me:null,e.bloomRadius=null!=Se?Se:null,e.bloomThreshold=null!=Be?Be:null,e.onInteracted=st.interacted,e.onInteractionPerf=se?null:t=>{se=!0,e.onInteractionPerf=null,Y(Vg,t)},e.animation=null!=M?M:null,e.paused=!1,e.style.display="",yield e.flushChanges(),st.loaded()}catch(e){throw st.failed(e),new a(A(e))}}),pt=()=>c(this,void 0,void 0,function*(){Je()!==bf.None&&("AR"!==x||Je()!==bf.AR&&Je()!==bf.QR)&&("3D"===x&&Je()===bf.Preview||(++At,te(),Je()===bf.QR||Je()===bf.AR?(Je()===bf.QR?rt.closed("close"):at.closed("close"),ie.stop(),Mg(),ct()):Je()===bf.Preview&&(st.closed("close"),qe()),Ze(bf.None),"AR"!==x?"3D"!==x||(yield dt()):yield ut()))});return $e(d("launchAR",ut),d("launch3D",dt),d("close",pt)),"AR"===x?(yield ut(),$m(k(),W)):"3D"===x&&(yield dt(),$m(k(),W)),Xm=!1,{launchAR:Pe?d("launchAR",ut):void 0,launch3D:Ge?d("launch3D",dt):void 0,closeAR:Pe?d("closeAR",()=>c(this,void 0,void 0,function*(){Je()!==bf.AR&&Je()!==bf.QR||"AR"!==x&&(++At,te(),Je()===bf.QR?rt.closed("close"):at.closed("close"),ie.stop(),Mg(),ct(),Ze(bf.None),"3D"!==x||(yield dt()))})):void 0,close3D:Ge?d("close3D",()=>c(this,void 0,void 0,function*(){Je()===bf.Preview&&"3D"!==x&&(++At,te(),st.closed("close"),qe(),Ze(bf.None),"AR"!==x||(yield ut()))})):void 0,close:Pe||Ge?d("close",pt):void 0,isInteractive:()=>z(),setInteractive:e=>V(e)}})}function $m(e,t){if(e!==t)throw new Error("Setup cancelled. Please ensure that setup is only called once.")}const ev={setup:function(e){return c(this,void 0,void 0,function*(){return d("visionSetup",()=>Km(e))()})}},tv={setup:function(e){return c(this,void 0,void 0,function*(){return d("setup",()=>Zm(e))()})},version:I};export{i as ApiError,o as CameraPermissionDeniedError,a as Launch3DError,s as LaunchARError,e as PREVIEW_STATES,t as PluginError,l as QRError,r as SanitizationError,n as ValidationError,tv as plugin,ev as vision};
12
+ */var Sh=Uint8Array,Bh=Uint16Array,Th=Int32Array,Rh=new Sh([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Dh=new Sh([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Qh=new Sh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lh=function(e,t){for(var n=new Bh(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Th(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)r[a]=a-n[i]<<5|i;return{b:n,r:r}},Uh=Lh(Rh,2),Ph=Uh.b,Nh=Uh.r;Ph[28]=258,Nh[258]=28;for(var Fh=Lh(Dh,0).b,Oh=new Bh(32768),kh=0;kh<32768;++kh){var Gh=(43690&kh)>>1|(21845&kh)<<1;Gh=(61680&(Gh=(52428&Gh)>>2|(13107&Gh)<<2))>>4|(3855&Gh)<<4,Oh[kh]=((65280&Gh)>>8|(255&Gh)<<8)>>1}var Hh=function(e,t,n){for(var i=e.length,r=0,a=new Bh(t);r<i;++r)e[r]&&++a[e[r]-1];var o,s=new Bh(t);for(r=1;r<t;++r)s[r]=s[r-1]+a[r-1]<<1;o=new Bh(1<<t);var l=15-t;for(r=0;r<i;++r)if(e[r])for(var c=r<<4|e[r],h=t-e[r],A=s[e[r]-1]++<<h,u=A|(1<<h)-1;A<=u;++A)o[Oh[A]>>l]=c;return o},zh=new Sh(288);for(kh=0;kh<144;++kh)zh[kh]=8;for(kh=144;kh<256;++kh)zh[kh]=9;for(kh=256;kh<280;++kh)zh[kh]=7;for(kh=280;kh<288;++kh)zh[kh]=8;var Vh=new Sh(32);for(kh=0;kh<32;++kh)Vh[kh]=5;var Wh=Hh(zh,9),qh=Hh(Vh,5),jh=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Yh=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},Xh=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Kh=function(e){return(e+7)/8|0},Jh=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Zh=function(e,t,n){var i=new Error(t||Jh[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,Zh),!n)throw i;return i},$h=new Sh(0);function eA(e,t){return function(e,t,n,i){var r=e.length;if(!r||t.f&&!t.l)return n||new Sh(0);var a=!n,o=a||2!=t.i,s=t.i;a&&(n=new Sh(3*r));var l=function(e){var t=n.length;if(e>t){var i=new Sh(Math.max(2*t,e));i.set(n),n=i}},c=t.f||0,h=t.p||0,A=t.b||0,u=t.l,d=t.d,p=t.m,f=t.n,g=8*r;do{if(!u){c=Yh(e,h,1);var m=Yh(e,h+1,3);if(h+=3,!m){var v=e[(B=Kh(h)+4)-4]|e[B-3]<<8,E=B+v;if(E>r){s&&Zh(0);break}o&&l(A+v),n.set(e.subarray(B,E),A),t.b=A+=v,t.p=h=8*E,t.f=c;continue}if(1==m)u=Wh,d=qh,p=9,f=5;else if(2==m){var b=Yh(e,h,31)+257,C=Yh(e,h+10,15)+4,_=b+Yh(e,h+5,31)+1;h+=14;for(var I=new Sh(_),x=new Sh(19),y=0;y<C;++y)x[Qh[y]]=Yh(e,h+3*y,7);h+=3*C;var M=jh(x),w=(1<<M)-1,S=Hh(x,M);for(y=0;y<_;){var B,T=S[Yh(e,h,w)];if(h+=15&T,(B=T>>4)<16)I[y++]=B;else{var R=0,D=0;for(16==B?(D=3+Yh(e,h,3),h+=2,R=I[y-1]):17==B?(D=3+Yh(e,h,7),h+=3):18==B&&(D=11+Yh(e,h,127),h+=7);D--;)I[y++]=R}}var Q=I.subarray(0,b),L=I.subarray(b);p=jh(Q),f=jh(L),u=Hh(Q,p),d=Hh(L,f)}else Zh(1);if(h>g){s&&Zh(0);break}}o&&l(A+131072);for(var U=(1<<p)-1,P=(1<<f)-1,N=h;;N=h){var F=(R=u[Xh(e,h)&U])>>4;if((h+=15&R)>g){s&&Zh(0);break}if(R||Zh(2),F<256)n[A++]=F;else{if(256==F){N=h,u=null;break}var O=F-254;if(F>264){var k=Rh[y=F-257];O=Yh(e,h,(1<<k)-1)+Ph[y],h+=k}var G=d[Xh(e,h)&P],H=G>>4;if(G||Zh(3),h+=15&G,L=Fh[H],H>3&&(k=Dh[H],L+=Xh(e,h)&(1<<k)-1,h+=k),h>g){s&&Zh(0);break}o&&l(A+131072);var z=A+O;if(A<L){var V=0-L,W=Math.min(L,z);for(V+A<0&&Zh(3);A<W;++A)n[A]=i[V+A]}for(;A<z;++A)n[A]=n[A-L]}}t.l=u,t.p=N,t.b=A,t.f=c,u&&(c=1,t.m=p,t.d=d,t.n=f)}while(!c);return A!=n.length&&a?function(e,t,n){return(null==n||n>e.length)&&(n=e.length),new Sh(e.subarray(0,n))}(n,0,A):n.subarray(0,A)}(e.subarray((i=t,(8!=(15&(n=e)[0])||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Zh(6,"invalid zlib data"),(n[1]>>5&1)==+!i&&Zh(6,"invalid zlib data: "+(32&n[1]?"need":"unexpected")+" dictionary"),2+(n[1]>>3&4)),-4),{i:2},t,t);var n,i}var tA="undefined"!=typeof TextDecoder&&new TextDecoder;try{tA.decode($h,{stream:!0})}catch(Zd){}class nA extends mc{constructor(e){super(e),this.type=Ze}parse(e){const t=65536,n=14,i=65537,r=Math.pow(2.7182818,2.2),a={l:0,c:0,lc:0};function o(e,t,n,i,r){for(;n<e;)t=t<<8|k(i,r),n+=8;n-=e,a.l=t>>n&(1<<e)-1,a.c=t,a.lc=n}const s=new Array(59);function l(e,t,n,r,l,c){const h=t;let A=0,u=0;for(;r<=l;r++){if(h.value-t.value>n)return!1;o(6,A,u,e,h);const i=a.l;if(A=a.c,u=a.lc,c[r]=i,63==i){if(h.value-t.value>n)throw new Error("Something wrong with hufUnpackEncTable");o(8,A,u,e,h);let i=a.l+6;if(A=a.c,u=a.lc,r+i>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;i--;)c[r++]=0;r--}else if(i>=59){let e=i-59+2;if(r+e>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;e--;)c[r++]=0;r--}}!function(e){for(let e=0;e<=58;++e)s[e]=0;for(let t=0;t<i;++t)s[e[t]]+=1;let t=0;for(let e=58;e>0;--e){const n=t+s[e]>>1;s[e]=t,t=n}for(let t=0;t<i;++t){const n=e[t];n>0&&(e[t]=n|s[n]++<<6)}}(c)}function c(e){return 63&e}function h(e){return e>>6}const A={c:0,lc:0};function u(e,t,n,i){e=e<<8|k(n,i),t+=8,A.c=e,A.lc=t}const d={c:0,lc:0};function p(e,t,n,i,r,a,o,s,l){if(e==t){i<8&&(u(n,i,r,a),n=A.c,i=A.lc);let e=n>>(i-=8);if(e=new Uint8Array([e])[0],s.value+e>l)return!1;const t=o[s.value-1];for(;e-- >0;)o[s.value++]=t}else{if(!(s.value<l))return!1;o[s.value++]=e}d.c=n,d.lc=i}function f(e){return 65535&e}function g(e){const t=f(e);return t>32767?t-65536:t}const m={a:0,b:0};function v(e,t){const n=g(e),i=g(t),r=n+(1&i)+(i>>1),a=r,o=r-i;m.a=a,m.b=o}function E(e,t){const n=f(e),i=f(t),r=n-(i>>1)&65535,a=i+r-32768&65535;m.a=a,m.b=r}function b(e,t,n,i,r,a,o){const s=o<16384,l=n>r?r:n;let c,h,A=1;for(;A<=l;)A<<=1;for(A>>=1,c=A,A>>=1;A>=1;){h=0;const o=h+a*(r-c),l=a*A,u=a*c,d=i*A,p=i*c;let f,g,b,C;for(;h<=o;h+=u){let r=h;const a=h+i*(n-c);for(;r<=a;r+=p){const n=r+d,i=r+l,a=i+d;s?(v(e[r+t],e[i+t]),f=m.a,b=m.b,v(e[n+t],e[a+t]),g=m.a,C=m.b,v(f,g),e[r+t]=m.a,e[n+t]=m.b,v(b,C),e[i+t]=m.a,e[a+t]=m.b):(E(e[r+t],e[i+t]),f=m.a,b=m.b,E(e[n+t],e[a+t]),g=m.a,C=m.b,E(f,g),e[r+t]=m.a,e[n+t]=m.b,E(b,C),e[i+t]=m.a,e[a+t]=m.b)}if(n&A){const n=r+l;s?v(e[r+t],e[n+t]):E(e[r+t],e[n+t]),f=m.a,e[n+t]=m.b,e[r+t]=f}}if(r&A){let r=h;const a=h+i*(n-c);for(;r<=a;r+=p){const n=r+d;s?v(e[r+t],e[n+t]):E(e[r+t],e[n+t]),f=m.a,e[n+t]=m.b,e[r+t]=f}}c=A,A>>=1}return h}function C(e,t,r,a,o,s){const f=r.value,g=O(t,r),m=O(t,r);r.value+=4;const v=O(t,r);if(r.value+=4,g<0||g>=i||m<0||m>=i)throw new Error("Something wrong with HUF_ENCSIZE");const E=new Array(i),b=new Array(16384);if(function(e){for(let t=0;t<16384;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(b),l(e,r,a-(r.value-f),g,m,E),v>8*(a-(r.value-f)))throw new Error("Something wrong with hufUncompress");!function(e,t,i,r){for(;t<=i;t++){const i=h(e[t]),a=c(e[t]);if(i>>a)throw new Error("Invalid table entry");if(a>n){const e=r[i>>a-n];if(e.len)throw new Error("Invalid table entry");if(e.lit++,e.p){const t=e.p;e.p=new Array(e.lit);for(let n=0;n<e.lit-1;++n)e.p[n]=t[n]}else e.p=new Array(1);e.p[e.lit-1]=t}else if(a){let e=0;for(let o=1<<n-a;o>0;o--){const o=r[(i<<n-a)+e];if(o.len||o.p)throw new Error("Invalid table entry");o.len=a,o.lit=t,e++}}}}(E,g,m,b),function(e,t,i,r,a,o,s,l,f){let g=0,m=0;const v=s,E=Math.trunc(r.value+(a+7)/8);for(;r.value<E;)for(u(g,m,i,r),g=A.c,m=A.lc;m>=n;){const a=t[g>>m-n&16383];if(a.len)m-=a.len,p(a.lit,o,g,m,i,r,l,f,v),g=d.c,m=d.lc;else{if(!a.p)throw new Error("hufDecode issues");let t;for(t=0;t<a.lit;t++){const n=c(e[a.p[t]]);for(;m<n&&r.value<E;)u(g,m,i,r),g=A.c,m=A.lc;if(m>=n&&h(e[a.p[t]])==(g>>m-n&(1<<n)-1)){m-=n,p(a.p[t],o,g,m,i,r,l,f,v),g=d.c,m=d.lc;break}}if(t==a.lit)throw new Error("hufDecode issues")}}const b=8-a&7;for(g>>=b,m-=b;m>0;){const e=t[g<<n-m&16383];if(!e.len)throw new Error("hufDecode issues");m-=e.len,p(e.lit,o,g,m,i,r,l,f,v),g=d.c,m=d.lc}}(E,b,e,r,v,m,s,o,{value:0})}function _(e){for(let t=1;t<e.length;t++){const n=e[t-1]+e[t]-128;e[t]=n}}function I(e,t){let n=0,i=Math.floor((e.length+1)/2),r=0;const a=e.length-1;for(;!(r>a||(t[r++]=e[n++],r>a));)t[r++]=e[i++]}function x(e){let t=e.byteLength;const n=new Array;let i=0;const r=new DataView(e);for(;t>0;){const e=r.getInt8(i++);if(e<0){const a=-e;t-=a+1;for(let e=0;e<a;e++)n.push(r.getUint8(i++))}else{const a=e;t-=2;const o=r.getUint8(i++);for(let e=0;e<a+1;e++)n.push(o)}}return n}function y(e,t,n){let i,r=1;for(;r<64;)i=t[e.value],65280==i?r=64:i>>8==255?r+=255&i:(n[r]=i,r++),e.value++}function M(e,t){t[0]=W(e[0]),t[1]=W(e[1]),t[2]=W(e[5]),t[3]=W(e[6]),t[4]=W(e[14]),t[5]=W(e[15]),t[6]=W(e[27]),t[7]=W(e[28]),t[8]=W(e[2]),t[9]=W(e[4]),t[10]=W(e[7]),t[11]=W(e[13]),t[12]=W(e[16]),t[13]=W(e[26]),t[14]=W(e[29]),t[15]=W(e[42]),t[16]=W(e[3]),t[17]=W(e[8]),t[18]=W(e[12]),t[19]=W(e[17]),t[20]=W(e[25]),t[21]=W(e[30]),t[22]=W(e[41]),t[23]=W(e[43]),t[24]=W(e[9]),t[25]=W(e[11]),t[26]=W(e[18]),t[27]=W(e[24]),t[28]=W(e[31]),t[29]=W(e[40]),t[30]=W(e[44]),t[31]=W(e[53]),t[32]=W(e[10]),t[33]=W(e[19]),t[34]=W(e[23]),t[35]=W(e[32]),t[36]=W(e[39]),t[37]=W(e[45]),t[38]=W(e[52]),t[39]=W(e[54]),t[40]=W(e[20]),t[41]=W(e[22]),t[42]=W(e[33]),t[43]=W(e[38]),t[44]=W(e[46]),t[45]=W(e[51]),t[46]=W(e[55]),t[47]=W(e[60]),t[48]=W(e[21]),t[49]=W(e[34]),t[50]=W(e[37]),t[51]=W(e[47]),t[52]=W(e[50]),t[53]=W(e[56]),t[54]=W(e[59]),t[55]=W(e[61]),t[56]=W(e[35]),t[57]=W(e[36]),t[58]=W(e[48]),t[59]=W(e[49]),t[60]=W(e[57]),t[61]=W(e[58]),t[62]=W(e[62]),t[63]=W(e[63])}function w(e){const t=.5*Math.cos(.7853975),n=.5*Math.cos(3.14159/16),i=.5*Math.cos(3.14159/8),r=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(.981746875),o=.5*Math.cos(3*3.14159/8),s=.5*Math.cos(1.374445625),l=new Array(4),c=new Array(4),h=new Array(4),A=new Array(4);for(let u=0;u<8;++u){const d=8*u;l[0]=i*e[d+2],l[1]=o*e[d+2],l[2]=i*e[d+6],l[3]=o*e[d+6],c[0]=n*e[d+1]+r*e[d+3]+a*e[d+5]+s*e[d+7],c[1]=r*e[d+1]-s*e[d+3]-n*e[d+5]-a*e[d+7],c[2]=a*e[d+1]-n*e[d+3]+s*e[d+5]+r*e[d+7],c[3]=s*e[d+1]-a*e[d+3]+r*e[d+5]-n*e[d+7],h[0]=t*(e[d+0]+e[d+4]),h[3]=t*(e[d+0]-e[d+4]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],A[0]=h[0]+h[1],A[1]=h[3]+h[2],A[2]=h[3]-h[2],A[3]=h[0]-h[1],e[d+0]=A[0]+c[0],e[d+1]=A[1]+c[1],e[d+2]=A[2]+c[2],e[d+3]=A[3]+c[3],e[d+4]=A[3]-c[3],e[d+5]=A[2]-c[2],e[d+6]=A[1]-c[1],e[d+7]=A[0]-c[0]}for(let u=0;u<8;++u)l[0]=i*e[16+u],l[1]=o*e[16+u],l[2]=i*e[48+u],l[3]=o*e[48+u],c[0]=n*e[8+u]+r*e[24+u]+a*e[40+u]+s*e[56+u],c[1]=r*e[8+u]-s*e[24+u]-n*e[40+u]-a*e[56+u],c[2]=a*e[8+u]-n*e[24+u]+s*e[40+u]+r*e[56+u],c[3]=s*e[8+u]-a*e[24+u]+r*e[40+u]-n*e[56+u],h[0]=t*(e[u]+e[32+u]),h[3]=t*(e[u]-e[32+u]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],A[0]=h[0]+h[1],A[1]=h[3]+h[2],A[2]=h[3]-h[2],A[3]=h[0]-h[1],e[0+u]=A[0]+c[0],e[8+u]=A[1]+c[1],e[16+u]=A[2]+c[2],e[24+u]=A[3]+c[3],e[32+u]=A[3]-c[3],e[40+u]=A[2]-c[2],e[48+u]=A[1]-c[1],e[56+u]=A[0]-c[0]}function S(e){for(let t=0;t<64;++t){const n=e[0][t],i=e[1][t],r=e[2][t];e[0][t]=n+1.5747*r,e[1][t]=n-.1873*i-.4682*r,e[2][t]=n+1.8556*i}}function B(e,t,n){for(let i=0;i<64;++i)t[n+i]=tr(T(e[i]))}function T(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(r,Math.abs(e)-1)}function R(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function D(e){const t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),n=new Uint8Array(x(t)),i=new Uint8Array(n.length);return _(n),I(n,i),new DataView(i.buffer)}function Q(e){const t=eA(e.array.slice(e.offset.value,e.offset.value+e.size)),n=new Uint8Array(t.length);return _(t),I(t,n),new DataView(n.buffer)}function L(e){const n=e.viewer,i={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),a=new Uint8Array(8192);let o=0;const s=new Array(e.inputChannels.length);for(let t=0,n=e.inputChannels.length;t<n;t++)s[t]={},s[t].start=o,s[t].end=s[t].start,s[t].nx=e.columns,s[t].ny=e.lines,s[t].size=e.type,o+=s[t].nx*s[t].ny*s[t].size;const l=q(n,i),c=q(n,i);if(c>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(l<=c)for(let e=0;e<c-l+1;e++)a[e+l]=G(n,i);const h=new Uint16Array(t),A=function(e,n){let i=0;for(let r=0;r<t;++r)(0==r||e[r>>3]&1<<(7&r))&&(n[i++]=r);const r=i-1;for(;i<t;)n[i++]=0;return r}(a,h),u=O(n,i);C(e.array,n,i,u,r,o);for(let t=0;t<e.inputChannels.length;++t){const e=s[t];for(let n=0;n<s[t].size;++n)b(r,e.start+n,e.nx,e.size,e.ny,e.nx*e.size,A)}!function(e,t,n){for(let i=0;i<n;++i)t[i]=e[t[i]]}(h,r,o);let d=0;const p=new Uint8Array(r.buffer.byteLength);for(let t=0;t<e.lines;t++)for(let t=0;t<e.inputChannels.length;t++){const e=s[t],n=e.nx*e.size,i=new Uint8Array(r.buffer,2*e.end,2*n);p.set(i,d),d+=2*n,e.end+=n}return new DataView(p.buffer)}function U(e){const t=eA(e.array.slice(e.offset.value,e.offset.value+e.size)),n=e.inputChannels.length*e.lines*e.columns*e.totalBytes,i=new ArrayBuffer(n),r=new DataView(i);let a=0,o=0;const s=new Array(4);for(let n=0;n<e.lines;n++)for(let n=0;n<e.inputChannels.length;n++){let i=0;switch(e.inputChannels[n].pixelType){case 1:s[0]=a,s[1]=s[0]+e.columns,a=s[1]+e.columns;for(let n=0;n<e.columns;++n)i+=t[s[0]++]<<8|t[s[1]++],r.setUint16(o,i,!0),o+=2;break;case 2:s[0]=a,s[1]=s[0]+e.columns,s[2]=s[1]+e.columns,a=s[2]+e.columns;for(let n=0;n<e.columns;++n)i+=t[s[0]++]<<24|t[s[1]++]<<16|t[s[2]++]<<8,r.setUint32(o,i,!0),o+=4}}return r}function P(e){const t=e.viewer,n={value:e.offset.value},i=new Uint8Array(e.columns*e.lines*(e.inputChannels.length*e.type*2)),r={version:H(t,n),unknownUncompressedSize:H(t,n),unknownCompressedSize:H(t,n),acCompressedSize:H(t,n),dcCompressedSize:H(t,n),rleCompressedSize:H(t,n),rleUncompressedSize:H(t,n),rleRawSize:H(t,n),totalAcUncompressedCount:H(t,n),totalDcUncompressedCount:H(t,n),acCompression:H(t,n)};if(r.version<2)throw new Error("EXRLoader.parse: "+te.compression+" version "+r.version+" is unsupported");const a=new Array;let o=q(t,n)-2;for(;o>0;){const e=N(t.buffer,n),i=G(t,n),r=i>>2&3,s=new Int8Array([(i>>4)-1])[0],l=G(t,n);a.push({name:e,index:s,type:l,compression:r}),o-=e.length+3}const s=te.channels,l=new Array(e.inputChannels.length);for(let t=0;t<e.inputChannels.length;++t){const n=l[t]={},i=s[t];n.name=i.name,n.compression=0,n.decoded=!1,n.type=i.pixelType,n.pLinear=i.pLinear,n.width=e.columns,n.height=e.lines}const c={idx:new Array(3)};for(let t=0;t<e.inputChannels.length;++t){const e=l[t];for(let n=0;n<a.length;++n){const i=a[n];e.name==i.name&&(e.compression=i.compression,i.index>=0&&(c.idx[i.index]=t),e.offset=t)}}let h,A,u;if(r.acCompressedSize>0)switch(r.acCompression){case 0:h=new Uint16Array(r.totalAcUncompressedCount),C(e.array,t,n,r.acCompressedSize,h,r.totalAcUncompressedCount);break;case 1:const i=eA(e.array.slice(n.value,n.value+r.totalAcUncompressedCount));h=new Uint16Array(i.buffer),n.value+=r.totalAcUncompressedCount}if(r.dcCompressedSize>0){const t={array:e.array,offset:n,size:r.dcCompressedSize};A=new Uint16Array(Q(t).buffer),n.value+=r.dcCompressedSize}r.rleRawSize>0&&(u=x(eA(e.array.slice(n.value,n.value+r.rleCompressedSize)).buffer),n.value+=r.rleCompressedSize);let d=0;const p=new Array(l.length);for(let e=0;e<p.length;++e)p[e]=new Array;for(let t=0;t<e.lines;++t)for(let t=0;t<l.length;++t)p[t].push(d),d+=l[t].width*e.type*2;!function(e,t,n,i,r,a){let o=new DataView(a.buffer);const s=n[e.idx[0]].width,l=n[e.idx[0]].height,c=Math.floor(s/8),h=Math.ceil(s/8),A=Math.ceil(l/8),u=s-8*(h-1),d=l-8*(A-1),p={value:0},f=new Array(3),g=new Array(3),m=new Array(3),v=new Array(3),E=new Array(3);for(let n=0;n<3;++n)E[n]=t[e.idx[n]],f[n]=n<1?0:f[n-1]+h*A,g[n]=new Float32Array(64),m[n]=new Uint16Array(64),v[n]=new Uint16Array(64*h);for(let t=0;t<A;++t){let a=8;t==A-1&&(a=d);let s=8;for(let e=0;e<h;++e){e==h-1&&(s=u);for(let e=0;e<3;++e)m[e].fill(0),m[e][0]=r[f[e]++],y(p,i,m[e]),M(m[e],g[e]),w(g[e]);S(g);for(let t=0;t<3;++t)B(g[t],v[t],64*e)}let l=0;for(let i=0;i<3;++i){const r=n[e.idx[i]].type;for(let e=8*t;e<8*t+a;++e){l=E[i][e];for(let t=0;t<c;++t){const n=64*t+8*(7&e);o.setUint16(l+0*r,v[i][n+0],!0),o.setUint16(l+2*r,v[i][n+1],!0),o.setUint16(l+4*r,v[i][n+2],!0),o.setUint16(l+6*r,v[i][n+3],!0),o.setUint16(l+8*r,v[i][n+4],!0),o.setUint16(l+10*r,v[i][n+5],!0),o.setUint16(l+12*r,v[i][n+6],!0),o.setUint16(l+14*r,v[i][n+7],!0),l+=16*r}}if(c!=h)for(let e=8*t;e<8*t+a;++e){const t=E[i][e]+8*c*2*r,n=64*c+8*(7&e);for(let e=0;e<s;++e)o.setUint16(t+2*e*r,v[i][n+e],!0)}}}const b=new Uint16Array(s);o=new DataView(a.buffer);for(let t=0;t<3;++t){n[e.idx[t]].decoded=!0;const i=n[e.idx[t]].type;if(2==n[t].type)for(let e=0;e<l;++e){const n=E[t][e];for(let e=0;e<s;++e)b[e]=o.getUint16(n+2*e*i,!0);for(let e=0;e<s;++e)o.setFloat32(n+2*e*i,W(b[e]),!0)}}}(c,p,l,h,A,i);for(let t=0;t<l.length;++t){const n=l[t];if(!n.decoded){if(2!==n.compression)throw new Error("EXRLoader.parse: unsupported channel compression");{let r=0,a=0;for(let o=0;o<e.lines;++o){let e=p[t][r];for(let t=0;t<n.width;++t){for(let t=0;t<2*n.type;++t)i[e++]=u[a+t*n.width*n.height];a++}r++}}}}return new DataView(i.buffer)}function N(e,t){const n=new Uint8Array(e);let i=0;for(;0!=n[t.value+i];)i+=1;const r=(new TextDecoder).decode(n.slice(t.value,t.value+i));return t.value=t.value+i+1,r}function F(e,t){const n=e.getInt32(t.value,!0);return t.value=t.value+4,n}function O(e,t){const n=e.getUint32(t.value,!0);return t.value=t.value+4,n}function k(e,t){const n=e[t.value];return t.value=t.value+1,n}function G(e,t){const n=e.getUint8(t.value);return t.value=t.value+1,n}const H=function(e,t){let n;return n="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,n};function z(e,t){const n=e.getFloat32(t.value,!0);return t.value+=4,n}function V(e,t){return tr(z(e,t))}function W(e){const t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:Math.pow(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}function q(e,t){const n=e.getUint16(t.value,!0);return t.value+=2,n}function j(e,t){return W(q(e,t))}function Y(e,t,n,i,r){return"string"===i||"stringvector"===i||"iccProfile"===i?function(e,t,n){const i=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+n));return t.value=t.value+n,i}(t,n,r):"chlist"===i?function(e,t,n,i){const r=n.value,a=[];for(;n.value<r+i-1;){const i=N(t,n),r=F(e,n),o=G(e,n);n.value+=3;const s=F(e,n),l=F(e,n);a.push({name:i,pixelType:r,pLinear:o,xSampling:s,ySampling:l})}return n.value+=1,a}(e,t,n,r):"chromaticities"===i?function(e,t){return{redX:z(e,t),redY:z(e,t),greenX:z(e,t),greenY:z(e,t),blueX:z(e,t),blueY:z(e,t),whiteX:z(e,t),whiteY:z(e,t)}}(e,n):"compression"===i?function(e,t){return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][G(e,t)]}(e,n):"box2i"===i?function(e,t){return{xMin:F(e,t),yMin:F(e,t),xMax:F(e,t),yMax:F(e,t)}}(e,n):"envmap"===i?function(e,t){return["ENVMAP_LATLONG","ENVMAP_CUBE"][G(e,t)]}(e,n):"tiledesc"===i?function(e,t){const n=O(e,t),i=O(e,t),r=G(e,t);return{xSize:n,ySize:i,levelMode:["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"][15&r],roundingMode:["ROUND_DOWN","ROUND_UP"][r>>4]}}(e,n):"lineOrder"===i?function(e,t){return["INCREASING_Y","DECREASING_Y","RANDOM_Y"][G(e,t)]}(e,n):"float"===i?z(e,n):"v2f"===i?function(e,t){return[z(e,t),z(e,t)]}(e,n):"v3f"===i?function(e,t){return[z(e,t),z(e,t),z(e,t)]}(e,n):"int"===i?F(e,n):"rational"===i?function(e,t){return[F(e,t),O(e,t)]}(e,n):"timecode"===i?function(e,t){return[O(e,t),O(e,t)]}(e,n):"preview"===i?(n.value+=r,"skipped"):void(n.value+=r)}function X(e,t,n,i){const r=new Array(e);for(let a=0;a<e;a++){const e=1<<a;let o=t/e|0;"ROUND_UP"==i&&o*e<t&&(o+=1);const s=Math.max(o,1);r[a]=(s+n-1)/n|0}return r}function K(){const e=this,t=e.offset,n={value:0};for(let i=0;i<e.tileCount;i++){const i=F(e.viewer,t),r=F(e.viewer,t);t.value+=8,e.size=O(e.viewer,t);const a=i*e.blockWidth,o=r*e.blockHeight;e.columns=a+e.blockWidth>e.width?e.width-a:e.blockWidth,e.lines=o+e.blockHeight>e.height?e.height-o:e.blockHeight;const s=e.columns*e.totalBytes,l=e.size<e.lines*s?e.uncompress(e):R(e);t.value+=e.size;for(let t=0;t<e.lines;t++){const i=t*e.columns*e.totalBytes;for(let r=0;r<e.inputChannels.length;r++){const s=te.channels[r].name,c=e.channelByteOffsets[s]*e.columns,h=e.decodeChannels[s];if(void 0===h)continue;n.value=i+c;const A=(e.height-(1+o+t))*e.outLineWidth;for(let t=0;t<e.columns;t++){const i=A+(t+a)*e.outputChannels+h;e.byteArray[i]=e.getter(l,n)}}}}}function J(){const e=this,t=e.offset,n={value:0};for(let i=0;i<e.height/e.blockHeight;i++){const r=F(e.viewer,t)-te.dataWindow.yMin;e.size=O(e.viewer,t),e.lines=r+e.blockHeight>e.height?e.height-r:e.blockHeight;const a=e.columns*e.totalBytes,o=e.size<e.lines*a?e.uncompress(e):R(e);t.value+=e.size;for(let t=0;t<e.blockHeight;t++){const r=i*e.blockHeight,s=t+e.scanOrder(r);if(s>=e.height)continue;const l=t*a,c=(e.height-1-s)*e.outLineWidth;for(let t=0;t<e.inputChannels.length;t++){const i=te.channels[t].name,r=e.channelByteOffsets[i]*e.columns,a=e.decodeChannels[i];if(void 0!==a){n.value=l+r;for(let t=0;t<e.columns;t++){const i=c+t*e.outputChannels+a;e.byteArray[i]=e.getter(o,n)}}}}}}const Z={value:0},$=new DataView(e),ee=new Uint8Array(e),te=function(e,t,n){const i={};if(20000630!=e.getUint32(0,!0))throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");i.version=e.getUint8(4);const r=e.getUint8(5);i.spec={singleTile:!!(2&r),longName:!!(4&r),deepFormat:!!(8&r),multiPart:!!(16&r)},n.value=8;let a=!0;for(;a;){const r=N(t,n);if(0==r)a=!1;else{const a=N(t,n),o=Y(e,t,n,a,O(e,n));void 0===o?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${a}'.`):i[r]=o}}if(-7&r)throw console.error("THREE.EXRHeader:",i),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return i}($,e,Z),ne=function(e,t,n,i,r){const a={size:0,viewer:t,array:n,offset:i,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,inputChannels:e.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:_t};switch(e.compression){case"NO_COMPRESSION":a.blockHeight=1,a.uncompress=R;break;case"RLE_COMPRESSION":a.blockHeight=1,a.uncompress=D;break;case"ZIPS_COMPRESSION":a.blockHeight=1,a.uncompress=Q;break;case"ZIP_COMPRESSION":a.blockHeight=16,a.uncompress=Q;break;case"PIZ_COMPRESSION":a.blockHeight=32,a.uncompress=L;break;case"PXR24_COMPRESSION":a.blockHeight=16,a.uncompress=U;break;case"DWAA_COMPRESSION":a.blockHeight=32,a.uncompress=P;break;case"DWAB_COMPRESSION":a.blockHeight=256,a.uncompress=P;break;default:throw new Error("EXRLoader.parse: "+e.compression+" is unsupported")}const o={};for(const t of e.channels)switch(t.name){case"Y":case"R":case"G":case"B":case"A":o[t.name]=!0,a.type=t.pixelType}let s=!1;if(o.R&&o.G&&o.B)s=!o.A,a.outputChannels=4,a.decodeChannels={R:0,G:1,B:2,A:3};else{if(!o.Y)throw new Error("EXRLoader.parse: file contains unsupported data channels.");a.outputChannels=1,a.decodeChannels={Y:0}}if(1==a.type)switch(r){case Je:a.getter=j;break;case Ze:a.getter=q}else{if(2!=a.type)throw new Error("EXRLoader.parse: unsupported pixelType "+a.type+" for "+e.compression+".");switch(r){case Je:a.getter=z;break;case Ze:a.getter=V}}a.columns=a.width;const l=a.width*a.height*a.outputChannels;switch(r){case Je:a.byteArray=new Float32Array(l),s&&a.byteArray.fill(1,0,l);break;case Ze:a.byteArray=new Uint16Array(l),s&&a.byteArray.fill(15360,0,l);break;default:console.error("THREE.EXRLoader: unsupported type: ",r)}let c=0;for(const t of e.channels)void 0!==a.decodeChannels[t.name]&&(a.channelByteOffsets[t.name]=c),c+=2*t.pixelType;if(a.totalBytes=c,a.outLineWidth=a.width*a.outputChannels,"INCREASING_Y"===e.lineOrder?a.scanOrder=e=>e:a.scanOrder=e=>a.height-1-e,4==a.outputChannels?(a.format=et,a.colorSpace=_t):(a.format=it,a.colorSpace=bt),e.spec.singleTile){a.blockHeight=e.tiles.ySize,a.blockWidth=e.tiles.xSize;const n=function(e,t,n){let i=0;switch(e.levelMode){case"ONE_LEVEL":i=1;break;case"MIPMAP_LEVELS":i=function(e,t){const n=Math.log2(e);return"ROUND_DOWN"==t?Math.floor(n):Math.ceil(n)}(Math.max(t,n),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return i}(e.tiles,a.width,a.height),r=X(n,a.width,e.tiles.xSize,e.tiles.roundingMode),o=X(n,a.height,e.tiles.ySize,e.tiles.roundingMode);a.tileCount=r[0]*o[0];for(let e=0;e<n;e++)for(let n=0;n<o[e];n++)for(let n=0;n<r[e];n++)H(t,i);a.decode=K.bind(a)}else{a.blockWidth=a.width;const e=Math.ceil(a.height/a.blockHeight);for(let n=0;n<e;n++)H(t,i);a.decode=J.bind(a)}return a}(te,$,ee,Z,this.type);return ne.decode(),{header:te,width:ne.width,height:ne.height,data:ne.byteArray,format:ne.format,colorSpace:ne.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){e.colorSpace=n.colorSpace,e.minFilter=We,e.magFilter=We,e.generateMipmaps=!1,e.flipY=!1,t&&t(e,n)},n,i)}}let iA,rA=!1;function aA(e){rA||(iA=new wh,new nA,rA=!0);const t=function(e){const t=new Al(e.data,e.width,e.height,void 0,e.type,void 0,ke,ke,We,We,1,_t);return t.flipY=!0,t.generateMipmaps=!1,t.needsUpdate=!0,t}(iA.parse(e));return t.mapping=Ne,t.colorSpace=_t,t}var oA=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var n,i=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",r=WebAssembly.instantiate(a(i),{}).then(function(e){(n=e.instance).exports.__wasm_call_ctors()});function a(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var r=e.charCodeAt(i);n[i]=r>96?r-97:r>64?r-39:r+4}var a=0;for(i=0;i<e.length;++i)n[a++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,a)}function o(e,t,i,r,a,o){var s=n.exports.sbrk,l=i+3&-4,c=s(l*r),h=s(a.length),A=new Uint8Array(n.exports.memory.buffer);A.set(a,h);var u=e(c,i,r,h,a.length);if(0==u&&o&&o(c,l,r),t.set(A.subarray(c,c+i*r)),s(c-s(0)),0!=u)throw new Error("Malformed buffer data: "+u)}var s={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},c=[],h=0;function A(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function u(e){r.then(function(){var t=e.data;try{var i=new Uint8Array(t.count*t.size);o(n.exports[t.mode],i,t.count,t.size,t.source,n.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:i},[i.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:"reject",value:e})}})}return{ready:r,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(a(i))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+u.toString(),n=new Blob([t],{type:"text/javascript"}),r=URL.createObjectURL(n),s=0;s<e;++s)c[s]=A(r);URL.revokeObjectURL(r)}(e)},decodeVertexBuffer:function(e,t,i,r,a){o(n.exports.meshopt_decodeVertexBuffer,e,t,i,r,n.exports[s[a]])},decodeIndexBuffer:function(e,t,i,r){o(n.exports.meshopt_decodeIndexBuffer,e,t,i,r)},decodeIndexSequence:function(e,t,i,r){o(n.exports.meshopt_decodeIndexSequence,e,t,i,r)},decodeGltfBuffer:function(e,t,i,r,a,c){o(n.exports[l[a]],e,t,i,r,n.exports[s[c]])},decodeGltfBufferAsync:function(e,t,i,a,A){return c.length>0?function(e,t,n,i,r){for(var a=c[0],o=1;o<c.length;++o)c[o].pending<a.pending&&(a=c[o]);return new Promise(function(o,s){var l=new Uint8Array(n),c=h++;a.pending+=e,a.requests[c]={resolve:o,reject:s},a.object.postMessage({id:c,count:e,size:t,source:l,mode:i,filter:r},[l.buffer])})}(e,t,i,l[a],s[A]):r.then(function(){var r=new Uint8Array(e*t);return o(n.exports[l[a]],r,e,t,i,n.exports[s[A]]),r})}}}();const sA=new WeakMap;class lA extends uc{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const r=new fc(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,e=>{this.parse(e,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,Ct,n).catch(n)}decodeDracoFile(e,t,n,i,r=_t,a=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,o).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(sA.has(e)){const t=sA.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(r,a).then(n=>(i=n,new Promise((n,a)=>{i._callbacks[r]={resolve:n,reject:a},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),sA.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new fr;e.index&&t.setIndex(new rr(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,a=i.array,o=i.itemSize,s=new rr(a,o);"color"===r&&(this._assignVertexColorSpace(s,i.vertexColorSpace),s.normalized=a instanceof Float32Array==0),t.setAttribute(r,s)}return t}_assignVertexColorSpace(e,t){if(t!==Ct)return;const n=new Xi;for(let t=0,i=e.count;t<i;t++)n.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new fc(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((t,i)=>{n.load(e,t,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=cA.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function cA(){let e,t;function n(e,t,n,i,r,a){const o=a.num_components(),s=n.num_points()*o,l=s*r.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,r),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,a,c,l,h);const A=new r(e.HEAPF32.buffer,h,s).slice();return e._free(h),{name:i,array:A,itemSize:o}}onmessage=function(i){const r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":const i=r.buffer,a=r.taskConfig;t.then(e=>{const t=e.draco,o=new t.Decoder;try{const e=function(e,t,i,r){const a=r.attributeIDs,o=r.attributeTypes;let s,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)s=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,s);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");s=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,s)}if(!l.ok()||0===s.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in a){const l=self[o[i]];let c,A;if(r.useUniqueIDs)A=a[i],c=t.GetAttributeByUniqueId(s,A);else{if(A=t.GetAttributeId(s,e[a[i]]),-1===A)continue;c=t.GetAttribute(s,A)}const u=n(e,t,s,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,a=e._malloc(r);t.GetTrianglesUInt32Array(n,r,a);const o=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:o,itemSize:1}}(e,t,s)),e.destroy(s),h}(t,o,new Int8Array(i),a),s=e.attributes.map(e=>e.array.buffer);e.index&&s.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},s)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(o)}})}}}function hA(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(2===t)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=e.clone();return a.setIndex(r),a.clearGroups(),a}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}class AA extends uc{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new bA(e)}),this.register(function(e){return new mA(e)}),this.register(function(e){return new vA(e)}),this.register(function(e){return new SA(e)}),this.register(function(e){return new BA(e)}),this.register(function(e){return new TA(e)}),this.register(function(e){return new CA(e)}),this.register(function(e){return new _A(e)}),this.register(function(e){return new IA(e)}),this.register(function(e){return new xA(e)}),this.register(function(e){return new gA(e)}),this.register(function(e){return new yA(e)}),this.register(function(e){return new EA(e)}),this.register(function(e){return new wA(e)}),this.register(function(e){return new MA(e)}),this.register(function(e){return new pA(e)}),this.register(function(e){return new RA(e)}),this.register(function(e){return new DA(e)})}load(e,t,n,i){const r=this;let a;if(""!==this.resourcePath)a=this.resourcePath;else if(""!==this.path){const t=Qc.extractUrlBase(e);a=Qc.resolveURL(t,this.path)}else a=Qc.extractUrlBase(e);this.manager.itemStart(e);const o=function(t){i?i(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},s=new fc(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{r.parse(n,a,function(n){t(n),r.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const a={},o={},s=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(s.decode(new Uint8Array(e,0,4))===QA){try{a[dA.KHR_BINARY_GLTF]=new LA(e)}catch(e){return void(i&&i(e))}r=JSON.parse(a[dA.KHR_BINARY_GLTF].content)}else r=JSON.parse(s.decode(e));else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new iu(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,a[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){const t=r.extensionsUsed[e],n=r.extensionsRequired||[];switch(t){case dA.KHR_MATERIALS_UNLIT:a[t]=new fA;break;case dA.KHR_DRACO_MESH_COMPRESSION:a[t]=new UA(r,this.dracoLoader);break;case dA.KHR_TEXTURE_TRANSFORM:a[t]=new PA;break;case dA.KHR_MESH_QUANTIZATION:a[t]=new NA;break;default:n.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function uA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const dA={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing",DEEPAR_MATERIALS_DIAMOND:"DEEPAR_materials_diamond"};class pA{constructor(e){this.parser=e,this.name=dA.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let o;const s=new Xi(16777215);void 0!==a.color&&s.setRGB(a.color[0],a.color[1],a.color[2],_t);const l=void 0!==a.range?a.range:0;switch(a.type){case"directional":o=new Dc(s),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new Tc(s),o.distance=l;break;case"spot":o=new yc(s),o.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),o.decay=2,JA(o,a),void 0!==a.intensity&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(o),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(e){return n._getNodeRef(t.cache,r,e)})}}class fA{constructor(){this.name=dA.KHR_MATERIALS_UNLIT}getMaterialType(){return $i}extendParams(e,t,n){const i=[];e.color=new Xi(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],_t),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,Ct))}return Promise.all(i)}}class gA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class mA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){const e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new tn(e,e)}return Promise.all(r)}}class vA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class EA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class bA{constructor(e){this.parser=e,this.name=dA.DEEPAR_MATERIALS_DIAMOND}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?js:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();t.envMapIntensity=1,t.envMapRotation=0,t.rIndexDelta=.012,t.squashFactor=.98,t.geometryFactor=.5,t.gammaFactor=1,t.absorptionFactor=1,t.reflectivity=.5,t.diamondOrientedEnvMap=0,t.boostFactors=new Tn(1,1,1),t.fixedEnvMapDirection=!1,t.rayBounces=5,t.defines={RAY_BOUNCES:5};const i=n.extensions[this.name];if(void 0!==i.envMapIntensity&&(t.envMapIntensity=i.envMapIntensity),void 0!==i.envMapRotationOffset&&(t.envMapRotation=i.envMapRotationOffset),void 0!==i.dispersion&&(t.rIndexDelta=i.dispersion),void 0!==i.squashFactor&&(t.squashFactor=i.squashFactor),void 0!==i.geometryFactor&&(t.geometryFactor=i.geometryFactor),void 0!==i.gammaFactor&&(t.gammaFactor=i.gammaFactor),void 0!==i.absorptionFactor&&(t.absorptionFactor=i.absorptionFactor),void 0!==i.reflectivity&&(t.reflectivity=i.reflectivity),void 0!==i.diamondOrientedEnvMap&&(t.diamondOrientedEnvMap=i.diamondOrientedEnvMap),void 0!==i.boostFactors){const e=i.boostFactors;t.boostFactors.set(e[0],e[1],e[2])}return void 0!==i.fixedEnvMapDirection&&(t.fixedEnvMapDirection=i.fixedEnvMapDirection),void 0!==i.rayBounces&&(t.rayBounces=i.rayBounces,t.defines={RAY_BOUNCES:i.rayBounces}),Promise.resolve()}}class CA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new Xi(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(void 0!==a.sheenColorFactor){const e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],_t)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,Ct)),void 0!==a.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class _A{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class IA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=(new Xi).setRGB(o[0],o[1],o[2],_t),Promise.all(r)}}class xA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class yA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=(new Xi).setRGB(o[0],o[1],o[2],_t),void 0!==a.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,Ct)),Promise.all(r)}}class MA{constructor(e){this.parser=e,this.name=dA.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class wA{constructor(e){this.parser=e,this.name=dA.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ws:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class SA{constructor(e){this.parser=e,this.name=dA.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class BA{constructor(e){this.parser=e,this.name=dA.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let s=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class TA{constructor(e){this.parser=e,this.name=dA.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let s=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class RA{constructor(e){this.name=dA.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(t){const n=e.byteOffset||0,i=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){const t=new ArrayBuffer(a*o);return r.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}return null}}class DA{constructor(e){this.name=dA.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==GA.TRIANGLES&&e.mode!==GA.TRIANGLE_STRIP&&e.mode!==GA.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,a=[],o={};for(const e in r)a.push(this.parser.getDependency("accessor",r[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new oi,n=new Tn,a=new Bn,s=new Tn(1,1,1),l=new Il(e.geometry,e.material,i);for(let e=0;e<i;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),l.setMatrixAt(e,t.compose(n,a,s));for(const t in o)if("_COLOR_0"===t){const e=o[t];l.instanceColor=new fl(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);Qi.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]}))}}const QA="glTF";class LA{constructor(e){this.name=dA.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==QA)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let a=0;for(;a<i;){const t=r.getUint32(a,!0);a+=4;const i=r.getUint32(a,!0);if(a+=4,1313821514===i){const i=new Uint8Array(e,12+a,t);this.content=n.decode(i)}else if(5130562===i){const n=12+a;this.body=e.slice(n,n+t)}a+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class UA{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=dA.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(const e in a){const t=qA[e]||e.toLowerCase();o[t]=a[e]}for(const t in e.attributes){const i=qA[t]||t.toLowerCase();if(void 0!==a[t]){const r=n.accessors[e.attributes[t]],a=HA[r.componentType];l[i]=a.name,s[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then(function(e){return new Promise(function(t,n){i.decodeDracoFile(e,function(e){for(const t in e.attributes){const n=e.attributes[t],i=s[t];void 0!==i&&(n.normalized=i)}t(e)},o,l,_t,n)})})}}class PA{constructor(){this.name=dA.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class NA{constructor(){this.name=dA.KHR_MESH_QUANTIZATION}}class FA extends Kl{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,c=i-t,h=(n-t)/c,A=h*h,u=A*h,d=e*l,p=d-l,f=-2*u+3*A,g=u-A,m=1-f,v=g-A+h;for(let e=0;e!==o;e++){const t=a[p+e+o],n=a[p+e+s]*c,i=a[d+e+o],l=a[d+e]*c;r[e]=m*t+v*n+f*i+g*l}return r}}const OA=new Bn;class kA extends FA{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return OA.fromArray(r).normalize().toArray(r),r}}const GA={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},HA={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},zA={9728:He,9729:We,9984:1004,9985:qe,9986:Ve,9987:je},VA={33071:ke,33648:Ge,10497:Oe},WA={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},qA={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},jA={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},YA={CUBICSPLINE:void 0,LINEAR:vt,STEP:mt};function XA(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new Vs({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function KA(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function JA(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ZA(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function $A(e){let t;const n=e.extensions&&e.extensions[dA.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+eu(n.attributes):e.indices+":"+eu(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+eu(e.targets[n]);return t}function eu(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function tu(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const nu=new oi;class iu{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new uA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,r=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&r<98?this.textureLoader=new vc(this.options.manager):this.textureLoader=new Lc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new fc(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){const a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return KA(r,a,i),JA(a,i),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(const e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":i=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map(function(t,i){return n.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[dA.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(e,r){n.load(Qc.resolveURL(t.uri,i.path),e,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=WA[i.type],t=HA[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new rr(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(e){const r=e[0],a=WA[i.type],o=HA[i.componentType],s=o.BYTES_PER_ELEMENT,l=s*a,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,A=!0===i.normalized;let u,d;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(u=new o(r,e*h,i.count*h/s),l=new Js(u,h/s),t.cache.add(n,l)),d=new $s(l,a,c%h/s,A)}else u=null===r?new o(i.count*a):new o(r,c,i.count*a),d=new rr(u,a,A);if(void 0!==i.sparse){const t=WA.SCALAR,n=HA[i.sparse.indices.componentType],s=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(e[1],s,i.sparse.count*t),h=new o(e[2],l,i.sparse.count*a);null!==r&&(d=new rr(d.array.slice(),d.itemSize,d.normalized));for(let e=0,t=c.length;e<t;e++){const t=c[e];if(d.setX(t,h[e*a]),a>=2&&d.setY(t,h[e*a+1]),a>=3&&d.setZ(t,h[e*a+2]),a>=4&&d.setW(t,h[e*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return d})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],o=r.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];const l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);const n=(r.samplers||{})[a.sampler]||{};return t.magFilter=zA[n.magFilter]||We,t.minFilter=zA[n.minFilter]||je,t.wrapS=VA[n.wrapS]||Oe,t.wrapT=VA[n.wrapT]||Oe,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const r=n.images[e],a=self.URL||self.webkitURL;let o=r.uri||"",s=!1;if(void 0!==r.bufferView)o=this.getDependency("bufferView",r.bufferView).then(function(e){s=!0;const t=new Blob([e],{type:r.mimeType});return o=a.createObjectURL(t),o});else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(o).then(function(e){return new Promise(function(n,r){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new In(e);t.needsUpdate=!0,n(t)}),t.load(Qc.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){var t;return!0===s&&a.revokeObjectURL(o),JA(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[dA.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[dA.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(a);a=r.extensions[dA.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new zs,Zi.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new qs,Zi.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Vs}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const o={},s=[];if((r.extensions||{})[dA.KHR_MATERIALS_UNLIT]){const e=i[dA.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),s.push(e.extendParams(o,r,t))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new Xi(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],_t),o.opacity=e[3]}void 0!==n.baseColorTexture&&s.push(t.assignTexture(o,"map",n.baseColorTexture,Ct)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),s.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),s.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===r.doubleSided&&(o.side=2);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===l&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&a!==$i&&(s.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new tn(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&a!==$i&&(s.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&a!==$i){const e=r.emissiveFactor;o.emissive=(new Xi).setRGB(e[0],e[1],e[2],_t)}return void 0!==r.emissiveTexture&&a!==$i&&s.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,Ct)),Promise.all(s).then(function(){const n=new a(o);return r.name&&(n.name=r.name),JA(n,r),t.associations.set(n,{materials:e}),r.extensions&&KA(i,n,r),n})}createUniqueName(e){const t=zc.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[dA.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return ru(n,e,t)})}const a=[];for(let n=0,o=e.length;n<o;n++){const o=e[n],s=$A(o),l=i[s];if(l)a.push(l.promise);else{let e;e=o.extensions&&o.extensions[dA.KHR_DRACO_MESH_COMPRESSION]?r(o):ru(new fr,o,t),i[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let e=0,t=a.length;e<t;e++){const t=void 0===a[e].material?XA(this.cache):this.getDependency("material",a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){const o=n.slice(0,n.length-1),s=n[n.length-1],l=[];for(let n=0,c=s.length;n<c;n++){const c=s[n],h=a[n];let A;const u=o[n];if(h.mode===GA.TRIANGLES||h.mode===GA.TRIANGLE_STRIP||h.mode===GA.TRIANGLE_FAN||void 0===h.mode)A=!0===r.isSkinnedMesh?new cl(c,u):new Qr(c,u),!0===A.isSkinnedMesh&&A.normalizeSkinWeights(),h.mode===GA.TRIANGLE_STRIP?A.geometry=hA(A.geometry,1):h.mode===GA.TRIANGLE_FAN&&(A.geometry=hA(A.geometry,2));else if(h.mode===GA.LINES)A=new Ul(c,u);else if(h.mode===GA.LINE_STRIP)A=new Rl(c,u);else if(h.mode===GA.LINE_LOOP)A=new Pl(c,u);else{if(h.mode!==GA.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);A=new Gl(c,u)}Object.keys(A.geometry.morphAttributes).length>0&&ZA(A,r),A.name=t.createUniqueName(r.name||"mesh_"+e),JA(A,r),h.extensions&&KA(i,A,h),t.assignFinalMaterial(A),A.computeOffsets(),l.push(A)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&KA(i,l[0],r),l[0];const c=new Qs;r.extensions&&KA(i,c,r),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new Wr(en(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new va(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),JA(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){const n=e.pop(),i=e,r=[],a=[];for(let e=0,o=i.length;e<o;e++){const o=i[e];if(o){r.push(o);const t=new oi;null!==n&&t.fromArray(n.array,16*e),a.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new pl(r,a)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],s=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){const t=i.channels[e],n=i.samplers[t.sampler],r=t.target,h=r.node,A=void 0!==i.parameters?i.parameters[n.input]:n.input,u=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(a.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",A)),s.push(this.getDependency("accessor",u)),l.push(n),c.push(r))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(c)]).then(function(e){const t=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],c=i[e],h=a[e],A=o[e],u=s[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const d=n._createAnimationTracks(r,c,h,A,u);if(d)for(let e=0;e<d.length;e++)l.push(d[e])}return new lc(r,void 0,l)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then(function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],a=n.children||[];for(let e=0,n=a.length;e<n;e++)r.push(t.getDependency("node",a[e]));const o=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then(function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(i,nu)});for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],s=i._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then(function(e){return i._getNodeRef(i.cameraCache,r.camera,e)})),i._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=!0===r.isBone?new hl:t.length>1?new Qs:1===t.length?t[0]:new Qi,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(r.name&&(o.userData.name=r.name,o.name=a),JA(o,r),r.extensions&&KA(n,o,r),void 0!==r.matrix){const e=new oi;e.fromArray(r.matrix),o.applyMatrix4(e)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Qs;n.name&&(r.name=i.createUniqueName(n.name)),JA(r,n),n.extensions&&KA(t,r,n);const a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(i.getDependency("node",a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[e,n]of i.associations)(e instanceof Zi||e instanceof In)&&t.set(e,n);return e.traverse(e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)}),t})(r),r.userData.isDiamondScene=i._sceneContainsDiamondMaterial(r),r})}_sceneContainsDiamondMaterial(e){let t=!1;return e.traverse(e=>{e.material&&e.material.isMeshDiamondMaterial&&(t=!0)}),t}_createAnimationTracks(e,t,n,i,r){const a=[],o=e.name?e.name:e.uuid,s=[];let l;switch(jA[r.path]===jA.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(o),jA[r.path]){case jA.weights:l=ic;break;case jA.rotation:l=ac;break;case jA.position:case jA.scale:l=sc;break;default:l=1===n.itemSize?ic:sc}const c=void 0!==i.interpolation?YA[i.interpolation]:vt,h=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){const n=new l(s[e]+"."+jA[r.path],t.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=tu(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof ac?kA:FA)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function ru(e,t,n){const i=t.attributes,r=[];function a(t,i){return n.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}for(const t in i){const n=qA[t]||t.toLowerCase();n in e.attributes||r.push(a(i[t],n))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(i)}return pn.workingColorSpace!==_t&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${pn.workingColorSpace}" not supported.`),JA(e,t),function(e,t,n){const i=t.attributes,r=new Qn;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Tn(t[0],t[1],t[2]),new Tn(a[0],a[1],a[2])),e.normalized){const t=tu(HA[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const a=t.targets;if(void 0!==a){const e=new Tn,t=new Tn;for(let i=0,r=a.length;i<r;i++){const r=a[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],a=i.min,o=i.max;if(void 0!==a&&void 0!==o){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),i.normalized){const e=tu(HA[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;const o=new Jn;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}(e,t,n),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,a=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(a=!0),i&&r&&a)break}if(!i&&!r&&!a)return Promise.resolve(e);const o=[],s=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):e.attributes.position;o.push(t)}if(r){const t=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):e.attributes.normal;s.push(t)}if(a){const t=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(l)]).then(function(t){const n=t[0],o=t[1],s=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}(e,t.targets,n):e})}class au{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:t,msg:n,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(n,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const ou=9,su=15,lu=16,cu=22,hu=37,Au=43,uu=76,du=83,pu=97,fu=100,gu=103,mu=109,vu=165,Eu=166;class bu{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Cu{constructor(e,t,n,i){this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}const _u=[171,75,84,88,32,50,48,187,13,10,26,10];function Iu(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}let xu,yu,Mu;const wu={env:{emscripten_notify_memory_growth:function(e){Mu=new Uint8Array(yu.exports.memory.buffer)}}};class Su{init(){return xu||(xu="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Bu).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,wu)).then(this._init):WebAssembly.instantiate(Buffer.from(Bu,"base64"),wu).then(this._init),xu)}_init(e){yu=e.instance,wu.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!yu)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=yu.exports.malloc(n);Mu.set(e,i),t=t||Number(yu.exports.ZSTD_findDecompressedSize(i,n));const r=yu.exports.malloc(t),a=yu.exports.ZSTD_decompress(r,t,i,n),o=Mu.slice(r,r+a);return yu.exports.free(i),yu.exports.free(r),o}}const Bu="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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",Tu=new WeakMap;let Ru,Du=0;class Qu extends uc{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new au,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new fc(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new fc(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then(([e,t])=>{const n=Qu.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Qu.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Qu.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Qu.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),Du>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Du++}return this.transcoderPending}load(e,t,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new fc(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,e=>{if(Tu.has(e))return Tu.get(e).promise.then(t).catch(i);this._createTexture(e).then(e=>t?t(e):null).catch(i)},n,i)}_createTextureFrom(e,t){const{faces:n,width:i,height:r,format:a,type:o,error:s,dfdFlags:l}=e;if("error"===o)return Promise.reject(s);let c;if(6===t.faceCount)c=new Wl(n,a,Ye);else{const e=n[0].mipmaps;c=t.layerCount>1?new Vl(e,i,r,t.layerCount,a,Ye):new zl(e,i,r,a,Ye)}return c.minFilter=1===n[0].mipmaps.length?We:je,c.magFilter=We,c.generateMipmaps=!1,c.needsUpdate=!0,c.colorSpace=Nu(t),c.premultiplyAlpha=!!(1&l),c}async _createTexture(e,t={}){const n=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,_u.length);if(t[0]!==_u[0]||t[1]!==_u[1]||t[2]!==_u[2]||t[3]!==_u[3]||t[4]!==_u[4]||t[5]!==_u[5]||t[6]!==_u[6]||t[7]!==_u[7]||t[8]!==_u[8]||t[9]!==_u[9]||t[10]!==_u[10]||t[11]!==_u[11])throw new Error("Missing KTX 2.0 identifier.");const n=new bu,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Cu(e,_u.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const a=r._nextUint32();n.supercompressionScheme=r._nextUint32();const o=r._nextUint32(),s=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),A=r._nextUint64(),u=new Cu(e,_u.length+i,3*a*8,!0);for(let t=0;t<a;t++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});const d=new Cu(e,o,s,!0),p={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},f=(p.descriptorBlockSize/4-6)/4;for(let e=0;e<f;e++){const t={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=d._nextInt32(),t.sampleUpper=d._nextInt32()):(t.sampleLower=d._nextUint32(),t.sampleUpper=d._nextUint32()),p.samples[e]=t}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(p);const g=new Cu(e,l,c,!0);for(;g._offset<c;){const e=g._nextUint32(),t=g._scan(e),i=Iu(t),r=g._scan(e-t.byteLength);n.keyValue[i]=i.match(/^ktx/i)?Iu(r):r,g._offset%4&&g._skip(4-g._offset%4)}if(A<=0)return n;const m=new Cu(e,h,A,!0),v=m._nextUint16(),E=m._nextUint16(),b=m._nextUint32(),C=m._nextUint32(),_=m._nextUint32(),I=m._nextUint32(),x=[];for(let e=0;e<a;e++)x.push({imageFlags:m._nextUint32(),rgbSliceByteOffset:m._nextUint32(),rgbSliceByteLength:m._nextUint32(),alphaSliceByteOffset:m._nextUint32(),alphaSliceByteLength:m._nextUint32()});const y=h+m._offset,M=y+b,w=M+C,S=w+_,B=new Uint8Array(e.buffer,e.byteOffset+y,b),T=new Uint8Array(e.buffer,e.byteOffset+M,C),R=new Uint8Array(e.buffer,e.byteOffset+w,_),D=new Uint8Array(e.buffer,e.byteOffset+S,I);return n.globalData={endpointCount:v,selectorCount:E,imageDescs:x,endpointsData:B,selectorsData:T,tablesData:R,extendedData:D},n}(new Uint8Array(e));if(0!==n.vkFormat)return async function(e){const{vkFormat:t}=e;if(void 0===Uu[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===e.supercompressionScheme&&(Ru||(Ru=new Promise(async e=>{const t=new Su;await t.init(),e(t)})),n=await Ru);const i=[];for(let r=0;r<e.levels.length;r++){const a=Math.max(1,e.pixelWidth>>r),o=Math.max(1,e.pixelHeight>>r),s=e.pixelDepth?Math.max(1,e.pixelDepth>>r):0,l=e.levels[r];let c,h;if(0===e.supercompressionScheme)c=l.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=Pu[t]===Je?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Pu[t]===Ze?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:a,height:o,depth:s})}let r;if(Lu.has(Uu[t]))r=0===e.pixelDepth?new Al(i[0].data,e.pixelWidth,e.pixelHeight):new Sn(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new zl(i,e.pixelWidth,e.pixelHeight)}return r.mipmaps=i,r.type=Pu[t],r.format=Uu[t],r.colorSpace=Nu(e),r.needsUpdate=!0,Promise.resolve(r)}(n);const i=t,r=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])).then(e=>this._createTextureFrom(e.data,n));return Tu.set(e,{promise:r}),r}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Du--,this}}Qu.BasisFormat={ETC1S:0,UASTC_4x4:1},Qu.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Qu.EngineFormat={RGBAFormat:et,RGBA_ASTC_4x4_Format:pt,RGBA_BPTC_Format:gt,RGBA_ETC2_EAC_Format:dt,RGBA_PVRTC_4BPPV1_Format:ht,RGBA_S3TC_DXT5_Format:lt,RGB_ETC1_Format:At,RGB_ETC2_Format:ut,RGB_PVRTC_4BPPV1_Format:ct,RGBA_S3TC_DXT1_Format:ot},Qu.BasisWorker=function(){let e,t,n;const i=_EngineFormat,r=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(o){const A=o.data;switch(A.type){case"init":e=A.config,u=A.transcoderBinary,t=new Promise(e=>{n={wasmBinary:u,onRuntimeInitialized:e},BASIS(n)}).then(()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{const{faces:t,buffers:o,width:u,height:d,hasAlpha:p,format:f,dfdFlags:g}=function(t){const o=new n.KTX2File(new Uint8Array(t));function A(){o.close(),o.delete()}if(!o.isValid())throw A(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const u=o.isUASTC()?a.UASTC_4x4:a.ETC1S,d=o.getWidth(),p=o.getHeight(),f=o.getLayers()||1,g=o.getLevels(),m=o.getFaces(),v=o.getHasAlpha(),E=o.getDFDFlags(),{transcoderFormat:b,engineFormat:C}=function(t,n,o,h){let A,u;const d=t===a.ETC1S?s:l;for(let i=0;i<d.length;i++){const r=d[i];if(e[r.if]&&r.basisFormat.includes(t)&&!(h&&r.transcoderFormat.length<2)&&(!r.needsPowerOfTwo||c(n)&&c(o)))return A=r.transcoderFormat[h?1:0],u=r.engineFormat[h?1:0],{transcoderFormat:A,engineFormat:u}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=r.RGBA32,u=i.RGBAFormat,{transcoderFormat:A,engineFormat:u}}(u,d,p,v);if(!d||!p||!g)throw A(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!o.startTranscoding())throw A(),new Error("THREE.KTX2Loader: .startTranscoding failed");const _=[],I=[];for(let e=0;e<m;e++){const t=[];for(let n=0;n<g;n++){const i=[];let r,a;for(let t=0;t<f;t++){const s=o.getImageLevelInfo(n,t,e);0!==e||0!==n||0!==t||s.origWidth%4==0&&s.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),g>1?(r=s.origWidth,a=s.origHeight):(r=s.width,a=s.height);const l=new Uint8Array(o.getImageTranscodedSizeInBytes(n,t,0,b));if(!o.transcodeImage(l,n,t,e,b,0,-1,-1))throw A(),new Error("THREE.KTX2Loader: .transcodeImage failed.");i.push(l)}const s=h(i);t.push({data:s,width:r,height:a}),I.push(s.buffer)}_.push({mipmaps:t,width:d,height:p,format:C})}return A(),{faces:_,buffers:I,width:d,height:p,hasAlpha:v,format:C,dfdFlags:E}}(A.buffer);self.postMessage({type:"transcode",id:A.id,faces:t,width:u,height:d,hasAlpha:p,format:f,dfdFlags:g},o)}catch(e){console.error(e),self.postMessage({type:"error",id:A.id,error:e.message})}})}var u});const o=[{if:"astcSupported",basisFormat:[a.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],s=o.sort(function(e,t){return e.priorityETC1S-t.priorityETC1S}),l=o.sort(function(e,t){return e.priorityUASTC-t.priorityUASTC});function c(e){return e<=2||!(e&e-1)&&0!==e}function h(e){if(1===e.length)return e[0];let t=0;for(let n=0;n<e.length;n++)t+=e[n].byteLength;const n=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];n.set(r,i),i+=r.byteLength}return n}};const Lu=new Set([et,rt,it]),Uu={[mu]:et,[pu]:et,[hu]:et,[Au]:et,[gu]:rt,[du]:rt,[lu]:rt,[cu]:rt,[fu]:it,[uu]:it,[su]:it,[ou]:it,[Eu]:ft,[vu]:ft},Pu={[mu]:Je,[pu]:Ze,[hu]:Ye,[Au]:Ye,[gu]:Je,[du]:Ze,[lu]:Ye,[cu]:Ye,[fu]:Je,[uu]:Ze,[su]:Ye,[ou]:Ye,[Eu]:Ye,[vu]:Ye};function Nu(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?Ct:_t:10===t.colorPrimaries?2===t.transferFunction?It:xt:(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),bt)}let Fu=null;const Ou=e=>{Fu=null==e?null:e.endsWith("/")?e.substring(0,e.length-1):e},ku=()=>null!=Fu?`${Fu}/libs`:"https://cdn.jsdelivr.net/npm/three@0.165.0/examples/jsm/libs",Gu=(()=>{const e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;const t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const e of t)if("viewport"===e.name)return!0;return!1})();return e||console.error('No <meta name="viewport"> detected. This might cause ShopAR to crash on iOS.\nPlease add the following line to your HTML:\n<meta name="viewport" content="width=device-width, initial-scale=1.0">'),()=>e?Math.min(window.devicePixelRatio||1,2):1})(),Hu=new Xi(16777215);let zu,Vu,Wu=!1,qu=1,ju=1,Yu=1;function Xu(){return Ku(),zu}function Ku(){if(Wu)return;Yu=Gu(),Vu=document.createElement("canvas");const e=Vu.style;e.position="absolute",e.top="0",e.left="0",e.width="100%",e.height="100%",zu=new Ks({powerPreference:"high-performance",canvas:Vu,antialias:!0,alpha:!0}),zu.outputColorSpace=Ct,zu.toneMapping=4,zu.setClearColor(new Xi(16777215),0),Wu=!0}function Ju(e,t,n,i,r){const{width:a,height:o}=t,s=zu.toneMapping,l=zu.toneMappingExposure;if(zu.toneMapping=i,zu.toneMappingExposure=r,zu.setViewport(0,0,a,o),zu.setClearColor(Hu,n),e.setSize(a,o),e.render(),zu.toneMapping=s,zu.toneMappingExposure=l,t.isBlitted()){const{context2d:e}=t;if(null==e)return;e.clearRect(0,0,a,o),Vu.width>0&&Vu.height>0&&e.drawImage(Vu,0,ju-o,a,o,0,0,a,o)}}function Zu(e,t){const n=Gu();e=Math.ceil(e*n),t=Math.ceil(t*n),e===qu&&t===ju&&n===Yu||(qu=e,ju=t,Yu=n,Xu().setSize(qu,ju,!1))}function $u(e,t){Xu().renderCubeMapNormals(e),e.traverse(e=>{e instanceof Qr&&e.material&&e.material.isMeshDiamondMaterial&&(e.material.envMap=t)})}let ed,td=!1;function nd(e){return td||id(),ed.parseAsync(e.buffer,"")}function id(){if(td)return;const e=(new lA).setDecoderPath(`${ku()}/draco/gltf/`);e.preload();const t=(new Qu).setTranscoderPath(`${ku()}/basis/`).detectSupport(Xu());ed=(new AA).setDRACOLoader(e).setKTX2Loader(t).setMeshoptDecoder(oA),td=!0}function rd(e){null!=e&&(Object.values(e).forEach(e=>{(null==e?void 0:e.dispose)instanceof Function&&e.dispose()}),e.dispose())}function ad(e,t,n,i,r,a){if(null==e)return new Tn;const o=od(e,i,r,new Tn),s=sd(e);od(e,o.scale,o.quaternion,o.position);const l=s.getSize(new Tn),c=s.getCenter(new Tn);let h=0;return h=l.x/2+t/2,n&&(h=-h),new Tn(-c.x+h,-c.y+l.y/2,-c.z)}function od(e,t,n,i){let r,a,o;return null!=t&&(r=e.scale.x,e.scale.set(t,t,t)),null!=n&&(a=e.quaternion.clone(),e.quaternion.copy(n)),null!=i&&(o=e.position.clone(),e.position.copy(i)),{scale:r,quaternion:a,position:o}}function sd(e){return(new Qn).setFromObject(e,!0)}function ld(e){e.traverse(e=>{var t;e instanceof Qr&&(null===(t=e.geometry)||void 0===t||t.dispose(),Array.isArray(e.material)?e.material.forEach(rd):rd(e.material))}),e.clear()}const cd={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class hd{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Ad=new va(-1,1,1,-1,0,1),ud=new class extends fr{constructor(){super(),this.setAttribute("position",new sr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new sr([0,2,0,0,2,0],2))}};class dd{constructor(e){this._mesh=new Qr(ud,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Ad)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class pd extends hd{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof kr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Or.clone(e.uniforms),this.material=new kr({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new dd(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class fd extends hd{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),r=e.state;let a,o;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0),this.inverse?(a=0,o=1):(a=1,o=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),r.buffers.stencil.setFunc(i.ALWAYS,a,4294967295),r.buffers.stencil.setClear(o),r.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.color.setMask(!0),r.buffers.depth.setMask(!0),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(i.EQUAL,1,4294967295),r.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),r.buffers.stencil.setLocked(!0)}}class gd extends hd{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class md{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const n=e.getSize(new tn);this._width=n.width,this._height=n.height,(t=new Mn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Ze})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new pd(cd),this.copyPass.material.blending=0,this.clock=new Uc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let t=0,i=this.passes.length;t<i;t++){const i=this.passes[t];if(!1!==i.enabled){if(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),i.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),i.needsSwap){if(n){const t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==fd&&(i instanceof fd?n=!0:i instanceof gd&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new tn);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}const vd={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:"\n\t\tprecision highp float;\n\n\t\tuniform mat4 modelViewMatrix;\n\t\tuniform mat4 projectionMatrix;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\t#include <tonemapping_pars_fragment>\n\t\t#include <colorspace_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// tone mapping\n\n\t\t\t#ifdef LINEAR_TONE_MAPPING\n\n\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = OptimizedCineonToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( AGX_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\n\t\t\t#endif\n\n\t\t\t// color space\n\n\t\t\t#ifdef SRGB_TRANSFER\n\n\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n\t\t\t#endif\n\n\t\t}"};class Ed extends hd{constructor(){super();const e=vd;this.uniforms=Or.clone(e.uniforms),this.material=new Hs({name:e.name,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.fsQuad=new dd(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,this._outputColorSpace===e.outputColorSpace&&this._toneMapping===e.toneMapping||(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},pn.getTransfer(this._outputColorSpace)===Mt&&(this.material.defines.SRGB_TRANSFER=""),1===this._toneMapping?this.material.defines.LINEAR_TONE_MAPPING="":2===this._toneMapping?this.material.defines.REINHARD_TONE_MAPPING="":3===this._toneMapping?this.material.defines.CINEON_TONE_MAPPING="":4===this._toneMapping?this.material.defines.ACES_FILMIC_TONE_MAPPING="":6===this._toneMapping?this.material.defines.AGX_TONE_MAPPING="":7===this._toneMapping&&(this.material.defines.NEUTRAL_TONE_MAPPING=""),this.material.needsUpdate=!0),!0===this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class bd extends hd{constructor(e,t,n=null,i=null,r=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=r,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Xi}render(e,t,n){const i=e.autoClear;let r,a;e.autoClear=!1,null!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),null!==this.clearAlpha&&(r=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),1==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(r),null!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}const Cd={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Xi(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\t\t\tgl_FragColor.rgb = max( gl_FragColor.rgb, vec3( 0.0 ) );\n\n\t\t}"};class _d extends hd{constructor(e,t,n,i){super(),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=i,this.resolution=void 0!==e?new tn(e.x,e.y):new tn(256,256),this.clearColor=new Xi(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new Mn(r,a,{type:Ze}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new Mn(r,a,{type:Ze});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const n=new Mn(r,a,{type:Ze});n.texture.name="UnrealBloomPass.v"+e,n.texture.generateMipmaps=!1,this.renderTargetsVertical.push(n),r=Math.round(r/2),a=Math.round(a/2)}const o=Cd;this.highPassUniforms=Or.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=i,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new kr({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const s=[3,5,7,9,11];r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(s[e])),this.separableBlurMaterials[e].uniforms.invSize.value=new tn(1/r,1/a),r=Math.round(r/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new Tn(1,1,1),new Tn(1,1,1),new Tn(1,1,1),new Tn(1,1,1),new Tn(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const l=cd;this.copyUniforms=Or.clone(l.uniforms),this.blendMaterial=new kr({uniforms:this.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Xi,this.oldClearAlpha=1,this.basic=new $i,this.fsQuad=new dd(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(n,i);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(n,i),this.renderTargetsVertical[e].setSize(n,i),this.separableBlurMaterials[e].uniforms.invSize.value=new tn(1/n,1/i),n=Math.round(n/2),i=Math.round(i/2)}render(e,t,n,i,r){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),r&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let o=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[t].uniforms.direction.value=_d.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=_d.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new kr({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new tn(.5,.5)},direction:{value:new tn(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 invSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float gaussianCoefficients[KERNEL_RADIUS];\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat weightSum = gaussianCoefficients[0];\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianCoefficients[i];\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}getCompositeMaterial(e){return new kr({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}_d.BlurDirectionX=new tn(1,0),_d.BlurDirectionY=new tn(0,1);const Id="backgroundTexture",xd=`\n uniform sampler2D ${Id};\n uniform sampler2D bloomTexture;\n uniform sampler2D objectMaskTexture;\n\n varying vec2 vUv;\n\n void main() {\n gl_FragColor = texture2D( ${Id}, vUv );\n gl_FragColor.rgb += texture2D( bloomTexture, vUv ).rgb * texture2D( objectMaskTexture, vUv ).a;\n }\n`;class yd extends pd{constructor(e,t){super(new kr({uniforms:{[Id]:{value:null},bloomTexture:{value:e},objectMaskTexture:{value:t}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:xd}),Id)}}var Md,wd,Sd,Bd,Td,Rd,Dd,Qd,Ld,Ud,Pd,Nd,Fd,Od,kd,Gd,Hd,zd;const Vd="neverDarken",Wd="shadowObject";class qd{constructor(e,t){Md.set(this,void 0),wd.set(this,void 0),Sd.set(this,!1),Bd.set(this,.25),Td.set(this,0),Rd.set(this,2),Dd.set(this,null),Qd.set(this,null),Ld.set(this,null),Ud.set(this,null),Pd.set(this,null),Nd.set(this,null),Fd.set(this,null),Od.set(this,null),kd.set(this,null),Gd.set(this,{}),Hd.set(this,null),zd.set(this,new Xi),H(this,Md,e),H(this,wd,t)}set strength(e){H(this,Bd,e),null!=G(this,Ld,"f")&&(G(this,Ld,"f").strength=G(this,Bd,"f"))}set radius(e){H(this,Td,e),null!=G(this,Ld,"f")&&(G(this,Ld,"f").radius=G(this,Td,"f"))}set threshold(e){H(this,Rd,e),null!=G(this,Ld,"f")&&(G(this,Ld,"f").threshold=G(this,Rd,"f"))}init(){G(this,Sd,"f")||(H(this,Dd,new md(Xu())),H(this,Qd,new bd(G(this,Md,"f"),G(this,wd,"f"))),G(this,Qd,"f").clearColor=new Xi(0),G(this,Qd,"f").clearAlpha=0,G(this,Dd,"f").addPass(G(this,Qd,"f")),H(this,Ld,new _d(new tn(256,256),G(this,Bd,"f"),G(this,Td,"f"),G(this,Rd,"f"))),G(this,Dd,"f").addPass(G(this,Ld,"f")),H(this,Ud,new Ed),G(this,Ud,"f").needsSwap=!1,G(this,Dd,"f").addPass(G(this,Ud,"f")),G(this,Dd,"f").renderToScreen=!1,H(this,Od,new md(Xu())),H(this,kd,new bd(G(this,Md,"f"),G(this,wd,"f"))),G(this,Od,"f").addPass(G(this,kd,"f")),G(this,Od,"f").renderToScreen=!1,H(this,Pd,new md(Xu())),H(this,Nd,new bd(G(this,Md,"f"),G(this,wd,"f"))),G(this,Pd,"f").addPass(G(this,Nd,"f")),H(this,Fd,new yd(G(this,Dd,"f").renderTarget1.texture,G(this,Od,"f").renderTarget2.texture)),G(this,Pd,"f").addPass(G(this,Fd,"f")),H(this,Hd,new $i({color:0})),H(this,Sd,!0))}destroy(){G(this,Sd,"f")&&(G(this,Hd,"f").dispose(),H(this,Hd,null),G(this,Fd,"f").dispose(),H(this,Fd,null),G(this,Nd,"f").dispose(),H(this,Nd,null),G(this,Pd,"f").dispose(),H(this,Pd,null),G(this,kd,"f").dispose(),H(this,kd,null),G(this,Od,"f").dispose(),H(this,Od,null),G(this,Ud,"f").dispose(),H(this,Ud,null),G(this,Ld,"f").dispose(),H(this,Ld,null),G(this,Qd,"f").dispose(),H(this,Qd,null),G(this,Dd,"f").dispose(),H(this,Dd,null),H(this,Sd,!1))}setSize(e,t){null!=G(this,Dd,"f")&&null!=G(this,Od,"f")&&null!=G(this,Pd,"f")&&(G(this,Dd,"f").setSize(e,t),G(this,Od,"f").setSize(e,t),G(this,Pd,"f").setSize(e,t))}render(){null!=G(this,Dd,"f")&&null!=G(this,Od,"f")&&null!=G(this,kd,"f")&&null!=G(this,Pd,"f")&&null!=G(this,Nd,"f")&&(G(this,Dd,"f").render(),this.darkenMaterials(),this.hideShadow(),G(this,kd,"f").clearColor=Xu().getClearColor(G(this,zd,"f")),G(this,kd,"f").clearAlpha=Xu().getClearAlpha(),G(this,Od,"f").render(),this.showShadow(),G(this,Nd,"f").clearColor=Xu().getClearColor(G(this,zd,"f")),G(this,Nd,"f").clearAlpha=Xu().getClearAlpha(),G(this,Pd,"f").render(),this.restoreDarkenedMaterials())}hideShadow(){G(this,Md,"f").traverse(e=>{e instanceof Qr&&e.material.userData[Wd]&&(e.visible=!1)})}showShadow(){G(this,Md,"f").traverse(e=>{e instanceof Qr&&e.material.userData[Wd]&&(e.visible=!0)})}onSceneUpdate(){Xu().renderCubeMapNormals(G(this,Md,"f"))}darkenMaterials(){G(this,Md,"f").traverse(e=>{if(e instanceof Qr){if(e.material.userData[Vd])return;G(this,Gd,"f")[e.uuid]=e.material,e.material=G(this,Hd,"f")}})}restoreDarkenedMaterials(){G(this,Md,"f").traverse(e=>{if(e instanceof Qr){if(e.material!==G(this,Hd,"f"))return;e.material=G(this,Gd,"f")[e.uuid],delete G(this,Gd,"f")[e.uuid]}})}}var jd,Yd,Xd,Kd,Jd,Zd;Md=new WeakMap,wd=new WeakMap,Sd=new WeakMap,Bd=new WeakMap,Td=new WeakMap,Rd=new WeakMap,Dd=new WeakMap,Qd=new WeakMap,Ld=new WeakMap,Ud=new WeakMap,Pd=new WeakMap,Nd=new WeakMap,Fd=new WeakMap,Od=new WeakMap,kd=new WeakMap,Gd=new WeakMap,Hd=new WeakMap,zd=new WeakMap,(Zd=Jd||(Jd={}))[Zd.Direct=0]="Direct",Zd[Zd.Postprocessed=1]="Postprocessed";class $d{constructor(e,t){jd.set(this,void 0),Yd.set(this,void 0),Xd.set(this,Jd.Direct),Kd.set(this,void 0),H(this,jd,e),H(this,Yd,t),H(this,Kd,new qd(G(this,jd,"f"),G(this,Yd,"f")))}get bloomEnabled(){return G(this,Xd,"f")===Jd.Postprocessed}set bloomEnabled(e){e?(G(this,Kd,"f").init(),H(this,Xd,Jd.Postprocessed)):(G(this,Kd,"f").destroy(),H(this,Xd,Jd.Direct))}set bloomStrength(e){G(this,Kd,"f").strength=e}set bloomRadius(e){G(this,Kd,"f").radius=e}set bloomThreshold(e){G(this,Kd,"f").threshold=e}dispose(){G(this,Kd,"f").destroy(),H(this,Xd,Jd.Direct)}setSize(e,t){G(this,Kd,"f").setSize(e,t)}render(){G(this,Xd,"f")===Jd.Direct?Xu().render(G(this,jd,"f"),G(this,Yd,"f")):G(this,Xd,"f")===Jd.Postprocessed&&G(this,Kd,"f").render()}}jd=new WeakMap,Yd=new WeakMap,Xd=new WeakMap,Kd=new WeakMap;const ep={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},tp={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};let np,ip,rp,ap=!1;const op=300,sp=2*Math.PI/32,lp=ce("hold"),cp=ce("sine"),hp=ce("sine-in"),Ap=ce("sine-out");function up(){let e=!0,t=!1,n=null,i=null,r=null;return{get custom(){return t},set:e=>{const{theta:a,phi:o,fov:s}=e;n=a,i=o,r=s,t=null!=a||null!=o||null!=s},reset:e=>{var a;t?(null==n||n.reset(),null==i||i.reset(),null==r||r.reset()):(n=Z([{time:0,value:a=e,interpolation:lp},{time:op,value:a,interpolation:Ap},{time:800,value:a+sp,interpolation:cp},{time:1800,value:a-sp,interpolation:hp},{time:2300,value:a,interpolation:lp},{time:4300,value:a,interpolation:lp}]),i=null,r=null)},get running(){return e},set running(t){e=t},update:t=>{e&&(null==n||n.update(t),null==i||i.update(t),null==r||r.update(t))},get theta(){return null==n?void 0:n.get()},get phi(){return null==i?void 0:i.get()},get fov(){return null==r?void 0:r.get()}}}var dp;!function(e){e[e.NONE=0]="NONE",e[e.USER_INTERACTION=1]="USER_INTERACTION",e[e.AUTOMATIC=2]="AUTOMATIC"}(dp||(dp={}));const pp="pan-y",fp=1e-6,gp=.03,mp=Math.PI/8,vp=new Tn;class Ep extends Ht{constructor(e,t){super(),this.touchAction_=pp,this.enablePan=!0,this.screenSpacePanning=!0,this.enableZoom_=!0,this.enableKeyControls=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.defaultFov=16,this.minFovFactor=.2,this.maxFovFactor=1.6,this.minFov=this.defaultFov*this.minFovFactor,this.maxFov=this.defaultFov*this.maxFovFactor,this.fovMultiplier_=1,this.enableDamping=!0,this.dampingFactor=.3,this.interactionEnabled=!1,this.userInteracted=!1,this.target=new Tn,this.panSphereCenter=new Tn,this.panSphereRadius=1/0,this.spherical=new Vc,this.goalSpherical=new Vc,this.fov=this.defaultFov,this.goalFov=this.defaultFov,this.panOffset=new Tn,this.lastPosition=new Tn,this.lastQuaternion=new Bn,this.lastTargetPosition=new Tn,this.lastFov=this.fov,this.changeSource=dp.NONE,this.panInProgress=!1,this.touchMode=null,this.pointers=[],this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.passiveTouchHandler=()=>{},this.atMaxZoom_=!1,this.atMinZoom_=!1,this.onMaxZoomEnter=null,this.onMaxZoomLeave=null,this.onMinZoomEnter=null,this.onMinZoomLeave=null,this.atMinVerticalAngle_=!1,this.atMaxVerticalAngle_=!1,this.onMinVerticalAngleEnter=null,this.onMinVerticalAngleLeave=null,this.onMaxVerticalAngleEnter=null,this.onMaxVerticalAngleLeave=null,this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY);try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),"touch"===e.pointerType?(this.changeSource=e.altKey?dp.AUTOMATIC:dp.USER_INTERACTION,this.onTouchChange()):(this.changeSource=dp.USER_INTERACTION,this.onMouseDown(e))},this.onPointerMove=e=>{const t=this.pointers.find(t=>t.id===e.pointerId);if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const n=this.pointers.length,i=(e.clientX-t.clientX)/n,r=(e.clientY-t.clientY)/n;0===i&&0===r||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?dp.AUTOMATIC:dp.USER_INTERACTION,null!==this.touchMode&&this.touchMode(i,r)):(this.changeSource=dp.USER_INTERACTION,this.panInProgress?this.pan(i,r):this.handleSinglePointerMove(i,r)))},this.onPointerUp=e=>{const t=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==t&&this.pointers.splice(t,1);const{element:n}=this;0===this.pointers.length?(n.removeEventListener("pointermove",this.onPointerMove),n.removeEventListener("pointerup",this.onPointerUp),n.removeEventListener("touchmove",this.disableScroll)):null!==this.touchMode&&this.onTouchChange(),n.style.cursor="grab",this.panInProgress=!1},this.onWheel=e=>{this.changeSource=dp.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*.2/30;this.userAdjustOrbit(0,0,t),e.preventDefault()},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=dp.USER_INTERACTION,(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?e.preventDefault():this.changeSource=t},this.disableScroll=e=>{e.preventDefault()},this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.onTouchChange=()=>{if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(!this.enableZoom_)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=Cp(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&this.initializePan()}},this.onMouseDown=e=>{this.panInProgress=!1,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&this.initializePan(),this.element.style.cursor="grabbing"},this.touchModeZoom=(e,t)=>{if(this.enableZoom_){const e=Cp(this.pointers[0],this.pointers[1]),t=.2*(this.lastSeparation-e)*35/this.element.clientHeight;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panInProgress&&this.pan(e,t)},this.touchModeRotate=(e,t)=>{if(!this.touchDecided){this.touchDecided=!0;const n=Math.abs(e),i=Math.abs(t),r="pan-x"===this.touchAction_&&n>i,a="pan-y"===this.touchAction_&&i>n;if(this.changeSource===dp.USER_INTERACTION&&(r||a))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.camera=e,this.element=t,this.quat=(new Bn).setFromUnitVectors(e.up,new Tn(0,1,0)),this.quatInverse=this.quat.clone().invert(),this.update(0)}set touchAction(e){this.touchAction_=null!=e?e:pp,this.updateTouchActionStyle()}set enableZoom(e){this.enableZoom_!=e&&(this.enableZoom_=e,e?this.element.addEventListener("wheel",this.onWheel):this.element.removeEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}set minZoom(e){this.maxFovFactor=null!=e?1/e:1.6,this.maxFov=this.defaultFov*this.fovMultiplier_*this.maxFovFactor,this.fov=bp(this.fov,this.minFov,this.maxFov),this.goalFov=bp(this.goalFov,this.minFov,this.maxFov)}set maxZoom(e){this.minFovFactor=null!=e?1/e:.2,this.minFov=this.defaultFov*this.fovMultiplier_*this.minFovFactor,this.fov=bp(this.fov,this.minFov,this.maxFov),this.goalFov=bp(this.goalFov,this.minFov,this.maxFov)}set fovMultiplier(e){this.fovMultiplier_=e,this.fov=this.defaultFov*this.fovMultiplier_,this.goalFov=this.fov,this.minFov=this.fov*this.minFovFactor,this.maxFov=this.fov*this.maxFovFactor}reset(e,t,n,i,r){i||(this.fov=this.defaultFov*this.fovMultiplier_,this.goalFov=this.fov,this.minFov=this.fov*this.minFovFactor,this.maxFov=this.fov*this.maxFovFactor,this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*Zt)/this.camera.aspect)*$t:this.fov,this.camera.updateProjectionMatrix()),r?vp.copy(this.target).sub(this.panSphereCenter).divideScalar(this.panSphereRadius):vp.set(0,0,0),this.panSphereCenter.set(e.x,e.y,e.z);const a=t/Math.tan(this.defaultFov/2*Zt);this.panSphereRadius=Math.min(t,a-t),vp.multiplyScalar(this.panSphereRadius);const o=e.clone().addScaledVector(n,a).add(vp);this.camera.position.set(o.x,o.y,o.z),this.target.set(e.x,e.y,e.z).add(vp),this.camera.lookAt(this.target),vp.copy(this.camera.position).sub(this.target),vp.applyQuaternion(this.quat),this.spherical.setFromVector3(vp),this.goalSpherical.copy(this.spherical),this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.lastTargetPosition.copy(this.target),this.lastFov=this.fov,this.userInteracted=!1}hasUserInteracted(){return this.userInteracted}update(e){this.spherical.theta+=(this.goalSpherical.theta-this.spherical.theta)*Math.min(gp*e,1),this.spherical.phi+=(this.goalSpherical.phi-this.spherical.phi)*Math.min(gp*e,1),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this.panOffset,this.dampingFactor):this.target.add(this.panOffset),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),vp.setFromSpherical(this.spherical),vp.applyQuaternion(this.quatInverse),this.camera.position.copy(this.target).add(vp),this.camera.lookAt(this.target),this.fov+=(this.goalFov-this.fov)*Math.min(gp*e,1),this.fov=bp(this.fov,this.minFov,this.maxFov),!0===this.enableDamping?this.panOffset.multiplyScalar(1-this.dampingFactor):this.panOffset.set(0,0,0),this.checkZoomLimits(),this.checkVerticalAngleLimits();let t=!1;const{aspect:n}=this.camera,i=this.element.clientWidth/this.element.clientHeight;i!==n&&(this.camera.aspect=i,t=!0);const r=Math.abs(this.lastFov-this.fov)>fp;return(t||r)&&(this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*Zt)/this.camera.aspect)*$t:this.fov),this.camera.updateProjectionMatrix(),(this.lastPosition.distanceToSquared(this.camera.position)>fp||8*(1-this.lastQuaternion.dot(this.camera.quaternion))>fp||this.lastTargetPosition.distanceToSquared(this.target)>0||r)&&(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.lastTargetPosition.copy(this.target),this.lastFov=this.fov,t=!0),this.userInteracted=!1,t}getPose(e){return e.copy(this.camera.position),e.sub(this.target),e.normalize(),e}getTheta(){const e=this.camera.position;return vp.copy(e).sub(this.target),vp.applyQuaternion(this.quat),this.spherical.setFromVector3(vp),this.spherical.theta}adjustZoom(e){this.enableZoom_&&(this.goalFov=bp(this.goalFov*Math.pow(2,-e),this.minFov,this.maxFov),this.userInteracted=!0)}adjustOrbit(e,t){this.goalSpherical.theta+=e,this.goalSpherical.phi+=t,this.goalSpherical.makeSafe(),this.userInteracted=!0}set(e,t,n){return null!=e&&this.setTheta(e),null!=t&&this.setPhi(t),null!=n&&this.setFovRadians(n),null!=e||null!=t||null!=n}setTheta(e){const t=this.camera.position;vp.copy(t).sub(this.target),vp.applyQuaternion(this.quat),this.spherical.setFromVector3(vp),this.spherical.theta=e,this.spherical.makeSafe(),this.goalSpherical.copy(this.spherical),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),vp.setFromSpherical(this.spherical),vp.applyQuaternion(this.quatInverse),t.copy(this.target).add(vp),this.camera.lookAt(this.target),this.lastPosition.copy(t),this.lastQuaternion.copy(this.camera.quaternion),this.camera.updateProjectionMatrix()}setPhi(e){const t=this.camera.position;vp.copy(t).sub(this.target),vp.applyQuaternion(this.quat),this.spherical.setFromVector3(vp),this.spherical.phi=e,this.spherical.makeSafe(),this.goalSpherical.copy(this.spherical),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),vp.setFromSpherical(this.spherical),vp.applyQuaternion(this.quatInverse),t.copy(this.target).add(vp),this.camera.lookAt(this.target),this.lastPosition.copy(t),this.lastQuaternion.copy(this.camera.quaternion),this.camera.updateProjectionMatrix()}setFovRadians(e){this.fov=bp(e*this.fovMultiplier_*$t,this.minFov,this.maxFov),this.goalFov=this.fov,this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*Zt)/this.camera.aspect)*$t:this.fov,this.lastFov=this.fov}setInteractionEnabled(e){e?this.enableInteraction():this.disableInteraction()}enableInteraction(){if(!1===this.interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this.enableZoom_&&e.addEventListener("wheel",this.onWheel),this.enableKeyControls&&(e.tabIndex=1,e.addEventListener("keydown",this.onKeyDown)),e.addEventListener("touchmove",this.passiveTouchHandler,{passive:!1}),e.addEventListener("contextmenu",this.onContext),e.style.cursor="grab",this.interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this.interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.tabIndex=-1,e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("touchmove",this.passiveTouchHandler),e.removeEventListener("touchmove",this.disableScroll),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this.interactionEnabled=!1,this.updateTouchActionStyle()}}dispose(){this.disableInteraction(),this.pointers.length=0}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,.2);break;case"PageDown":this.userAdjustOrbit(0,0,-.2);break;case"ArrowUp":this.userAdjustOrbit(0,-mp,0);break;case"ArrowDown":this.userAdjustOrbit(0,mp,0);break;case"ArrowLeft":this.userAdjustOrbit(-mp,0,0);break;case"ArrowRight":this.userAdjustOrbit(mp,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.pan(0,10);break;case"ArrowDown":this.pan(0,-10);break;case"ArrowLeft":this.pan(10,0);break;case"ArrowRight":this.pan(-10,0);break;default:t=!1}return t}initializePan(){this.panInProgress=!0}pan(e,t){const n=this.element,i=this.camera.position;vp.copy(i).sub(this.target);let r=vp.length();r*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(2*e*r/n.clientHeight,this.camera.matrix),this.panUp(2*t*r/n.clientHeight,this.camera.matrix)}panLeft(e,t){vp.setFromMatrixColumn(t,0),vp.multiplyScalar(-e),this.panOffset.add(vp)}panUp(e,t){!0===this.screenSpacePanning?vp.setFromMatrixColumn(t,1):(vp.setFromMatrixColumn(t,0),vp.crossVectors(this.camera.up,vp)),vp.multiplyScalar(e),this.panOffset.add(vp)}handleSinglePointerMove(e,t){const n=this.pixelLengthToSphericalAngle(e),i=this.pixelLengthToSphericalAngle(t);this.userAdjustOrbit(n,i,0)}userAdjustOrbit(e,t,n){this.goalSpherical.theta+=.5*e*this.fovMultiplier_,this.goalSpherical.phi+=.5*t*this.fovMultiplier_,this.goalSpherical.makeSafe();const i=bp(Math.pow(Math.sqrt(this.fov)+n,2),this.minFov,this.maxFov);this.fov=i,this.goalFov=i,this.userInteracted=!0}pixelLengthToSphericalAngle(e){return-2*Math.PI*e/Math.min(this.element.clientHeight,this.element.clientWidth)}checkZoomLimits(){var e,t,n,i;const r=this.goalFov<=this.minFov+fp,a=this.goalFov>=this.maxFov-fp;r!==this.atMaxZoom_&&(this.atMaxZoom_=r,r?null===(e=this.onMaxZoomEnter)||void 0===e||e.call(this):null===(t=this.onMaxZoomLeave)||void 0===t||t.call(this)),a!==this.atMinZoom_&&(this.atMinZoom_=a,a?null===(n=this.onMinZoomEnter)||void 0===n||n.call(this):null===(i=this.onMinZoomLeave)||void 0===i||i.call(this))}checkVerticalAngleLimits(){var e,t,n,i;const r=this.goalSpherical.phi<=this.minPolarAngle+fp,a=this.goalSpherical.phi>=this.maxPolarAngle-fp;r!==this.atMinVerticalAngle_&&(this.atMinVerticalAngle_=r,r?null===(e=this.onMinVerticalAngleEnter)||void 0===e||e.call(this):null===(t=this.onMinVerticalAngleLeave)||void 0===t||t.call(this)),a!==this.atMaxVerticalAngle_&&(this.atMaxVerticalAngle_=a,a?null===(n=this.onMaxVerticalAngleEnter)||void 0===n||n.call(this):null===(i=this.onMaxVerticalAngleLeave)||void 0===i||i.call(this))}updateTouchActionStyle(){const{style:e}=this.element;this.interactionEnabled?this.enableZoom_?e.touchAction=this.touchAction_:e.touchAction="manipulation":e.touchAction=""}}function bp(e,t,n){return Math.max(t,Math.min(n,e))}function Cp(e,t){const{clientX:n,clientY:i}=e,{clientX:r,clientY:a}=t,o=r-n,s=a-i;return Math.sqrt(o*o+s*s)}const _p=new Map;let Ip=null;function xp(){Xu().setAnimationLoop(yp)}function yp(e){!function(){for(const e of _p.values())e.prepareResize()}(),function(e){for(const t of _p.values())t.update(e)}(e);let t=function(){let e=null;for(const t of _p.values())if(t.needsRender){if(null!=e)return null;e=t}return e}();null!=Ip&&t!==Ip&&(Ip.ensureBlittedMode(),t=null),Ip=t,0!==function(){let e=0;for(const t of _p.values())t.needsRender&&e++;return e}()&&(null!=t?(t.ensureDirectMode(),Mp(),Zu(t.width,t.height),wp()):(function(){for(const e of _p.values())e.needsRender&&e.ensureBlittedMode()}(),Mp(),Zu(function(){let e=0;for(const t of _p.values())t.needsRender&&(e=Math.max(e,t.width));return e}(),function(){let e=0;for(const t of _p.values())t.needsRender&&(e=Math.max(e,t.height));return e}()),wp()))}function Mp(){for(const e of _p.values())e.commitResize()}function wp(){for(const e of _p.values())e.render()}function Sp(){let e=null,t=null;return{reset:()=>{e=Z([{time:0,value:0,interpolation:lp},{time:op,value:1,interpolation:lp},{time:2300,value:0,interpolation:lp},{time:4300,value:0,interpolation:lp}]),t=Z([{time:0,value:0,interpolation:lp},{time:op,value:0,interpolation:Ap},{time:800,value:-.05,interpolation:cp},{time:1800,value:.05,interpolation:hp},{time:2300,value:0,interpolation:lp},{time:4300,value:0,interpolation:lp}])},clear:()=>{e=null,t=null},update:n=>{null==e||e.update(n),null==t||t.update(n)},get visibility(){return null==e?void 0:e.get()},get position(){return null==t?void 0:t.get()}}}const Bp=2e3,Tp=2*Math.PI,Rp=Tp/12,Dp=Tp/60,Qp=Tp/60;function Lp(e){return Z([{time:0,value:0,interpolation:{type:"bezier",x1:.9,y1:0,x2:.6,y2:1}},{time:Bp,value:e,interpolation:{type:"hold"}}])}function Up(e,t,n){return-1*Rp*(e%12+t/60+n/3600)}function Pp(e,t){return-1*Dp*(e+t/60)}function Np(e,t){return-1*Qp*(e+t/1e3)}function Fp(e,t){let n,i,r,a,o,s,l,c,h,A,u,d,p,f=!1,g=null,m=new Tn(1,0,0),v=!1,E=!1,b=!1,C=!0,_=!1,I=!1,x=4,y=1,M=!0,w=!1,S=null,B=!1,T=!1,R=!1,D=0,Q=0,L=0,U=0,P=0;const N={get paused(){return C},get needsRender(){return!(!f||C)&&_},ensureDirectMode:()=>{e.isDirect()||(_=!0),e.ensureDirectMode()},ensureBlittedMode:()=>{e.isBlitted()||(_=!0),e.ensureBlittedMode()},update:t=>{if(w||!f||C||null==o||!function(e){const t=e.getBoundingClientRect();return t.bottom>0&&t.top<Math.max(document.documentElement.clientHeight,window.innerHeight)&&t.right>0&&t.left<Math.max(document.documentElement.clientWidth,window.innerWidth)}(e.element))return;let n=0!==P?t-P:0;P=t,0===U?_=!0:U<3&&(n=0),U++,B||(a.hasUserInteracted()?(B=!0,u.running=!1,d.clear(),I=!0):(u.update(n),d.update(n),u.running&&a.set(u.theta,u.phi,u.fov)&&(_=!0),null==d.visibility&&null==d.position||(I=!0))),a.update(n)&&(_=!0,T=!0),0!==n&&p.update()&&(_=!0)},render:()=>{if(!w&&f&&!C){if(_){if(Ju(n,e,!E&&!n.bloomEnabled||b?0:1,x,y),_=!1,!R&&null!=S&&T&&B){const e=performance.now();L>0&&(D++,Q+=e-L),L=e,Q>=2e3&&(R=!0,S({fps:D/Q*1e3}))}else L=0;T=!1,null==h||h()}I&&(t.visible=M&&!B,null!=d.visibility&&(t.opacity=`${d.visibility}`),null!=d.position&&(t.transform=`translateX(${d.position*Math.min(e.width,e.height)}px)`),I=!1)}},get width(){return e.element.clientWidth},get height(){return e.element.clientHeight},prepareResize:()=>{const{clientWidth:t,clientHeight:n}=e.element;e.clientWidth=t,e.clientHeight=n,e.dpr=Yu,e.sizeDirty&&(_=!0)},commitResize:()=>{e.commitResize()}},F=(e,t)=>{const n=l.min.clone().add(l.max).divideScalar(2),i=Math.sqrt(function(e,t){let n=0;const i=new Tn;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{const{geometry:r}=e;if(void 0!==r){const{position:a}=r.attributes;if(void 0!==a)for(let r=0,o=a.count;r<o;r++)e.isMesh?e.getVertexPosition(r,i):i.fromBufferAttribute(a,r),e.isSkinnedMesh||i.applyMatrix4(e.matrixWorld),n=t(n,i)}}),n}(e,(e,t)=>Math.max(e,n.distanceToSquared(t))));a.reset(n,i,t?a.getPose(new Tn):m,t,t),null!=u&&(u.reset(a.getTheta()),a.set(u.theta,u.phi,u.fov))},O={init:()=>{f||(function(e,t){_p.set(e,t),1===_p.size&&(Ku(),ap||(np=new Ms,np.userData.darkness={value:1},np.onBeforeCompile=e=>{e.uniforms.darkness=np.userData.darkness;const t=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );");e.fragmentShader=`uniform float darkness;\n${t}`},np.depthTest=!1,np.depthWrite=!1,ip=new kr(ep),ip.depthTest=!1,rp=new kr(tp),rp.depthTest=!1,ap=!0))}(e.element,N),i=new Xs,r=new Wr(25,1,.5),a=new Ep(r,e.element),a.setInteractionEnabled(M),n=new $d(i,r),c=function(e){let t,n,i,r,a,o,s,l,c=!1;function h(e){s.visible=!0,ip.uniforms.tDiffuse.value=t.texture,ip.uniforms.h.value=1*e/256,s.material=ip;const i=Xu();i.setRenderTarget(n),i.render(s,l),rp.uniforms.tDiffuse.value=n.texture,rp.uniforms.v.value=1*e/256,s.material=rp,i.setRenderTarget(t),i.render(s,l),s.visible=!1}return{init:()=>{c||(t=new Mn(512,512),t.texture.generateMipmaps=!1,n=new Mn(512,512),n.texture.generateMipmaps=!1,i=new Qs,i.position.y=-.7,r=new aa(45,45).rotateX(Math.PI/2),a=new $i({map:t.texture,opacity:.5,transparent:!0,depthWrite:!1,userData:{[Vd]:!0,[Wd]:!0}}),o=new Qr(r,a),o.renderOrder=1,o.scale.y=-1,i.add(o),s=new Qr(r),s.visible=!1,i.add(s),l=new va(-22.5,22.5,22.5,-22.5,0,3),l.rotation.x=Math.PI/2,i.add(l),c=!0)},destroy:()=>{c&&(l=null,s.clear(),s=null,o.clear(),o=null,rd(a),a=null,r.dispose(),r=null,i.clear(),i=null,n.dispose(),n=null,t.dispose(),t=null,c=!1)},get group(){return i},render:()=>{const n=e.background;e.background=null,e.overrideMaterial=np;const i=Xu(),r=i.getClearAlpha();i.setClearAlpha(0),i.setRenderTarget(t),i.render(e,l),e.overrideMaterial=null,h(1.5),h(.4*1.5),i.setRenderTarget(null),i.setClearAlpha(r),e.background=n}}}(i),c.init(),u=up(),d=Sp(),p=function(){let e,t,n,i,r=!1,a=null;return{clear:()=>{r=!1,e=void 0,t=void 0,n=void 0,a=null},reset:i=>{r=!0,e=i.getObjectByName("hours"),t=i.getObjectByName("minutes"),n=i.getObjectByName("seconds"),a=function(e,t,n){let i,r,a,o,s=!1,l=!1;return{update:c=>{if(!s){i=new Date(c),i.setMilliseconds(i.getMilliseconds()+Bp);const e=i.getHours(),t=i.getMinutes(),n=i.getSeconds(),l=i.getMilliseconds();r=Lp(Up(e,t,n)),a=Lp(Pp(t,n)),o=Lp(Np(n,l)),s=!0}if(l)return;const h=i.getTime()-c.getTime(),A=Bp-h;h<=0?l=!0:(null!=e&&(r.seek(A),e.rotation.y=r.get()),null!=t&&(a.seek(A),t.rotation.y=a.get()),null!=n&&(o.seek(A),n.rotation.y=o.get()))},get done(){return l}}}(e,t,n)},update:()=>{if(!r)return!1;const o=new Date;if(null==i&&(i=new Date),null!=a){if(a.update(o),!a.done)return i=o,!0;a=null}if(Math.abs(o.getTime()-i.getTime())<125)return!1;const s=o.getHours(),l=o.getMinutes(),c=o.getSeconds(),h=o.getMilliseconds();return null!=e&&(e.rotation.y=Up(s,l,c)),null!=t&&(t.rotation.y=Pp(l,c)),null!=n&&(n.rotation.y=Np(c,h)),i=o,!0}}}(),f=!0)},destroy:()=>{var t;f&&(null===(t=i.environment)||void 0===t||t.dispose(),i.environment=null,p=null,d=null,u=null,c.destroy(),c=null,n.dispose(),n=null,null!=A&&a.removeEventListener("change",A),A=null,a.dispose(),a=null,r=null,ld(i),i=null,function(e){_p.delete(e),0===_p.size&&(ap&&(rd(rp),rp=null,rd(ip),ip=null,rd(np),np=null,ap=!1),Ip=null,Wu&&(zu.dispose(),zu=null,Vu=null,qu=1,ju=1,Yu=1,Wu=!1))}(e.element),f=!1)},set gltfScene(e){o=e,ld(i),null!=o&&(i.add(o),this.isDiamondScene&&$u(o,s),l=(new Qn).setFromObject(o),c.group.position.y=l.min.y-0,i.add(c.group),c.render(),E=function(e){let t=!1;return e.traverse(e=>{if(!t&&e instanceof Qr){const n=e.material;Array.isArray(n)?n.forEach(e=>{e.transmission>0&&(t=!0)}):n.transmission>0&&(t=!0)}}),t}(i),F(o,v&&B),u.reset(a.getTheta()),d.reset(),p.clear(),"Watches"===g&&p.reset(o),C||xp()),U=0,_=!0},get isDiamondScene(){var e;return!!(null===(e=null==o?void 0:o.userData)||void 0===e?void 0:e.isDiamondScene)},set environment(e){var t;null===(t=i.environment)||void 0===t||t.dispose(),i.environment=e},set diamondEnvironment(e){s=e,this.isDiamondScene&&null!=o&&$u(o,e)},set environmentRotation(e){i.environmentRotation.y=e*Math.PI/180,_=!0},updateOnce:e=>{f&&!C&&(B||(u.update(e),u.running&&a.set(u.theta,u.phi,u.fov)&&(_=!0)),0!==e&&p.update()&&(_=!0))},renderOnce:()=>{N.prepareResize(),N.ensureBlittedMode(),N.commitResize(),Zu(N.width,N.height),B||a.set(u.theta,u.phi,u.fov),Ju(n,e,!E&&!n.bloomEnabled||b?0:1,x,y),null==h||h()},get category(){return g},set category(e){g=e},set initialPose(e){m=e},set toneMapping(e){const t={ACES:4,Linear:1,Neutral:7};null!=t[e]&&(x=t[e]),_=!0},set toneMappingExposure(e){y=e,_=!0},set paused(e){e?(C=!0,a.setInteractionEnabled(!1),function(){for(const{paused:e}of _p.values())if(!e)return!1;return!0}()&&Xu().setAnimationLoop(null),t.opacity="0",t.visible=!1):(C=!1,a.setInteractionEnabled(M),null!=o&&(F(o,!1),_=!0,xp()),P=0)},set interactive(e){M=e,a.setInteractionEnabled(e)},set touchAction(e){a.touchAction=e},set zoomEnabled(e){a.enableZoom=e},set minZoom(e){a.minZoom=e},set maxZoom(e){a.maxZoom=e},set preserveCameraOnReload(e){v=e},set forcedTransparency(e){b=e,_=!0},set defaultFov(e){a.defaultFov=e},set fovMultiplier(e){a.fovMultiplier=e,_=!0},set bloomEnabled(e){n.bloomEnabled=e,_=!0},set bloomStrength(e){n.bloomStrength=e,_=!0},set bloomRadius(e){n.bloomRadius=e,_=!0},set bloomThreshold(e){n.bloomThreshold=e,_=!0},set nonLiveRendering(e){w=e},set onRendered(e){h=e},set onInteracted(e){null!=A&&a.removeEventListener("change",A),A=e,null!=e&&a.addEventListener("change",e)},set onInteractionPerf(e){S=e},set onMaxZoomEnter(e){a.onMaxZoomEnter=e},set onMaxZoomLeave(e){a.onMaxZoomLeave=e},set onMinZoomEnter(e){a.onMinZoomEnter=e},set onMinZoomLeave(e){a.onMinZoomLeave=e},set onMinVerticalAngleEnter(e){a.onMinVerticalAngleEnter=e},set onMinVerticalAngleLeave(e){a.onMinVerticalAngleLeave=e},set onMaxVerticalAngleEnter(e){a.onMaxVerticalAngleEnter=e},set onMaxVerticalAngleLeave(e){a.onMaxVerticalAngleLeave=e},zoomBy:e=>{f&&!C&&(a.adjustZoom(e),_=!0)},rotateBy:(e,t)=>{f&&!C&&(a.adjustOrbit(-e*Math.PI/180,t*Math.PI/180),_=!0)},setAnimationConfig:e=>{u.set(e),null!=o&&F(o,!0),u.custom||(u.reset(a.getTheta()),d.reset()),_=!0}};return O}function Op(e){return t=>k(this,void 0,void 0,function*(){try{yield t()}catch(t){e(t)}})}const kp={initialized:!1,paused:!1,posterUrl:null,glbUrl:null,envUrl:null,diamondEnvUrl:null,envRotation:null,toneMapping:null,toneMappingExposure:null,bloomEnabled:null,bloomStrength:null,bloomRadius:null,bloomThreshold:null,category:null,glbLocal:!1,interactive:!1,touchAction:null,zoomEnabled:!1,minZoom:null,maxZoom:null,preserveCameraOnReload:!1,alwaysTransparentBackground:!1,defaultFov:null,fovMultiplier:null,defaultCameraPositions:null,interactionPromptUrl:null,interactionPromptSize:null,nonLiveRendering:null,baseUrl:null,downloadCacheEnabled:!1,onModelLoaded:null,onRendered:null,onInteracted:null,onInteractionPerf:null,onMaxZoomEnter:null,onMaxZoomLeave:null,onMinZoomEnter:null,onMinZoomLeave:null,onMinVerticalAngleEnter:null,onMinVerticalAngleLeave:null,onMaxVerticalAngleEnter:null,onMaxVerticalAngleLeave:null,animation:null,thetaAnimation:null,phiAnimation:null,fovAnimation:null};function Gp(e,t){const n=e,i=t,r=Fp(i.canvasWrapper,i.prompt),a=function(){const e=Object.assign({},Xc);return{set vectors(t){for(const i of Object.keys(e)){if(!Yc(i))continue;const r=null==t?void 0:t[i];e[i]=null!=r?new Tn((n=r)[0],n[1],n[2]):Xc[i]}var n},getVector:t=>{var n;return(null==t?e.Glasses:null!==(n=e[t])&&void 0!==n?n:e.Glasses).normalize()}}}();let o=()=>{};const s=[],l=new Mh;let c,h,A,u,d,p,f,g,m,v,E,b,C,_,I,x;l.setOnProgress(e=>{i.loading.progress=e,e>0&&(i.loading.visible=!0)});const y=function(){const e=Object.keys(kp).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:0}),{});return t=>{const n=++e[t];return()=>n!==e[t]}}(),M=function(){const e=Object.keys(kp).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:!1}),{});return{lock:t=>{e[t]=!0},unlock:t=>{e[t]=!1},anyLocked:()=>Object.values(e).some(e=>e),locks_:e}}(),w=function(e,t){return n=>{t.length>0?(t.forEach(e=>e.reject(n)),t.length=0):e.onError?e.onError(n):console.error(n)}}(n,s),S=function(e,t){return(n,i)=>k(this,void 0,void 0,function*(){const r=Op(t),a=function(e,t){const n=e(t);return e=>k(this,void 0,void 0,function*(){yield e(n)})}(e,n);yield r(()=>a(i))})}(y,w),B=function(e,t,n,i){return(r,a)=>k(this,void 0,void 0,function*(){const o=function(e,t){return n=>k(this,void 0,void 0,function*(){e.lock(t),yield n(),e.unlock(t)})}(e,r),s=Op(i),l=function(e,t,n,i){const r=t(i);return t=>k(this,void 0,void 0,function*(){yield Promise.resolve(),r()||(yield t(r))&&(e.unlock(i),e.anyLocked()||n())})}(e,t,n,r);yield o(()=>s(()=>l(a)))})}(M,y,()=>{void 0!==E&&(r.category=E,r.initialPose=a.getVector(null!=E?E:Kc)),void 0!==c&&(r.gltfScene=c),void 0!==h&&(r.environment=h),void 0!==A&&(r.diamondEnvironment=A),void 0!==u&&(r.environmentRotation=null!=u?u:0),void 0!==f&&(r.bloomEnabled=null!=f&&f),void 0!==g&&(r.bloomStrength=null!=g?g:.25),void 0!==m&&(r.bloomRadius=null!=m?m:0),void 0!==v&&(r.bloomThreshold=null!=v?v:2),null==o||o(),void 0!==x&&r.setAnimationConfig(x),void 0!==d&&(r.toneMapping=null!=d?d:"Neutral"),void 0!==p&&(r.toneMappingExposure=null!=p?p:1),void 0!==b&&(r.forcedTransparency=b),void 0!==C&&(r.onRendered=C),void 0!==_&&(r.onInteracted=_),void 0!==I&&(r.onInteractionPerf=I),r.renderOnce(),i.canvasVisible=!0,i.posterVisible=!1,i.loading.visible=!1,s.forEach(e=>e.resolve()),s.length=0,c=void 0,h=void 0,A=void 0,d=void 0,p=void 0,E=void 0,b=void 0,C=void 0,_=void 0,I=void 0},w);return n.onInitializedChange=e=>S("initialized",t=>k(this,void 0,void 0,function*(){e?(r.init(),r.paused=n.paused):r.destroy()})),n.onPausedChange=e=>S("paused",t=>k(this,void 0,void 0,function*(){r.paused=e})),n.onPosterUrlChange=e=>S("posterUrl",t=>k(this,void 0,void 0,function*(){i.loadPoster(e),i.posterVisible=M.anyLocked(),i.canvasVisible=!M.anyLocked()})),n.onGlbUrlChange=t=>B("glbUrl",r=>k(this,void 0,void 0,function*(){if(r()||!n.initialized)return!1;if(null!=t)if(id(),"string"==typeof t){null!=n.posterUrl&&(i.posterVisible=!0,i.canvasVisible=!1);const a=255,o=Hp(e.glbLocal)?new Uint8Array(yield Eh(t,l,n.downloadCacheEnabled)):yield bh(t,(new Date).getTime()+a,Math.random()*a,l,n.downloadCacheEnabled);if(r()||!n.initialized)return!1;const s=yield nd(o);if(r()||!n.initialized)return!1;c=s.scene}else{const i=255,a=Hp(e.glbLocal,"left")?Eh(t.left,l,n.downloadCacheEnabled).then(e=>new Uint8Array(e)):bh(t.left,(new Date).getTime()+i,Math.random()*i,l,n.downloadCacheEnabled),o=Hp(e.glbLocal,"right")?Eh(t.right,l,n.downloadCacheEnabled).then(e=>new Uint8Array(e)):bh(t.right,(new Date).getTime()+i,Math.random()*i,l,n.downloadCacheEnabled),s=yield a;if(r()||!n.initialized)return!1;const h=yield o;if(r()||!n.initialized)return!1;const A=(yield nd(s)).scene;if(r()||!n.initialized)return!1;const u=(yield nd(h)).scene;if(r()||!n.initialized)return!1;c=function(e,t){const n=new Qs,i=sd(e).getSize(new Tn),r=sd(t).getSize(new Tn),a=.075*Math.max(i.z,r.z),o=ad(e,a,!1,void 0,new Bn(0,0,0,1));e.position.set(o.x,o.y,o.z);const s=ad(t,a,!0,void 0,new Bn(0,0,0,1));return t.position.set(s.x,s.y,s.z),n.add(e,t),n}(A,u)}else c=null;return!0})),n.onEnvUrlChange=e=>B("envUrl",t=>k(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null!=e){const i=yield Eh(e,l,n.downloadCacheEnabled);if(t()||!n.initialized)return!1;h=aA(i)}else h=null;return!0})),n.onDiamondEnvUrlChange=e=>B("diamondEnvUrl",t=>k(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null!=e){const i=yield Eh(e,l,n.downloadCacheEnabled);if(t()||!n.initialized)return!1;A=aA(i)}else A=null;return!0})),n.onEnvRotationChange=e=>B("envRotation",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(u=e,0))})),n.onToneMappingChange=e=>B("toneMapping",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(d=e,0))})),n.onToneMappingExposureChange=e=>B("toneMappingExposure",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(p=e,0))})),n.onBloomEnabledChange=e=>B("bloomEnabled",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(f=e,0))})),n.onBloomStrengthChange=e=>B("bloomStrength",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(g=e,0))})),n.onBloomRadiusChange=e=>B("bloomRadius",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(m=e,0))})),n.onBloomThresholdChange=e=>B("bloomThreshold",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(v=e,0))})),n.onCategoryChange=e=>B("category",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(E=e,0))})),n.onInteractiveChange=e=>S("interactive",t=>k(this,void 0,void 0,function*(){r.interactive=e})),n.onTouchActionChange=e=>S("touchAction",t=>k(this,void 0,void 0,function*(){r.touchAction=e})),n.onZoomEnabledChange=e=>S("zoomEnabled",t=>k(this,void 0,void 0,function*(){r.zoomEnabled=e})),n.onMinZoomChange=e=>S("minZoom",t=>k(this,void 0,void 0,function*(){r.minZoom=e})),n.onMaxZoomChange=e=>S("maxZoom",t=>k(this,void 0,void 0,function*(){r.maxZoom=e})),n.onPreserveCameraOnReloadChange=e=>S("preserveCameraOnReload",t=>k(this,void 0,void 0,function*(){r.preserveCameraOnReload=e})),n.onAlwaysTransparentBackgroundChange=e=>B("alwaysTransparentBackground",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(b=e,0))})),n.onDefaultFovChange=e=>S("defaultFov",t=>k(this,void 0,void 0,function*(){r.defaultFov=null!=e?e:16})),n.onFovMultiplierChange=e=>S("fovMultiplier",t=>k(this,void 0,void 0,function*(){r.fovMultiplier=null!=e?e:1})),n.onDefaultCameraPositionsChange=e=>S("defaultCameraPositions",t=>k(this,void 0,void 0,function*(){var t;a.vectors=e,r.initialPose=a.getVector(null!==(t=r.category)&&void 0!==t?t:Kc)})),n.onInteractionPromptUrlChange=e=>S("interactionPromptUrl",t=>k(this,void 0,void 0,function*(){i.prompt.imageUrl=e})),n.onInteractionPromptSizeChange=e=>S("interactionPromptSize",t=>k(this,void 0,void 0,function*(){i.prompt.imageSize=e})),n.onNonLiveRenderingChange=e=>S("nonLiveRendering",t=>k(this,void 0,void 0,function*(){r.nonLiveRendering=!!e})),n.onBaseUrlChange=e=>S("baseUrl",t=>k(this,void 0,void 0,function*(){Ou(e)})),n.onOnModelLoadedChange=e=>S("onModelLoaded",t=>k(this,void 0,void 0,function*(){o=e})),n.onOnRenderedChange=e=>B("onRendered",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(C=e,0))})),n.onOnInteractedChange=e=>B("onInteracted",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(_=e,0))})),n.onOnInteractionPerfChange=e=>B("onInteractionPerf",t=>k(this,void 0,void 0,function*(){return!(t()||!n.initialized||(I=e,0))})),n.onOnMaxZoomEnterChange=e=>S("onMaxZoomEnter",t=>k(this,void 0,void 0,function*(){r.onMaxZoomEnter=e})),n.onOnMaxZoomLeaveChange=e=>S("onMaxZoomLeave",t=>k(this,void 0,void 0,function*(){r.onMaxZoomLeave=e})),n.onOnMinZoomEnterChange=e=>S("onMinZoomEnter",t=>k(this,void 0,void 0,function*(){r.onMinZoomEnter=e})),n.onOnMinZoomLeaveChange=e=>S("onMinZoomLeave",t=>k(this,void 0,void 0,function*(){r.onMinZoomLeave=e})),n.onOnMinVerticalAngleEnterChange=e=>S("onMinVerticalAngleEnter",t=>k(this,void 0,void 0,function*(){r.onMinVerticalAngleEnter=e})),n.onOnMinVerticalAngleLeaveChange=e=>S("onMinVerticalAngleLeave",t=>k(this,void 0,void 0,function*(){r.onMinVerticalAngleLeave=e})),n.onOnMaxVerticalAngleEnterChange=e=>S("onMaxVerticalAngleEnter",t=>k(this,void 0,void 0,function*(){r.onMaxVerticalAngleEnter=e})),n.onOnMaxVerticalAngleLeaveChange=e=>S("onMaxVerticalAngleLeave",t=>k(this,void 0,void 0,function*(){r.onMaxVerticalAngleLeave=e})),n.onAnimationChange=e=>B("animation",t=>k(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null==e)return x={theta:null,phi:null,fov:null},!0;const i=oe(e);return x={theta:null!=i.theta?Z(i.theta):null,phi:null!=i.phi?Z(i.phi):null,fov:null!=i.fov?Z(i.fov):null},!0})),{render:e=>{r.updateOnce(e),r.renderOnce()},flushChanges:()=>new Promise((e,t)=>{M.anyLocked()?s.push({resolve:e,reject:t}):e()}),zoomBy:e=>{r.zoomBy(e)},rotateBy:(e,t)=>{r.rotateBy(e,t)}}}function Hp(e,t){if(null==t){if("boolean"==typeof e)return e;const t=e.left||e.right;return console.warn(`Expected 'glbLocal' to be boolean, but got object (treating as ${t}).`),t}return"boolean"==typeof e?e:e[t]}var zp,Vp,Wp,qp,jp,Yp,Xp,Kp,Jp,Zp,$p,ef;!function(e){e[e.Empty=0]="Empty",e[e.Direct=1]="Direct",e[e.Blitted=2]="Blitted"}(ef||(ef={}));class tf{constructor(){zp.add(this),Vp.set(this,document.createElement("div")),Wp.set(this,ef.Empty),qp.set(this,null),jp.set(this,1),Yp.set(this,1),Xp.set(this,1),Kp.set(this,1),Jp.set(this,1),Zp.set(this,!1);const{style:e}=G(this,Vp,"f");e.position="absolute",e.top="0",e.left="0",e.width="100%",e.height="100%",e.pointerEvents="auto"}get element(){return G(this,Vp,"f")}isDirect(){return G(this,Wp,"f")===ef.Direct}ensureDirectMode(){if(G(this,Wp,"f")===ef.Direct)return;H(this,Wp,ef.Direct);const e=Xu().domElement;document.contains(e)&&console.warn("[ShopAR 3D] Direct rendering not working properly!"),G(this,Vp,"f").replaceChildren(e),H(this,qp,null),H(this,Zp,!0)}isBlitted(){return G(this,Wp,"f")===ef.Blitted}ensureBlittedMode(){G(this,Wp,"f")!==ef.Blitted&&(H(this,Wp,ef.Blitted),H(this,qp,function(){const e=document.createElement("canvas"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",e}()),G(this,Vp,"f").replaceChildren(G(this,qp,"f")),H(this,Zp,!0))}set visible(e){G(this,Vp,"f").style.visibility=e?"visible":"hidden"}get width(){return G(this,Xp,"f")}get height(){return G(this,Kp,"f")}set clientWidth(e){e!==G(this,jp,"f")&&H(this,Zp,!0),H(this,jp,e)}set clientHeight(e){e!==G(this,Yp,"f")&&H(this,Zp,!0),H(this,Yp,e)}get dpr(){return G(this,Jp,"f")}set dpr(e){e!==this.dpr&&H(this,Zp,!0),H(this,Jp,e)}get sizeDirty(){return G(this,Zp,"f")}commitResize(){if(!G(this,Zp,"f"))return;H(this,Zp,!1);const e=G(this,zp,"m",$p).call(this);null!=e&&(H(this,Xp,Math.ceil(G(this,jp,"f")*G(this,Jp,"f"))),H(this,Kp,Math.ceil(G(this,Yp,"f")*G(this,Jp,"f"))),e.width=G(this,Xp,"f"),e.height=G(this,Kp,"f"))}get context2d(){var e,t;return null!==(t=null===(e=G(this,qp,"f"))||void 0===e?void 0:e.getContext("2d"))&&void 0!==t?t:null}}function nf(e){return`var(${e.var}, ${e.default})`}Vp=new WeakMap,Wp=new WeakMap,qp=new WeakMap,jp=new WeakMap,Yp=new WeakMap,Xp=new WeakMap,Kp=new WeakMap,Jp=new WeakMap,Zp=new WeakMap,zp=new WeakSet,$p=function(){return G(this,Wp,"f")===ef.Direct?Xu().domElement:G(this,Wp,"f")===ef.Blitted?G(this,qp,"f"):null};const rf="--shopar-3d",af={display:{var:`${rf}-loading-display`,default:"block"},top:{var:`${rf}-loading-top`,default:"0"},bottom:{var:`${rf}-loading-bottom`,default:"auto"},height:{var:`${rf}-loading-height`,default:"0.375rem"},radius:{var:`${rf}-loading-radius`,default:"calc(infinity * 1px)"},fg:{var:`${rf}-loading-fg`,default:"linear-gradient(90deg, #773cd8, #5fb9ec)"},bg:{var:`${rf}-loading-bg`,default:"#e5e7eb"}},of="width 0.05s ease-out";const sf="data:image/svg+xml,%3csvg width='869' height='1251' viewBox='0 0 869 1251' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_894_1533)'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M303.44 353.132C304.829 314.64 330.051 282.714 363.992 272.987C371.106 271.049 378.436 270.01 385.808 269.895C391.367 269.895 396.717 270.486 401.893 271.424C439.69 278.372 467.899 309.36 467.899 346.462V654.953H511.671C613.911 606.665 685.371 500.36 685.371 376.165C685.571 306.213 662.333 238.211 619.365 183.01L604.427 165.64C577.851 136.528 545.96 112.766 510.212 96.1603C473.492 79.1377 432.881 69.4105 390.012 69.4105C347.143 69.4105 306.636 79.0683 269.812 96.1603C234.029 112.766 202.173 136.528 175.666 165.64L160.728 183.01C117.761 238.211 94.5225 306.213 94.722 376.165C94.714 391.336 95.8054 406.487 97.9875 421.5C99.0297 428.796 101.045 435.744 102.504 442.935L107.228 464.613C110.112 474.548 114.037 484.067 117.824 493.516L122.132 505.085C127.341 516.473 133.246 527.53 139.814 538.192L142.073 542.43C171.755 590.029 214.112 628.416 264.392 653.286L302.954 671.941V353.097L303.44 353.132Z' fill='white' fill-opacity='0.5'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M797.001 876.074L701.118 1144.96C695.143 1161.81 677.634 1172.75 657.589 1172.75H425.283C369.49 1172.75 317.867 1149.13 287.018 1109.53C231.711 1038.38 160.321 976.75 74.7561 926.447C71.4558 924.536 69.5451 921.687 69.4757 918.456C69.3367 914.982 71.0737 911.647 76.1805 908.139C95.6349 894.486 119.05 887.295 143.09 887.295C151.152 887.279 159.195 888.083 167.095 889.692L338.085 924.223V346.427C338.085 323.395 359.45 304.635 385.679 304.635C411.908 304.635 433.377 323.395 433.377 346.427V689.728H535.964C545.448 689.728 554.481 692.264 562.263 697.024L779.631 831.606C780.569 832.197 781.194 833.065 782.063 833.691C796.306 843.974 802.42 860.441 796.862 876.074M142.499 542.431C141.665 541.041 141.04 539.547 140.241 538.192C133.666 527.534 127.76 516.477 122.558 505.085C120.891 501.368 119.779 497.338 118.251 493.517L107.655 464.613C105.64 457.595 104.528 450.161 102.93 442.935L98.4141 421.501C96.2308 406.488 95.1394 391.336 95.1485 376.165C95.1485 302.968 119.953 235.815 161.155 183.011L176.093 165.641C202.634 136.459 234.525 112.731 270.238 96.1605C306.993 79.1379 347.569 69.4107 390.439 69.4107C433.308 69.4107 473.884 79.1379 510.639 96.1605C546.421 112.731 578.278 136.459 604.854 165.641L619.723 183.011C662.719 238.184 685.972 306.182 685.763 376.13C685.763 500.395 614.338 606.665 512.063 654.953H468.291V346.393C468.291 309.325 439.735 278.302 402.285 271.354C397.074 270.382 391.724 269.826 386.2 269.826C378.557 269.826 371.366 271.111 364.384 272.952C330.443 282.68 305.221 314.571 303.832 353.063V671.907L265.27 653.251C214.758 628.725 172.376 590.58 142.499 542.431ZM798.043 802.147L580.71 667.564C577.166 665.375 573.136 664.16 569.245 662.562C662.453 600.03 720.503 493.899 720.503 376.2C720.503 359.316 719.218 342.71 716.89 326.521C709.659 275.243 691.021 226.238 662.348 183.115L652.1 168.941L649.807 165.745C639.725 152.491 628.708 139.976 616.839 128.295C604.958 116.692 592.243 105.957 578.834 96.2647C538.709 67.2916 492.261 47.2118 441.958 38.9437L416.528 35.8866L390.543 34.8444C373.298 34.8447 356.082 36.2272 339.058 38.9785C288.789 47.2466 242.272 67.3263 202.182 96.2995C192.322 103.7 182.893 111.657 173.939 120.131C163.518 129.655 153.713 139.831 144.584 150.598L131.209 165.779L118.702 183.149L108.697 199.408L94.1758 226.436L92.7862 229.562C72.1854 274.029 60.478 323.708 60.478 376.234C60.478 509.358 136.281 631.295 253.632 686.741L303.554 710.364V882.188L173.765 855.994C163.608 853.965 153.273 852.964 142.916 853.006C142.325 853.006 141.735 853.11 141.179 853.11C132.425 853.249 123.705 854.257 115.124 855.89C112.364 856.472 109.619 857.121 106.891 857.835C100.186 859.433 93.62 861.552 87.1583 864.088C84.5528 865.13 81.9473 866.068 79.3418 867.562C70.6568 871.523 62.1803 876.039 54.2248 881.632C47.9431 885.96 42.8502 891.798 39.4144 898.609C35.9785 905.42 34.3099 912.986 34.562 920.61C34.9201 928.091 37.1618 935.359 41.079 941.742C44.9961 948.125 50.4619 953.415 56.9693 957.122C139.025 1004.85 207.116 1063.53 259.677 1131.24C264.329 1137.24 269.365 1142.94 274.754 1148.3C312.482 1185.88 367.024 1207.81 425.04 1207.88H657.693C683.679 1207.84 707.372 1196.31 722.24 1177.58C727.173 1171.33 731.134 1164.38 733.913 1156.67L829.691 887.781C832.957 878.749 834.207 869.369 833.582 860.197C832.957 851.026 830.525 842.133 826.53 833.795C820.225 820.757 810.33 809.79 798.008 802.182' fill='black' fill-opacity='0.6'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M779.738 831.676L562.37 697.093C554.446 692.276 545.346 689.739 536.072 689.763H433.485V346.532C433.485 323.499 412.085 304.74 385.787 304.74C359.489 304.74 338.193 323.499 338.193 346.532V924.71L167.203 890.178C159.291 888.569 151.236 887.766 143.163 887.781C119.267 887.676 95.9182 894.929 76.2881 908.555C71.1813 912.099 69.4096 915.434 69.5485 918.908C69.6875 922.174 71.5635 925.022 74.8638 926.898C160.394 977.202 231.784 1038.76 287.125 1109.98C317.94 1149.58 369.563 1173.2 425.39 1173.2H657.662C677.707 1173.2 695.181 1161.88 701.191 1145.41L797.074 876.525C802.632 860.962 796.483 844.46 782.274 834.142C781.406 833.448 780.781 832.649 779.843 832.058L779.738 831.676Z' fill='white'/%3e%3cmask id='mask0_894_1533' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='869' height='1243'%3e%3cpath d='M0.0664062 0.0349731H868.462V1242.62H0.0664062V0.0349731Z' fill='white'/%3e%3c/mask%3e%3cg mask='url(%23mask0_894_1533)'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M833.58 860.197C834.209 869.559 832.897 878.95 829.724 887.781L733.911 1156.67C731.132 1164.31 727.172 1171.36 722.239 1177.58C707.405 1196.34 683.677 1207.81 657.727 1207.88H425.038C367.022 1207.81 312.481 1185.88 274.753 1148.3C269.403 1142.95 264.331 1137.25 259.676 1131.27C207.114 1063.57 139.024 1004.89 57.2458 956.809C43.8709 948.993 35.4985 935.34 34.8385 920.332C34.5864 912.708 36.255 905.143 39.6909 898.332C43.1267 891.521 48.2196 885.682 54.5013 881.354C62.4292 875.912 70.8363 871.202 79.6183 867.284L87.4348 863.81C93.8598 861.272 100.453 859.183 107.167 857.557L115.401 855.612C124.016 854.014 132.771 853.006 141.456 852.833C142.081 852.833 142.637 852.728 143.193 852.728C153.719 852.694 163.932 853.666 174.111 855.716L303.413 881.84V710.399L253.527 686.775C136.21 631.33 60.3724 509.393 60.3724 376.269C60.3724 323.812 72.045 274.134 92.6806 229.597C93.2017 228.555 93.5491 227.513 94.0702 226.47C98.4821 217.195 103.38 208.232 108.591 199.443C111.822 193.884 115.053 188.465 118.597 183.184C120.785 179.884 123.217 176.723 125.545 173.561L131.138 165.675C135.237 160.291 140.17 155.601 144.513 150.494C153.753 140.072 163.411 129.511 173.868 120.027C182.822 111.552 192.251 103.596 202.112 96.1953C242.202 67.2569 288.753 47.2119 339.022 38.8743C356.034 36.1219 373.239 34.7394 390.472 34.7402C399.145 34.7313 407.815 35.0906 416.457 35.8172C425.038 36.512 433.48 37.5542 441.922 38.8743C492.225 47.1424 538.707 67.2221 578.797 96.1953C592.242 105.923 604.922 116.622 616.803 128.226C628.681 139.898 639.699 152.413 649.771 165.675L652.064 168.871C655.607 173.492 659.116 178.182 662.312 183.045C690.997 226.166 709.647 275.171 716.889 326.452C719.182 342.676 720.467 359.281 720.467 376.13C720.467 493.829 662.451 600.307 569.244 662.492C573.065 664.09 577.13 665.271 580.708 667.495L798.041 802.077C810.895 810.068 820.449 821.184 826.528 833.343C830.523 841.681 832.955 850.644 833.58 859.746M857.794 818.231C848.588 799.124 834.275 783.248 816.315 772.166L631.394 657.628C709.732 586.863 755.207 484.971 755.207 375.748C755.207 299.667 733.078 226.227 691.285 163.348C686.908 156.817 682.253 150.494 677.389 144.171C654.982 114.712 628.684 88.5872 599.155 67.6043C537.561 23.5887 465.337 0.0349731 390.472 0.0349731C315.457 0.0670918 242.383 23.8817 181.754 68.0559C152.294 89.3863 125.961 115.163 103.485 144.658C98.7601 150.911 94.0354 157.268 89.6582 163.765C47.7965 226.679 25.6671 300.119 25.6671 376.2C25.6671 522.733 109.286 656.899 238.728 718.111L268.708 732.354V839.77L180.99 822.053C168.622 819.621 156.081 818.37 143.609 818.37C104.55 818.376 66.4474 830.462 34.5258 852.971C11.8406 868.952 -0.978479 894.729 0.133201 921.861C0.732449 935.148 4.66826 948.071 11.5776 959.437C18.4869 970.803 28.1472 980.245 39.6673 986.894C117.485 1032.68 182.31 1088.44 232.231 1152.67C276.004 1208.95 348.02 1242.65 425.038 1242.72H657.727C707.057 1242.68 750.83 1212.84 766.602 1168.45L862.484 899.558C871.933 873.26 870.266 844.53 857.829 818.787' fill='black' fill-opacity='0.05'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0_894_1533'%3e%3crect width='868.5' height='1250.64' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",lf="2rem";function cf(e){const t=function(){const e=document.createElement("div"),{style:t}=e;return t.position="relative",t.width="100%",t.height="100%",t.pointerEvents="none",e}(),n=function(){const e=document.createElement("div");e.draggable=!1;const{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.objectFit="contain",t.visibility="hidden",t.backgroundSize="contain",t.backgroundRepeat="no-repeat",t.backgroundPosition="center",e}();t.appendChild(n);const i=new tf;t.appendChild(i.element);const r=function(){const e=function(){const e=document.createElement("div"),{style:t}=e;return t.display=nf(af.display),t.opacity="0",t.transition="opacity 0.2s ease-out",t.position="absolute",t.top=nf(af.top),t.bottom=nf(af.bottom),t.left="0",t.width="100%",t.height=nf(af.height),t.overflow="hidden",e}(),t=function(){const e=document.createElement("div"),{style:t}=e;return t.position="absolute",t.width="100%",t.height="100%",t.background=nf(af.bg),e}(),n=function(){const e=document.createElement("div"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="0%",t.height="100%",t.background=nf(af.fg),t.borderRadius=nf(af.radius),t.transition=of,e}();t.appendChild(n),e.appendChild(t);let i=0;return{get container(){return e},set progress(e){e<i?(n.style.transition="none",n.style.width=100*e+"%",n.offsetWidth,n.style.transition=of):n.style.width=100*e+"%",i=e},set visible(t){e.style.opacity=t?"1":"0"}}}();t.appendChild(r.container);const a=function(){const e=function(){const e=document.createElement("div"),{style:t}=e;return t.visibility="hidden",t.position="absolute",t.width="100%",t.height="100%",t.display="flex",t.justifyContent="center",t.alignItems="center",e}(),t=function(){const e=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width",e),t.setAttribute("height",e),t}(lf),{style:t}=e;return t.transition="opacity 0.3s",t.opacity="0",e}(),n=function(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","image");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t),n.setAttribute("width",e),n.setAttribute("height",e),n}(lf,sf);return t.appendChild(n),e.appendChild(t),{get container(){return e},get svg(){return t},set imageUrl(e){n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",null!=e?e:sf)},set imageSize(e){const i=null!=e?e:lf;t.setAttribute("width",i),t.setAttribute("height",i),n.setAttribute("width",i),n.setAttribute("height",i)},set visible(t){e.style.visibility=t?"visible":"hidden"},set opacity(e){t.style.opacity=e},set transform(e){t.style.transform=e}}}();return t.appendChild(a.container),{get root(){return t},get canvasWrapper(){return i},get loading(){return r},get prompt(){return a},set canvasVisible(e){i.visible=e},set posterVisible(e){n.style.visibility=e?"visible":"hidden"},loadPoster:e=>{n.style.backgroundImage=e?`url(${e})`:""}}}var hf,Af,uf,df;class pf extends HTMLElement{constructor(){super(),hf.add(this),Af.set(this,void 0),uf.set(this,void 0),H(this,Af,function(){let e,t,n,i,r,a,o,s,l,c,h,A,u,d,p,f,g,m,v,E,b,C,_,I,x,y,M,w,S,B,T,R,D,Q,L,U,P,N,F,O,k,G,H,z,V=()=>{},W=()=>{},q=()=>{},j=()=>{},Y=()=>{},X=()=>{},K=()=>{},J=()=>{},Z=()=>{},$=()=>{},ee=()=>{},te=()=>{},ne=()=>{},ie=()=>{},re=()=>{},ae=()=>{},oe=()=>{},se=()=>{},le=()=>{},ce=()=>{},he=()=>{},Ae=()=>{},ue=()=>{},de=()=>{},pe=()=>{},fe=()=>{},ge=()=>{},me=()=>{},ve=()=>{},Ee=()=>{},be=()=>{},Ce=()=>{},_e=()=>{},Ie=()=>{},xe=()=>{},ye=()=>{},Me=()=>{},we=()=>{},Se=()=>{},Be=()=>{},Te=()=>{},Re=()=>{},De=()=>{},Qe=()=>{};function Le(){e=!1,t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null,h=null,A=null,u=null,d=null,p=!1,f=!0,g=null,m=null,v=null,E=null,b=null,C=null,_=null,I=null,x=null,y=null,M=null,w=null,S=null,B=null,T=!0,R=null,D=null,Q=!1,L=!1,U=null,P=null,N=null,F=null,O=null,k=null,G=null,H=null,z=!1}return Le(),{get initialized(){return e},set initialized(t){const n=t!==e;e=t,t||Le(),n&&(null==V||V(e))},set onInitializedChange(e){V=e},get paused(){return t},set paused(e){const n=e!==t;t=e,n&&(null==W||W(t))},set onPausedChange(e){W=e},get posterUrl(){return n},set posterUrl(e){const t=e!==n;n=e,t&&(null==q||q(e))},set onPosterUrlChange(e){q=e},set glbUrl(e){const t=e!==i;i=e,t&&(null==j||j(i))},set onGlbUrlChange(e){j=e},set envUrl(e){const t=e!==r;r=e,t&&(null==Y||Y(r))},set onEnvUrlChange(e){Y=e},set diamondEnvUrl(e){const t=e!==a;a=e,t&&(null==X||X(a))},set onDiamondEnvUrlChange(e){X=e},set envRotation(e){const t=e!==o;o=e,t&&(null==K||K(o))},set onEnvRotationChange(e){K=e},set toneMapping(e){const t=e!==s;s=e,t&&(null==J||J(s))},set onToneMappingChange(e){J=e},set toneMappingExposure(e){const t=e!==l;l=e,t&&(null==Z||Z(l))},set onToneMappingExposureChange(e){Z=e},set bloomEnabled(e){const t=e!==c;c=e,t&&(null==$||$(c))},set onBloomEnabledChange(e){$=e},set bloomStrength(e){const t=e!==h;h=e,t&&(null==ee||ee(h))},set onBloomStrengthChange(e){ee=e},set bloomRadius(e){const t=e!==A;A=e,t&&(null==te||te(A))},set onBloomRadiusChange(e){te=e},set bloomThreshold(e){const t=e!==u;u=e,t&&(null==ne||ne(u))},set onBloomThresholdChange(e){ne=e},set category(e){const t=e!==d;d=e,t&&(null==ie||ie(d))},set onCategoryChange(e){ie=e},get glbLocal(){return p},set glbLocal(e){const t=e!==p;p=e,t&&(null==re||re(p))},set onGlbLocalChange(e){re=e},set interactive(e){const t=e!==f;f=e,t&&(null==ae||ae(f))},set onInteractiveChange(e){ae=e},set onModelLoaded(e){const t=e!==g;g=e,t&&(null==oe||oe(g))},set onOnModelLoadedChange(e){oe=e},set onRendered(e){const t=e!==m;m=e,t&&(null==se||se(m))},set onOnRenderedChange(e){se=e},set onInteracted(e){const t=e!==v;v=e,t&&(null==le||le(v))},set onOnInteractedChange(e){le=e},set onInteractionPerf(e){const t=e!==E;E=e,t&&(null==ce||ce(E))},set onOnInteractionPerfChange(e){ce=e},set onMaxZoomEnter(e){const t=e!==b;b=e,t&&(null==he||he(b))},set onOnMaxZoomEnterChange(e){he=e},set onMaxZoomLeave(e){const t=e!==C;C=e,t&&(null==Ae||Ae(C))},set onOnMaxZoomLeaveChange(e){Ae=e},set onMinZoomEnter(e){const t=e!==_;_=e,t&&(null==ue||ue(_))},set onOnMinZoomEnterChange(e){ue=e},set onMinZoomLeave(e){const t=e!==I;I=e,t&&(null==de||de(I))},set onOnMinZoomLeaveChange(e){de=e},set onMinVerticalAngleEnter(e){const t=e!==x;x=e,t&&(null==pe||pe(x))},set onOnMinVerticalAngleEnterChange(e){pe=e},set onMinVerticalAngleLeave(e){const t=e!==y;y=e,t&&(null==fe||fe(y))},set onOnMinVerticalAngleLeaveChange(e){fe=e},set onMaxVerticalAngleEnter(e){const t=e!==M;M=e,t&&(null==ge||ge(M))},set onOnMaxVerticalAngleEnterChange(e){ge=e},set onMaxVerticalAngleLeave(e){const t=e!==w;w=e,t&&(null==me||me(w))},set onOnMaxVerticalAngleLeaveChange(e){me=e},get onError(){return S},set onError(e){const t=e!==S;S=e,t&&(null==ve||ve(S))},set onOnErrorChange(e){ve=e},set touchAction(e){const t=e!==B;B=e,t&&(null==Ee||Ee(B))},set onTouchActionChange(e){Ee=e},set zoomEnabled(e){const t=e!==T;T=e,t&&(null==be||be(T))},set onZoomEnabledChange(e){be=e},set minZoom(e){const t=e!==R;R=e,t&&(null==Ce||Ce(R))},set onMinZoomChange(e){Ce=e},set maxZoom(e){const t=e!==D;D=e,t&&(null==_e||_e(D))},set onMaxZoomChange(e){_e=e},set preserveCameraOnReload(e){const t=e!==Q;Q=e,t&&(null==Ie||Ie(Q))},set onPreserveCameraOnReloadChange(e){Ie=e},set alwaysTransparentBackground(e){const t=e!==L;L=e,t&&(null==xe||xe(L))},set onAlwaysTransparentBackgroundChange(e){xe=e},set defaultFov(e){const t=e!==U;U=e,t&&(null==ye||ye(U))},set onDefaultFovChange(e){ye=e},set fovMultiplier(e){const t=e!==P;P=e,t&&(null==Me||Me(P))},set onFovMultiplierChange(e){Me=e},set defaultCameraPositions(e){const t=e!==N;N=e,t&&(null==we||we(N))},set onDefaultCameraPositionsChange(e){we=e},set interactionPromptUrl(e){const t=e!==F;F=e,t&&(null==Se||Se(F))},set onInteractionPromptUrlChange(e){Se=e},set interactionPromptSize(e){const t=e!==O;O=e,t&&(null==Be||Be(O))},set onInteractionPromptSizeChange(e){Be=e},set animation(e){const t=e!==k;k=e,t&&(null==Te||Te(k))},set onAnimationChange(e){Te=e},set nonLiveRendering(e){const t=e!==G;G=e,t&&(null==Re||Re(G))},set onNonLiveRenderingChange(e){Re=e},set baseUrl(e){const t=e!==H;H=e,t&&(null==De||De(H))},set onBaseUrlChange(e){De=e},get downloadCacheEnabled(){return z},set downloadCacheEnabled(e){const t=e!==z;z=e,t&&(null==Qe||Qe(z))},set onDownloadCacheEnabledChange(e){Qe=e}}}());const e=cf(G(this,Af,"f"));H(this,uf,Gp(G(this,Af,"f"),e)),this.attachShadow({mode:"open"}).appendChild(e.root)}connectedCallback(){G(this,Af,"f").initialized=!0}disconnectedCallback(){G(this,Af,"f").paused=!0,G(this,Af,"f").initialized=!1}attributeChangedCallback(e,t,n){var i,r;if(G(this,Af,"f").initialized)if("paused"===e)G(this,Af,"f").paused=ff(n);else if("poster-url"===e)G(this,Af,"f").posterUrl=n;else if("glb-url"===e)G(this,Af,"f").glbUrl=function(e){if(null==e?void 0:e.includes("|")){const[t,n]=e.split("|",2);return{left:t,right:n}}return e}(n);else if("env-url"===e)G(this,Af,"f").envUrl=n;else if("diamond-env-url"===e)G(this,Af,"f").diamondEnvUrl=n;else if("env-rotation"===e)G(this,Af,"f").envRotation=gf(n);else if("tone-mapping"===e)G(this,Af,"f").toneMapping=(r=i=n,qc.includes(r)?i:null);else if("tone-mapping-exposure"===e)G(this,Af,"f").toneMappingExposure=gf(n);else if("bloom-enabled"===e)G(this,Af,"f").bloomEnabled=ff(n);else if("bloom-strength"===e)G(this,Af,"f").bloomStrength=gf(n);else if("bloom-radius"===e)G(this,Af,"f").bloomRadius=gf(n);else if("bloom-threshold"===e)G(this,Af,"f").bloomThreshold=gf(n);else if("category"===e)G(this,Af,"f").category=function(e){return Yc(e)?e:null}(n);else if("glb-local"===e)G(this,Af,"f").glbLocal=function(e){if(null==e?void 0:e.includes("|")){const[t,n]=e.split("|",2);return{left:"true"===t,right:"true"===n}}return ff(e)}(n);else if("interactivity-disabled"===e)G(this,Af,"f").interactive=!ff(n);else if("touch-action"===e)G(this,Af,"f").touchAction=function(e){return function(e){return jc.includes(e)}(e)?e:null}(n);else if("zoom-disabled"===e)G(this,Af,"f").zoomEnabled=!ff(n);else if("min-zoom"===e)G(this,Af,"f").minZoom=gf(n);else if("max-zoom"===e)G(this,Af,"f").maxZoom=gf(n);else if("preserve-camera-on-reload"===e)G(this,Af,"f").preserveCameraOnReload=ff(n);else if("always-transparent-background"===e)G(this,Af,"f").alwaysTransparentBackground=ff(n);else if("default-fov"===e)G(this,Af,"f").defaultFov=gf(n);else if("fov-multiplier"===e)G(this,Af,"f").fovMultiplier=gf(n);else if("interaction-prompt-url"===e)G(this,Af,"f").interactionPromptUrl=n;else if("interaction-prompt-size"===e)G(this,Af,"f").interactionPromptSize=n;else if("non-live-rendering"===e)G(this,Af,"f").nonLiveRendering=ff(n);else if("base-url"===e)G(this,Af,"f").baseUrl=n;else{if("download-cache-enabled"!==e)throw new Error(`Unknown attribute: ${e} (changed from '${t}' to '${n}')`);G(this,Af,"f").downloadCacheEnabled=ff(n)}}set paused(e){G(this,hf,"m",df).call(this,"paused",e?"":null)}set posterUrl(e){G(this,hf,"m",df).call(this,"poster-url",e)}set glbUrl(e){G(this,hf,"m",df).call(this,"glb-url","string"==typeof e||null==e?e:`${e.left}|${e.right}`)}set envUrl(e){G(this,hf,"m",df).call(this,"env-url",e)}set diamondEnvUrl(e){G(this,hf,"m",df).call(this,"diamond-env-url",e)}set envRotation(e){G(this,hf,"m",df).call(this,"env-rotation",null!=e?`${e}`:null)}set toneMapping(e){G(this,hf,"m",df).call(this,"tone-mapping",e)}set toneMappingExposure(e){G(this,hf,"m",df).call(this,"tone-mapping-exposure",`${e}`)}set bloomEnabled(e){G(this,hf,"m",df).call(this,"bloom-enabled",e?"":null)}set bloomStrength(e){G(this,hf,"m",df).call(this,"bloom-strength",null!=e?`${e}`:null)}set bloomRadius(e){G(this,hf,"m",df).call(this,"bloom-radius",null!=e?`${e}`:null)}set bloomThreshold(e){G(this,hf,"m",df).call(this,"bloom-threshold",null!=e?`${e}`:null)}set category(e){G(this,hf,"m",df).call(this,"category",e)}set animation(e){G(this,Af,"f").animation=e}set glbLocal(e){G(this,hf,"m",df).call(this,"glb-local","boolean"==typeof e||null==e?e?"":null:`${e.left}|${e.right}`)}set interactivityDisabled(e){G(this,hf,"m",df).call(this,"interactivity-disabled",e?"":null)}set touchAction(e){G(this,hf,"m",df).call(this,"touch-action",e)}set zoomDisabled(e){G(this,hf,"m",df).call(this,"zoom-disabled",e?"":null)}set minZoom(e){G(this,hf,"m",df).call(this,"min-zoom",null!=e?`${e}`:null)}set maxZoom(e){G(this,hf,"m",df).call(this,"max-zoom",null!=e?`${e}`:null)}set preserveCameraOnReload(e){G(this,hf,"m",df).call(this,"preserve-camera-on-reload",e?"":null)}set alwaysTransparentBackground(e){G(this,hf,"m",df).call(this,"always-transparent-background",e?"":null)}set defaultFov(e){G(this,hf,"m",df).call(this,"default-fov",`${e}`)}set fovMultiplier(e){G(this,hf,"m",df).call(this,"fov-multiplier",`${e}`)}set defaultCameraPositions(e){G(this,Af,"f").defaultCameraPositions=e}set interactionPromptUrl(e){G(this,hf,"m",df).call(this,"interaction-prompt-url",e)}set interactionPromptSize(e){G(this,hf,"m",df).call(this,"interaction-prompt-size",e)}set nonLiveRendering(e){G(this,hf,"m",df).call(this,"non-live-rendering",e?"":null)}set baseUrl(e){G(this,hf,"m",df).call(this,"base-url",e)}set downloadCacheEnabled(e){G(this,hf,"m",df).call(this,"download-cache-enabled",e?"":null)}set onModelLoaded(e){G(this,Af,"f").onModelLoaded=e}set onRendered(e){G(this,Af,"f").onRendered=e}set onInteracted(e){G(this,Af,"f").onInteracted=e}set onInteractionPerf(e){G(this,Af,"f").onInteractionPerf=e}set onMaxZoomEnter(e){G(this,Af,"f").onMaxZoomEnter=e}set onMaxZoomLeave(e){G(this,Af,"f").onMaxZoomLeave=e}set onMinZoomEnter(e){G(this,Af,"f").onMinZoomEnter=e}set onMinZoomLeave(e){G(this,Af,"f").onMinZoomLeave=e}set onMinVerticalAngleEnter(e){G(this,Af,"f").onMinVerticalAngleEnter=e}set onMinVerticalAngleLeave(e){G(this,Af,"f").onMinVerticalAngleLeave=e}set onMaxVerticalAngleEnter(e){G(this,Af,"f").onMaxVerticalAngleEnter=e}set onMaxVerticalAngleLeave(e){G(this,Af,"f").onMaxVerticalAngleLeave=e}set onError(e){G(this,Af,"f").onError=e}zoomBy(e){G(this,uf,"f").zoomBy(e)}rotateBy(e,t){G(this,uf,"f").rotateBy(e,t)}render(e){G(this,uf,"f").render(e)}flushChanges(){return G(this,uf,"f").flushChanges()}}function ff(e){return null!=e}function gf(e){return null==e?null:Number.parseFloat(e)}if(Af=new WeakMap,uf=new WeakMap,hf=new WeakSet,df=function(e,t){null==t?this.removeAttribute(e):this.setAttribute(e,t)},pf.observedAttributes=["paused","poster-url","glb-url","env-url","diamond-env-url","env-rotation","tone-mapping","tone-mapping-exposure","category","glb-local","interactivity-disabled","touch-action","zoom-disabled","min-zoom","max-zoom","preserve-camera-on-reload","always-transparent-background","default-fov","fov-multiplier","interaction-prompt-url","interaction-prompt-size","bloom-enabled","bloom-strength","bloom-radius","bloom-threshold","non-live-rendering","base-url","download-cache-enabled"],null==window)throw new Error("window is not defined. ShopAR 3D only works in a browser environment.");const{customElements:mf}=window;try{mf.define("shopar-3d",pf)}catch(Zd){console.error(Zd)}const vf={bg:{var:`${D}-3d-bg`,default:"#ffffff"}};function Ef(e){var t,n;const i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("width",null!==(t=e.getAttribute("width"))&&void 0!==t?t:"1rem"),i.setAttribute("height",null!==(n=e.getAttribute("height"))&&void 0!==n?n:"1rem"),i.appendChild(e),i}function bf(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","image");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22/%3E"),n.setAttribute("width",e),n.setAttribute("height",e),n}var Cf;function _f(){const e=function(){const e=document.createElement("div");e.id="shopar-main";const t=e.style;return t.position="absolute",t.top="0",t.bottom="0",t.left="0",t.right="0",t.pointerEvents="none",e}(),t=function(){const e=document.createElement("div");return e.style.textAlign="center",e}(),n=function(){const e=new Image;e.draggable=!1;const t=e.style;return t.maxWidth="100%",t.maxHeight="100%",e}(),i=function(e,t){const n=document.createElement("div"),i=n.style;i.position="absolute",i.top="0",i.left="0",i.width="100%",i.height="100%",i.display="none",i.pointerEvents="auto",i.userSelect="none";const r=document.createElement("div"),a=r.style;a.position="relative",a.top="0",a.left="0",a.width="100%",a.height="100%",a.display="flex",a.flexDirection="column",a.justifyContent="center",a.alignItems="center",a.background=Q(O.bg),n.appendChild(r),r.appendChild(e);const o=document.createElement("div");return o.appendChild(t),r.appendChild(o),n}(t,n);e.appendChild(i);const r=function(){const e=document.createElement("div"),t=e.style;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.display="none",t.pointerEvents="auto",e}();e.appendChild(r);const a=document.createElement("div");a.dataset.placeholder="shopar-3d",e.appendChild(a);let o=null;const s=function(){const e=document.createElement("div");return e.style.textAlign="center",e.style.color=Q(N.textColor),e}(),l=function(){const e=new Image;e.alt="",e.setAttribute("role","presentation");const{style:t}=e;return t.maxWidth=Q(N.imgMaxWidth),t.maxHeight=Q(N.imgMaxHeight),t.objectFit="contain",e}(),c=function(e,t){const n=document.createElement("div"),{style:i}=n;return i.position="absolute",i.width="100%",i.height="100%",i.opacity="0",i.display="flex",i.flexDirection="column",i.justifyContent="center",i.alignItems="center",i.gap=Q(N.gap),i.backgroundColor=Q(N.bg),i.transition="0.3s ease-in-out opacity",n.setAttribute("aria-hidden","true"),n.appendChild(e),n.appendChild(t),n}(s,l);e.appendChild(c);const h=function(){const e=document.createElement("div"),t=e.style;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.pointerEvents="auto",t.userSelect="none",t.display=Q(F.containerDisplay),t.flexDirection="column",t.justifyContent="center",t.alignItems="center",t.gap=Q(F.containerGap),t.backgroundColor=Q(F.containerBg),e}(),A=function(e){const t=document.createElement("div");return t.textContent=e,t.style.textAlign="center",t}(T["loading.ar"]);h.appendChild(A);const u=function(){const e=document.createElement("div"),t=e.style;return t.position="relative",t.overflow="hidden",t.width=Q(F.barWidth),t.height=Q(F.barHeight),t.backgroundColor=Q(F.barBg),t.borderRadius=Q(F.barRadius),e}(),d=function(){const e=document.createElement("div"),t=e.style;return t.height="100%",t.width="0%",t.background=Q(F.barFg),t.borderRadius=Q(F.barRadius),t.transition="width 0.05s ease-out",e}(),p=function(){const e=document.createElement("div");return e.textContent="0%",e.style.textAlign="center",e}();u.appendChild(d),h.appendChild(u),h.appendChild(p),e.appendChild(h);const f=function(){const e=document.createElement("div");return e.style.textAlign="center",e}(),g=function(e){const t=document.createElement("div"),n=t.style;n.position="absolute",n.width="100%",n.height="100%",n.display="none",n.pointerEvents="auto",n.userSelect="none";const i=document.createElement("div"),r=i.style;return r.position="absolute",r.width="100%",r.height="100%",r.backgroundColor="#ffffff",r.display="flex",r.flexDirection="column",r.justifyContent="center",r.alignItems="center",t.appendChild(i),i.appendChild(e),t}(f);e.appendChild(g);const m=function(){const e=document.createElement("div");e.role="group",e.ariaLabel="Preview type chooser";const{style:t}=e;return t.display="none",t.position="absolute",t.width="100%",t.bottom="0",t.paddingBottom=Q(P.paddingBottom),t.justifyContent="center",t.gap=Q(P.gap),e}();e.appendChild(m);const v=bf("1.75rem"),E=U("Try-on","Launch ShopAR virtual try-on",Ef(v));m.appendChild(E);const b=bf("1.75rem"),C=U("3D","Launch ShopAR 3D preview",Ef(b));m.appendChild(C);const _=bf("1.75rem"),I=U("Close","Close ShopAR view",Ef(_));m.append(I);let x,y,w=Cf.None,S=!1,B=!1,R=!1,D=!1;function L(){d.style.width="100%",p.textContent="100%",h.style.visibility="hidden",d.style.width="0%",p.textContent="0%"}return{setTargetElement:function(t){t.style.position="relative",t.appendChild(e)},getQRTarget:function(){return i},getQRImage:function(){return n},getDeepARTarget:function(){return r},getDeepARPrompt:function(){return c},getThreeTarget:function(){return null==o&&(o=function(){const e=document.createElement("shopar-3d"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.pointerEvents="auto",t.display="none",t.background=Q(vf.bg),e}(),a.replaceWith(o)),o},hasThreeTarget:function(){return null!=o},removeThreeTarget:function(){null!=o&&(o.replaceWith(a),o=null)},customizeDeepARPrompt:function(e,t){s.textContent=e,l.src=t},customizeCameraError:function(e){f.textContent=null!=e?e:"Please reload page and allow camera access to continue"},customizeQRPrompt:function(e){t.textContent=null!=e?e:"Scan on mobile or tablet to try on"},setVisibilityParameters:function(e,t,n,i,r,a){var o;S=e,B=t,R=n,D=i,x=r,y=a,xf(m,S),xf(E,S&&(R||B)&&w===Cf.None),xf(C,S&&D&&w===Cf.None),xf(I,S&&w!==Cf.None),L(),S||""===(o=g).style.display&&If(o,!1)},getUIState:function(){return w},setUIState:function(e){w=e,w===Cf.None?(L(),S&&(If(g,!1),xf(I,!1),(B||R)&&xf(E,!0),D&&xf(C,!0))):w===Cf.QR||w===Cf.AR?S&&(If(g,!1),xf(E,!1),xf(C,D&&"AR"===y),xf(I,"AR"!==y)):w===Cf.Preview&&S&&(If(g,!1),xf(E,(B||R)&&"3D"===y),xf(C,!1),xf(I,"3D"!==y))},setDefaultUIActions:function(e,t,n){S&&((B||R)&&(!function(e){const t={Glasses:"glasses.svg",Shoes:"shoe.svg",Watches:"watch.svg",Bracelets:"watch.svg",Scarves:"glasses.svg",Hats:"glasses.svg",Necklaces:"glasses.svg"},n=null!=e&&t[e]||t.Glasses,i=`${M()}/img/icons/${n}`;v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i)}(x),E.onclick=e),D&&(b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${M()}/img/icons/cube.svg`),C.onclick=t),_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${M()}/img/icons/close.svg`),I.onclick=n)},startDeepARLoading:function(){d.style.width="0%",h.style.visibility="visible"},stopDeepARLoading:L,updateDeepARLoadingProgress:function(e){d.style.width=`${e}%`,p.textContent=`${Math.floor(e)}%`},showCameraError:function(){S&&If(g,!0)}}}function If(e,t){e.style.display=t?"":"none"}function xf(e,t){e.style.display=t?"flex":"none"}!function(e){e[e.None=0]="None",e[e.QR=1]="QR",e[e.AR=2]="AR",e[e.Preview=3]="Preview"}(Cf||(Cf={}));const yf=new Map;function Mf(e){let t=yf.get(e);return null==t?(t=function(){let e=0,t=null,n=null,i=!0;const r=()=>(null==t&&(t=_f()),t);return{getSetupId:()=>e,incrementSetupId_:()=>e++,getUI_:()=>t,findUI:r,findQR:()=>{if(null==n){const{getQRTarget:e,getQRImage:t}=r();n=B(e(),t())}return n},isInteractive:()=>i,setInteractive:e=>{i=e,(null==t?void 0:t.hasThreeTarget())&&(t.getThreeTarget().interactivityDisabled=!e)}}}(),yf.set(e,t)):t.incrementSetupId_(),t}function wf(e){for(const t of yf.values()){if(t===e)continue;const n=t.getUI_();if(null==n)continue;const{getUIState:i,setUIState:r}=n;i()===Cf.AR&&r(Cf.None)}}const Sf=[];for(let e=0;e<256;++e)Sf.push((e+256).toString(16).slice(1));let Bf;const Tf=new Uint8Array(16);var Rf={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Df(e,t,n){const i=(e=e||{}).random??e.rng?.()??function(){if(!Bf){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Bf=crypto.getRandomValues.bind(crypto)}return Bf(Tf)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(Sf[e[t+0]]+Sf[e[t+1]]+Sf[e[t+2]]+Sf[e[t+3]]+"-"+Sf[e[t+4]]+Sf[e[t+5]]+"-"+Sf[e[t+6]]+Sf[e[t+7]]+"-"+Sf[e[t+8]]+Sf[e[t+9]]+"-"+Sf[e[t+10]]+Sf[e[t+11]]+Sf[e[t+12]]+Sf[e[t+13]]+Sf[e[t+14]]+Sf[e[t+15]]).toLowerCase()}(i)}function Qf(e,t,n){return Rf.randomUUID&&!e?Rf.randomUUID():Df(e)}var Lf="undefined"!=typeof Float32Array?Float32Array:Array;function Uf(){var e=new Lf(16);return Lf!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Pf(e,t){var n=t[0],i=t[1],r=t[2],a=t[3],o=t[4],s=t[5],l=t[6],c=t[7],h=t[8],A=t[9],u=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=t[15],v=n*s-i*o,E=n*l-r*o,b=n*c-a*o,C=i*l-r*s,_=i*c-a*s,I=r*c-a*l,x=h*f-A*p,y=h*g-u*p,M=h*m-d*p,w=A*g-u*f,S=A*m-d*f,B=u*m-d*g,T=v*B-E*S+b*w+C*M-_*y+I*x;return T?(T=1/T,e[0]=(s*B-l*S+c*w)*T,e[1]=(r*S-i*B-a*w)*T,e[2]=(f*I-g*_+m*C)*T,e[3]=(u*_-A*I-d*C)*T,e[4]=(l*M-o*B-c*y)*T,e[5]=(n*B-r*M+a*y)*T,e[6]=(g*b-p*I-m*E)*T,e[7]=(h*I-u*b+d*E)*T,e[8]=(o*S-s*M+c*x)*T,e[9]=(i*M-n*S-a*x)*T,e[10]=(p*_-f*b+m*v)*T,e[11]=(A*b-h*_-d*v)*T,e[12]=(s*y-o*w-l*x)*T,e[13]=(n*w-i*y+r*x)*T,e[14]=(f*E-p*C-g*v)*T,e[15]=(h*C-A*E+u*v)*T,e):null}function Nf(e,t,n){var i=t[0],r=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],h=t[7],A=t[8],u=t[9],d=t[10],p=t[11],f=t[12],g=t[13],m=t[14],v=t[15],E=n[0],b=n[1],C=n[2],_=n[3];return e[0]=E*i+b*s+C*A+_*f,e[1]=E*r+b*l+C*u+_*g,e[2]=E*a+b*c+C*d+_*m,e[3]=E*o+b*h+C*p+_*v,E=n[4],b=n[5],C=n[6],_=n[7],e[4]=E*i+b*s+C*A+_*f,e[5]=E*r+b*l+C*u+_*g,e[6]=E*a+b*c+C*d+_*m,e[7]=E*o+b*h+C*p+_*v,E=n[8],b=n[9],C=n[10],_=n[11],e[8]=E*i+b*s+C*A+_*f,e[9]=E*r+b*l+C*u+_*g,e[10]=E*a+b*c+C*d+_*m,e[11]=E*o+b*h+C*p+_*v,E=n[12],b=n[13],C=n[14],_=n[15],e[12]=E*i+b*s+C*A+_*f,e[13]=E*r+b*l+C*u+_*g,e[14]=E*a+b*c+C*d+_*m,e[15]=E*o+b*h+C*p+_*v,e}function Ff(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Of(e,t){var n=t[0],i=t[1],r=t[2],a=t[4],o=t[5],s=t[6],l=t[8],c=t[9],h=t[10];return e[0]=Math.hypot(n,i,r),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(l,c,h),e}function kf(e,t){var n=new Lf(3);Of(n,t);var i=1/n[0],r=1/n[1],a=1/n[2],o=t[0]*i,s=t[1]*r,l=t[2]*a,c=t[4]*i,h=t[5]*r,A=t[6]*a,u=t[8]*i,d=t[9]*r,p=t[10]*a,f=o+h+p,g=0;return f>0?(g=2*Math.sqrt(f+1),e[3]=.25*g,e[0]=(A-d)/g,e[1]=(u-l)/g,e[2]=(s-c)/g):o>h&&o>p?(g=2*Math.sqrt(1+o-h-p),e[3]=(A-d)/g,e[0]=.25*g,e[1]=(s+c)/g,e[2]=(u+l)/g):h>p?(g=2*Math.sqrt(1+h-o-p),e[3]=(u-l)/g,e[0]=(s+c)/g,e[1]=.25*g,e[2]=(A+d)/g):(g=2*Math.sqrt(1+p-o-h),e[3]=(s-c)/g,e[0]=(u+l)/g,e[1]=(A+d)/g,e[2]=.25*g),e}function Gf(){var e=new Lf(3);return Lf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Hf(e,t,n){var i=new Lf(3);return i[0]=e,i[1]=t,i[2]=n,i}function zf(e,t){var n=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2];return Math.hypot(n,i,r)}function Vf(e,t,n){var i=t[0],r=t[1],a=t[2],o=n[3]*i+n[7]*r+n[11]*a+n[15];return o=o||1,e[0]=(n[0]*i+n[4]*r+n[8]*a+n[12])/o,e[1]=(n[1]*i+n[5]*r+n[9]*a+n[13])/o,e[2]=(n[2]*i+n[6]*r+n[10]*a+n[14])/o,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Wf(){var e=new Lf(4);return Lf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Gf(),function(){var e,t=(e=new Lf(4),Lf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();var qf;Gf(),Hf(1,0,0),Hf(0,1,0),Wf(),Wf(),qf=new Lf(9),Lf!=Float32Array&&(qf[1]=0,qf[2]=0,qf[3]=0,qf[5]=0,qf[6]=0,qf[7]=0),qf[0]=1,qf[4]=1,qf[8]=1;async function jf(){const e=await async function(){const e=await fetch("data:application/octet-stream;base64,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");return await function(e={}){var t,n,i,r,a,o=e,s=new Promise((e,n)=>{t=e}),l={1076:e=>{const t=[e,Date.now()],n=t.length-2,r=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame","navigator","userAgent"],a=[2,12,7,1],o=window[r[r[a[a[a.length-1]]+2].length-a[t.length]+1]][r[Math.pow(a[n],r[a.length].length)]]||"no user agent",s=c(32);for(let e=0;e<32;++e)i[s+e]=o.charCodeAt(e%o.length);return s},1870:e=>{var t,n=function(){var e;try{e=Function('return (function() {}.constructor("return this")( ));')()}catch(t){e=window}return e}(),r=Date.now();for(var a in n)if(8==a.length&&110==a.charCodeAt(7)&&105==a.charCodeAt(5)&&97==a.charCodeAt(3)&&108==a.charCodeAt(0)){r=a,t=e;break}for(var o in n[r])if(8==o.length&&97==o.charCodeAt(5)&&104==o.charCodeAt(0)){t=o;break}const s=n[r][t]||"no hostname",l=c(32);for(let e=0;e<32;++e)i[l+e]=s.charCodeAt(e%s.length);return l}};o.noExitRuntime;var c,h=[],A=(e,t,o)=>{var s=((e,t)=>{var o;for(h.length=0;o=i[e++];){var s=105!=o;t+=(s&=112!=o)&&t%8?4:0,h.push(112==o?r[t>>2]:105==o?n[t>>2]:a[t>>3]),t+=s?8:4}return h})(t,o);return l[e](...s)},u={a:{a:(e,t,n)=>A(e,t,n),c:()=>Date.now(),b:e=>{i.length,function(){throw"OOM"}()}}};return WebAssembly.instantiate(o.wasm,u).then(e=>{var s,l=e.instance.exports;o._magic=l.f,o._free=l.g,o._malloc=c=l.i,s=l.d.buffer,o.HEAPU8=i=new Uint8Array(s),n=new Int32Array(s),r=new Uint32Array(s),a=new Float64Array(s),function(e){e.e()}(l),t(o)}),s}({wasm:await e.arrayBuffer()})}();return function(t){const n=e._malloc(32);for(let i=0;i<t.size()&&i<32;i++)e.HEAPU8[n+i]=t.get(i);const i=e._malloc(64);e._magic(n,i);const r=new Uint8Array(64);for(let t=0;t<64;++t)r[t]=e.HEAPU8[i+t];return e._free(n),e._free(i),r}}let Yf,Xf,Kf,Jf,Zf,$f,eg=!1,tg=null,ng=[],ig=[];function rg(e){return c(this,void 0,void 0,function*(){eg=!1;const{ShopAR__TrueScale:t}=window;yield t.initialize(`${M()}/wasm/mediapipe`,e),tg&&clearInterval(tg);const n=[],i=[];tg=setInterval(()=>c(this,void 0,void 0,function*(){if(eg)return;const{error:e,faceWidth:r,ipd:a,translation:o,rotation:s}=yield t.predict(performance.now());eg||(null!=o&&null!=s&&function(e){for(let t of ng)t(e)}({translation:o,rotation:s}),null==e&&(n.push(r),i.push(a),n.length<10||(n.shift(),i.shift(),function(e,t){for(let n of ig)n({faceWidth:e,IPD:t})}(og(n),og(i)))))}),200)})}function ag(){ig=[],ng=[],eg=!0}function og(e){let t=0;const n=e.length;for(let i=0;i<n;i++)t+=e[i];return t/n}let sg=null;const lg=new Set;let cg,hg,Ag,ug,dg,pg,fg=!1;function gg(){null==Yf&&(Yf=w(`${M()}/shopar-deepar.js`,"ShopAR__DeepAR"))}function mg(){null==Xf&&(Xf=w(`${M()}/shopar-true-scale.js`,"ShopAR__TrueScale"))}function vg(e){return c(this,void 0,void 0,function*(){const{licenseKey:t,truescaleUsecase:n,onProgress:i,effectUrl:r,effectOptions:a}=e;a&&null==a.envmap&&(a.envmap=`${M()}/deepar/default_envmap.webp`),dg=n;const o=null!=e.videoConfig;return null==cg&&(cg=(()=>c(this,void 0,void 0,function*(){fg=!1;const n=function(e){var t;const n={Glasses:"user",Shoes:"environment",Watches:"environment",Bracelets:"environment",Hats:"user",Scarves:"user",Necklaces:"user"};return null==e?"user":null!==(t=n[e])&&void 0!==t?t:"user"}(Zf);try{Kf=yield window.ShopAR__DeepAR.deepar.initialize({licenseKey:t||"your_license_key_goes_here",previewElement:$f,effect:r,effectOptions:a,rootPath:`${M()}/deepar`,additionalOptions:{hint:pg,cameraConfig:{disableDefaultCamera:o,facingMode:n},pixelRatio:Math.min(window.devicePixelRatio,2),onVerify:yield jf()},onProgress:i})}catch(e){throw cg=null,e}Kf.setWatchTicking("Watches"===Zf),o&&Kf.setVideoElement(e.videoConfig.video,null==e?void 0:e.videoConfig.mirror),"Glasses"===Zf&&null==e.customTrueScaleFaceWidth?(yield Xf,Jf=Kf.getVideoElement(),rg(Jf),"DetectionLoop"!==dg&&kg(e=>{ug=e.faceWidth})):"Glasses"===Zf&&null!=e.customTrueScaleFaceWidth&&(ug=e.customTrueScaleFaceWidth),fg=!0,Rg(),$f.style.display=""}))()),cg})}function Eg(e,t){t=null!=t?t:function(e){const t={Glasses:["rigidFaceTrackingInit","faceInit"],Shoes:["footInit"],Watches:["wristInit"],Bracelets:["wristInit"],Hats:["rigidFaceTrackingInit","faceInit"],Scarves:["rigidFaceTrackingInit","faceInit"],Necklaces:["rigidFaceTrackingInit","faceInit"]};return null==e?void 0:t[e]}(e),e===Zf&&function(e,t){return e===t||null!=e&&null!=t&&e.length===t.length&&e.every(e=>t.find(t=>e===t))&&t.every(t=>e.find(e=>e===t))}(t,pg)||(Zf=e,pg=t)}function bg(e){Dg(),e!==$f&&($f=e,null!=Kf&&Kf.changePreviewElement($f,Math.min(window.devicePixelRatio,2)))}function Cg(e){sg=e}function _g(e,t){Kf.callbacks.onFaceTracked=n=>{var i;if(n.some(e=>e.detected)){if(ug){const e=137/(ug+5);Kf.changeParameterVector("GLASSES","","scale",e,e,e,0),Kf.changeParameterVector("shopar_glasses","","scale",e,e,e,0),function(e){const t=[-8.362421,4.549,-9.275],n=[8.362421,4.549,-9.275];try{const i=Kf.getTransformationBetween("face_position","temples"),r=Fg(i,"temple_left","temple_left_outer","temple_tip_outer_left",n,e).map(Lg),a=Fg(i,"temple_right","temple_right_outer","temple_tip_outer_right",t,e).map(Lg);Kf.changeParameterVector("temple_left","","rotation",r[0],r[1],r[2],0),Kf.changeParameterVector("temple_right","","rotation",a[0],a[1],a[2],0)}catch(e){return}}(e),ag(),ug=null}e(),Qg("Glasses")}null===(i=null==t?void 0:t.onFaceTracked)||void 0===i||i.call(t,n)},Kf.callbacks.onFeetTracked=(n,i)=>{var r;(n.detected||i.detected)&&(e(),Qg("Shoes")),null===(r=null==t?void 0:t.onFeetTracked)||void 0===r||r.call(t,n,i)},Kf.callbacks.onWristTracked=n=>{var i;n.detected&&(e(),Qg("Watches")),null===(i=null==t?void 0:t.onWristTracked)||void 0===i||i.call(t,n)}}function Ig(e){ug=e}function xg(e){null==Kf||Kf.setStatsCapture(e)}function yg(e,t,n){return c(this,void 0,void 0,function*(){return null!=hg&&Ag===n||(yield hg,t.trackingInit={face:(null==pg?void 0:pg.includes("rigidFaceTrackingInit"))||(null==pg?void 0:pg.includes("faceInit")),foot:null==pg?void 0:pg.includes("footInit"),wrist:null==pg?void 0:pg.includes("wristInit")},null==t.envmap&&(t.envmap=`${M()}/deepar/default_envmap.webp`),hg=Kf.switchEffect(e,t),Kf.setWatchTicking("Watches"===Zf),Ag=n,Rg(),$f.style.display=""),hg})}function Mg(e,t){null!=e&&null!=t&&(Kf.setToneMapping(e),Kf.setExposure(t))}function wg(e,t,n,i){Kf.setBloomEnabled(!!e),null!=t&&Kf.setBloomStrength(t),null!=n&&Kf.setBloomRadius(n),null!=i&&Kf.setBloomThreshold(i)}function Sg(){null!=Kf&&(ag(),null!=Jf&&null!=Jf.srcObject&&Jf.srcObject instanceof MediaStream&&(Jf.srcObject.getTracks().forEach(e=>e.stop()),Jf=null),Kf.shutdown(),Dg(),fg=!1,Kf=null,cg=null,$f.style.display="none")}function Bg(){return fg}function Tg(e){Kf.setVideoElement(e.video,e.mirror)}function Rg(){null!=sg&&(null==Zf||lg.has(Zf)||(sg.removeAttribute("aria-hidden"),sg.style.visibility="visible",sg.style.opacity="1"))}function Dg(){null!=sg&&(sg.setAttribute("aria-hidden","true"),sg.style.visibility="hidden",sg.style.opacity="0")}function Qg(e){null!=sg&&(lg.has(e)||(lg.add(e),sg.setAttribute("aria-hidden","true"),sg.style.opacity="0"))}function Lg(e){return 180*e/Math.PI}function Ug(e,t){let n=t[0],i=t[1],r=t[2],a=t[3],o=n*n,s=i*i,l=r*r;return e[0]=Math.atan2(2*(a*n+i*r),1-2*(o+s)),e[1]=-Math.PI/2+2*Math.atan2(Math.sqrt(1+2*(a*i-n*r)),Math.sqrt(1-2*(a*i-n*r))),e[2]=Math.atan2(2*(a*r+n*i),1-2*(s+l)),e}function Pg(e,t,n){const i=Pf(Uf(),e),r=function(e,t){var n=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(Uf(),-n),a=Nf(Uf(),i,r),o=Nf(Uf(),a,e),s=Nf(Uf(),o,t),l=kf(Wf(),s);return Ug(Gf(),l)}function Ng(e,t){let n=Kf.getTransformationBetween("face_position",t);const i=Ug(Gf(),kf(Wf(),n)).map(Lg);n=function(e,t,n,i){var r=t[0],a=t[1],o=t[2],s=t[3],l=r+r,c=a+a,h=o+o,A=r*l,u=r*c,d=r*h,p=a*c,f=a*h,g=o*h,m=s*l,v=s*c,E=s*h,b=i[0],C=i[1],_=i[2];return e[0]=(1-(p+g))*b,e[1]=(u+E)*b,e[2]=(d-v)*b,e[3]=0,e[4]=(u-E)*C,e[5]=(1-(A+g))*C,e[6]=(f+m)*C,e[7]=0,e[8]=(d+v)*_,e[9]=(f-m)*_,e[10]=(1-(A+p))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}(Uf(),function(e,t,n,i){var r=.5*Math.PI/180;t*=r,n*=r,i*=r;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(n),l=Math.cos(n),c=Math.sin(i),h=Math.cos(i);return e[0]=a*l*h-o*s*c,e[1]=o*s*h+a*l*c,e[2]=o*l*c-a*s*h,e[3]=o*l*h+a*s*c,e}(Wf(),i[0],0,i[2]),Ff(Gf(),n),Of(Gf(),n));const r=Pf(Uf(),e);return Nf(Uf(),r,n)}function Fg(e,t,n,i,r,a){let o=Ng(e,t);const s=Nf(Uf(),e,o),l=Vf(Gf(),Ff(Gf(),s),function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(Uf(),[a,a,a])),c=Math.atan2(r[0]-l[0],Math.abs(r[2]-l[2]));let h;try{h=Kf.getTransformationBetween(t,n)}catch(t){return Pg(e,o,c)}const A=Nf(Uf(),s,h),u=Hf(l[0],r[1],r[2]),d=Vf(Gf(),u,Pf(Uf(),A));let p=Kf.getClosestPointOnMesh(n,d);try{const e=Kf.getClosestPointOnMesh(i,d);zf(d,e)<zf(d,p)&&(p=e)}catch(e){}const f=Vf(Gf(),p,A);return Pg(e,o,c-Math.atan2(f[0]-l[0],Math.abs(f[2]-l[2])))}function Og(e){!function(e){ng.push(e)}(e)}function kg(e){!function(e){ig.push(e)}(e)}function Gg(e){let t,n=!1,i=!1;return{onTracked(r,a){if(!n&&a)if(i){if(r-t>=2e3){const{Fps:t,"Engine update":r,"Face tracking":a,"Foot tracking time":o,"Wrist tracking time":s}=null==Kf?void 0:Kf.getStats();xg(!1),n=!0,i=!1,e({fps:t,tickDuration:r.avg,faceTrackDuration:a.avg,footTrackDuration:o.avg,wristTrackDuration:s.avg})}}else i=!0,t=r,xg(!0);i&&!a&&(i=!1,xg(!1))}}}function Hg(){let e=!1,t=0,n=0;return{get dirty(){return e},clearDirty(){e=!1},get engagementMs(){return Math.round(t)},interact(i){const r=i-n;n=i,r<200&&(t+=r,e=!0)}}}function zg(){let e,t,n=0,i=0,r=2e3;return{set debounceDurationMs(e){r=null!=e?e:2e3},set onDebouncedEngagement(e){t=e},interact(a){const o=a-i;i=a,o<200&&(n+=o),e&&clearTimeout(e),e=setTimeout(()=>{n>0&&t&&(t(Math.round(n)),n=0,i=0),e=void 0},r)},flush(){e&&(clearTimeout(e),e=void 0,n>0&&t&&(t(Math.round(n)),n=0,i=0))}}}const Vg="arRecord",Wg="previewPerf",qg=45e3;function jg(e){let t=0,n=0;const i=[],r=[],a=[];let o,s=1,l=1,c=1,h=-1,A=qg,u=!1;function d(){let e=0;for(let t=0;t<i.length;t++)e+=+i[t].detected,e+=+r[t].detected;const n=5*i.length+28*e,o=new ArrayBuffer(n),h=new DataView(o);let A=0;for(let e=0;e<i.length;e++){const t=i[e],n=r[e];h.setFloat32(A,a[e],!0),A+=4,h.setUint8(A++,+t.detected+(+n.detected<<1)),t.detected&&(h.setFloat32(A+0,t.position[0],!0),h.setFloat32(A+4,t.position[1],!0),h.setFloat32(A+8,t.position[2],!0),A+=12,h.setFloat32(A+0,t.rotation[0],!0),h.setFloat32(A+4,t.rotation[1],!0),h.setFloat32(A+8,t.rotation[2],!0),h.setFloat32(A+12,t.rotation[3],!0),A+=16),n.detected&&(h.setFloat32(A+0,n.position[0],!0),h.setFloat32(A+4,n.position[1],!0),h.setFloat32(A+8,n.position[2],!0),A+=12,h.setFloat32(A+0,n.rotation[0],!0),h.setFloat32(A+4,n.rotation[1],!0),h.setFloat32(A+8,n.rotation[2],!0),h.setFloat32(A+12,n.rotation[3],!0),A+=16)}if(0===t){const e=function(){var e,t,n,i;return{width:null!==(t=null===(e=null==Kf?void 0:Kf.getVideoElement())||void 0===e?void 0:e.videoWidth)&&void 0!==t?t:0,height:null!==(i=null===(n=null==Kf?void 0:Kf.getVideoElement())||void 0===n?void 0:n.videoHeight)&&void 0!==i?i:0}}(),t=function(){var e,t,n,i;return{width:null!==(t=null===(e=null==Kf?void 0:Kf.getCanvas())||void 0===e?void 0:e.width)&&void 0!==t?t:0,height:null!==(i=null===(n=null==Kf?void 0:Kf.getCanvas())||void 0===n?void 0:n.height)&&void 0!==i?i:0}}();s=e.width/e.height,l=t.width/t.height,c=function(){var e;return null!==(e=null==Kf?void 0:Kf.getFov())&&void 0!==e?e:85}()}return{recordType:"FOOT",idx:t++,arRecord:btoa(String.fromCharCode.apply(null,new Uint8Array(o))),cameraAspect:s,canvasAspect:l,fov:c}}function p(){if(i.length>0){const t=d();e(t),i.length=0,r.length=0,a.length=0}}return{start(e=45e3){u||(A=e>qg?qg:e,u=!0,o=window.setInterval(()=>{p()},1e3))},stop(){u&&(p(),clearInterval(o),t=0,n=0,i.length=0,r.length=0,a.length=0,u=!1)},onFeetTracked(e,o){if(!u)return;const s=performance.now();h<0&&(h=s),s-h>A?stop():(i.push(e),r.push(o),0===t&&0===a.length?a.push(0):a.push(s-n),n=s)}}}let Yg,Xg,Kg=!1;const Jg=window.navigator.userAgent||"no user agent",Zg=[];function $g(){null==Yg&&(Xg=Qf(),Yg=w(`${M()}/shopar-analytics.js`,"ShopAR__analytics"),Yg.then(()=>{Kg=!0,window.ShopAR__analytics.initializeImpl(),Zg.forEach(e=>e())}))}function em(e,t){const n=performance.now(),i=Qf(),r=Hg(),a=Hg(),o=zg(),s=zg();window.setInterval(()=>{if(r.dirty||a.dirty){const e=r.engagementMs,t=a.engagementMs,n=e+t;r.clearDirty(),a.clearDirty(),h("heartbeat",{engagementTotal:n,engagementAR:e,engagement3D:t})}},1e3);const l=(r,a={})=>({name:r,props:a=Object.assign(Object.assign({},a),{userAgent:Jg,hostname:window.location.hostname,href:window.location.href,pluginVersion:I,sessionId:Xg,setupId:i,timeSinceSetup:performance.now()-n,sku:e,apiKey:t})}),c=({name:e,props:t})=>{tm(()=>{window.ShopAR__analytics.trackEventImpl(e,t)})},h=(e,t={})=>{c(l(e,t))},A=function(e){const t=Gg(e),n=Gg(e),i=Gg(e);return{onFaceTracked(e){e.length>0&&t.onTracked(performance.now(),e[0].detected)},onFeetTracked(e,t){n.onTracked(performance.now(),e.detected&&t.detected)},onWristTracked(e){i.onTracked(performance.now(),e.detected)}}}(e=>{h("arPerf",e)}),{footRecorder:u,onFeetTracked:d}=function(e){const t=jg(e);return{footRecorder:t,onFeetTracked(e,n){t.onFeetTracked(e,n)}}}(e=>{0===e.idx?h(Vg,e):((e,t={})=>{c({name:e,props:Object.assign(Object.assign({},t),{sessionId:Xg,setupId:i})})})(Vg,{idx:e.idx,arRecord:e.arRecord})}),p=(f=[A,{onFeetTracked:d}],{onFaceTracked:e=>{var t;for(const n of f)null===(t=n.onFaceTracked)||void 0===t||t.call(n,e)},onFeetTracked:(e,t)=>{var n;for(const i of f)null===(n=i.onFeetTracked)||void 0===n||n.call(i,e,t)},onWristTracked:e=>{var t;for(const n of f)null===(t=n.onWristTracked)||void 0===t||t.call(n,e)}});var f;return{prepareEvent:l,submitEvent:c,trackEvent:h,arInteracted:()=>{const e=performance.now();r.interact(e),o.interact(e)},previewInteracted:()=>{const e=performance.now();a.interact(e),s.interact(e)},setDebounceAREngagementMs:e=>{o.debounceDurationMs=e},setOnDebouncedAREngagement:e=>{o.onDebouncedEngagement=e},setDebouncePreviewEngagementMs:e=>{s.debounceDurationMs=e},setOnDebouncedPreviewEngagement:e=>{s.onDebouncedEngagement=e},flushEngagementCallbacks:()=>{o.flush(),s.flush()},arTrackingEvents:p,footRecorder:u}}function tm(e){Kg?e():Zg.push(e)}function nm(e,t,n,i,r,a){let o,s,l=0,c=0;return{launched(){o=performance.now(),l=0,c=0,r(e)},loaded(){s=performance.now(),r(t,{duration:s-o})},failed(e){r(n,{errorName:h(e),errorMessage:A(e),errorStack:u(e),duration:performance.now()-o})},interacted(){if(null==a||a(),null==o)return;const e=performance.now(),t=e-c;c=e,t<200&&(l+=t)},closed(e){if(null==o)return;const t=null!=s;r(i,{duration:t?performance.now()-s:void 0,engagement:t?Math.round(l):void 0,trigger:e,loaded:t}),o=void 0,s=void 0,l=0,c=0}}}const im=.1,rm="function"==typeof Float32Array;function am(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return Am;const r=rm?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)r[t]=cm(t*im,e,n);function a(t){let i=0,a=1;for(;10!==a&&r[a]<=t;++a)i+=im;--a;const o=i+(t-r[a])/(r[a+1]-r[a])*im,s=hm(o,e,n);return s>=.001?function(e,t,n,i){for(let r=0;r<4;++r){const r=hm(t,n,i);if(0===r)return t;t-=(cm(t,n,i)-e)/r}return t}(t,o,e,n):0===s?o:function(e,t,n,i,r){let a,o,s=0;do{o=t+(n-t)/2,a=cm(o,i,r)-e,a>0?n=o:t=o}while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+im,e,n)}return function(e){return 0===e||1===e?e:cm(a(e),t,i)}}function om(e,t){return 1-3*t+3*e}function sm(e,t){return 3*t-6*e}function lm(e){return 3*e}function cm(e,t,n){return((om(t,n)*e+sm(t,n))*e+lm(t))*e}function hm(e,t,n){return 3*om(t,n)*e*e+2*sm(t,n)*e+lm(t)}function Am(e){return e}function um(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=am(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function dm(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort((e,t)=>e.time-t.time).map(({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:um(n)}));let i=0,r=n[0].value;return{reset:()=>{i=0},update:e=>{for(i+=e;i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}},get:()=>r}}const pm="time",fm="interpolation",gm="pitch",mm=[pm,"yaw",gm,"fov",fm],vm="s",Em="ms",bm=Math.PI/180,Cm="ease-in-out",_m="cubic-bezier(";function Im(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map(e=>function(e){const t=e.indexOf("#");return(-1!==t?e.substring(0,t):e).trim()}(e)).filter(e=>""!==e)}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!mm.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(pm))throw new Error(`Missing required token: '${pm}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=xm(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:o}=i;if(null==e)throw new Error("Time missing.");const s=Mm(null!==(t=i.interpolation)&&void 0!==t?t:Cm);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*bm,interpolation:s})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*bm,interpolation:s})),null!=o&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:o*bm,interpolation:s}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every(t=>t.length!==e.length))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function xm(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter(e=>!(null==n?void 0:n.includes(e))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter(t=>!e.includes(t)).join(", ")}'.`);const i=e.indexOf(pm),r=function(e){if(e.endsWith(Em))return Sm(e.substring(0,e.length-2));if(e.endsWith(vm))return 1e3*Sm(e.substring(0,e.length-1));return Sm(e)}(n[i]),a=e.indexOf(fm),o=Mm(-1===a?Cm:n[a]),s={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case"yaw":s.theta={time:r,value:ym(c),interpolation:o};break;case gm:s.phi={time:r,value:ym(c),interpolation:o};break;case"fov":s.fov={time:r,value:ym(c),interpolation:o};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return s}function ym(e){return e.endsWith("deg")?Sm(e.substring(0,e.length-3))*bm:e.endsWith("rad")?Sm(e.substring(0,e.length-3)):Sm(e)*bm}function Mm(e){if("hold"===e)return{type:"hold"};if("linear"===e)return wm(0,0,1,1);if("sine"===e)return wm(.37,0,.63,1);if("sine-in"===e)return wm(.12,0,.39,0);if("sine-out"===e)return wm(.61,1,.88,1);if("ease"===e)return wm(.25,.1,.25,1);if("ease-in"===e)return wm(.42,0,1,1);if("ease-out"===e)return wm(0,0,.58,1);if("ease-in-out"===e)return wm(.42,0,.58,1);if(e.startsWith(_m)&&e.endsWith(")")){const t=e.substring(13,e.length-1).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:Sm(t[0]),y1:Sm(t[1]),x2:Sm(t[2]),y2:Sm(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function wm(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function Sm(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}var Bm;function Tm(){return[Bm.Android,Bm.iOS,Bm.Tablet].includes(function(){if("undefined"!=typeof window&&window.navigator){const e=window.navigator.userAgent,t=window.navigator.platform||"",n=["Macintosh","MacIntel","MacPPC","Mac68K"],i=["Win32","Win64","Windows","WinCE"],r=["iPhone","iPod","iPad"],a="ontouchstart"in window||navigator.maxTouchPoints>0;return-1!==r.indexOf(t)?Bm.iOS:-1!==n.indexOf(t)?a?Bm.Tablet:Bm.MacOS:-1!==i.indexOf(t)?Bm.Windows:/Android/.test(e)?Bm.Android:/Linux/.test(t)?Bm.Linux:a?Bm.Tablet:Bm.Unknown}return Bm.Unknown}())}!function(e){e[e.Unknown=0]="Unknown",e[e.Android=1]="Android",e[e.iOS=2]="iOS",e[e.Tablet=3]="Tablet",e[e.MacOS=4]="MacOS",e[e.Windows=5]="Windows",e[e.Linux=6]="Linux"}(Bm||(Bm={}));const Rm=["demo.deepar.ai","dbeochk72stb2.cloudfront.net","d1q93hnxt3ps3w.cloudfront.net","dj5e08oeu5ym4.cloudfront.net"];function Dm(e,{trustUrls:t=!1}={}){const n=Object.assign({},e);if(n.category&&!Wc.includes(n.category))throw new r(`Invalid response category: ${e.category}`);if(n.arToneMapping&&!qc.includes(n.arToneMapping))throw new r(`Invalid tone mapping: ${e.arToneMapping}`);if(n.previewToneMapping&&!qc.includes(n.previewToneMapping))throw new r(`Invalid tone mapping: ${e.previewToneMapping}`);const i=t?Qm:Lm;return n.arUrl=n.arUrl?i(n.arUrl):void 0,n.arEnvUrl=n.arEnvUrl?i(n.arEnvUrl):void 0,n.arDiamondEnvUrl=n.arDiamondEnvUrl?i(n.arDiamondEnvUrl):void 0,n.arPromptImage=n.arPromptImage?i(n.arPromptImage):void 0,n.previewUrl=n.previewUrl?i(n.previewUrl):void 0,n.previewEnvUrl=n.previewEnvUrl?i(n.previewEnvUrl):void 0,n.previewDiamondEnvUrl=n.previewDiamondEnvUrl?i(n.previewDiamondEnvUrl):void 0,n.previewPosterUrl=n.previewPosterUrl?i(n.previewPosterUrl):void 0,n}function Qm(e){if(null==e||"string"!=typeof e)throw new r(`Invalid url: ${e}.`);let t;try{t=new URL(e)}catch(t){throw new r(`Invalid url: ${e}. ${t.message}`)}if("https:"!==t.protocol)throw new r(`Invalid url: ${e}.`);return t.toString()}function Lm(e){const t=Qm(e);if(!function(e){return Rm.includes(e)}(new URL(t).hostname))throw new r(`Invalid url: ${e}.`);return t}const Um=[1e3,2e3,4e3],Pm=Um.length;function Nm(e){return c(this,arguments,void 0,function*(e,t=0){try{return yield e()}catch(n){if(t>=Pm)throw n;return yield new Promise(e=>setTimeout(e,Um[t])),Nm(e,t+1)}})}const Fm={};function Om(e){const t=function(e){const{apiKey:t,sku:n,yaw:i,pitch:r,fov:a,forcedTransparency:o}=e,s=[];s.push(`apiKey=${t}`),s.push(`sku=${n}`),null!=i&&s.push(`yaw=${i}`);null!=r&&s.push(`pitch=${r}`);null!=a&&s.push(`fov=${a}`);null!=o&&s.push(`forcedTransparency=${o}`);return s.join("&")}(e),n=null!=Fm[t];return n||(Fm[t]=function(e){return c(this,void 0,void 0,function*(){return Dm(yield Nm(()=>c(this,void 0,void 0,function*(){const t=yield fetch(`https://dashboard.shopar.ai/plugin?${new URLSearchParams(e)}`).catch(e=>{throw new i(`API unavailable: ${A(e)}`)});if(!t.ok)throw new i("API response not OK.",t.status);const n=t.headers.get("content-length");if(n&&parseInt(n)>1048576)throw new i("API response too large.");try{return yield t.json()}catch(e){throw new i(`API returned invalid body: ${A(e)}`)}})))})}(e).catch(e=>{throw delete Fm[t],e})),{promise:Fm[t],cacheHit:n}}function km(e,t){if(null==e)throw new n(`'${t}' not specified.`)}function Gm(e,t){if("boolean"!=typeof e)throw new n(`'${t}' must be a boolean.`)}function Hm(e,t){if("number"!=typeof e)throw new n(`'${t}' must be a number.`)}function zm(e,t,i,r){if("number"!=typeof e)throw new n(`'${t}' must be a number.`);if(e<i)throw new n(`'${t}' must be greater than ${i}.`);if(e>r)throw new n(`'${t}' must be less than ${r}.`)}function Vm(e,t){if("string"!=typeof e)throw new n(`'${t}' must be a string.`)}function Wm(e,t,i){if("string"!=typeof e)throw new n(`'${t}' must be a string.`);if(!i.includes(e))throw new n(`'${t}' must be ${i.join("' or '")}.`)}function qm(e,t){if(!(e instanceof HTMLElement))throw new n(`'${t}' must be an HTMLElement.`)}function jm(e,t){if("function"!=typeof e)throw new n(`'${t}' must be a function.`)}function Ym(t){const{apiKey:i,sku:r,skuData:a,targetElement:o,initialState:s,initialAnimation:l,baseUrl:c,defaultUI:h,interactive:A,touchAction:u,zoomEnabled:d,minZoom:p,maxZoom:f,alwaysTransparentBackground:g,strings:m,debounceAREngagementMs:v,onDebouncedAREngagement:E,debounce3DEngagementMs:b,onDebounced3DEngagement:C,onMaxZoomEnter:_,onMaxZoomLeave:I,onMinZoomEnter:x,onMinZoomLeave:y,onMinVerticalAngleEnter:M,onMinVerticalAngleLeave:w,onMaxVerticalAngleEnter:S,onMaxVerticalAngleLeave:B,customArVideo:T,customTrueScaleFaceWidth:D}=t;Xm(i),function(e){km(e,"sku"),Vm(e,"sku"),function(e){if(0===e.length||e.length>100||!/^[\p{L}0-9 ./_-]+$/u.test(e))throw new n("Invalid 'sku'.")}(e)}(r),null!=a&&function(e,t){if("object"!=typeof e)throw new n(`'${t}' must be an object.`)}(a,"skuData"),km(o,"targetElement"),qm(o,"targetElement"),null!=s&&Wm(s,"initialState",e),null!=l&&function(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new n(`'${t}' must be a string or array.`)}(l,"initialAnimation"),null!=c&&Vm(c,"baseUrl"),null!=h&&Gm(h,"defaultUI"),null!=A&&Gm(A,"interactive"),null!=u&&Wm(u,"touchAction",jc),null!=d&&Gm(d,"zoomEnabled"),null!=p&&zm(p,"minZoom",.1,1),null!=f&&zm(f,"maxZoom",1,1/0),null!=g&&Gm(g,"alwaysTransparentBackground"),null!=m&&function(e,t,i){for(const r of i){const i=e[r];if(null!=i&&"string"!=typeof i)throw new n(`Value for key '${r}' in '${t}' must be a string or undefined.`)}}(m,"strings",R),null!=v&&Hm(v,"debounceAREngagementMs"),null!=E&&jm(E,"onDebouncedAREngagement"),null!=b&&Hm(b,"debounce3DEngagementMs"),null!=C&&jm(C,"onDebounced3DEngagement"),null!=_&&jm(_,"onMaxZoomEnter"),null!=I&&jm(I,"onMaxZoomLeave"),null!=x&&jm(x,"onMinZoomEnter"),null!=y&&jm(y,"onMinZoomLeave"),null!=M&&jm(M,"onMinVerticalAngleEnter"),null!=w&&jm(w,"onMinVerticalAngleLeave"),null!=S&&jm(S,"onMaxVerticalAngleEnter"),null!=B&&jm(B,"onMaxVerticalAngleLeave"),null!=T&&(km(T.video,"customArVideo.video"),function(e,t){if(!(e instanceof HTMLVideoElement))throw new n(`'${t}' must be an HTMLVideoElement.`)}(T.video,"customArVideo.video"),km(T.mirror,"customArVideo.mirror"),Gm(T.mirror,"customArVideo.mirror")),null!=D&&Hm(D,"customTrueScaleFaceWidth")}function Xm(e){km(e,"apiKey"),Vm(e,"apiKey"),function(e){if(!function(e){return 24===e.length&&/^[0-9a-fA-F]{24}$/.test(e)}(e))throw new n("Invalid 'apiKey'.")}(e)}let Km=!1;function Jm(e){return c(this,void 0,void 0,function*(){!function(e){const{apiKey:t,targetElement:n}=e;Xm(t),km(n,"targetElement"),qm(n,"targetElement")}(e);const{targetElement:t}=e;y(e.baseUrl),$g();const{trackEvent:n}=function(e){const t=performance.now(),n=Qf();return{trackEvent:(i,r={})=>{r=Object.assign(Object.assign({},r),{userAgent:Jg,hostname:window.location.hostname,href:window.location.href,pluginVersion:I,sessionId:Xg,setupId:n,timeSinceSetup:performance.now()-t,apiKey:e}),tm(()=>{window.ShopAR__analytics.trackEventImpl(i,r)})}}}(e.apiKey);n("visionSetup");const r=yield function(e){return c(this,void 0,void 0,function*(){return yield Nm(()=>c(this,void 0,void 0,function*(){const t=yield fetch(`https://dashboard.shopar.ai/plugin/vision?${new URLSearchParams({apiKey:e,sid:v()})}`).catch(e=>{throw new i(`API unavailable: ${A(e)}`)});if(!t.ok)throw new i("API response not OK.",t.status);const n=t.headers.get("content-length");if(n&&parseInt(n)>1048576)throw new i("API response too large.");try{return yield t.json()}catch(e){throw new i(`API returned invalid body: ${A(e)}`)}}))})}(e.apiKey);n("visionApiResponse",r);const{arKey:a}=r,o=Mf(t),{getSetupId:s,findUI:l}=o,u=s();gg(),mg();const{setTargetElement:d,getDeepARTarget:p,setVisibilityParameters:f,getUIState:g,setUIState:m,startDeepARLoading:E,stopDeepARLoading:b,showCameraError:C}=l();if(g()!=Cf.None)throw Error("UI state is not None, this is weird..");m(Cf.AR),d(t),f(!1,!1,!0,!1,void 0,void 0),E(),yield Yf,Zm(s(),u);try{n("visionArLaunch"),Eg("Glasses",["faceInit"]),bg(p()),yield vg({licenseKey:a,truescaleUsecase:"DetectionLoop"}),Zm(s(),u),Zm(s(),u)}catch(e){const t=A(e);throw n("visionArLaunchFailure",{errorName:h(e),errorMessage:t}),C(),new Error(`AR failed: ${t}`)}finally{b()}return Km=!0,{registerFacePoseListener:e=>{Km&&(n("registerFacePoseListener"),Og(e))},registerFaceMeasurementListener:e=>{Km&&(n("registerFaceMeasurementListener"),kg(e))},switchEffect:e=>c(this,void 0,void 0,function*(){Km&&(n("switchEffect",{arUrl:e}),function(e){Kf.switchEffect(e)}(e))}),clearEffect:()=>{Km&&(n("clearEffect"),Kf.clearEffect())},close:()=>{if(Km){if(Km=!1,n("visionClose"),g()!==Cf.AR)throw new Error("AR not launched.");m(Cf.None)}}}})}function Zm(e,t){if(e!==t)throw new Error("Setup cancelled. Please ensure that setup is only called once.")}function $m(e){return c(this,void 0,void 0,function*(){var t,r,u,p,f,g,m,I,x,w,S,B;Ym(e);const{apiKey:R,sku:D,skuData:Q,targetElement:L,initialState:U,initialAnimation:P}=e,N=e.touchAction,F=null==e.zoomEnabled||e.zoomEnabled,O=e.minZoom,k=e.maxZoom,G=null!==(t=e.onMaxZoomEnter)&&void 0!==t?t:null,H=null!==(r=e.onMaxZoomLeave)&&void 0!==r?r:null,z=null!==(u=e.onMinZoomEnter)&&void 0!==u?u:null,V=null!==(p=e.onMinZoomLeave)&&void 0!==p?p:null,W=null!==(f=e.onMinVerticalAngleEnter)&&void 0!==f?f:null,q=null!==(g=e.onMinVerticalAngleLeave)&&void 0!==g?g:null,j=null!==(m=e.onMaxVerticalAngleEnter)&&void 0!==m?m:null,Y=null!==(I=e.onMaxVerticalAngleLeave)&&void 0!==I?I:null,X=!0===e.alwaysTransparentBackground;!function(e){const t=getComputedStyle(e);if(!["static","relative"].includes(t.position))throw new n(`Invalid targetElement's position. Expected 'static' or 'relative', but found '${t.position}'.`)}(L),y(e.baseUrl),function(e){if(null!=e)for(const t of Object.keys(e)){if(!Object.prototype.hasOwnProperty.call(T,t)){console.warn(`String for key '${t}' will be ignored.`);continue}const n=e[t];null!=n&&(T[t]=n)}}(e.strings);const K=null!=P?Im(P):null,J=null!=(null==K?void 0:K.theta)?dm(K.theta):null,Z=null!=(null==K?void 0:K.phi)?dm(K.phi):null,$=null!=(null==K?void 0:K.fov)?dm(K.fov):null,ee=function(e,t){if(null!=e)return{apiUsed:!1,skuData:Dm(e,{trustUrls:!0})};const n=performance.now(),{promise:i,cacheHit:r}=Om(t);return{apiUsed:!0,promise:i,startTimestamp:n,cacheHit:r}}(Q,function(e,t,n,i,r,a){return Object.assign(Object.assign(Object.assign(Object.assign({apiKey:e,sku:t,sid:v(),initialFov:"16"},null!=n&&{yaw:`${b(E(n))}`}),null!=i&&{pitch:`${b(E(i))}`}),null!=r&&{fov:`${b(E(r))}`}),a&&{forcedTransparency:`${a}`})}(R,D,null==J?void 0:J.get(),null==Z?void 0:Z.get(),null==$?void 0:$.get(),X)),te=Mf(L),{getSetupId:ne,findUI:ie,findQR:re,isInteractive:ae,setInteractive:oe}=te,se=ne();$g();const{prepareEvent:le,submitEvent:ce,trackEvent:he,arInteracted:Ae,previewInteracted:ue,setDebounceAREngagementMs:de,setOnDebouncedAREngagement:pe,setDebouncePreviewEngagementMs:fe,setOnDebouncedPreviewEngagement:ge,flushEngagementCallbacks:me,arTrackingEvents:ve,footRecorder:Ee}=em(D,R),be=le("setup");de(e.debounceAREngagementMs),pe(e.onDebouncedAREngagement),fe(e.debounce3DEngagementMs),ge(e.onDebounced3DEngagement);let Ce,_e=!1;if(ee.apiUsed){try{Ce=yield ee.promise}catch(e){const t=A(e),n=performance.now()-ee.startTimestamp;throw he("apiError",{errorName:h(e),errorMessage:t,errorStatusCode:e instanceof i?e.status:void 0,duration:n}),e instanceof i?e:new i(t)}ev(ne(),se)}else Ce=ee.skuData;const{category:Ie,arUrl:xe,arEnvUrl:ye,arDiamondEnvUrl:Me,arToneMapping:we,arToneMappingExposure:Se,arBloomEnabled:Be,arBloomStrength:Te,arBloomRadius:Re,arBloomThreshold:De,arKey:Qe,arPromptEnabled:Le,arPromptText:Ue,arPromptImage:Pe,previewUrl:Ne,previewEnvUrl:Fe,previewDiamondEnvUrl:Oe,previewToneMapping:ke,previewToneMappingExposure:Ge,previewBloomEnabled:He,previewBloomStrength:ze,previewBloomRadius:Ve,previewBloomThreshold:We,previewPosterUrl:qe,cameraErrorText:je,qrPromptText:Ye,arSessionRecording:Xe,arSessionRecordingMaxDurationMs:Ke}=Ce;if(ee.apiUsed){const e=performance.now()-ee.startTimestamp;null!=xe||null!=Ne?(ce(be),he("apiResponse",Object.assign(Object.assign({},Ce),{duration:e,cacheHit:ee.cacheHit}))):(he("apiResponseFailure",Object.assign(Object.assign({},Ce),{duration:e,cacheHit:ee.cacheHit})),Je="SKU not found (or both 3D and AR disabled).",console.error(`ShopAR Plugin: ${Je}`))}var Je;const Ze=null!=xe&&function(e){return null!=e&&C.includes(e)}(Ie),$e=null==(null===(x=e._internalOptions)||void 0===x?void 0:x.qrEnabled)||(null===(w=e._internalOptions)||void 0===w?void 0:w.qrEnabled),et=Ze&&function(e){return null!=e&&_.includes(e)}(Ie),tt=$e&&et&&!Tm(),nt=Ze&&!tt,it=null!=Ne;ev(ne(),se);const{setTargetElement:rt,getDeepARTarget:at,getDeepARPrompt:ot,getThreeTarget:st,hasThreeTarget:lt,removeThreeTarget:ct,customizeDeepARPrompt:ht,customizeCameraError:At,customizeQRPrompt:ut,setVisibilityParameters:dt,getUIState:pt,setUIState:ft,setDefaultUIActions:gt,startDeepARLoading:mt,stopDeepARLoading:vt,showCameraError:Et,updateDeepARLoadingProgress:bt}=ie();rt(L);dt(null==e.defaultUI||e.defaultUI,tt,nt,it,Ie,U),ht(null!==(B=null!==(S=function(e){switch(e){case"Glasses":return T["prompt.ar.glasses"];case"Shoes":return T["prompt.ar.shoes"];case"Watches":return T["prompt.ar.watches"];case"Bracelets":return T["prompt.ar.bracelets"];case"Scarves":return T["prompt.ar.scarves"];case"Hats":return T["prompt.ar.hats"];case"Necklaces":return T["prompt.ar.necklaces"];default:return}}(Ie))&&void 0!==S?S:Ue)&&void 0!==B?B:"",null!=Pe?Pe:ee.apiUsed?"":`${M()}/img/prompt/ar-foot.webp`),At(je),ut(Ye);const Ct=nm("qrLaunch","qrLaunchSuccess","qrLaunchFailure","qrClose",he),_t=nm("arLaunch","arLaunchSuccess","arLaunchFailure","arClose",he,Ae),It=nm("previewLaunch","previewLaunchSuccess","previewLaunchFailure","previewClose",he,ue);!function(e,t){const n=e.parentNode;if(null==n)throw new Error("Parent node missing.");new MutationObserver(n=>{for(const i of n)for(const n of i.removedNodes)if(n===e)return void t()}).observe(n,{childList:!0})}(L,()=>{me(),pt()===Cf.QR?(Ct.closed("detach"),xt()||Mt()):pt()===Cf.AR?(_t.closed("detach"),Bg()&&(Ee.stop(),Sg())):pt()===Cf.Preview&&(It.closed("detach"),ct()),ft(Cf.None),function(e){yf.delete(e)}(L)});const{qrPaused:xt,qrDraw:yt,qrPause:Mt}=re(),wt=null==e.interactive||e.interactive;let St=0;if(pt()===Cf.QR){if(!xt())if(tt){Ct.launched();try{yield yt(R,D)}catch(e){const t=A(e);throw new l(t)}Ct.loaded()}else Mt(),ft(Cf.None)}else if(pt()===Cf.AR){if(Bg())if(nt&&!Km){_t.launched(),Ee.stop(),mt(),gg(),"Glasses"===Ie&&mg(),wf(te),bg(at()),Eg(Ie),Cg(Le?ot():null);const t=e=>{bt(e.loaded/e.total*100)};null!=e.customArVideo&&Tg(e.customArVideo),yield yg(xe,{envmap:ye,diamondEnvMap:Me,onProgress:t},`${xe}${ye}${Me}`),Mg(we,Se),wg(Be,Te,Re,De),_g(_t.interacted,ve),Xe&&"Shoes"===Ie&&ee.apiUsed&&Ee.start(Ke),ev(ne(),se),vt(),null!=e.customTrueScaleFaceWidth&&Ig(e.customTrueScaleFaceWidth),_t.loaded()}else Ee.stop(),Sg(),ft(Cf.None)}else if(pt()===Cf.Preview)if(it){It.launched(),yield customElements.whenDefined("shopar-3d");const e=st();e.baseUrl=`${M()}/3d`,e.interactivityDisabled=!wt,e.posterUrl=null!=qe?qe:null,e.glbUrl=Ne,e.envUrl=null!=Fe?Fe:`${M()}/env/default.hdr`,e.diamondEnvUrl=null!=Oe?Oe:null,e.category=null!=Ie?Ie:null,e.touchAction=null!=N?N:null,e.zoomDisabled=!F,e.minZoom=null!=O?O:null,e.maxZoom=null!=k?k:null,e.alwaysTransparentBackground=X,e.toneMapping=null!=ke?ke:"ACES",e.toneMappingExposure=null!=Ge?Ge:1,e.bloomEnabled=null!=He?He:null,e.bloomStrength=null!=ze?ze:null,e.bloomRadius=null!=Ve?Ve:null,e.bloomThreshold=null!=We?We:null,e.onInteracted=It.interacted,e.onInteractionPerf=_e?null:t=>{_e=!0,e.onInteractionPerf=null,he(Wg,t)},e.onMaxZoomEnter=G,e.onMaxZoomLeave=H,e.onMinZoomEnter=z,e.onMinZoomLeave=V,e.onMinVerticalAngleEnter=W,e.onMinVerticalAngleLeave=q,e.onMaxVerticalAngleEnter=j,e.onMaxVerticalAngleLeave=Y,e.animation=null!=P?P:null,e.paused=!1,e.style.display="",yield e.flushChanges(),It.loaded()}else ct(),ft(Cf.None);const Bt=()=>c(this,void 0,void 0,function*(){if(tt){Ct.launched();try{const e=++St;if(pt()===Cf.Preview&&(It.closed("switch"),ct()),ft(Cf.QR),yield yt(R,D),St!==e)return;return ev(ne(),se),void Ct.loaded()}catch(e){throw Ct.failed(e),new l(A(e))}}if(!nt)throw new o("Model does not have AR enabled.");_t.launched();try{const t=++St;if(pt()===Cf.Preview&&(It.closed("switch"),ct()),wf(te),ft(Cf.AR),gg(),"Glasses"===Ie&&mg(),mt(),yield Yf,St!==t)return;ev(ne(),se),Eg(Ie),bg(at()),Cg(Le?ot():null);const n=e=>{bt(e.loaded/e.total*100)};if(Ee.stop(),Bg())null!=e.customArVideo&&Tg(e.customArVideo),yield yg(xe,{envmap:ye,diamondEnvMap:Me,onProgress:n},`${xe}${ye}${Me}`),null!=e.customTrueScaleFaceWidth&&Ig(e.customTrueScaleFaceWidth);else{if(yield vg({licenseKey:Qe,effectUrl:xe,effectOptions:{envmap:ye,diamondEnvMap:Me},onProgress:n,videoConfig:e.customArVideo,customTrueScaleFaceWidth:e.customTrueScaleFaceWidth}),St!==t)return;ev(ne(),se)}if(Mg(we,Se),wg(Be,Te,Re,De),_g(_t.interacted,ve),Xe&&"Shoes"===Ie&&ee.apiUsed&&Ee.start(Ke),St!==t)return;if(ev(ne(),se),St!==t)return;ev(ne(),se),_t.loaded()}catch(e){_t.failed(e),Et();const t=A(e);if("CameraPermissionDeniedError"===h(e))throw new s(t);throw new o(t)}finally{vt()}}),Tt=()=>c(this,void 0,void 0,function*(){if(!it)throw new a("Model does not have 3D enabled.");It.launched();try{pt()===Cf.AR&&(_t.closed("switch"),Ee.stop(),Sg(),Mt()),ft(Cf.Preview),yield customElements.whenDefined("shopar-3d");const e=st();e.baseUrl=`${M()}/3d`,e.interactivityDisabled=!wt,e.posterUrl=null!=qe?qe:null,e.glbUrl=Ne,e.envUrl=null!=Fe?Fe:`${M()}/env/default.hdr`,e.diamondEnvUrl=null!=Oe?Oe:null,e.category=null!=Ie?Ie:null,e.touchAction=null!=N?N:null,e.zoomDisabled=!F,e.minZoom=null!=O?O:null,e.maxZoom=null!=k?k:null,e.alwaysTransparentBackground=X,e.toneMapping=null!=ke?ke:"ACES",e.toneMappingExposure=null!=Ge?Ge:1,e.bloomEnabled=null!=He?He:null,e.bloomStrength=null!=ze?ze:null,e.bloomRadius=null!=Ve?Ve:null,e.bloomThreshold=null!=We?We:null,e.onInteracted=It.interacted,e.onInteractionPerf=_e?null:t=>{_e=!0,e.onInteractionPerf=null,he(Wg,t)},e.onMaxZoomEnter=G,e.onMaxZoomLeave=H,e.onMinZoomEnter=z,e.onMinZoomLeave=V,e.onMinVerticalAngleEnter=W,e.onMinVerticalAngleLeave=q,e.onMaxVerticalAngleEnter=j,e.onMaxVerticalAngleLeave=Y,e.animation=null!=P?P:null,e.paused=!1,e.style.display="",yield e.flushChanges(),It.loaded()}catch(e){throw It.failed(e),new a(A(e))}}),Rt=()=>c(this,void 0,void 0,function*(){pt()!==Cf.None&&("AR"!==U||pt()!==Cf.AR&&pt()!==Cf.QR)&&("3D"===U&&pt()===Cf.Preview||(++St,me(),pt()===Cf.QR||pt()===Cf.AR?(pt()===Cf.QR?Ct.closed("close"):_t.closed("close"),Ee.stop(),Sg(),Mt()):pt()===Cf.Preview&&(It.closed("close"),ct()),ft(Cf.None),"AR"!==U?"3D"!==U||(yield Tt()):yield Bt()))});return gt(d("launchAR",Bt),d("launch3D",Tt),d("close",Rt)),"AR"===U?(yield Bt(),ev(ne(),se)):"3D"===U&&(yield Tt(),ev(ne(),se)),Km=!1,{launchAR:Ze?d("launchAR",Bt):void 0,launch3D:it?d("launch3D",Tt):void 0,closeAR:Ze?d("closeAR",()=>c(this,void 0,void 0,function*(){pt()!==Cf.AR&&pt()!==Cf.QR||"AR"!==U&&(++St,me(),pt()===Cf.QR?Ct.closed("close"):_t.closed("close"),Ee.stop(),Sg(),Mt(),ft(Cf.None),"3D"!==U||(yield Tt()))})):void 0,close3D:it?d("close3D",()=>c(this,void 0,void 0,function*(){pt()===Cf.Preview&&"3D"!==U&&(++St,me(),It.closed("close"),ct(),ft(Cf.None),"AR"!==U||(yield Bt()))})):void 0,close:Ze||it?d("close",Rt):void 0,isInteractive:()=>ae(),setInteractive:e=>oe(e),zoomIn3D:it?e=>{pt()===Cf.Preview&&lt()&&st().zoomBy(e)}:void 0,zoomOut3D:it?e=>{pt()===Cf.Preview&&lt()&&st().zoomBy(-e)}:void 0,rotateHorizontally3D:it?e=>{pt()===Cf.Preview&&lt()&&st().rotateBy(e,0)}:void 0,rotateVertically3D:it?e=>{pt()===Cf.Preview&&lt()&&st().rotateBy(0,e)}:void 0}})}function ev(e,t){if(e!==t)throw new Error("Setup cancelled. Please ensure that setup is only called once.")}const tv={setup:function(e){return c(this,void 0,void 0,function*(){return d("visionSetup",()=>Jm(e))()})}},nv={setup:function(e){return c(this,void 0,void 0,function*(){return d("setup",()=>$m(e))()})},version:I};export{i as ApiError,s as CameraPermissionDeniedError,a as Launch3DError,o as LaunchARError,e as PREVIEW_STATES,t as PluginError,l as QRError,r as SanitizationError,n as ValidationError,nv as plugin,tv as vision};