Files
2024-10-11 16:01:13 +08:00

4255 lines
1.1 MiB
Plaintext

var KP=Object.defineProperty;var ZP=(n,e,t)=>e in n?KP(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var QP=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Ve=(n,e,t)=>ZP(n,typeof e!="symbol"?e+"":e,t);var r8=QP((_T,xg)=>{(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();var YS={exports:{}},Sh={},$S={exports:{}},Dt={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Bc=Symbol.for("react.element"),JP=Symbol.for("react.portal"),e2=Symbol.for("react.fragment"),t2=Symbol.for("react.strict_mode"),n2=Symbol.for("react.profiler"),i2=Symbol.for("react.provider"),r2=Symbol.for("react.context"),s2=Symbol.for("react.forward_ref"),a2=Symbol.for("react.suspense"),o2=Symbol.for("react.memo"),l2=Symbol.for("react.lazy"),Vb=Symbol.iterator;function c2(n){return n===null||typeof n!="object"?null:(n=Vb&&n[Vb]||n["@@iterator"],typeof n=="function"?n:null)}var qS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},KS=Object.assign,ZS={};function al(n,e,t){this.props=n,this.context=e,this.refs=ZS,this.updater=t||qS}al.prototype.isReactComponent={};al.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};al.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function QS(){}QS.prototype=al.prototype;function wg(n,e,t){this.props=n,this.context=e,this.refs=ZS,this.updater=t||qS}var Sg=wg.prototype=new QS;Sg.constructor=wg;KS(Sg,al.prototype);Sg.isPureReactComponent=!0;var Wb=Array.isArray,JS=Object.prototype.hasOwnProperty,Mg={current:null},eM={key:!0,ref:!0,__self:!0,__source:!0};function tM(n,e,t){var i,r={},s=null,a=null;if(e!=null)for(i in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)JS.call(e,i)&&!eM.hasOwnProperty(i)&&(r[i]=e[i]);var l=arguments.length-2;if(l===1)r.children=t;else if(1<l){for(var d=Array(l),h=0;h<l;h++)d[h]=arguments[h+2];r.children=d}if(n&&n.defaultProps)for(i in l=n.defaultProps,l)r[i]===void 0&&(r[i]=l[i]);return{$$typeof:Bc,type:n,key:s,ref:a,props:r,_owner:Mg.current}}function u2(n,e){return{$$typeof:Bc,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function Eg(n){return typeof n=="object"&&n!==null&&n.$$typeof===Bc}function d2(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var jb=/\/+/g;function bf(n,e){return typeof n=="object"&&n!==null&&n.key!=null?d2(""+n.key):e.toString(36)}function _d(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var a=!1;if(n===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(n.$$typeof){case Bc:case JP:a=!0}}if(a)return a=n,r=r(a),n=i===""?"."+bf(a,0):i,Wb(r)?(t="",n!=null&&(t=n.replace(jb,"$&/")+"/"),_d(r,e,t,"",function(h){return h})):r!=null&&(Eg(r)&&(r=u2(r,t+(!r.key||a&&a.key===r.key?"":(""+r.key).replace(jb,"$&/")+"/")+n)),e.push(r)),1;if(a=0,i=i===""?".":i+":",Wb(n))for(var l=0;l<n.length;l++){s=n[l];var d=i+bf(s,l);a+=_d(s,e,t,d,r)}else if(d=c2(n),typeof d=="function")for(n=d.call(n),l=0;!(s=n.next()).done;)s=s.value,d=i+bf(s,l++),a+=_d(s,e,t,d,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function gu(n,e,t){if(n==null)return n;var i=[],r=0;return _d(n,i,"","",function(s){return e.call(t,s,r++)}),i}function h2(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var Ti={current:null},vd={transition:null},f2={ReactCurrentDispatcher:Ti,ReactCurrentBatchConfig:vd,ReactCurrentOwner:Mg};function nM(){throw Error("act(...) is not supported in production builds of React.")}Dt.Children={map:gu,forEach:function(n,e,t){gu(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return gu(n,function(){e++}),e},toArray:function(n){return gu(n,function(e){return e})||[]},only:function(n){if(!Eg(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Dt.Component=al;Dt.Fragment=e2;Dt.Profiler=n2;Dt.PureComponent=wg;Dt.StrictMode=t2;Dt.Suspense=a2;Dt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=f2;Dt.act=nM;Dt.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=KS({},n.props),r=n.key,s=n.ref,a=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=Mg.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var l=n.type.defaultProps;for(d in e)JS.call(e,d)&&!eM.hasOwnProperty(d)&&(i[d]=e[d]===void 0&&l!==void 0?l[d]:e[d])}var d=arguments.length-2;if(d===1)i.children=t;else if(1<d){l=Array(d);for(var h=0;h<d;h++)l[h]=arguments[h+2];i.children=l}return{$$typeof:Bc,type:n.type,key:r,ref:s,props:i,_owner:a}};Dt.createContext=function(n){return n={$$typeof:r2,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:i2,_context:n},n.Consumer=n};Dt.createElement=tM;Dt.createFactory=function(n){var e=tM.bind(null,n);return e.type=n,e};Dt.createRef=function(){return{current:null}};Dt.forwardRef=function(n){return{$$typeof:s2,render:n}};Dt.isValidElement=Eg;Dt.lazy=function(n){return{$$typeof:l2,_payload:{_status:-1,_result:n},_init:h2}};Dt.memo=function(n,e){return{$$typeof:o2,type:n,compare:e===void 0?null:e}};Dt.startTransition=function(n){var e=vd.transition;vd.transition={};try{n()}finally{vd.transition=e}};Dt.unstable_act=nM;Dt.useCallback=function(n,e){return Ti.current.useCallback(n,e)};Dt.useContext=function(n){return Ti.current.useContext(n)};Dt.useDebugValue=function(){};Dt.useDeferredValue=function(n){return Ti.current.useDeferredValue(n)};Dt.useEffect=function(n,e){return Ti.current.useEffect(n,e)};Dt.useId=function(){return Ti.current.useId()};Dt.useImperativeHandle=function(n,e,t){return Ti.current.useImperativeHandle(n,e,t)};Dt.useInsertionEffect=function(n,e){return Ti.current.useInsertionEffect(n,e)};Dt.useLayoutEffect=function(n,e){return Ti.current.useLayoutEffect(n,e)};Dt.useMemo=function(n,e){return Ti.current.useMemo(n,e)};Dt.useReducer=function(n,e,t){return Ti.current.useReducer(n,e,t)};Dt.useRef=function(n){return Ti.current.useRef(n)};Dt.useState=function(n){return Ti.current.useState(n)};Dt.useSyncExternalStore=function(n,e,t){return Ti.current.useSyncExternalStore(n,e,t)};Dt.useTransition=function(){return Ti.current.useTransition()};Dt.version="18.3.1";$S.exports=Dt;var Xn=$S.exports;/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var p2=Xn,m2=Symbol.for("react.element"),g2=Symbol.for("react.fragment"),_2=Object.prototype.hasOwnProperty,v2=p2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y2={key:!0,ref:!0,__self:!0,__source:!0};function iM(n,e,t){var i,r={},s=null,a=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(a=e.ref);for(i in e)_2.call(e,i)&&!y2.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:m2,type:n,key:s,ref:a,props:r,_owner:v2.current}}Sh.Fragment=g2;Sh.jsx=iM;Sh.jsxs=iM;YS.exports=Sh;var an=YS.exports,rM={exports:{}},Ki={},sM={exports:{}},aM={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(n){function e(Y,pe){var _e=Y.length;Y.push(pe);e:for(;0<_e;){var Ae=_e-1>>>1,Pe=Y[Ae];if(0<r(Pe,pe))Y[Ae]=pe,Y[_e]=Pe,_e=Ae;else break e}}function t(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var pe=Y[0],_e=Y.pop();if(_e!==pe){Y[0]=_e;e:for(var Ae=0,Pe=Y.length,Ue=Pe>>>1;Ae<Ue;){var ae=2*(Ae+1)-1,ge=Y[ae],ce=ae+1,Me=Y[ce];if(0>r(ge,_e))ce<Pe&&0>r(Me,ge)?(Y[Ae]=Me,Y[ce]=_e,Ae=ce):(Y[Ae]=ge,Y[ae]=_e,Ae=ae);else if(ce<Pe&&0>r(Me,_e))Y[Ae]=Me,Y[ce]=_e,Ae=ce;else break e}}return pe}function r(Y,pe){var _e=Y.sortIndex-pe.sortIndex;return _e!==0?_e:Y.id-pe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();n.unstable_now=function(){return a.now()-l}}var d=[],h=[],m=1,u=null,g=3,v=!1,w=!1,T=!1,M=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(Y){for(var pe=t(h);pe!==null;){if(pe.callback===null)i(h);else if(pe.startTime<=Y)i(h),pe.sortIndex=pe.expirationTime,e(d,pe);else break;pe=t(h)}}function P(Y){if(T=!1,E(Y),!w)if(t(d)!==null)w=!0,$(G);else{var pe=t(h);pe!==null&&ue(P,pe.startTime-Y)}}function G(Y,pe){w=!1,T&&(T=!1,b(F),F=-1),v=!0;var _e=g;try{for(E(pe),u=t(d);u!==null&&(!(u.expirationTime>pe)||Y&&!V());){var Ae=u.callback;if(typeof Ae=="function"){u.callback=null,g=u.priorityLevel;var Pe=Ae(u.expirationTime<=pe);pe=n.unstable_now(),typeof Pe=="function"?u.callback=Pe:u===t(d)&&i(d),E(pe)}else i(d);u=t(d)}if(u!==null)var Ue=!0;else{var ae=t(h);ae!==null&&ue(P,ae.startTime-pe),Ue=!1}return Ue}finally{u=null,g=_e,v=!1}}var O=!1,B=null,F=-1,D=5,L=-1;function V(){return!(n.unstable_now()-L<D)}function ie(){if(B!==null){var Y=n.unstable_now();L=Y;var pe=!0;try{pe=B(!0,Y)}finally{pe?re():(O=!1,B=null)}}else O=!1}var re;if(typeof A=="function")re=function(){A(ie)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,me=de.port2;de.port1.onmessage=ie,re=function(){me.postMessage(null)}}else re=function(){M(ie,0)};function $(Y){B=Y,O||(O=!0,re())}function ue(Y,pe){F=M(function(){Y(n.unstable_now())},pe)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Y){Y.callback=null},n.unstable_continueExecution=function(){w||v||(w=!0,$(G))},n.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<Y?Math.floor(1e3/Y):5},n.unstable_getCurrentPriorityLevel=function(){return g},n.unstable_getFirstCallbackNode=function(){return t(d)},n.unstable_next=function(Y){switch(g){case 1:case 2:case 3:var pe=3;break;default:pe=g}var _e=g;g=pe;try{return Y()}finally{g=_e}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(Y,pe){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var _e=g;g=Y;try{return pe()}finally{g=_e}},n.unstable_scheduleCallback=function(Y,pe,_e){var Ae=n.unstable_now();switch(typeof _e=="object"&&_e!==null?(_e=_e.delay,_e=typeof _e=="number"&&0<_e?Ae+_e:Ae):_e=Ae,Y){case 1:var Pe=-1;break;case 2:Pe=250;break;case 5:Pe=1073741823;break;case 4:Pe=1e4;break;default:Pe=5e3}return Pe=_e+Pe,Y={id:m++,callback:pe,priorityLevel:Y,startTime:_e,expirationTime:Pe,sortIndex:-1},_e>Ae?(Y.sortIndex=_e,e(h,Y),t(d)===null&&Y===t(h)&&(T?(b(F),F=-1):T=!0,ue(P,_e-Ae))):(Y.sortIndex=Pe,e(d,Y),w||v||(w=!0,$(G))),Y},n.unstable_shouldYield=V,n.unstable_wrapCallback=function(Y){var pe=g;return function(){var _e=g;g=pe;try{return Y.apply(this,arguments)}finally{g=_e}}}})(aM);sM.exports=aM;var b2=sM.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var x2=Xn,$i=b2;function Be(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var oM=new Set,fc={};function Oa(n,e){jo(n,e),jo(n+"Capture",e)}function jo(n,e){for(fc[n]=e,n=0;n<e.length;n++)oM.add(e[n])}var hs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Np=Object.prototype.hasOwnProperty,w2=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Xb={},Yb={};function S2(n){return Np.call(Yb,n)?!0:Np.call(Xb,n)?!1:w2.test(n)?Yb[n]=!0:(Xb[n]=!0,!1)}function M2(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function E2(n,e,t,i){if(e===null||typeof e>"u"||M2(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ai(n,e,t,i,r,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var ai={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){ai[n]=new Ai(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];ai[e]=new Ai(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){ai[n]=new Ai(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){ai[n]=new Ai(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){ai[n]=new Ai(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){ai[n]=new Ai(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){ai[n]=new Ai(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){ai[n]=new Ai(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){ai[n]=new Ai(n,5,!1,n.toLowerCase(),null,!1,!1)});var Tg=/[\-:]([a-z])/g;function Ag(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(Tg,Ag);ai[e]=new Ai(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(Tg,Ag);ai[e]=new Ai(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(Tg,Ag);ai[e]=new Ai(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){ai[n]=new Ai(n,1,!1,n.toLowerCase(),null,!1,!1)});ai.xlinkHref=new Ai("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){ai[n]=new Ai(n,1,!1,n.toLowerCase(),null,!0,!0)});function Cg(n,e,t,i){var r=ai.hasOwnProperty(e)?ai[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(E2(e,t,r,i)&&(t=null),i||r===null?S2(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var vs=x2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_u=Symbol.for("react.element"),fo=Symbol.for("react.portal"),po=Symbol.for("react.fragment"),Rg=Symbol.for("react.strict_mode"),Bp=Symbol.for("react.profiler"),lM=Symbol.for("react.provider"),cM=Symbol.for("react.context"),Pg=Symbol.for("react.forward_ref"),zp=Symbol.for("react.suspense"),Hp=Symbol.for("react.suspense_list"),Lg=Symbol.for("react.memo"),Ds=Symbol.for("react.lazy"),uM=Symbol.for("react.offscreen"),$b=Symbol.iterator;function Tl(n){return n===null||typeof n!="object"?null:(n=$b&&n[$b]||n["@@iterator"],typeof n=="function"?n:null)}var Cn=Object.assign,xf;function jl(n){if(xf===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);xf=e&&e[1]||""}return`
`+xf+n}var wf=!1;function Sf(n,e){if(!n||wf)return"";wf=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(h){var i=h}Reflect.construct(n,[],e)}else{try{e.call()}catch(h){i=h}n.call(e.prototype)}else{try{throw Error()}catch(h){i=h}n()}}catch(h){if(h&&i&&typeof h.stack=="string"){for(var r=h.stack.split(`
`),s=i.stack.split(`
`),a=r.length-1,l=s.length-1;1<=a&&0<=l&&r[a]!==s[l];)l--;for(;1<=a&&0<=l;a--,l--)if(r[a]!==s[l]){if(a!==1||l!==1)do if(a--,l--,0>l||r[a]!==s[l]){var d=`
`+r[a].replace(" at new "," at ");return n.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",n.displayName)),d}while(1<=a&&0<=l);break}}}finally{wf=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?jl(n):""}function T2(n){switch(n.tag){case 5:return jl(n.type);case 16:return jl("Lazy");case 13:return jl("Suspense");case 19:return jl("SuspenseList");case 0:case 2:case 15:return n=Sf(n.type,!1),n;case 11:return n=Sf(n.type.render,!1),n;case 1:return n=Sf(n.type,!0),n;default:return""}}function Gp(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case po:return"Fragment";case fo:return"Portal";case Bp:return"Profiler";case Rg:return"StrictMode";case zp:return"Suspense";case Hp:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case cM:return(n.displayName||"Context")+".Consumer";case lM:return(n._context.displayName||"Context")+".Provider";case Pg:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Lg:return e=n.displayName||null,e!==null?e:Gp(n.type)||"Memo";case Ds:e=n._payload,n=n._init;try{return Gp(n(e))}catch{}}return null}function A2(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Gp(e);case 8:return e===Rg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function qs(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function dM(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function C2(n){var e=dM(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(a){i=""+a,s.call(this,a)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(a){i=""+a},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function vu(n){n._valueTracker||(n._valueTracker=C2(n))}function hM(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=dM(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Bd(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Vp(n,e){var t=e.checked;return Cn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function qb(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=qs(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function fM(n,e){e=e.checked,e!=null&&Cg(n,"checked",e,!1)}function Wp(n,e){fM(n,e);var t=qs(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?jp(n,e.type,t):e.hasOwnProperty("defaultValue")&&jp(n,e.type,qs(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function Kb(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function jp(n,e,t){(e!=="number"||Bd(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Xl=Array.isArray;function Io(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+qs(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function Xp(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Be(91));return Cn({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Zb(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(Be(92));if(Xl(t)){if(1<t.length)throw Error(Be(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:qs(t)}}function pM(n,e){var t=qs(e.value),i=qs(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function Qb(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function mM(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Yp(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?mM(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var yu,gM=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(yu=yu||document.createElement("div"),yu.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=yu.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function pc(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var ec={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},R2=["Webkit","ms","Moz","O"];Object.keys(ec).forEach(function(n){R2.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),ec[e]=ec[n]})});function _M(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||ec.hasOwnProperty(n)&&ec[n]?(""+e).trim():e+"px"}function vM(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=_M(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var P2=Cn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $p(n,e){if(e){if(P2[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Be(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Be(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Be(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Be(62))}}function qp(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Kp=null;function Ig(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Zp=null,Do=null,ko=null;function Jb(n){if(n=Gc(n)){if(typeof Zp!="function")throw Error(Be(280));var e=n.stateNode;e&&(e=Ch(e),Zp(n.stateNode,n.type,e))}}function yM(n){Do?ko?ko.push(n):ko=[n]:Do=n}function bM(){if(Do){var n=Do,e=ko;if(ko=Do=null,Jb(n),e)for(n=0;n<e.length;n++)Jb(e[n])}}function xM(n,e){return n(e)}function wM(){}var Mf=!1;function SM(n,e,t){if(Mf)return n(e,t);Mf=!0;try{return xM(n,e,t)}finally{Mf=!1,(Do!==null||ko!==null)&&(wM(),bM())}}function mc(n,e){var t=n.stateNode;if(t===null)return null;var i=Ch(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(Be(231,e,typeof t));return t}var Qp=!1;if(hs)try{var Al={};Object.defineProperty(Al,"passive",{get:function(){Qp=!0}}),window.addEventListener("test",Al,Al),window.removeEventListener("test",Al,Al)}catch{Qp=!1}function L2(n,e,t,i,r,s,a,l,d){var h=Array.prototype.slice.call(arguments,3);try{e.apply(t,h)}catch(m){this.onError(m)}}var tc=!1,zd=null,Hd=!1,Jp=null,I2={onError:function(n){tc=!0,zd=n}};function D2(n,e,t,i,r,s,a,l,d){tc=!1,zd=null,L2.apply(I2,arguments)}function k2(n,e,t,i,r,s,a,l,d){if(D2.apply(this,arguments),tc){if(tc){var h=zd;tc=!1,zd=null}else throw Error(Be(198));Hd||(Hd=!0,Jp=h)}}function Na(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function MM(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function ex(n){if(Na(n)!==n)throw Error(Be(188))}function F2(n){var e=n.alternate;if(!e){if(e=Na(n),e===null)throw Error(Be(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return ex(r),n;if(s===i)return ex(r),e;s=s.sibling}throw Error(Be(188))}if(t.return!==i.return)t=r,i=s;else{for(var a=!1,l=r.child;l;){if(l===t){a=!0,t=r,i=s;break}if(l===i){a=!0,i=r,t=s;break}l=l.sibling}if(!a){for(l=s.child;l;){if(l===t){a=!0,t=s,i=r;break}if(l===i){a=!0,i=s,t=r;break}l=l.sibling}if(!a)throw Error(Be(189))}}if(t.alternate!==i)throw Error(Be(190))}if(t.tag!==3)throw Error(Be(188));return t.stateNode.current===t?n:e}function EM(n){return n=F2(n),n!==null?TM(n):null}function TM(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=TM(n);if(e!==null)return e;n=n.sibling}return null}var AM=$i.unstable_scheduleCallback,tx=$i.unstable_cancelCallback,U2=$i.unstable_shouldYield,O2=$i.unstable_requestPaint,kn=$i.unstable_now,N2=$i.unstable_getCurrentPriorityLevel,Dg=$i.unstable_ImmediatePriority,CM=$i.unstable_UserBlockingPriority,Gd=$i.unstable_NormalPriority,B2=$i.unstable_LowPriority,RM=$i.unstable_IdlePriority,Mh=null,zr=null;function z2(n){if(zr&&typeof zr.onCommitFiberRoot=="function")try{zr.onCommitFiberRoot(Mh,n,void 0,(n.current.flags&128)===128)}catch{}}var Tr=Math.clz32?Math.clz32:V2,H2=Math.log,G2=Math.LN2;function V2(n){return n>>>=0,n===0?32:31-(H2(n)/G2|0)|0}var bu=64,xu=4194304;function Yl(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Vd(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,a=t&268435455;if(a!==0){var l=a&~r;l!==0?i=Yl(l):(s&=a,s!==0&&(i=Yl(s)))}else a=t&~r,a!==0?i=Yl(a):s!==0&&(i=Yl(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-Tr(e),r=1<<t,i|=n[t],e&=~r;return i}function W2(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function j2(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var a=31-Tr(s),l=1<<a,d=r[a];d===-1?(!(l&t)||l&i)&&(r[a]=W2(l,e)):d<=e&&(n.expiredLanes|=l),s&=~l}}function em(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function PM(){var n=bu;return bu<<=1,!(bu&4194240)&&(bu=64),n}function Ef(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function zc(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Tr(e),n[e]=t}function X2(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-Tr(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function kg(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-Tr(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var rn=0;function LM(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var IM,Fg,DM,kM,FM,tm=!1,wu=[],zs=null,Hs=null,Gs=null,gc=new Map,_c=new Map,Fs=[],Y2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function nx(n,e){switch(n){case"focusin":case"focusout":zs=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Gs=null;break;case"pointerover":case"pointerout":gc.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":_c.delete(e.pointerId)}}function Cl(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Gc(e),e!==null&&Fg(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function $2(n,e,t,i,r){switch(e){case"focusin":return zs=Cl(zs,n,e,t,i,r),!0;case"dragenter":return Hs=Cl(Hs,n,e,t,i,r),!0;case"mouseover":return Gs=Cl(Gs,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return gc.set(s,Cl(gc.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,_c.set(s,Cl(_c.get(s)||null,n,e,t,i,r)),!0}return!1}function UM(n){var e=wa(n.target);if(e!==null){var t=Na(e);if(t!==null){if(e=t.tag,e===13){if(e=MM(t),e!==null){n.blockedOn=e,FM(n.priority,function(){DM(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function yd(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=nm(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);Kp=i,t.target.dispatchEvent(i),Kp=null}else return e=Gc(t),e!==null&&Fg(e),n.blockedOn=t,!1;e.shift()}return!0}function ix(n,e,t){yd(n)&&t.delete(e)}function q2(){tm=!1,zs!==null&&yd(zs)&&(zs=null),Hs!==null&&yd(Hs)&&(Hs=null),Gs!==null&&yd(Gs)&&(Gs=null),gc.forEach(ix),_c.forEach(ix)}function Rl(n,e){n.blockedOn===e&&(n.blockedOn=null,tm||(tm=!0,$i.unstable_scheduleCallback($i.unstable_NormalPriority,q2)))}function vc(n){function e(r){return Rl(r,n)}if(0<wu.length){Rl(wu[0],n);for(var t=1;t<wu.length;t++){var i=wu[t];i.blockedOn===n&&(i.blockedOn=null)}}for(zs!==null&&Rl(zs,n),Hs!==null&&Rl(Hs,n),Gs!==null&&Rl(Gs,n),gc.forEach(e),_c.forEach(e),t=0;t<Fs.length;t++)i=Fs[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<Fs.length&&(t=Fs[0],t.blockedOn===null);)UM(t),t.blockedOn===null&&Fs.shift()}var Fo=vs.ReactCurrentBatchConfig,Wd=!0;function K2(n,e,t,i){var r=rn,s=Fo.transition;Fo.transition=null;try{rn=1,Ug(n,e,t,i)}finally{rn=r,Fo.transition=s}}function Z2(n,e,t,i){var r=rn,s=Fo.transition;Fo.transition=null;try{rn=4,Ug(n,e,t,i)}finally{rn=r,Fo.transition=s}}function Ug(n,e,t,i){if(Wd){var r=nm(n,e,t,i);if(r===null)Ff(n,e,i,jd,t),nx(n,i);else if($2(r,n,e,t,i))i.stopPropagation();else if(nx(n,i),e&4&&-1<Y2.indexOf(n)){for(;r!==null;){var s=Gc(r);if(s!==null&&IM(s),s=nm(n,e,t,i),s===null&&Ff(n,e,i,jd,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else Ff(n,e,i,null,t)}}var jd=null;function nm(n,e,t,i){if(jd=null,n=Ig(i),n=wa(n),n!==null)if(e=Na(n),e===null)n=null;else if(t=e.tag,t===13){if(n=MM(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return jd=n,null}function OM(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(N2()){case Dg:return 1;case CM:return 4;case Gd:case B2:return 16;case RM:return 536870912;default:return 16}default:return 16}}var Os=null,Og=null,bd=null;function NM(){if(bd)return bd;var n,e=Og,t=e.length,i,r="value"in Os?Os.value:Os.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var a=t-n;for(i=1;i<=a&&e[t-i]===r[s-i];i++);return bd=r.slice(n,1<i?1-i:void 0)}function xd(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function Su(){return!0}function rx(){return!1}function Zi(n){function e(t,i,r,s,a){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var l in n)n.hasOwnProperty(l)&&(t=n[l],this[l]=t?t(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Su:rx,this.isPropagationStopped=rx,this}return Cn(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=Su)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=Su)},persist:function(){},isPersistent:Su}),e}var ol={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ng=Zi(ol),Hc=Cn({},ol,{view:0,detail:0}),Q2=Zi(Hc),Tf,Af,Pl,Eh=Cn({},Hc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bg,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Pl&&(Pl&&n.type==="mousemove"?(Tf=n.screenX-Pl.screenX,Af=n.screenY-Pl.screenY):Af=Tf=0,Pl=n),Tf)},movementY:function(n){return"movementY"in n?n.movementY:Af}}),sx=Zi(Eh),J2=Cn({},Eh,{dataTransfer:0}),eL=Zi(J2),tL=Cn({},Hc,{relatedTarget:0}),Cf=Zi(tL),nL=Cn({},ol,{animationName:0,elapsedTime:0,pseudoElement:0}),iL=Zi(nL),rL=Cn({},ol,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),sL=Zi(rL),aL=Cn({},ol,{data:0}),ax=Zi(aL),oL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lL={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},cL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function uL(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=cL[n])?!!e[n]:!1}function Bg(){return uL}var dL=Cn({},Hc,{key:function(n){if(n.key){var e=oL[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=xd(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?lL[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bg,charCode:function(n){return n.type==="keypress"?xd(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?xd(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),hL=Zi(dL),fL=Cn({},Eh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ox=Zi(fL),pL=Cn({},Hc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bg}),mL=Zi(pL),gL=Cn({},ol,{propertyName:0,elapsedTime:0,pseudoElement:0}),_L=Zi(gL),vL=Cn({},Eh,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),yL=Zi(vL),bL=[9,13,27,32],zg=hs&&"CompositionEvent"in window,nc=null;hs&&"documentMode"in document&&(nc=document.documentMode);var xL=hs&&"TextEvent"in window&&!nc,BM=hs&&(!zg||nc&&8<nc&&11>=nc),lx=" ",cx=!1;function zM(n,e){switch(n){case"keyup":return bL.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function HM(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var mo=!1;function wL(n,e){switch(n){case"compositionend":return HM(e);case"keypress":return e.which!==32?null:(cx=!0,lx);case"textInput":return n=e.data,n===lx&&cx?null:n;default:return null}}function SL(n,e){if(mo)return n==="compositionend"||!zg&&zM(n,e)?(n=NM(),bd=Og=Os=null,mo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return BM&&e.locale!=="ko"?null:e.data;default:return null}}var ML={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ux(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!ML[n.type]:e==="textarea"}function GM(n,e,t,i){yM(i),e=Xd(e,"onChange"),0<e.length&&(t=new Ng("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var ic=null,yc=null;function EL(n){JM(n,0)}function Th(n){var e=vo(n);if(hM(e))return n}function TL(n,e){if(n==="change")return e}var VM=!1;if(hs){var Rf;if(hs){var Pf="oninput"in document;if(!Pf){var dx=document.createElement("div");dx.setAttribute("oninput","return;"),Pf=typeof dx.oninput=="function"}Rf=Pf}else Rf=!1;VM=Rf&&(!document.documentMode||9<document.documentMode)}function hx(){ic&&(ic.detachEvent("onpropertychange",WM),yc=ic=null)}function WM(n){if(n.propertyName==="value"&&Th(yc)){var e=[];GM(e,yc,n,Ig(n)),SM(EL,e)}}function AL(n,e,t){n==="focusin"?(hx(),ic=e,yc=t,ic.attachEvent("onpropertychange",WM)):n==="focusout"&&hx()}function CL(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Th(yc)}function RL(n,e){if(n==="click")return Th(e)}function PL(n,e){if(n==="input"||n==="change")return Th(e)}function LL(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Rr=typeof Object.is=="function"?Object.is:LL;function bc(n,e){if(Rr(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!Np.call(e,r)||!Rr(n[r],e[r]))return!1}return!0}function fx(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function px(n,e){var t=fx(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=fx(t)}}function jM(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?jM(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function XM(){for(var n=window,e=Bd();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Bd(n.document)}return e}function Hg(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function IL(n){var e=XM(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&jM(t.ownerDocument.documentElement,t)){if(i!==null&&Hg(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=px(t,s);var a=px(t,i);r&&a&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==a.node||n.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var DL=hs&&"documentMode"in document&&11>=document.documentMode,go=null,im=null,rc=null,rm=!1;function mx(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;rm||go==null||go!==Bd(i)||(i=go,"selectionStart"in i&&Hg(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),rc&&bc(rc,i)||(rc=i,i=Xd(im,"onSelect"),0<i.length&&(e=new Ng("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=go)))}function Mu(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var _o={animationend:Mu("Animation","AnimationEnd"),animationiteration:Mu("Animation","AnimationIteration"),animationstart:Mu("Animation","AnimationStart"),transitionend:Mu("Transition","TransitionEnd")},Lf={},YM={};hs&&(YM=document.createElement("div").style,"AnimationEvent"in window||(delete _o.animationend.animation,delete _o.animationiteration.animation,delete _o.animationstart.animation),"TransitionEvent"in window||delete _o.transitionend.transition);function Ah(n){if(Lf[n])return Lf[n];if(!_o[n])return n;var e=_o[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in YM)return Lf[n]=e[t];return n}var $M=Ah("animationend"),qM=Ah("animationiteration"),KM=Ah("animationstart"),ZM=Ah("transitionend"),QM=new Map,gx="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Js(n,e){QM.set(n,e),Oa(e,[n])}for(var If=0;If<gx.length;If++){var Df=gx[If],kL=Df.toLowerCase(),FL=Df[0].toUpperCase()+Df.slice(1);Js(kL,"on"+FL)}Js($M,"onAnimationEnd");Js(qM,"onAnimationIteration");Js(KM,"onAnimationStart");Js("dblclick","onDoubleClick");Js("focusin","onFocus");Js("focusout","onBlur");Js(ZM,"onTransitionEnd");jo("onMouseEnter",["mouseout","mouseover"]);jo("onMouseLeave",["mouseout","mouseover"]);jo("onPointerEnter",["pointerout","pointerover"]);jo("onPointerLeave",["pointerout","pointerover"]);Oa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Oa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Oa("onBeforeInput",["compositionend","keypress","textInput","paste"]);Oa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Oa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Oa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $l="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),UL=new Set("cancel close invalid load scroll toggle".split(" ").concat($l));function _x(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,k2(i,e,void 0,n),n.currentTarget=null}function JM(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var a=i.length-1;0<=a;a--){var l=i[a],d=l.instance,h=l.currentTarget;if(l=l.listener,d!==s&&r.isPropagationStopped())break e;_x(r,l,h),s=d}else for(a=0;a<i.length;a++){if(l=i[a],d=l.instance,h=l.currentTarget,l=l.listener,d!==s&&r.isPropagationStopped())break e;_x(r,l,h),s=d}}}if(Hd)throw n=Jp,Hd=!1,Jp=null,n}function fn(n,e){var t=e[cm];t===void 0&&(t=e[cm]=new Set);var i=n+"__bubble";t.has(i)||(e1(e,n,2,!1),t.add(i))}function kf(n,e,t){var i=0;e&&(i|=4),e1(t,n,i,e)}var Eu="_reactListening"+Math.random().toString(36).slice(2);function xc(n){if(!n[Eu]){n[Eu]=!0,oM.forEach(function(t){t!=="selectionchange"&&(UL.has(t)||kf(t,!1,n),kf(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[Eu]||(e[Eu]=!0,kf("selectionchange",!1,e))}}function e1(n,e,t,i){switch(OM(e)){case 1:var r=K2;break;case 4:r=Z2;break;default:r=Ug}t=r.bind(null,e,t,n),r=void 0,!Qp||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function Ff(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var a=i.tag;if(a===3||a===4){var l=i.stateNode.containerInfo;if(l===r||l.nodeType===8&&l.parentNode===r)break;if(a===4)for(a=i.return;a!==null;){var d=a.tag;if((d===3||d===4)&&(d=a.stateNode.containerInfo,d===r||d.nodeType===8&&d.parentNode===r))return;a=a.return}for(;l!==null;){if(a=wa(l),a===null)return;if(d=a.tag,d===5||d===6){i=s=a;continue e}l=l.parentNode}}i=i.return}SM(function(){var h=s,m=Ig(t),u=[];e:{var g=QM.get(n);if(g!==void 0){var v=Ng,w=n;switch(n){case"keypress":if(xd(t)===0)break e;case"keydown":case"keyup":v=hL;break;case"focusin":w="focus",v=Cf;break;case"focusout":w="blur",v=Cf;break;case"beforeblur":case"afterblur":v=Cf;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=sx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=eL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=mL;break;case $M:case qM:case KM:v=iL;break;case ZM:v=_L;break;case"scroll":v=Q2;break;case"wheel":v=yL;break;case"copy":case"cut":case"paste":v=sL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=ox}var T=(e&4)!==0,M=!T&&n==="scroll",b=T?g!==null?g+"Capture":null:g;T=[];for(var A=h,E;A!==null;){E=A;var P=E.stateNode;if(E.tag===5&&P!==null&&(E=P,b!==null&&(P=mc(A,b),P!=null&&T.push(wc(A,P,E)))),M)break;A=A.return}0<T.length&&(g=new v(g,w,null,t,m),u.push({event:g,listeners:T}))}}if(!(e&7)){e:{if(g=n==="mouseover"||n==="pointerover",v=n==="mouseout"||n==="pointerout",g&&t!==Kp&&(w=t.relatedTarget||t.fromElement)&&(wa(w)||w[fs]))break e;if((v||g)&&(g=m.window===m?m:(g=m.ownerDocument)?g.defaultView||g.parentWindow:window,v?(w=t.relatedTarget||t.toElement,v=h,w=w?wa(w):null,w!==null&&(M=Na(w),w!==M||w.tag!==5&&w.tag!==6)&&(w=null)):(v=null,w=h),v!==w)){if(T=sx,P="onMouseLeave",b="onMouseEnter",A="mouse",(n==="pointerout"||n==="pointerover")&&(T=ox,P="onPointerLeave",b="onPointerEnter",A="pointer"),M=v==null?g:vo(v),E=w==null?g:vo(w),g=new T(P,A+"leave",v,t,m),g.target=M,g.relatedTarget=E,P=null,wa(m)===h&&(T=new T(b,A+"enter",w,t,m),T.target=E,T.relatedTarget=M,P=T),M=P,v&&w)t:{for(T=v,b=w,A=0,E=T;E;E=Wa(E))A++;for(E=0,P=b;P;P=Wa(P))E++;for(;0<A-E;)T=Wa(T),A--;for(;0<E-A;)b=Wa(b),E--;for(;A--;){if(T===b||b!==null&&T===b.alternate)break t;T=Wa(T),b=Wa(b)}T=null}else T=null;v!==null&&vx(u,g,v,T,!1),w!==null&&M!==null&&vx(u,M,w,T,!0)}}e:{if(g=h?vo(h):window,v=g.nodeName&&g.nodeName.toLowerCase(),v==="select"||v==="input"&&g.type==="file")var G=TL;else if(ux(g))if(VM)G=PL;else{G=CL;var O=AL}else(v=g.nodeName)&&v.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(G=RL);if(G&&(G=G(n,h))){GM(u,G,t,m);break e}O&&O(n,g,h),n==="focusout"&&(O=g._wrapperState)&&O.controlled&&g.type==="number"&&jp(g,"number",g.value)}switch(O=h?vo(h):window,n){case"focusin":(ux(O)||O.contentEditable==="true")&&(go=O,im=h,rc=null);break;case"focusout":rc=im=go=null;break;case"mousedown":rm=!0;break;case"contextmenu":case"mouseup":case"dragend":rm=!1,mx(u,t,m);break;case"selectionchange":if(DL)break;case"keydown":case"keyup":mx(u,t,m)}var B;if(zg)e:{switch(n){case"compositionstart":var F="onCompositionStart";break e;case"compositionend":F="onCompositionEnd";break e;case"compositionupdate":F="onCompositionUpdate";break e}F=void 0}else mo?zM(n,t)&&(F="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(F="onCompositionStart");F&&(BM&&t.locale!=="ko"&&(mo||F!=="onCompositionStart"?F==="onCompositionEnd"&&mo&&(B=NM()):(Os=m,Og="value"in Os?Os.value:Os.textContent,mo=!0)),O=Xd(h,F),0<O.length&&(F=new ax(F,n,null,t,m),u.push({event:F,listeners:O}),B?F.data=B:(B=HM(t),B!==null&&(F.data=B)))),(B=xL?wL(n,t):SL(n,t))&&(h=Xd(h,"onBeforeInput"),0<h.length&&(m=new ax("onBeforeInput","beforeinput",null,t,m),u.push({event:m,listeners:h}),m.data=B))}JM(u,e)})}function wc(n,e,t){return{instance:n,listener:e,currentTarget:t}}function Xd(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=mc(n,t),s!=null&&i.unshift(wc(n,s,r)),s=mc(n,e),s!=null&&i.push(wc(n,s,r))),n=n.return}return i}function Wa(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function vx(n,e,t,i,r){for(var s=e._reactName,a=[];t!==null&&t!==i;){var l=t,d=l.alternate,h=l.stateNode;if(d!==null&&d===i)break;l.tag===5&&h!==null&&(l=h,r?(d=mc(t,s),d!=null&&a.unshift(wc(t,d,l))):r||(d=mc(t,s),d!=null&&a.push(wc(t,d,l)))),t=t.return}a.length!==0&&n.push({event:e,listeners:a})}var OL=/\r\n?/g,NL=/\u0000|\uFFFD/g;function yx(n){return(typeof n=="string"?n:""+n).replace(OL,`
`).replace(NL,"")}function Tu(n,e,t){if(e=yx(e),yx(n)!==e&&t)throw Error(Be(425))}function Yd(){}var sm=null,am=null;function om(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var lm=typeof setTimeout=="function"?setTimeout:void 0,BL=typeof clearTimeout=="function"?clearTimeout:void 0,bx=typeof Promise=="function"?Promise:void 0,zL=typeof queueMicrotask=="function"?queueMicrotask:typeof bx<"u"?function(n){return bx.resolve(null).then(n).catch(HL)}:lm;function HL(n){setTimeout(function(){throw n})}function Uf(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),vc(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);vc(e)}function Vs(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function xx(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var ll=Math.random().toString(36).slice(2),Fr="__reactFiber$"+ll,Sc="__reactProps$"+ll,fs="__reactContainer$"+ll,cm="__reactEvents$"+ll,GL="__reactListeners$"+ll,VL="__reactHandles$"+ll;function wa(n){var e=n[Fr];if(e)return e;for(var t=n.parentNode;t;){if(e=t[fs]||t[Fr]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=xx(n);n!==null;){if(t=n[Fr])return t;n=xx(n)}return e}n=t,t=n.parentNode}return null}function Gc(n){return n=n[Fr]||n[fs],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function vo(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(Be(33))}function Ch(n){return n[Sc]||null}var um=[],yo=-1;function ea(n){return{current:n}}function gn(n){0>yo||(n.current=um[yo],um[yo]=null,yo--)}function cn(n,e){yo++,um[yo]=n.current,n.current=e}var Ks={},vi=ea(Ks),Ui=ea(!1),Ca=Ks;function Xo(n,e){var t=n.type.contextTypes;if(!t)return Ks;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Oi(n){return n=n.childContextTypes,n!=null}function $d(){gn(Ui),gn(vi)}function wx(n,e,t){if(vi.current!==Ks)throw Error(Be(168));cn(vi,e),cn(Ui,t)}function t1(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Be(108,A2(n)||"Unknown",r));return Cn({},t,i)}function qd(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Ks,Ca=vi.current,cn(vi,n),cn(Ui,Ui.current),!0}function Sx(n,e,t){var i=n.stateNode;if(!i)throw Error(Be(169));t?(n=t1(n,e,Ca),i.__reactInternalMemoizedMergedChildContext=n,gn(Ui),gn(vi),cn(vi,n)):gn(Ui),cn(Ui,t)}var rs=null,Rh=!1,Of=!1;function n1(n){rs===null?rs=[n]:rs.push(n)}function WL(n){Rh=!0,n1(n)}function ta(){if(!Of&&rs!==null){Of=!0;var n=0,e=rn;try{var t=rs;for(rn=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}rs=null,Rh=!1}catch(r){throw rs!==null&&(rs=rs.slice(n+1)),AM(Dg,ta),r}finally{rn=e,Of=!1}}return null}var bo=[],xo=0,Kd=null,Zd=0,sr=[],ar=0,Ra=null,os=1,ls="";function pa(n,e){bo[xo++]=Zd,bo[xo++]=Kd,Kd=n,Zd=e}function i1(n,e,t){sr[ar++]=os,sr[ar++]=ls,sr[ar++]=Ra,Ra=n;var i=os;n=ls;var r=32-Tr(i)-1;i&=~(1<<r),t+=1;var s=32-Tr(e)+r;if(30<s){var a=r-r%5;s=(i&(1<<a)-1).toString(32),i>>=a,r-=a,os=1<<32-Tr(e)+r|t<<r|i,ls=s+n}else os=1<<s|t<<r|i,ls=n}function Gg(n){n.return!==null&&(pa(n,1),i1(n,1,0))}function Vg(n){for(;n===Kd;)Kd=bo[--xo],bo[xo]=null,Zd=bo[--xo],bo[xo]=null;for(;n===Ra;)Ra=sr[--ar],sr[ar]=null,ls=sr[--ar],sr[ar]=null,os=sr[--ar],sr[ar]=null}var Yi=null,Xi=null,xn=!1,Sr=null;function r1(n,e){var t=lr(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function Mx(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,Yi=n,Xi=Vs(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,Yi=n,Xi=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=Ra!==null?{id:os,overflow:ls}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=lr(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,Yi=n,Xi=null,!0):!1;default:return!1}}function dm(n){return(n.mode&1)!==0&&(n.flags&128)===0}function hm(n){if(xn){var e=Xi;if(e){var t=e;if(!Mx(n,e)){if(dm(n))throw Error(Be(418));e=Vs(t.nextSibling);var i=Yi;e&&Mx(n,e)?r1(i,t):(n.flags=n.flags&-4097|2,xn=!1,Yi=n)}}else{if(dm(n))throw Error(Be(418));n.flags=n.flags&-4097|2,xn=!1,Yi=n}}}function Ex(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Yi=n}function Au(n){if(n!==Yi)return!1;if(!xn)return Ex(n),xn=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!om(n.type,n.memoizedProps)),e&&(e=Xi)){if(dm(n))throw s1(),Error(Be(418));for(;e;)r1(n,e),e=Vs(e.nextSibling)}if(Ex(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(Be(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Xi=Vs(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Xi=null}}else Xi=Yi?Vs(n.stateNode.nextSibling):null;return!0}function s1(){for(var n=Xi;n;)n=Vs(n.nextSibling)}function Yo(){Xi=Yi=null,xn=!1}function Wg(n){Sr===null?Sr=[n]:Sr.push(n)}var jL=vs.ReactCurrentBatchConfig;function Ll(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(Be(309));var i=t.stateNode}if(!i)throw Error(Be(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(a){var l=r.refs;a===null?delete l[s]:l[s]=a},e._stringRef=s,e)}if(typeof n!="string")throw Error(Be(284));if(!t._owner)throw Error(Be(290,n))}return n}function Cu(n,e){throw n=Object.prototype.toString.call(e),Error(Be(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function Tx(n){var e=n._init;return e(n._payload)}function a1(n){function e(b,A){if(n){var E=b.deletions;E===null?(b.deletions=[A],b.flags|=16):E.push(A)}}function t(b,A){if(!n)return null;for(;A!==null;)e(b,A),A=A.sibling;return null}function i(b,A){for(b=new Map;A!==null;)A.key!==null?b.set(A.key,A):b.set(A.index,A),A=A.sibling;return b}function r(b,A){return b=Ys(b,A),b.index=0,b.sibling=null,b}function s(b,A,E){return b.index=E,n?(E=b.alternate,E!==null?(E=E.index,E<A?(b.flags|=2,A):E):(b.flags|=2,A)):(b.flags|=1048576,A)}function a(b){return n&&b.alternate===null&&(b.flags|=2),b}function l(b,A,E,P){return A===null||A.tag!==6?(A=Wf(E,b.mode,P),A.return=b,A):(A=r(A,E),A.return=b,A)}function d(b,A,E,P){var G=E.type;return G===po?m(b,A,E.props.children,P,E.key):A!==null&&(A.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ds&&Tx(G)===A.type)?(P=r(A,E.props),P.ref=Ll(b,A,E),P.return=b,P):(P=Cd(E.type,E.key,E.props,null,b.mode,P),P.ref=Ll(b,A,E),P.return=b,P)}function h(b,A,E,P){return A===null||A.tag!==4||A.stateNode.containerInfo!==E.containerInfo||A.stateNode.implementation!==E.implementation?(A=jf(E,b.mode,P),A.return=b,A):(A=r(A,E.children||[]),A.return=b,A)}function m(b,A,E,P,G){return A===null||A.tag!==7?(A=Ta(E,b.mode,P,G),A.return=b,A):(A=r(A,E),A.return=b,A)}function u(b,A,E){if(typeof A=="string"&&A!==""||typeof A=="number")return A=Wf(""+A,b.mode,E),A.return=b,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case _u:return E=Cd(A.type,A.key,A.props,null,b.mode,E),E.ref=Ll(b,null,A),E.return=b,E;case fo:return A=jf(A,b.mode,E),A.return=b,A;case Ds:var P=A._init;return u(b,P(A._payload),E)}if(Xl(A)||Tl(A))return A=Ta(A,b.mode,E,null),A.return=b,A;Cu(b,A)}return null}function g(b,A,E,P){var G=A!==null?A.key:null;if(typeof E=="string"&&E!==""||typeof E=="number")return G!==null?null:l(b,A,""+E,P);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case _u:return E.key===G?d(b,A,E,P):null;case fo:return E.key===G?h(b,A,E,P):null;case Ds:return G=E._init,g(b,A,G(E._payload),P)}if(Xl(E)||Tl(E))return G!==null?null:m(b,A,E,P,null);Cu(b,E)}return null}function v(b,A,E,P,G){if(typeof P=="string"&&P!==""||typeof P=="number")return b=b.get(E)||null,l(A,b,""+P,G);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case _u:return b=b.get(P.key===null?E:P.key)||null,d(A,b,P,G);case fo:return b=b.get(P.key===null?E:P.key)||null,h(A,b,P,G);case Ds:var O=P._init;return v(b,A,E,O(P._payload),G)}if(Xl(P)||Tl(P))return b=b.get(E)||null,m(A,b,P,G,null);Cu(A,P)}return null}function w(b,A,E,P){for(var G=null,O=null,B=A,F=A=0,D=null;B!==null&&F<E.length;F++){B.index>F?(D=B,B=null):D=B.sibling;var L=g(b,B,E[F],P);if(L===null){B===null&&(B=D);break}n&&B&&L.alternate===null&&e(b,B),A=s(L,A,F),O===null?G=L:O.sibling=L,O=L,B=D}if(F===E.length)return t(b,B),xn&&pa(b,F),G;if(B===null){for(;F<E.length;F++)B=u(b,E[F],P),B!==null&&(A=s(B,A,F),O===null?G=B:O.sibling=B,O=B);return xn&&pa(b,F),G}for(B=i(b,B);F<E.length;F++)D=v(B,b,F,E[F],P),D!==null&&(n&&D.alternate!==null&&B.delete(D.key===null?F:D.key),A=s(D,A,F),O===null?G=D:O.sibling=D,O=D);return n&&B.forEach(function(V){return e(b,V)}),xn&&pa(b,F),G}function T(b,A,E,P){var G=Tl(E);if(typeof G!="function")throw Error(Be(150));if(E=G.call(E),E==null)throw Error(Be(151));for(var O=G=null,B=A,F=A=0,D=null,L=E.next();B!==null&&!L.done;F++,L=E.next()){B.index>F?(D=B,B=null):D=B.sibling;var V=g(b,B,L.value,P);if(V===null){B===null&&(B=D);break}n&&B&&V.alternate===null&&e(b,B),A=s(V,A,F),O===null?G=V:O.sibling=V,O=V,B=D}if(L.done)return t(b,B),xn&&pa(b,F),G;if(B===null){for(;!L.done;F++,L=E.next())L=u(b,L.value,P),L!==null&&(A=s(L,A,F),O===null?G=L:O.sibling=L,O=L);return xn&&pa(b,F),G}for(B=i(b,B);!L.done;F++,L=E.next())L=v(B,b,F,L.value,P),L!==null&&(n&&L.alternate!==null&&B.delete(L.key===null?F:L.key),A=s(L,A,F),O===null?G=L:O.sibling=L,O=L);return n&&B.forEach(function(ie){return e(b,ie)}),xn&&pa(b,F),G}function M(b,A,E,P){if(typeof E=="object"&&E!==null&&E.type===po&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case _u:e:{for(var G=E.key,O=A;O!==null;){if(O.key===G){if(G=E.type,G===po){if(O.tag===7){t(b,O.sibling),A=r(O,E.props.children),A.return=b,b=A;break e}}else if(O.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ds&&Tx(G)===O.type){t(b,O.sibling),A=r(O,E.props),A.ref=Ll(b,O,E),A.return=b,b=A;break e}t(b,O);break}else e(b,O);O=O.sibling}E.type===po?(A=Ta(E.props.children,b.mode,P,E.key),A.return=b,b=A):(P=Cd(E.type,E.key,E.props,null,b.mode,P),P.ref=Ll(b,A,E),P.return=b,b=P)}return a(b);case fo:e:{for(O=E.key;A!==null;){if(A.key===O)if(A.tag===4&&A.stateNode.containerInfo===E.containerInfo&&A.stateNode.implementation===E.implementation){t(b,A.sibling),A=r(A,E.children||[]),A.return=b,b=A;break e}else{t(b,A);break}else e(b,A);A=A.sibling}A=jf(E,b.mode,P),A.return=b,b=A}return a(b);case Ds:return O=E._init,M(b,A,O(E._payload),P)}if(Xl(E))return w(b,A,E,P);if(Tl(E))return T(b,A,E,P);Cu(b,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,A!==null&&A.tag===6?(t(b,A.sibling),A=r(A,E),A.return=b,b=A):(t(b,A),A=Wf(E,b.mode,P),A.return=b,b=A),a(b)):t(b,A)}return M}var $o=a1(!0),o1=a1(!1),Qd=ea(null),Jd=null,wo=null,jg=null;function Xg(){jg=wo=Jd=null}function Yg(n){var e=Qd.current;gn(Qd),n._currentValue=e}function fm(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Uo(n,e){Jd=n,jg=wo=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Fi=!0),n.firstContext=null)}function dr(n){var e=n._currentValue;if(jg!==n)if(n={context:n,memoizedValue:e,next:null},wo===null){if(Jd===null)throw Error(Be(308));wo=n,Jd.dependencies={lanes:0,firstContext:n}}else wo=wo.next=n;return e}var Sa=null;function $g(n){Sa===null?Sa=[n]:Sa.push(n)}function l1(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,$g(e)):(t.next=r.next,r.next=t),e.interleaved=t,ps(n,i)}function ps(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var ks=!1;function qg(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function c1(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function ds(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Ws(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,qt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,ps(n,t)}return r=i.interleaved,r===null?(e.next=e,$g(i)):(e.next=r.next,r.next=e),i.interleaved=e,ps(n,t)}function wd(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,kg(n,t)}}function Ax(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var a={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=a:s=s.next=a,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function eh(n,e,t,i){var r=n.updateQueue;ks=!1;var s=r.firstBaseUpdate,a=r.lastBaseUpdate,l=r.shared.pending;if(l!==null){r.shared.pending=null;var d=l,h=d.next;d.next=null,a===null?s=h:a.next=h,a=d;var m=n.alternate;m!==null&&(m=m.updateQueue,l=m.lastBaseUpdate,l!==a&&(l===null?m.firstBaseUpdate=h:l.next=h,m.lastBaseUpdate=d))}if(s!==null){var u=r.baseState;a=0,m=h=d=null,l=s;do{var g=l.lane,v=l.eventTime;if((i&g)===g){m!==null&&(m=m.next={eventTime:v,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var w=n,T=l;switch(g=e,v=t,T.tag){case 1:if(w=T.payload,typeof w=="function"){u=w.call(v,u,g);break e}u=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=T.payload,g=typeof w=="function"?w.call(v,u,g):w,g==null)break e;u=Cn({},u,g);break e;case 2:ks=!0}}l.callback!==null&&l.lane!==0&&(n.flags|=64,g=r.effects,g===null?r.effects=[l]:g.push(l))}else v={eventTime:v,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},m===null?(h=m=v,d=u):m=m.next=v,a|=g;if(l=l.next,l===null){if(l=r.shared.pending,l===null)break;g=l,l=g.next,g.next=null,r.lastBaseUpdate=g,r.shared.pending=null}}while(!0);if(m===null&&(d=u),r.baseState=d,r.firstBaseUpdate=h,r.lastBaseUpdate=m,e=r.shared.interleaved,e!==null){r=e;do a|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);La|=a,n.lanes=a,n.memoizedState=u}}function Cx(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(Be(191,r));r.call(i)}}}var Vc={},Hr=ea(Vc),Mc=ea(Vc),Ec=ea(Vc);function Ma(n){if(n===Vc)throw Error(Be(174));return n}function Kg(n,e){switch(cn(Ec,e),cn(Mc,n),cn(Hr,Vc),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Yp(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=Yp(e,n)}gn(Hr),cn(Hr,e)}function qo(){gn(Hr),gn(Mc),gn(Ec)}function u1(n){Ma(Ec.current);var e=Ma(Hr.current),t=Yp(e,n.type);e!==t&&(cn(Mc,n),cn(Hr,t))}function Zg(n){Mc.current===n&&(gn(Hr),gn(Mc))}var En=ea(0);function th(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Nf=[];function Qg(){for(var n=0;n<Nf.length;n++)Nf[n]._workInProgressVersionPrimary=null;Nf.length=0}var Sd=vs.ReactCurrentDispatcher,Bf=vs.ReactCurrentBatchConfig,Pa=0,An=null,Yn=null,ei=null,nh=!1,sc=!1,Tc=0,XL=0;function ui(){throw Error(Be(321))}function Jg(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!Rr(n[t],e[t]))return!1;return!0}function e_(n,e,t,i,r,s){if(Pa=s,An=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Sd.current=n===null||n.memoizedState===null?KL:ZL,n=t(i,r),sc){s=0;do{if(sc=!1,Tc=0,25<=s)throw Error(Be(301));s+=1,ei=Yn=null,e.updateQueue=null,Sd.current=QL,n=t(i,r)}while(sc)}if(Sd.current=ih,e=Yn!==null&&Yn.next!==null,Pa=0,ei=Yn=An=null,nh=!1,e)throw Error(Be(300));return n}function t_(){var n=Tc!==0;return Tc=0,n}function kr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ei===null?An.memoizedState=ei=n:ei=ei.next=n,ei}function hr(){if(Yn===null){var n=An.alternate;n=n!==null?n.memoizedState:null}else n=Yn.next;var e=ei===null?An.memoizedState:ei.next;if(e!==null)ei=e,Yn=n;else{if(n===null)throw Error(Be(310));Yn=n,n={memoizedState:Yn.memoizedState,baseState:Yn.baseState,baseQueue:Yn.baseQueue,queue:Yn.queue,next:null},ei===null?An.memoizedState=ei=n:ei=ei.next=n}return ei}function Ac(n,e){return typeof e=="function"?e(n):e}function zf(n){var e=hr(),t=e.queue;if(t===null)throw Error(Be(311));t.lastRenderedReducer=n;var i=Yn,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var a=r.next;r.next=s.next,s.next=a}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var l=a=null,d=null,h=s;do{var m=h.lane;if((Pa&m)===m)d!==null&&(d=d.next={lane:0,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),i=h.hasEagerState?h.eagerState:n(i,h.action);else{var u={lane:m,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null};d===null?(l=d=u,a=i):d=d.next=u,An.lanes|=m,La|=m}h=h.next}while(h!==null&&h!==s);d===null?a=i:d.next=l,Rr(i,e.memoizedState)||(Fi=!0),e.memoizedState=i,e.baseState=a,e.baseQueue=d,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,An.lanes|=s,La|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function Hf(n){var e=hr(),t=e.queue;if(t===null)throw Error(Be(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var a=r=r.next;do s=n(s,a.action),a=a.next;while(a!==r);Rr(s,e.memoizedState)||(Fi=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function d1(){}function h1(n,e){var t=An,i=hr(),r=e(),s=!Rr(i.memoizedState,r);if(s&&(i.memoizedState=r,Fi=!0),i=i.queue,n_(m1.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||ei!==null&&ei.memoizedState.tag&1){if(t.flags|=2048,Cc(9,p1.bind(null,t,i,r,e),void 0,null),ni===null)throw Error(Be(349));Pa&30||f1(t,e,r)}return r}function f1(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=An.updateQueue,e===null?(e={lastEffect:null,stores:null},An.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function p1(n,e,t,i){e.value=t,e.getSnapshot=i,g1(e)&&_1(n)}function m1(n,e,t){return t(function(){g1(e)&&_1(n)})}function g1(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!Rr(n,t)}catch{return!0}}function _1(n){var e=ps(n,1);e!==null&&Ar(e,n,1,-1)}function Rx(n){var e=kr();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ac,lastRenderedState:n},e.queue=n,n=n.dispatch=qL.bind(null,An,n),[e.memoizedState,n]}function Cc(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=An.updateQueue,e===null?(e={lastEffect:null,stores:null},An.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function v1(){return hr().memoizedState}function Md(n,e,t,i){var r=kr();An.flags|=n,r.memoizedState=Cc(1|e,t,void 0,i===void 0?null:i)}function Ph(n,e,t,i){var r=hr();i=i===void 0?null:i;var s=void 0;if(Yn!==null){var a=Yn.memoizedState;if(s=a.destroy,i!==null&&Jg(i,a.deps)){r.memoizedState=Cc(e,t,s,i);return}}An.flags|=n,r.memoizedState=Cc(1|e,t,s,i)}function Px(n,e){return Md(8390656,8,n,e)}function n_(n,e){return Ph(2048,8,n,e)}function y1(n,e){return Ph(4,2,n,e)}function b1(n,e){return Ph(4,4,n,e)}function x1(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function w1(n,e,t){return t=t!=null?t.concat([n]):null,Ph(4,4,x1.bind(null,e,n),t)}function i_(){}function S1(n,e){var t=hr();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Jg(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function M1(n,e){var t=hr();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Jg(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function E1(n,e,t){return Pa&21?(Rr(t,e)||(t=PM(),An.lanes|=t,La|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,Fi=!0),n.memoizedState=t)}function YL(n,e){var t=rn;rn=t!==0&&4>t?t:4,n(!0);var i=Bf.transition;Bf.transition={};try{n(!1),e()}finally{rn=t,Bf.transition=i}}function T1(){return hr().memoizedState}function $L(n,e,t){var i=Xs(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},A1(n))C1(e,t);else if(t=l1(n,e,t,i),t!==null){var r=Mi();Ar(t,n,i,r),R1(t,e,i)}}function qL(n,e,t){var i=Xs(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(A1(n))C1(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,l=s(a,t);if(r.hasEagerState=!0,r.eagerState=l,Rr(l,a)){var d=e.interleaved;d===null?(r.next=r,$g(e)):(r.next=d.next,d.next=r),e.interleaved=r;return}}catch{}finally{}t=l1(n,e,r,i),t!==null&&(r=Mi(),Ar(t,n,i,r),R1(t,e,i))}}function A1(n){var e=n.alternate;return n===An||e!==null&&e===An}function C1(n,e){sc=nh=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function R1(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,kg(n,t)}}var ih={readContext:dr,useCallback:ui,useContext:ui,useEffect:ui,useImperativeHandle:ui,useInsertionEffect:ui,useLayoutEffect:ui,useMemo:ui,useReducer:ui,useRef:ui,useState:ui,useDebugValue:ui,useDeferredValue:ui,useTransition:ui,useMutableSource:ui,useSyncExternalStore:ui,useId:ui,unstable_isNewReconciler:!1},KL={readContext:dr,useCallback:function(n,e){return kr().memoizedState=[n,e===void 0?null:e],n},useContext:dr,useEffect:Px,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Md(4194308,4,x1.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Md(4194308,4,n,e)},useInsertionEffect:function(n,e){return Md(4,2,n,e)},useMemo:function(n,e){var t=kr();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=kr();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=$L.bind(null,An,n),[i.memoizedState,n]},useRef:function(n){var e=kr();return n={current:n},e.memoizedState=n},useState:Rx,useDebugValue:i_,useDeferredValue:function(n){return kr().memoizedState=n},useTransition:function(){var n=Rx(!1),e=n[0];return n=YL.bind(null,n[1]),kr().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=An,r=kr();if(xn){if(t===void 0)throw Error(Be(407));t=t()}else{if(t=e(),ni===null)throw Error(Be(349));Pa&30||f1(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,Px(m1.bind(null,i,s,n),[n]),i.flags|=2048,Cc(9,p1.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=kr(),e=ni.identifierPrefix;if(xn){var t=ls,i=os;t=(i&~(1<<32-Tr(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Tc++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=XL++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},ZL={readContext:dr,useCallback:S1,useContext:dr,useEffect:n_,useImperativeHandle:w1,useInsertionEffect:y1,useLayoutEffect:b1,useMemo:M1,useReducer:zf,useRef:v1,useState:function(){return zf(Ac)},useDebugValue:i_,useDeferredValue:function(n){var e=hr();return E1(e,Yn.memoizedState,n)},useTransition:function(){var n=zf(Ac)[0],e=hr().memoizedState;return[n,e]},useMutableSource:d1,useSyncExternalStore:h1,useId:T1,unstable_isNewReconciler:!1},QL={readContext:dr,useCallback:S1,useContext:dr,useEffect:n_,useImperativeHandle:w1,useInsertionEffect:y1,useLayoutEffect:b1,useMemo:M1,useReducer:Hf,useRef:v1,useState:function(){return Hf(Ac)},useDebugValue:i_,useDeferredValue:function(n){var e=hr();return Yn===null?e.memoizedState=n:E1(e,Yn.memoizedState,n)},useTransition:function(){var n=Hf(Ac)[0],e=hr().memoizedState;return[n,e]},useMutableSource:d1,useSyncExternalStore:h1,useId:T1,unstable_isNewReconciler:!1};function br(n,e){if(n&&n.defaultProps){e=Cn({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function pm(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:Cn({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var Lh={isMounted:function(n){return(n=n._reactInternals)?Na(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=Mi(),r=Xs(n),s=ds(i,r);s.payload=e,t!=null&&(s.callback=t),e=Ws(n,s,r),e!==null&&(Ar(e,n,r,i),wd(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=Mi(),r=Xs(n),s=ds(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=Ws(n,s,r),e!==null&&(Ar(e,n,r,i),wd(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=Mi(),i=Xs(n),r=ds(t,i);r.tag=2,e!=null&&(r.callback=e),e=Ws(n,r,i),e!==null&&(Ar(e,n,i,t),wd(e,n,i))}};function Lx(n,e,t,i,r,s,a){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,a):e.prototype&&e.prototype.isPureReactComponent?!bc(t,i)||!bc(r,s):!0}function P1(n,e,t){var i=!1,r=Ks,s=e.contextType;return typeof s=="object"&&s!==null?s=dr(s):(r=Oi(e)?Ca:vi.current,i=e.contextTypes,s=(i=i!=null)?Xo(n,r):Ks),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Lh,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function Ix(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&Lh.enqueueReplaceState(e,e.state,null)}function mm(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},qg(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=dr(s):(s=Oi(e)?Ca:vi.current,r.context=Xo(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(pm(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&Lh.enqueueReplaceState(r,r.state,null),eh(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function Ko(n,e){try{var t="",i=e;do t+=T2(i),i=i.return;while(i);var r=t}catch(s){r=`
Error generating stack: `+s.message+`
`+s.stack}return{value:n,source:e,stack:r,digest:null}}function Gf(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function gm(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var JL=typeof WeakMap=="function"?WeakMap:Map;function L1(n,e,t){t=ds(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){sh||(sh=!0,Tm=i),gm(n,e)},t}function I1(n,e,t){t=ds(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){gm(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){gm(n,e),typeof i!="function"&&(js===null?js=new Set([this]):js.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),t}function Dx(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new JL;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=fI.bind(null,n,e,t),e.then(n,n))}function kx(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function Fx(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=ds(-1,1),e.tag=2,Ws(t,e,1))),t.lanes|=1),n)}var eI=vs.ReactCurrentOwner,Fi=!1;function wi(n,e,t,i){e.child=n===null?o1(e,null,t,i):$o(e,n.child,t,i)}function Ux(n,e,t,i,r){t=t.render;var s=e.ref;return Uo(e,r),i=e_(n,e,t,i,s,r),t=t_(),n!==null&&!Fi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,ms(n,e,r)):(xn&&t&&Gg(e),e.flags|=1,wi(n,e,i,r),e.child)}function Ox(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!d_(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,D1(n,e,s,i,r)):(n=Cd(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var a=s.memoizedProps;if(t=t.compare,t=t!==null?t:bc,t(a,i)&&n.ref===e.ref)return ms(n,e,r)}return e.flags|=1,n=Ys(s,i),n.ref=e.ref,n.return=e,e.child=n}function D1(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(bc(s,i)&&n.ref===e.ref)if(Fi=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(Fi=!0);else return e.lanes=n.lanes,ms(n,e,r)}return _m(n,e,t,i,r)}function k1(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},cn(Mo,ji),ji|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,cn(Mo,ji),ji|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,cn(Mo,ji),ji|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,cn(Mo,ji),ji|=i;return wi(n,e,r,t),e.child}function F1(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function _m(n,e,t,i,r){var s=Oi(t)?Ca:vi.current;return s=Xo(e,s),Uo(e,r),t=e_(n,e,t,i,s,r),i=t_(),n!==null&&!Fi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,ms(n,e,r)):(xn&&i&&Gg(e),e.flags|=1,wi(n,e,t,r),e.child)}function Nx(n,e,t,i,r){if(Oi(t)){var s=!0;qd(e)}else s=!1;if(Uo(e,r),e.stateNode===null)Ed(n,e),P1(e,t,i),mm(e,t,i,r),i=!0;else if(n===null){var a=e.stateNode,l=e.memoizedProps;a.props=l;var d=a.context,h=t.contextType;typeof h=="object"&&h!==null?h=dr(h):(h=Oi(t)?Ca:vi.current,h=Xo(e,h));var m=t.getDerivedStateFromProps,u=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function";u||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==i||d!==h)&&Ix(e,a,i,h),ks=!1;var g=e.memoizedState;a.state=g,eh(e,i,a,r),d=e.memoizedState,l!==i||g!==d||Ui.current||ks?(typeof m=="function"&&(pm(e,t,m,i),d=e.memoizedState),(l=ks||Lx(e,t,l,i,g,d,h))?(u||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=d),a.props=i,a.state=d,a.context=h,i=l):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{a=e.stateNode,c1(n,e),l=e.memoizedProps,h=e.type===e.elementType?l:br(e.type,l),a.props=h,u=e.pendingProps,g=a.context,d=t.contextType,typeof d=="object"&&d!==null?d=dr(d):(d=Oi(t)?Ca:vi.current,d=Xo(e,d));var v=t.getDerivedStateFromProps;(m=typeof v=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==u||g!==d)&&Ix(e,a,i,d),ks=!1,g=e.memoizedState,a.state=g,eh(e,i,a,r);var w=e.memoizedState;l!==u||g!==w||Ui.current||ks?(typeof v=="function"&&(pm(e,t,v,i),w=e.memoizedState),(h=ks||Lx(e,t,h,i,g,w,d)||!1)?(m||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(i,w,d),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(i,w,d)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===n.memoizedProps&&g===n.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===n.memoizedProps&&g===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=w),a.props=i,a.state=w,a.context=d,i=h):(typeof a.componentDidUpdate!="function"||l===n.memoizedProps&&g===n.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===n.memoizedProps&&g===n.memoizedState||(e.flags|=1024),i=!1)}return vm(n,e,t,i,s,r)}function vm(n,e,t,i,r,s){F1(n,e);var a=(e.flags&128)!==0;if(!i&&!a)return r&&Sx(e,t,!1),ms(n,e,s);i=e.stateNode,eI.current=e;var l=a&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&a?(e.child=$o(e,n.child,null,s),e.child=$o(e,null,l,s)):wi(n,e,l,s),e.memoizedState=i.state,r&&Sx(e,t,!0),e.child}function U1(n){var e=n.stateNode;e.pendingContext?wx(n,e.pendingContext,e.pendingContext!==e.context):e.context&&wx(n,e.context,!1),Kg(n,e.containerInfo)}function Bx(n,e,t,i,r){return Yo(),Wg(r),e.flags|=256,wi(n,e,t,i),e.child}var ym={dehydrated:null,treeContext:null,retryLane:0};function bm(n){return{baseLanes:n,cachePool:null,transitions:null}}function O1(n,e,t){var i=e.pendingProps,r=En.current,s=!1,a=(e.flags&128)!==0,l;if((l=a)||(l=n!==null&&n.memoizedState===null?!1:(r&2)!==0),l?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),cn(En,r&1),n===null)return hm(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=i.children,n=i.fallback,s?(i=e.mode,s=e.child,a={mode:"hidden",children:a},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=kh(a,i,0,null),n=Ta(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=bm(t),e.memoizedState=ym,n):r_(e,a));if(r=n.memoizedState,r!==null&&(l=r.dehydrated,l!==null))return tI(n,e,a,i,l,r,t);if(s){s=i.fallback,a=e.mode,r=n.child,l=r.sibling;var d={mode:"hidden",children:i.children};return!(a&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=d,e.deletions=null):(i=Ys(r,d),i.subtreeFlags=r.subtreeFlags&14680064),l!==null?s=Ys(l,s):(s=Ta(s,a,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,a=n.child.memoizedState,a=a===null?bm(t):{baseLanes:a.baseLanes|t,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=n.childLanes&~t,e.memoizedState=ym,i}return s=n.child,n=s.sibling,i=Ys(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function r_(n,e){return e=kh({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function Ru(n,e,t,i){return i!==null&&Wg(i),$o(e,n.child,null,t),n=r_(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function tI(n,e,t,i,r,s,a){if(t)return e.flags&256?(e.flags&=-257,i=Gf(Error(Be(422))),Ru(n,e,a,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=kh({mode:"visible",children:i.children},r,0,null),s=Ta(s,r,a,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&$o(e,n.child,null,a),e.child.memoizedState=bm(a),e.memoizedState=ym,s);if(!(e.mode&1))return Ru(n,e,a,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var l=i.dgst;return i=l,s=Error(Be(419)),i=Gf(s,i,void 0),Ru(n,e,a,i)}if(l=(a&n.childLanes)!==0,Fi||l){if(i=ni,i!==null){switch(a&-a){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|a)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,ps(n,r),Ar(i,n,r,-1))}return u_(),i=Gf(Error(Be(421))),Ru(n,e,a,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=pI.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,Xi=Vs(r.nextSibling),Yi=e,xn=!0,Sr=null,n!==null&&(sr[ar++]=os,sr[ar++]=ls,sr[ar++]=Ra,os=n.id,ls=n.overflow,Ra=e),e=r_(e,i.children),e.flags|=4096,e)}function zx(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),fm(n.return,e,t)}function Vf(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function N1(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(wi(n,e,i.children,t),i=En.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&zx(n,t,e);else if(n.tag===19)zx(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(cn(En,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&th(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),Vf(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&th(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}Vf(e,!0,t,null,s);break;case"together":Vf(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ed(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function ms(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),La|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(Be(153));if(e.child!==null){for(n=e.child,t=Ys(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Ys(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function nI(n,e,t){switch(e.tag){case 3:U1(e),Yo();break;case 5:u1(e);break;case 1:Oi(e.type)&&qd(e);break;case 4:Kg(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;cn(Qd,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(cn(En,En.current&1),e.flags|=128,null):t&e.child.childLanes?O1(n,e,t):(cn(En,En.current&1),n=ms(n,e,t),n!==null?n.sibling:null);cn(En,En.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return N1(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),cn(En,En.current),i)break;return null;case 22:case 23:return e.lanes=0,k1(n,e,t)}return ms(n,e,t)}var B1,xm,z1,H1;B1=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};xm=function(){};z1=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,Ma(Hr.current);var s=null;switch(t){case"input":r=Vp(n,r),i=Vp(n,i),s=[];break;case"select":r=Cn({},r,{value:void 0}),i=Cn({},i,{value:void 0}),s=[];break;case"textarea":r=Xp(n,r),i=Xp(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=Yd)}$p(t,i);var a;t=null;for(h in r)if(!i.hasOwnProperty(h)&&r.hasOwnProperty(h)&&r[h]!=null)if(h==="style"){var l=r[h];for(a in l)l.hasOwnProperty(a)&&(t||(t={}),t[a]="")}else h!=="dangerouslySetInnerHTML"&&h!=="children"&&h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(fc.hasOwnProperty(h)?s||(s=[]):(s=s||[]).push(h,null));for(h in i){var d=i[h];if(l=r!=null?r[h]:void 0,i.hasOwnProperty(h)&&d!==l&&(d!=null||l!=null))if(h==="style")if(l){for(a in l)!l.hasOwnProperty(a)||d&&d.hasOwnProperty(a)||(t||(t={}),t[a]="");for(a in d)d.hasOwnProperty(a)&&l[a]!==d[a]&&(t||(t={}),t[a]=d[a])}else t||(s||(s=[]),s.push(h,t)),t=d;else h==="dangerouslySetInnerHTML"?(d=d?d.__html:void 0,l=l?l.__html:void 0,d!=null&&l!==d&&(s=s||[]).push(h,d)):h==="children"?typeof d!="string"&&typeof d!="number"||(s=s||[]).push(h,""+d):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&(fc.hasOwnProperty(h)?(d!=null&&h==="onScroll"&&fn("scroll",n),s||l===d||(s=[])):(s=s||[]).push(h,d))}t&&(s=s||[]).push("style",t);var h=s;(e.updateQueue=h)&&(e.flags|=4)}};H1=function(n,e,t,i){t!==i&&(e.flags|=4)};function Il(n,e){if(!xn)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function di(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function iI(n,e,t){var i=e.pendingProps;switch(Vg(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return di(e),null;case 1:return Oi(e.type)&&$d(),di(e),null;case 3:return i=e.stateNode,qo(),gn(Ui),gn(vi),Qg(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Au(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Sr!==null&&(Rm(Sr),Sr=null))),xm(n,e),di(e),null;case 5:Zg(e);var r=Ma(Ec.current);if(t=e.type,n!==null&&e.stateNode!=null)z1(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(Be(166));return di(e),null}if(n=Ma(Hr.current),Au(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[Fr]=e,i[Sc]=s,n=(e.mode&1)!==0,t){case"dialog":fn("cancel",i),fn("close",i);break;case"iframe":case"object":case"embed":fn("load",i);break;case"video":case"audio":for(r=0;r<$l.length;r++)fn($l[r],i);break;case"source":fn("error",i);break;case"img":case"image":case"link":fn("error",i),fn("load",i);break;case"details":fn("toggle",i);break;case"input":qb(i,s),fn("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},fn("invalid",i);break;case"textarea":Zb(i,s),fn("invalid",i)}$p(t,s),r=null;for(var a in s)if(s.hasOwnProperty(a)){var l=s[a];a==="children"?typeof l=="string"?i.textContent!==l&&(s.suppressHydrationWarning!==!0&&Tu(i.textContent,l,n),r=["children",l]):typeof l=="number"&&i.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Tu(i.textContent,l,n),r=["children",""+l]):fc.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&fn("scroll",i)}switch(t){case"input":vu(i),Kb(i,s,!0);break;case"textarea":vu(i),Qb(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=Yd)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{a=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=mM(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=a.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=a.createElement(t,{is:i.is}):(n=a.createElement(t),t==="select"&&(a=n,i.multiple?a.multiple=!0:i.size&&(a.size=i.size))):n=a.createElementNS(n,t),n[Fr]=e,n[Sc]=i,B1(n,e,!1,!1),e.stateNode=n;e:{switch(a=qp(t,i),t){case"dialog":fn("cancel",n),fn("close",n),r=i;break;case"iframe":case"object":case"embed":fn("load",n),r=i;break;case"video":case"audio":for(r=0;r<$l.length;r++)fn($l[r],n);r=i;break;case"source":fn("error",n),r=i;break;case"img":case"image":case"link":fn("error",n),fn("load",n),r=i;break;case"details":fn("toggle",n),r=i;break;case"input":qb(n,i),r=Vp(n,i),fn("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=Cn({},i,{value:void 0}),fn("invalid",n);break;case"textarea":Zb(n,i),r=Xp(n,i),fn("invalid",n);break;default:r=i}$p(t,r),l=r;for(s in l)if(l.hasOwnProperty(s)){var d=l[s];s==="style"?vM(n,d):s==="dangerouslySetInnerHTML"?(d=d?d.__html:void 0,d!=null&&gM(n,d)):s==="children"?typeof d=="string"?(t!=="textarea"||d!=="")&&pc(n,d):typeof d=="number"&&pc(n,""+d):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(fc.hasOwnProperty(s)?d!=null&&s==="onScroll"&&fn("scroll",n):d!=null&&Cg(n,s,d,a))}switch(t){case"input":vu(n),Kb(n,i,!1);break;case"textarea":vu(n),Qb(n);break;case"option":i.value!=null&&n.setAttribute("value",""+qs(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?Io(n,!!i.multiple,s,!1):i.defaultValue!=null&&Io(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=Yd)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return di(e),null;case 6:if(n&&e.stateNode!=null)H1(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(Be(166));if(t=Ma(Ec.current),Ma(Hr.current),Au(e)){if(i=e.stateNode,t=e.memoizedProps,i[Fr]=e,(s=i.nodeValue!==t)&&(n=Yi,n!==null))switch(n.tag){case 3:Tu(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Tu(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[Fr]=e,e.stateNode=i}return di(e),null;case 13:if(gn(En),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(xn&&Xi!==null&&e.mode&1&&!(e.flags&128))s1(),Yo(),e.flags|=98560,s=!1;else if(s=Au(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(Be(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Be(317));s[Fr]=e}else Yo(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;di(e),s=!1}else Sr!==null&&(Rm(Sr),Sr=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||En.current&1?$n===0&&($n=3):u_())),e.updateQueue!==null&&(e.flags|=4),di(e),null);case 4:return qo(),xm(n,e),n===null&&xc(e.stateNode.containerInfo),di(e),null;case 10:return Yg(e.type._context),di(e),null;case 17:return Oi(e.type)&&$d(),di(e),null;case 19:if(gn(En),s=e.memoizedState,s===null)return di(e),null;if(i=(e.flags&128)!==0,a=s.rendering,a===null)if(i)Il(s,!1);else{if($n!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(a=th(n),a!==null){for(e.flags|=128,Il(s,!1),i=a.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,n=a.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return cn(En,En.current&1|2),e.child}n=n.sibling}s.tail!==null&&kn()>Zo&&(e.flags|=128,i=!0,Il(s,!1),e.lanes=4194304)}else{if(!i)if(n=th(a),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Il(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!xn)return di(e),null}else 2*kn()-s.renderingStartTime>Zo&&t!==1073741824&&(e.flags|=128,i=!0,Il(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(t=s.last,t!==null?t.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=kn(),e.sibling=null,t=En.current,cn(En,i?t&1|2:t&1),e):(di(e),null);case 22:case 23:return c_(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?ji&1073741824&&(di(e),e.subtreeFlags&6&&(e.flags|=8192)):di(e),null;case 24:return null;case 25:return null}throw Error(Be(156,e.tag))}function rI(n,e){switch(Vg(e),e.tag){case 1:return Oi(e.type)&&$d(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return qo(),gn(Ui),gn(vi),Qg(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return Zg(e),null;case 13:if(gn(En),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Be(340));Yo()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return gn(En),null;case 4:return qo(),null;case 10:return Yg(e.type._context),null;case 22:case 23:return c_(),null;case 24:return null;default:return null}}var Pu=!1,pi=!1,sI=typeof WeakSet=="function"?WeakSet:Set,st=null;function So(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Rn(n,e,i)}else t.current=null}function wm(n,e,t){try{t()}catch(i){Rn(n,e,i)}}var Hx=!1;function aI(n,e){if(sm=Wd,n=XM(),Hg(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var a=0,l=-1,d=-1,h=0,m=0,u=n,g=null;t:for(;;){for(var v;u!==t||r!==0&&u.nodeType!==3||(l=a+r),u!==s||i!==0&&u.nodeType!==3||(d=a+i),u.nodeType===3&&(a+=u.nodeValue.length),(v=u.firstChild)!==null;)g=u,u=v;for(;;){if(u===n)break t;if(g===t&&++h===r&&(l=a),g===s&&++m===i&&(d=a),(v=u.nextSibling)!==null)break;u=g,g=u.parentNode}u=v}t=l===-1||d===-1?null:{start:l,end:d}}else t=null}t=t||{start:0,end:0}}else t=null;for(am={focusedElem:n,selectionRange:t},Wd=!1,st=e;st!==null;)if(e=st,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,st=n;else for(;st!==null;){e=st;try{var w=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var T=w.memoizedProps,M=w.memoizedState,b=e.stateNode,A=b.getSnapshotBeforeUpdate(e.elementType===e.type?T:br(e.type,T),M);b.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Be(163))}}catch(P){Rn(e,e.return,P)}if(n=e.sibling,n!==null){n.return=e.return,st=n;break}st=e.return}return w=Hx,Hx=!1,w}function ac(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&wm(e,t,s)}r=r.next}while(r!==i)}}function Ih(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function Sm(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function G1(n){var e=n.alternate;e!==null&&(n.alternate=null,G1(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Fr],delete e[Sc],delete e[cm],delete e[GL],delete e[VL])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function V1(n){return n.tag===5||n.tag===3||n.tag===4}function Gx(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||V1(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Mm(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Yd));else if(i!==4&&(n=n.child,n!==null))for(Mm(n,e,t),n=n.sibling;n!==null;)Mm(n,e,t),n=n.sibling}function Em(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(Em(n,e,t),n=n.sibling;n!==null;)Em(n,e,t),n=n.sibling}var ri=null,wr=!1;function ws(n,e,t){for(t=t.child;t!==null;)W1(n,e,t),t=t.sibling}function W1(n,e,t){if(zr&&typeof zr.onCommitFiberUnmount=="function")try{zr.onCommitFiberUnmount(Mh,t)}catch{}switch(t.tag){case 5:pi||So(t,e);case 6:var i=ri,r=wr;ri=null,ws(n,e,t),ri=i,wr=r,ri!==null&&(wr?(n=ri,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):ri.removeChild(t.stateNode));break;case 18:ri!==null&&(wr?(n=ri,t=t.stateNode,n.nodeType===8?Uf(n.parentNode,t):n.nodeType===1&&Uf(n,t),vc(n)):Uf(ri,t.stateNode));break;case 4:i=ri,r=wr,ri=t.stateNode.containerInfo,wr=!0,ws(n,e,t),ri=i,wr=r;break;case 0:case 11:case 14:case 15:if(!pi&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&wm(t,e,a),r=r.next}while(r!==i)}ws(n,e,t);break;case 1:if(!pi&&(So(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(l){Rn(t,e,l)}ws(n,e,t);break;case 21:ws(n,e,t);break;case 22:t.mode&1?(pi=(i=pi)||t.memoizedState!==null,ws(n,e,t),pi=i):ws(n,e,t);break;default:ws(n,e,t)}}function Vx(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new sI),e.forEach(function(i){var r=mI.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function pr(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,a=e,l=a;e:for(;l!==null;){switch(l.tag){case 5:ri=l.stateNode,wr=!1;break e;case 3:ri=l.stateNode.containerInfo,wr=!0;break e;case 4:ri=l.stateNode.containerInfo,wr=!0;break e}l=l.return}if(ri===null)throw Error(Be(160));W1(s,a,r),ri=null,wr=!1;var d=r.alternate;d!==null&&(d.return=null),r.return=null}catch(h){Rn(r,e,h)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)j1(e,n),e=e.sibling}function j1(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(pr(e,n),Dr(n),i&4){try{ac(3,n,n.return),Ih(3,n)}catch(T){Rn(n,n.return,T)}try{ac(5,n,n.return)}catch(T){Rn(n,n.return,T)}}break;case 1:pr(e,n),Dr(n),i&512&&t!==null&&So(t,t.return);break;case 5:if(pr(e,n),Dr(n),i&512&&t!==null&&So(t,t.return),n.flags&32){var r=n.stateNode;try{pc(r,"")}catch(T){Rn(n,n.return,T)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,a=t!==null?t.memoizedProps:s,l=n.type,d=n.updateQueue;if(n.updateQueue=null,d!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&fM(r,s),qp(l,a);var h=qp(l,s);for(a=0;a<d.length;a+=2){var m=d[a],u=d[a+1];m==="style"?vM(r,u):m==="dangerouslySetInnerHTML"?gM(r,u):m==="children"?pc(r,u):Cg(r,m,u,h)}switch(l){case"input":Wp(r,s);break;case"textarea":pM(r,s);break;case"select":var g=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var v=s.value;v!=null?Io(r,!!s.multiple,v,!1):g!==!!s.multiple&&(s.defaultValue!=null?Io(r,!!s.multiple,s.defaultValue,!0):Io(r,!!s.multiple,s.multiple?[]:"",!1))}r[Sc]=s}catch(T){Rn(n,n.return,T)}}break;case 6:if(pr(e,n),Dr(n),i&4){if(n.stateNode===null)throw Error(Be(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(T){Rn(n,n.return,T)}}break;case 3:if(pr(e,n),Dr(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{vc(e.containerInfo)}catch(T){Rn(n,n.return,T)}break;case 4:pr(e,n),Dr(n);break;case 13:pr(e,n),Dr(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(o_=kn())),i&4&&Vx(n);break;case 22:if(m=t!==null&&t.memoizedState!==null,n.mode&1?(pi=(h=pi)||m,pr(e,n),pi=h):pr(e,n),Dr(n),i&8192){if(h=n.memoizedState!==null,(n.stateNode.isHidden=h)&&!m&&n.mode&1)for(st=n,m=n.child;m!==null;){for(u=st=m;st!==null;){switch(g=st,v=g.child,g.tag){case 0:case 11:case 14:case 15:ac(4,g,g.return);break;case 1:So(g,g.return);var w=g.stateNode;if(typeof w.componentWillUnmount=="function"){i=g,t=g.return;try{e=i,w.props=e.memoizedProps,w.state=e.memoizedState,w.componentWillUnmount()}catch(T){Rn(i,t,T)}}break;case 5:So(g,g.return);break;case 22:if(g.memoizedState!==null){jx(u);continue}}v!==null?(v.return=g,st=v):jx(u)}m=m.sibling}e:for(m=null,u=n;;){if(u.tag===5){if(m===null){m=u;try{r=u.stateNode,h?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=u.stateNode,d=u.memoizedProps.style,a=d!=null&&d.hasOwnProperty("display")?d.display:null,l.style.display=_M("display",a))}catch(T){Rn(n,n.return,T)}}}else if(u.tag===6){if(m===null)try{u.stateNode.nodeValue=h?"":u.memoizedProps}catch(T){Rn(n,n.return,T)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===n)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===n)break e;for(;u.sibling===null;){if(u.return===null||u.return===n)break e;m===u&&(m=null),u=u.return}m===u&&(m=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:pr(e,n),Dr(n),i&4&&Vx(n);break;case 21:break;default:pr(e,n),Dr(n)}}function Dr(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(V1(t)){var i=t;break e}t=t.return}throw Error(Be(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(pc(r,""),i.flags&=-33);var s=Gx(n);Em(n,s,r);break;case 3:case 4:var a=i.stateNode.containerInfo,l=Gx(n);Mm(n,l,a);break;default:throw Error(Be(161))}}catch(d){Rn(n,n.return,d)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function oI(n,e,t){st=n,X1(n)}function X1(n,e,t){for(var i=(n.mode&1)!==0;st!==null;){var r=st,s=r.child;if(r.tag===22&&i){var a=r.memoizedState!==null||Pu;if(!a){var l=r.alternate,d=l!==null&&l.memoizedState!==null||pi;l=Pu;var h=pi;if(Pu=a,(pi=d)&&!h)for(st=r;st!==null;)a=st,d=a.child,a.tag===22&&a.memoizedState!==null?Xx(r):d!==null?(d.return=a,st=d):Xx(r);for(;s!==null;)st=s,X1(s),s=s.sibling;st=r,Pu=l,pi=h}Wx(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,st=s):Wx(n)}}function Wx(n){for(;st!==null;){var e=st;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:pi||Ih(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!pi)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:br(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&Cx(e,s,i);break;case 3:var a=e.updateQueue;if(a!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}Cx(e,a,t)}break;case 5:var l=e.stateNode;if(t===null&&e.flags&4){t=l;var d=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":d.autoFocus&&t.focus();break;case"img":d.src&&(t.src=d.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var h=e.alternate;if(h!==null){var m=h.memoizedState;if(m!==null){var u=m.dehydrated;u!==null&&vc(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Be(163))}pi||e.flags&512&&Sm(e)}catch(g){Rn(e,e.return,g)}}if(e===n){st=null;break}if(t=e.sibling,t!==null){t.return=e.return,st=t;break}st=e.return}}function jx(n){for(;st!==null;){var e=st;if(e===n){st=null;break}var t=e.sibling;if(t!==null){t.return=e.return,st=t;break}st=e.return}}function Xx(n){for(;st!==null;){var e=st;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{Ih(4,e)}catch(d){Rn(e,t,d)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(d){Rn(e,r,d)}}var s=e.return;try{Sm(e)}catch(d){Rn(e,s,d)}break;case 5:var a=e.return;try{Sm(e)}catch(d){Rn(e,a,d)}}}catch(d){Rn(e,e.return,d)}if(e===n){st=null;break}var l=e.sibling;if(l!==null){l.return=e.return,st=l;break}st=e.return}}var lI=Math.ceil,rh=vs.ReactCurrentDispatcher,s_=vs.ReactCurrentOwner,cr=vs.ReactCurrentBatchConfig,qt=0,ni=null,jn=null,si=0,ji=0,Mo=ea(0),$n=0,Rc=null,La=0,Dh=0,a_=0,oc=null,Di=null,o_=0,Zo=1/0,ns=null,sh=!1,Tm=null,js=null,Lu=!1,Ns=null,ah=0,lc=0,Am=null,Td=-1,Ad=0;function Mi(){return qt&6?kn():Td!==-1?Td:Td=kn()}function Xs(n){return n.mode&1?qt&2&&si!==0?si&-si:jL.transition!==null?(Ad===0&&(Ad=PM()),Ad):(n=rn,n!==0||(n=window.event,n=n===void 0?16:OM(n.type)),n):1}function Ar(n,e,t,i){if(50<lc)throw lc=0,Am=null,Error(Be(185));zc(n,t,i),(!(qt&2)||n!==ni)&&(n===ni&&(!(qt&2)&&(Dh|=t),$n===4&&Us(n,si)),Ni(n,i),t===1&&qt===0&&!(e.mode&1)&&(Zo=kn()+500,Rh&&ta()))}function Ni(n,e){var t=n.callbackNode;j2(n,e);var i=Vd(n,n===ni?si:0);if(i===0)t!==null&&tx(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&tx(t),e===1)n.tag===0?WL(Yx.bind(null,n)):n1(Yx.bind(null,n)),zL(function(){!(qt&6)&&ta()}),t=null;else{switch(LM(i)){case 1:t=Dg;break;case 4:t=CM;break;case 16:t=Gd;break;case 536870912:t=RM;break;default:t=Gd}t=eE(t,Y1.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function Y1(n,e){if(Td=-1,Ad=0,qt&6)throw Error(Be(327));var t=n.callbackNode;if(Oo()&&n.callbackNode!==t)return null;var i=Vd(n,n===ni?si:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=oh(n,i);else{e=i;var r=qt;qt|=2;var s=q1();(ni!==n||si!==e)&&(ns=null,Zo=kn()+500,Ea(n,e));do try{dI();break}catch(l){$1(n,l)}while(!0);Xg(),rh.current=s,qt=r,jn!==null?e=0:(ni=null,si=0,e=$n)}if(e!==0){if(e===2&&(r=em(n),r!==0&&(i=r,e=Cm(n,r))),e===1)throw t=Rc,Ea(n,0),Us(n,i),Ni(n,kn()),t;if(e===6)Us(n,i);else{if(r=n.current.alternate,!(i&30)&&!cI(r)&&(e=oh(n,i),e===2&&(s=em(n),s!==0&&(i=s,e=Cm(n,s))),e===1))throw t=Rc,Ea(n,0),Us(n,i),Ni(n,kn()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(Be(345));case 2:ma(n,Di,ns);break;case 3:if(Us(n,i),(i&130023424)===i&&(e=o_+500-kn(),10<e)){if(Vd(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){Mi(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=lm(ma.bind(null,n,Di,ns),e);break}ma(n,Di,ns);break;case 4:if(Us(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var a=31-Tr(i);s=1<<a,a=e[a],a>r&&(r=a),i&=~s}if(i=r,i=kn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*lI(i/1960))-i,10<i){n.timeoutHandle=lm(ma.bind(null,n,Di,ns),i);break}ma(n,Di,ns);break;case 5:ma(n,Di,ns);break;default:throw Error(Be(329))}}}return Ni(n,kn()),n.callbackNode===t?Y1.bind(null,n):null}function Cm(n,e){var t=oc;return n.current.memoizedState.isDehydrated&&(Ea(n,e).flags|=256),n=oh(n,e),n!==2&&(e=Di,Di=t,e!==null&&Rm(e)),n}function Rm(n){Di===null?Di=n:Di.push.apply(Di,n)}function cI(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!Rr(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Us(n,e){for(e&=~a_,e&=~Dh,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-Tr(e),i=1<<t;n[t]=-1,e&=~i}}function Yx(n){if(qt&6)throw Error(Be(327));Oo();var e=Vd(n,0);if(!(e&1))return Ni(n,kn()),null;var t=oh(n,e);if(n.tag!==0&&t===2){var i=em(n);i!==0&&(e=i,t=Cm(n,i))}if(t===1)throw t=Rc,Ea(n,0),Us(n,e),Ni(n,kn()),t;if(t===6)throw Error(Be(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,ma(n,Di,ns),Ni(n,kn()),null}function l_(n,e){var t=qt;qt|=1;try{return n(e)}finally{qt=t,qt===0&&(Zo=kn()+500,Rh&&ta())}}function Ia(n){Ns!==null&&Ns.tag===0&&!(qt&6)&&Oo();var e=qt;qt|=1;var t=cr.transition,i=rn;try{if(cr.transition=null,rn=1,n)return n()}finally{rn=i,cr.transition=t,qt=e,!(qt&6)&&ta()}}function c_(){ji=Mo.current,gn(Mo)}function Ea(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,BL(t)),jn!==null)for(t=jn.return;t!==null;){var i=t;switch(Vg(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&$d();break;case 3:qo(),gn(Ui),gn(vi),Qg();break;case 5:Zg(i);break;case 4:qo();break;case 13:gn(En);break;case 19:gn(En);break;case 10:Yg(i.type._context);break;case 22:case 23:c_()}t=t.return}if(ni=n,jn=n=Ys(n.current,null),si=ji=e,$n=0,Rc=null,a_=Dh=La=0,Di=oc=null,Sa!==null){for(e=0;e<Sa.length;e++)if(t=Sa[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var a=s.next;s.next=r,i.next=a}t.pending=i}Sa=null}return n}function $1(n,e){do{var t=jn;try{if(Xg(),Sd.current=ih,nh){for(var i=An.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}nh=!1}if(Pa=0,ei=Yn=An=null,sc=!1,Tc=0,s_.current=null,t===null||t.return===null){$n=1,Rc=e,jn=null;break}e:{var s=n,a=t.return,l=t,d=e;if(e=si,l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){var h=d,m=l,u=m.tag;if(!(m.mode&1)&&(u===0||u===11||u===15)){var g=m.alternate;g?(m.updateQueue=g.updateQueue,m.memoizedState=g.memoizedState,m.lanes=g.lanes):(m.updateQueue=null,m.memoizedState=null)}var v=kx(a);if(v!==null){v.flags&=-257,Fx(v,a,l,s,e),v.mode&1&&Dx(s,h,e),e=v,d=h;var w=e.updateQueue;if(w===null){var T=new Set;T.add(d),e.updateQueue=T}else w.add(d);break e}else{if(!(e&1)){Dx(s,h,e),u_();break e}d=Error(Be(426))}}else if(xn&&l.mode&1){var M=kx(a);if(M!==null){!(M.flags&65536)&&(M.flags|=256),Fx(M,a,l,s,e),Wg(Ko(d,l));break e}}s=d=Ko(d,l),$n!==4&&($n=2),oc===null?oc=[s]:oc.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var b=L1(s,d,e);Ax(s,b);break e;case 1:l=d;var A=s.type,E=s.stateNode;if(!(s.flags&128)&&(typeof A.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(js===null||!js.has(E)))){s.flags|=65536,e&=-e,s.lanes|=e;var P=I1(s,l,e);Ax(s,P);break e}}s=s.return}while(s!==null)}Z1(t)}catch(G){e=G,jn===t&&t!==null&&(jn=t=t.return);continue}break}while(!0)}function q1(){var n=rh.current;return rh.current=ih,n===null?ih:n}function u_(){($n===0||$n===3||$n===2)&&($n=4),ni===null||!(La&268435455)&&!(Dh&268435455)||Us(ni,si)}function oh(n,e){var t=qt;qt|=2;var i=q1();(ni!==n||si!==e)&&(ns=null,Ea(n,e));do try{uI();break}catch(r){$1(n,r)}while(!0);if(Xg(),qt=t,rh.current=i,jn!==null)throw Error(Be(261));return ni=null,si=0,$n}function uI(){for(;jn!==null;)K1(jn)}function dI(){for(;jn!==null&&!U2();)K1(jn)}function K1(n){var e=J1(n.alternate,n,ji);n.memoizedProps=n.pendingProps,e===null?Z1(n):jn=e,s_.current=null}function Z1(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=rI(t,e),t!==null){t.flags&=32767,jn=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{$n=6,jn=null;return}}else if(t=iI(t,e,ji),t!==null){jn=t;return}if(e=e.sibling,e!==null){jn=e;return}jn=e=n}while(e!==null);$n===0&&($n=5)}function ma(n,e,t){var i=rn,r=cr.transition;try{cr.transition=null,rn=1,hI(n,e,t,i)}finally{cr.transition=r,rn=i}return null}function hI(n,e,t,i){do Oo();while(Ns!==null);if(qt&6)throw Error(Be(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(Be(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(X2(n,s),n===ni&&(jn=ni=null,si=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||Lu||(Lu=!0,eE(Gd,function(){return Oo(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=cr.transition,cr.transition=null;var a=rn;rn=1;var l=qt;qt|=4,s_.current=null,aI(n,t),j1(t,n),IL(am),Wd=!!sm,am=sm=null,n.current=t,oI(t),O2(),qt=l,rn=a,cr.transition=s}else n.current=t;if(Lu&&(Lu=!1,Ns=n,ah=r),s=n.pendingLanes,s===0&&(js=null),z2(t.stateNode),Ni(n,kn()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(sh)throw sh=!1,n=Tm,Tm=null,n;return ah&1&&n.tag!==0&&Oo(),s=n.pendingLanes,s&1?n===Am?lc++:(lc=0,Am=n):lc=0,ta(),null}function Oo(){if(Ns!==null){var n=LM(ah),e=cr.transition,t=rn;try{if(cr.transition=null,rn=16>n?16:n,Ns===null)var i=!1;else{if(n=Ns,Ns=null,ah=0,qt&6)throw Error(Be(331));var r=qt;for(qt|=4,st=n.current;st!==null;){var s=st,a=s.child;if(st.flags&16){var l=s.deletions;if(l!==null){for(var d=0;d<l.length;d++){var h=l[d];for(st=h;st!==null;){var m=st;switch(m.tag){case 0:case 11:case 15:ac(8,m,s)}var u=m.child;if(u!==null)u.return=m,st=u;else for(;st!==null;){m=st;var g=m.sibling,v=m.return;if(G1(m),m===h){st=null;break}if(g!==null){g.return=v,st=g;break}st=v}}}var w=s.alternate;if(w!==null){var T=w.child;if(T!==null){w.child=null;do{var M=T.sibling;T.sibling=null,T=M}while(T!==null)}}st=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,st=a;else e:for(;st!==null;){if(s=st,s.flags&2048)switch(s.tag){case 0:case 11:case 15:ac(9,s,s.return)}var b=s.sibling;if(b!==null){b.return=s.return,st=b;break e}st=s.return}}var A=n.current;for(st=A;st!==null;){a=st;var E=a.child;if(a.subtreeFlags&2064&&E!==null)E.return=a,st=E;else e:for(a=A;st!==null;){if(l=st,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ih(9,l)}}catch(G){Rn(l,l.return,G)}if(l===a){st=null;break e}var P=l.sibling;if(P!==null){P.return=l.return,st=P;break e}st=l.return}}if(qt=r,ta(),zr&&typeof zr.onPostCommitFiberRoot=="function")try{zr.onPostCommitFiberRoot(Mh,n)}catch{}i=!0}return i}finally{rn=t,cr.transition=e}}return!1}function $x(n,e,t){e=Ko(t,e),e=L1(n,e,1),n=Ws(n,e,1),e=Mi(),n!==null&&(zc(n,1,e),Ni(n,e))}function Rn(n,e,t){if(n.tag===3)$x(n,n,t);else for(;e!==null;){if(e.tag===3){$x(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(js===null||!js.has(i))){n=Ko(t,n),n=I1(e,n,1),e=Ws(e,n,1),n=Mi(),e!==null&&(zc(e,1,n),Ni(e,n));break}}e=e.return}}function fI(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=Mi(),n.pingedLanes|=n.suspendedLanes&t,ni===n&&(si&t)===t&&($n===4||$n===3&&(si&130023424)===si&&500>kn()-o_?Ea(n,0):a_|=t),Ni(n,e)}function Q1(n,e){e===0&&(n.mode&1?(e=xu,xu<<=1,!(xu&130023424)&&(xu=4194304)):e=1);var t=Mi();n=ps(n,e),n!==null&&(zc(n,e,t),Ni(n,t))}function pI(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),Q1(n,t)}function mI(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(Be(314))}i!==null&&i.delete(e),Q1(n,t)}var J1;J1=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ui.current)Fi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Fi=!1,nI(n,e,t);Fi=!!(n.flags&131072)}else Fi=!1,xn&&e.flags&1048576&&i1(e,Zd,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Ed(n,e),n=e.pendingProps;var r=Xo(e,vi.current);Uo(e,t),r=e_(null,e,i,n,r,t);var s=t_();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Oi(i)?(s=!0,qd(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,qg(e),r.updater=Lh,e.stateNode=r,r._reactInternals=e,mm(e,i,n,t),e=vm(null,e,i,!0,s,t)):(e.tag=0,xn&&s&&Gg(e),wi(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(Ed(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=_I(i),n=br(i,n),r){case 0:e=_m(null,e,i,n,t);break e;case 1:e=Nx(null,e,i,n,t);break e;case 11:e=Ux(null,e,i,n,t);break e;case 14:e=Ox(null,e,i,br(i.type,n),t);break e}throw Error(Be(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:br(i,r),_m(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:br(i,r),Nx(n,e,i,r,t);case 3:e:{if(U1(e),n===null)throw Error(Be(387));i=e.pendingProps,s=e.memoizedState,r=s.element,c1(n,e),eh(e,i,null,t);var a=e.memoizedState;if(i=a.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Ko(Error(Be(423)),e),e=Bx(n,e,i,t,r);break e}else if(i!==r){r=Ko(Error(Be(424)),e),e=Bx(n,e,i,t,r);break e}else for(Xi=Vs(e.stateNode.containerInfo.firstChild),Yi=e,xn=!0,Sr=null,t=o1(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Yo(),i===r){e=ms(n,e,t);break e}wi(n,e,i,t)}e=e.child}return e;case 5:return u1(e),n===null&&hm(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,a=r.children,om(i,r)?a=null:s!==null&&om(i,s)&&(e.flags|=32),F1(n,e),wi(n,e,a,t),e.child;case 6:return n===null&&hm(e),null;case 13:return O1(n,e,t);case 4:return Kg(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=$o(e,null,i,t):wi(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:br(i,r),Ux(n,e,i,r,t);case 7:return wi(n,e,e.pendingProps,t),e.child;case 8:return wi(n,e,e.pendingProps.children,t),e.child;case 12:return wi(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,a=r.value,cn(Qd,i._currentValue),i._currentValue=a,s!==null)if(Rr(s.value,a)){if(s.children===r.children&&!Ui.current){e=ms(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){a=s.child;for(var d=l.firstContext;d!==null;){if(d.context===i){if(s.tag===1){d=ds(-1,t&-t),d.tag=2;var h=s.updateQueue;if(h!==null){h=h.shared;var m=h.pending;m===null?d.next=d:(d.next=m.next,m.next=d),h.pending=d}}s.lanes|=t,d=s.alternate,d!==null&&(d.lanes|=t),fm(s.return,t,e),l.lanes|=t;break}d=d.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(Be(341));a.lanes|=t,l=a.alternate,l!==null&&(l.lanes|=t),fm(a,t,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}wi(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Uo(e,t),r=dr(r),i=i(r),e.flags|=1,wi(n,e,i,t),e.child;case 14:return i=e.type,r=br(i,e.pendingProps),r=br(i.type,r),Ox(n,e,i,r,t);case 15:return D1(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:br(i,r),Ed(n,e),e.tag=1,Oi(i)?(n=!0,qd(e)):n=!1,Uo(e,t),P1(e,i,r),mm(e,i,r,t),vm(null,e,i,!0,n,t);case 19:return N1(n,e,t);case 22:return k1(n,e,t)}throw Error(Be(156,e.tag))};function eE(n,e){return AM(n,e)}function gI(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lr(n,e,t,i){return new gI(n,e,t,i)}function d_(n){return n=n.prototype,!(!n||!n.isReactComponent)}function _I(n){if(typeof n=="function")return d_(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Pg)return 11;if(n===Lg)return 14}return 2}function Ys(n,e){var t=n.alternate;return t===null?(t=lr(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Cd(n,e,t,i,r,s){var a=2;if(i=n,typeof n=="function")d_(n)&&(a=1);else if(typeof n=="string")a=5;else e:switch(n){case po:return Ta(t.children,r,s,e);case Rg:a=8,r|=8;break;case Bp:return n=lr(12,t,e,r|2),n.elementType=Bp,n.lanes=s,n;case zp:return n=lr(13,t,e,r),n.elementType=zp,n.lanes=s,n;case Hp:return n=lr(19,t,e,r),n.elementType=Hp,n.lanes=s,n;case uM:return kh(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case lM:a=10;break e;case cM:a=9;break e;case Pg:a=11;break e;case Lg:a=14;break e;case Ds:a=16,i=null;break e}throw Error(Be(130,n==null?n:typeof n,""))}return e=lr(a,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function Ta(n,e,t,i){return n=lr(7,n,i,e),n.lanes=t,n}function kh(n,e,t,i){return n=lr(22,n,i,e),n.elementType=uM,n.lanes=t,n.stateNode={isHidden:!1},n}function Wf(n,e,t){return n=lr(6,n,null,e),n.lanes=t,n}function jf(n,e,t){return e=lr(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function vI(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ef(0),this.expirationTimes=Ef(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ef(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function h_(n,e,t,i,r,s,a,l,d){return n=new vI(n,e,t,l,d),e===1?(e=1,s===!0&&(e|=8)):e=0,s=lr(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},qg(s),n}function yI(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:fo,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function tE(n){if(!n)return Ks;n=n._reactInternals;e:{if(Na(n)!==n||n.tag!==1)throw Error(Be(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Oi(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Be(171))}if(n.tag===1){var t=n.type;if(Oi(t))return t1(n,t,e)}return e}function nE(n,e,t,i,r,s,a,l,d){return n=h_(t,i,!0,n,r,s,a,l,d),n.context=tE(null),t=n.current,i=Mi(),r=Xs(t),s=ds(i,r),s.callback=e??null,Ws(t,s,r),n.current.lanes=r,zc(n,r,i),Ni(n,i),n}function Fh(n,e,t,i){var r=e.current,s=Mi(),a=Xs(r);return t=tE(t),e.context===null?e.context=t:e.pendingContext=t,e=ds(s,a),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=Ws(r,e,a),n!==null&&(Ar(n,r,a,s),wd(n,r,a)),a}function lh(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function qx(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function f_(n,e){qx(n,e),(n=n.alternate)&&qx(n,e)}function bI(){return null}var iE=typeof reportError=="function"?reportError:function(n){console.error(n)};function p_(n){this._internalRoot=n}Uh.prototype.render=p_.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(Be(409));Fh(n,e,null,null)};Uh.prototype.unmount=p_.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;Ia(function(){Fh(null,n,null,null)}),e[fs]=null}};function Uh(n){this._internalRoot=n}Uh.prototype.unstable_scheduleHydration=function(n){if(n){var e=kM();n={blockedOn:null,target:n,priority:e};for(var t=0;t<Fs.length&&e!==0&&e<Fs[t].priority;t++);Fs.splice(t,0,n),t===0&&UM(n)}};function m_(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Oh(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Kx(){}function xI(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var h=lh(a);s.call(h)}}var a=nE(e,i,n,0,null,!1,!1,"",Kx);return n._reactRootContainer=a,n[fs]=a.current,xc(n.nodeType===8?n.parentNode:n),Ia(),a}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var l=i;i=function(){var h=lh(d);l.call(h)}}var d=h_(n,0,!1,null,null,!1,!1,"",Kx);return n._reactRootContainer=d,n[fs]=d.current,xc(n.nodeType===8?n.parentNode:n),Ia(function(){Fh(e,d,t,i)}),d}function Nh(n,e,t,i,r){var s=t._reactRootContainer;if(s){var a=s;if(typeof r=="function"){var l=r;r=function(){var d=lh(a);l.call(d)}}Fh(e,a,n,r)}else a=xI(t,e,n,r,i);return lh(a)}IM=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=Yl(e.pendingLanes);t!==0&&(kg(e,t|1),Ni(e,kn()),!(qt&6)&&(Zo=kn()+500,ta()))}break;case 13:Ia(function(){var i=ps(n,1);if(i!==null){var r=Mi();Ar(i,n,1,r)}}),f_(n,1)}};Fg=function(n){if(n.tag===13){var e=ps(n,134217728);if(e!==null){var t=Mi();Ar(e,n,134217728,t)}f_(n,134217728)}};DM=function(n){if(n.tag===13){var e=Xs(n),t=ps(n,e);if(t!==null){var i=Mi();Ar(t,n,e,i)}f_(n,e)}};kM=function(){return rn};FM=function(n,e){var t=rn;try{return rn=n,e()}finally{rn=t}};Zp=function(n,e,t){switch(e){case"input":if(Wp(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=Ch(i);if(!r)throw Error(Be(90));hM(i),Wp(i,r)}}}break;case"textarea":pM(n,t);break;case"select":e=t.value,e!=null&&Io(n,!!t.multiple,e,!1)}};xM=l_;wM=Ia;var wI={usingClientEntryPoint:!1,Events:[Gc,vo,Ch,yM,bM,l_]},Dl={findFiberByHostInstance:wa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},SI={bundleType:Dl.bundleType,version:Dl.version,rendererPackageName:Dl.rendererPackageName,rendererConfig:Dl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vs.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=EM(n),n===null?null:n.stateNode},findFiberByHostInstance:Dl.findFiberByHostInstance||bI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Iu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Iu.isDisabled&&Iu.supportsFiber)try{Mh=Iu.inject(SI),zr=Iu}catch{}}Ki.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wI;Ki.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m_(e))throw Error(Be(200));return yI(n,e,null,t)};Ki.createRoot=function(n,e){if(!m_(n))throw Error(Be(299));var t=!1,i="",r=iE;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=h_(n,1,!1,null,null,t,!1,i,r),n[fs]=e.current,xc(n.nodeType===8?n.parentNode:n),new p_(e)};Ki.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(Be(188)):(n=Object.keys(n).join(","),Error(Be(268,n)));return n=EM(e),n=n===null?null:n.stateNode,n};Ki.flushSync=function(n){return Ia(n)};Ki.hydrate=function(n,e,t){if(!Oh(e))throw Error(Be(200));return Nh(null,n,e,!0,t)};Ki.hydrateRoot=function(n,e,t){if(!m_(n))throw Error(Be(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",a=iE;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),e=nE(e,null,n,1,t??null,r,!1,s,a),n[fs]=e.current,xc(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new Uh(e)};Ki.render=function(n,e,t){if(!Oh(e))throw Error(Be(200));return Nh(null,n,e,!1,t)};Ki.unmountComponentAtNode=function(n){if(!Oh(n))throw Error(Be(40));return n._reactRootContainer?(Ia(function(){Nh(null,null,n,!1,function(){n._reactRootContainer=null,n[fs]=null})}),!0):!1};Ki.unstable_batchedUpdates=l_;Ki.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!Oh(t))throw Error(Be(200));if(n==null||n._reactInternals===void 0)throw Error(Be(38));return Nh(n,e,t,!1,i)};Ki.version="18.3.1-next-f1338f8080-20240426";function rE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rE)}catch(n){console.error(n)}}rE(),rM.exports=Ki;var MI=rM.exports,sE,Zx=MI;sE=Zx.createRoot,Zx.hydrateRoot;/**
* @license
* Copyright 2010-2024 Three.js Authors
* SPDX-License-Identifier: MIT
*/const g_="166",EI=0,Qx=1,TI=2,aE=1,oE=2,ts=3,gs=0,Ei=1,Si=2,Gr=0,No=1,ch=2,Jx=3,ew=4,AI=5,ya=100,CI=101,RI=102,PI=103,LI=104,II=200,DI=201,kI=202,FI=203,Pm=204,Lm=205,UI=206,OI=207,NI=208,BI=209,zI=210,HI=211,GI=212,VI=213,WI=214,jI=0,XI=1,YI=2,uh=3,$I=4,qI=5,KI=6,ZI=7,Bh=0,QI=1,JI=2,$s=0,lE=1,eD=2,tD=3,nD=4,iD=5,rD=6,sD=7,tw="attached",aD="detached",__=300,Qo=301,Jo=302,el=303,Im=304,zh=306,Vr=1e3,ti=1001,dh=1002,Fn=1003,cE=1004,ql=1005,ln=1006,Rd=1007,Er=1008,nw=1008,Bi=1009,uE=1010,dE=1011,Pc=1012,v_=1013,Da=1014,Un=1015,gi=1016,y_=1017,b_=1018,tl=1020,hE=35902,fE=1021,pE=1022,Vn=1023,mE=1024,gE=1025,Bo=1026,nl=1027,Wc=1028,x_=1029,_E=1030,w_=1031,S_=1033,Pd=33776,Ld=33777,Id=33778,Dd=33779,Dm=35840,km=35841,Fm=35842,Um=35843,Om=36196,Nm=37492,Bm=37496,zm=37808,Hm=37809,Gm=37810,Vm=37811,Wm=37812,jm=37813,Xm=37814,Ym=37815,$m=37816,qm=37817,Km=37818,Zm=37819,Qm=37820,Jm=37821,kd=36492,eg=36494,tg=36495,vE=36283,ng=36284,ig=36285,rg=36286,Lc=2300,Ic=2301,Xf=2302,iw=2400,rw=2401,sw=2402,oD=2500,lD=0,yE=1,sg=2,cD=3200,uD=3201,cl=0,dD=1,ss="",on="srgb",Sn="srgb-linear",M_="display-p3",Hh="display-p3-linear",hh="linear",pn="srgb",fh="rec709",ph="p3",ja=7680,aw=519,hD=512,fD=513,pD=514,bE=515,mD=516,gD=517,_D=518,vD=519,ag=35044,ow="300 es",cs=2e3,mh=2001;class ul{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const hi=["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"];let lw=1234567;const cc=Math.PI/180,il=180/Math.PI;function Cr(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(hi[n&255]+hi[n>>8&255]+hi[n>>16&255]+hi[n>>24&255]+"-"+hi[e&255]+hi[e>>8&255]+"-"+hi[e>>16&15|64]+hi[e>>24&255]+"-"+hi[t&63|128]+hi[t>>8&255]+"-"+hi[t>>16&255]+hi[t>>24&255]+hi[i&255]+hi[i>>8&255]+hi[i>>16&255]+hi[i>>24&255]).toLowerCase()}function Wn(n,e,t){return Math.max(e,Math.min(t,n))}function E_(n,e){return(n%e+e)%e}function yD(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function bD(n,e,t){return n!==e?(t-n)/(e-n):0}function uc(n,e,t){return(1-t)*n+t*e}function xD(n,e,t,i){return uc(n,e,1-Math.exp(-t*i))}function wD(n,e=1){return e-Math.abs(E_(n,e*2)-e)}function SD(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function MD(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function ED(n,e){return n+Math.floor(Math.random()*(e-n+1))}function TD(n,e){return n+Math.random()*(e-n)}function AD(n){return n*(.5-Math.random())}function CD(n){n!==void 0&&(lw=n);let e=lw+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function RD(n){return n*cc}function PD(n){return n*il}function LD(n){return(n&n-1)===0&&n!==0}function ID(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function DD(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function kD(n,e,t,i,r){const s=Math.cos,a=Math.sin,l=s(t/2),d=a(t/2),h=s((e+i)/2),m=a((e+i)/2),u=s((e-i)/2),g=a((e-i)/2),v=s((i-e)/2),w=a((i-e)/2);switch(r){case"XYX":n.set(l*m,d*u,d*g,l*h);break;case"YZY":n.set(d*g,l*m,d*u,l*h);break;case"ZXZ":n.set(d*u,d*g,l*m,l*h);break;case"XZX":n.set(l*m,d*w,d*v,l*h);break;case"YXY":n.set(d*v,l*m,d*w,l*h);break;case"ZYZ":n.set(d*w,d*v,l*m,l*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Mr(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function tn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const bn={DEG2RAD:cc,RAD2DEG:il,generateUUID:Cr,clamp:Wn,euclideanModulo:E_,mapLinear:yD,inverseLerp:bD,lerp:uc,damp:xD,pingpong:wD,smoothstep:SD,smootherstep:MD,randInt:ED,randFloat:TD,randFloatSpread:AD,seededRandom:CD,degToRad:RD,radToDeg:PD,isPowerOfTwo:LD,ceilPowerOfTwo:ID,floorPowerOfTwo:DD,setQuaternionFromProperEuler:kD,normalize:tn,denormalize:Mr};class et{constructor(e=0,t=0){et.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,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Wn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class At{constructor(e,t,i,r,s,a,l,d,h){At.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,l,d,h)}set(e,t,i,r,s,a,l,d,h){const m=this.elements;return m[0]=e,m[1]=r,m[2]=l,m[3]=t,m[4]=s,m[5]=d,m[6]=i,m[7]=a,m[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){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 i=e.elements,r=t.elements,s=this.elements,a=i[0],l=i[3],d=i[6],h=i[1],m=i[4],u=i[7],g=i[2],v=i[5],w=i[8],T=r[0],M=r[3],b=r[6],A=r[1],E=r[4],P=r[7],G=r[2],O=r[5],B=r[8];return s[0]=a*T+l*A+d*G,s[3]=a*M+l*E+d*O,s[6]=a*b+l*P+d*B,s[1]=h*T+m*A+u*G,s[4]=h*M+m*E+u*O,s[7]=h*b+m*P+u*B,s[2]=g*T+v*A+w*G,s[5]=g*M+v*E+w*O,s[8]=g*b+v*P+w*B,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],i=e[1],r=e[2],s=e[3],a=e[4],l=e[5],d=e[6],h=e[7],m=e[8];return t*a*m-t*l*h-i*s*m+i*l*d+r*s*h-r*a*d}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],l=e[5],d=e[6],h=e[7],m=e[8],u=m*a-l*h,g=l*d-m*s,v=h*s-a*d,w=t*u+i*g+r*v;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);const T=1/w;return e[0]=u*T,e[1]=(r*h-m*i)*T,e[2]=(l*i-r*a)*T,e[3]=g*T,e[4]=(m*t-r*d)*T,e[5]=(r*s-l*t)*T,e[6]=v*T,e[7]=(i*d-h*t)*T,e[8]=(a*t-i*s)*T,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,i,r,s,a,l){const d=Math.cos(s),h=Math.sin(s);return this.set(i*d,i*h,-i*(d*a+h*l)+a+e,-r*h,r*d,-r*(-h*a+d*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(Yf.makeScale(e,t)),this}rotate(e){return this.premultiply(Yf.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yf.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),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Yf=new At;function xE(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Dc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function FD(){const n=Dc("canvas");return n.style.display="block",n}const cw={};function T_(n){n in cw||(cw[n]=!0,console.warn(n))}function UD(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const uw=new At().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),dw=new At().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Du={[Sn]:{transfer:hh,primaries:fh,toReference:n=>n,fromReference:n=>n},[on]:{transfer:pn,primaries:fh,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Hh]:{transfer:hh,primaries:ph,toReference:n=>n.applyMatrix3(dw),fromReference:n=>n.applyMatrix3(uw)},[M_]:{transfer:pn,primaries:ph,toReference:n=>n.convertSRGBToLinear().applyMatrix3(dw),fromReference:n=>n.applyMatrix3(uw).convertLinearToSRGB()}},OD=new Set([Sn,Hh]),Kt={enabled:!0,_workingColorSpace:Sn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!OD.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Du[e].toReference,r=Du[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Du[n].primaries},getTransfer:function(n){return n===ss?hh:Du[n].transfer}};function zo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function $f(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Xa;class ND{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Xa===void 0&&(Xa=Dc("canvas")),Xa.width=e.width,Xa.height=e.height;const i=Xa.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Xa}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Dc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=zo(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(zo(t[i]/255)*255):t[i]=zo(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let BD=0;class wE{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:BD++}),this.uuid=Cr(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,l=r.length;a<l;a++)r[a].isDataTexture?s.push(qf(r[a].image)):s.push(qf(r[a]))}else s=qf(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function qf(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?ND.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let zD=0;class qn extends ul{constructor(e=qn.DEFAULT_IMAGE,t=qn.DEFAULT_MAPPING,i=ti,r=ti,s=ln,a=Er,l=Vn,d=Bi,h=qn.DEFAULT_ANISOTROPY,m=ss){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:zD++}),this.uuid=Cr(),this.name="",this.source=new wE(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=h,this.format=l,this.internalFormat=null,this.type=d,this.offset=new et(0,0),this.repeat=new et(1,1),this.center=new et(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new At,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=m,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=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==__)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Vr:e.x=e.x-Math.floor(e.x);break;case ti:e.x=e.x<0?0:1;break;case dh:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Vr:e.y=e.y-Math.floor(e.y);break;case ti:e.y=e.y<0?0:1;break;case dh:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}qn.DEFAULT_IMAGE=null;qn.DEFAULT_MAPPING=__;qn.DEFAULT_ANISOTROPY=1;class $t{constructor(e=0,t=0,i=0,r=1){$t.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,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,i,r,s;const d=e.elements,h=d[0],m=d[4],u=d[8],g=d[1],v=d[5],w=d[9],T=d[2],M=d[6],b=d[10];if(Math.abs(m-g)<.01&&Math.abs(u-T)<.01&&Math.abs(w-M)<.01){if(Math.abs(m+g)<.1&&Math.abs(u+T)<.1&&Math.abs(w+M)<.1&&Math.abs(h+v+b-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(h+1)/2,P=(v+1)/2,G=(b+1)/2,O=(m+g)/4,B=(u+T)/4,F=(w+M)/4;return E>P&&E>G?E<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(E),r=O/i,s=B/i):P>G?P<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(P),i=O/r,s=F/r):G<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(G),i=B/s,r=F/s),this.set(i,r,s,t),this}let A=Math.sqrt((M-w)*(M-w)+(u-T)*(u-T)+(g-m)*(g-m));return Math.abs(A)<.001&&(A=1),this.x=(M-w)/A,this.y=(u-T)/A,this.z=(g-m)/A,this.w=Math.acos((h+v+b-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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class HD extends ul{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new $t(0,0,e,t),this.scissorTest=!1,this.viewport=new $t(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ln,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new qn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const a=i.count;for(let l=0;l<a;l++)this.textures[l]=s.clone(),this.textures[l].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new wE(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Zs extends HD{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class SE extends qn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Fn,this.minFilter=Fn,this.wrapR=ti,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class GD extends qn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Fn,this.minFilter=Fn,this.wrapR=ti,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Gn{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,l){let d=i[r+0],h=i[r+1],m=i[r+2],u=i[r+3];const g=s[a+0],v=s[a+1],w=s[a+2],T=s[a+3];if(l===0){e[t+0]=d,e[t+1]=h,e[t+2]=m,e[t+3]=u;return}if(l===1){e[t+0]=g,e[t+1]=v,e[t+2]=w,e[t+3]=T;return}if(u!==T||d!==g||h!==v||m!==w){let M=1-l;const b=d*g+h*v+m*w+u*T,A=b>=0?1:-1,E=1-b*b;if(E>Number.EPSILON){const G=Math.sqrt(E),O=Math.atan2(G,b*A);M=Math.sin(M*O)/G,l=Math.sin(l*O)/G}const P=l*A;if(d=d*M+g*P,h=h*M+v*P,m=m*M+w*P,u=u*M+T*P,M===1-l){const G=1/Math.sqrt(d*d+h*h+m*m+u*u);d*=G,h*=G,m*=G,u*=G}}e[t]=d,e[t+1]=h,e[t+2]=m,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,r,s,a){const l=i[r],d=i[r+1],h=i[r+2],m=i[r+3],u=s[a],g=s[a+1],v=s[a+2],w=s[a+3];return e[t]=l*w+m*u+d*v-h*g,e[t+1]=d*w+m*g+h*u-l*v,e[t+2]=h*w+m*v+l*g-d*u,e[t+3]=m*w-l*u-d*g-h*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,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 i=e._x,r=e._y,s=e._z,a=e._order,l=Math.cos,d=Math.sin,h=l(i/2),m=l(r/2),u=l(s/2),g=d(i/2),v=d(r/2),w=d(s/2);switch(a){case"XYZ":this._x=g*m*u+h*v*w,this._y=h*v*u-g*m*w,this._z=h*m*w+g*v*u,this._w=h*m*u-g*v*w;break;case"YXZ":this._x=g*m*u+h*v*w,this._y=h*v*u-g*m*w,this._z=h*m*w-g*v*u,this._w=h*m*u+g*v*w;break;case"ZXY":this._x=g*m*u-h*v*w,this._y=h*v*u+g*m*w,this._z=h*m*w+g*v*u,this._w=h*m*u-g*v*w;break;case"ZYX":this._x=g*m*u-h*v*w,this._y=h*v*u+g*m*w,this._z=h*m*w-g*v*u,this._w=h*m*u+g*v*w;break;case"YZX":this._x=g*m*u+h*v*w,this._y=h*v*u+g*m*w,this._z=h*m*w-g*v*u,this._w=h*m*u-g*v*w;break;case"XZY":this._x=g*m*u-h*v*w,this._y=h*v*u-g*m*w,this._z=h*m*w+g*v*u,this._w=h*m*u+g*v*w;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],l=t[5],d=t[9],h=t[2],m=t[6],u=t[10],g=i+l+u;if(g>0){const v=.5/Math.sqrt(g+1);this._w=.25/v,this._x=(m-d)*v,this._y=(s-h)*v,this._z=(a-r)*v}else if(i>l&&i>u){const v=2*Math.sqrt(1+i-l-u);this._w=(m-d)/v,this._x=.25*v,this._y=(r+a)/v,this._z=(s+h)/v}else if(l>u){const v=2*Math.sqrt(1+l-i-u);this._w=(s-h)/v,this._x=(r+a)/v,this._y=.25*v,this._z=(d+m)/v}else{const v=2*Math.sqrt(1+u-i-l);this._w=(a-r)/v,this._x=(s+h)/v,this._y=(d+m)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Wn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,l=t._x,d=t._y,h=t._z,m=t._w;return this._x=i*m+a*l+r*h-s*d,this._y=r*m+a*d+s*l-i*h,this._z=s*m+a*h+i*d-r*l,this._w=a*m-i*l-r*d-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let l=a*e._w+i*e._x+r*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const d=1-l*l;if(d<=Number.EPSILON){const v=1-t;return this._w=v*a+t*this._w,this._x=v*i+t*this._x,this._y=v*r+t*this._y,this._z=v*s+t*this._z,this.normalize(),this}const h=Math.sqrt(d),m=Math.atan2(h,l),u=Math.sin((1-t)*m)/h,g=Math.sin(t*m)/h;return this._w=a*u+this._w*g,this._x=i*u+this._x*g,this._y=r*u+this._y*g,this._z=s*u+this._z*g,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*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 j{constructor(e=0,t=0,i=0){j.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(hw.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(hw.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,l=e.z,d=e.w,h=2*(a*r-l*i),m=2*(l*t-s*r),u=2*(s*i-a*t);return this.x=t+d*h+a*u-l*m,this.y=i+d*m+l*h-s*u,this.z=r+d*u+s*m-a*h,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,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,l=t.y,d=t.z;return this.x=r*d-s*l,this.y=s*a-i*d,this.z=i*l-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Kf.copy(this).projectOnVector(e),this.sub(Kf)}reflect(e){return this.sub(Kf.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Wn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){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(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Kf=new j,hw=new Gn;class Pr{constructor(e=new j(1/0,1/0,1/0),t=new j(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(mr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(mr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=mr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,l=s.count;a<l;a++)e.isMesh===!0?e.getVertexPosition(a,mr):mr.fromBufferAttribute(s,a),mr.applyMatrix4(e.matrixWorld),this.expandByPoint(mr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ku.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),ku.copy(i.boundingBox)),ku.applyMatrix4(e.matrixWorld),this.union(ku)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],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,mr),mr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(kl),Fu.subVectors(this.max,kl),Ya.subVectors(e.a,kl),$a.subVectors(e.b,kl),qa.subVectors(e.c,kl),Ss.subVectors($a,Ya),Ms.subVectors(qa,$a),oa.subVectors(Ya,qa);let t=[0,-Ss.z,Ss.y,0,-Ms.z,Ms.y,0,-oa.z,oa.y,Ss.z,0,-Ss.x,Ms.z,0,-Ms.x,oa.z,0,-oa.x,-Ss.y,Ss.x,0,-Ms.y,Ms.x,0,-oa.y,oa.x,0];return!Zf(t,Ya,$a,qa,Fu)||(t=[1,0,0,0,1,0,0,0,1],!Zf(t,Ya,$a,qa,Fu))?!1:(Uu.crossVectors(Ss,Ms),t=[Uu.x,Uu.y,Uu.z],Zf(t,Ya,$a,qa,Fu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,mr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(mr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(qr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qr),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 qr=[new j,new j,new j,new j,new j,new j,new j,new j],mr=new j,ku=new Pr,Ya=new j,$a=new j,qa=new j,Ss=new j,Ms=new j,oa=new j,kl=new j,Fu=new j,Uu=new j,la=new j;function Zf(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){la.fromArray(n,s);const l=r.x*Math.abs(la.x)+r.y*Math.abs(la.y)+r.z*Math.abs(la.z),d=e.dot(la),h=t.dot(la),m=i.dot(la);if(Math.max(-Math.max(d,h,m),Math.min(d,h,m))>l)return!1}return!0}const VD=new Pr,Fl=new j,Qf=new j;class Wr{constructor(e=new j,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 i=this.center;t!==void 0?i.copy(t):VD.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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 i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Fl.subVectors(e,this.center);const t=Fl.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Fl,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Qf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fl.copy(e.center).add(Qf)),this.expandByPoint(Fl.copy(e.center).sub(Qf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Kr=new j,Jf=new j,Ou=new j,Es=new j,ep=new j,Nu=new j,tp=new j;class jc{constructor(e=new j,t=new j(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,Kr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Kr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Kr.copy(this.origin).addScaledVector(this.direction,t),Kr.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Jf.copy(e).add(t).multiplyScalar(.5),Ou.copy(t).sub(e).normalize(),Es.copy(this.origin).sub(Jf);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ou),l=Es.dot(this.direction),d=-Es.dot(Ou),h=Es.lengthSq(),m=Math.abs(1-a*a);let u,g,v,w;if(m>0)if(u=a*d-l,g=a*l-d,w=s*m,u>=0)if(g>=-w)if(g<=w){const T=1/m;u*=T,g*=T,v=u*(u+a*g+2*l)+g*(a*u+g+2*d)+h}else g=s,u=Math.max(0,-(a*g+l)),v=-u*u+g*(g+2*d)+h;else g=-s,u=Math.max(0,-(a*g+l)),v=-u*u+g*(g+2*d)+h;else g<=-w?(u=Math.max(0,-(-a*s+l)),g=u>0?-s:Math.min(Math.max(-s,-d),s),v=-u*u+g*(g+2*d)+h):g<=w?(u=0,g=Math.min(Math.max(-s,-d),s),v=g*(g+2*d)+h):(u=Math.max(0,-(a*s+l)),g=u>0?s:Math.min(Math.max(-s,-d),s),v=-u*u+g*(g+2*d)+h);else g=a>0?-s:s,u=Math.max(0,-(a*g+l)),v=-u*u+g*(g+2*d)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Jf).addScaledVector(Ou,g),v}intersectSphere(e,t){Kr.subVectors(e.center,this.origin);const i=Kr.dot(this.direction),r=Kr.dot(Kr)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),l=i-a,d=i+a;return d<0?null:l<0?this.at(d,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,l,d;const h=1/this.direction.x,m=1/this.direction.y,u=1/this.direction.z,g=this.origin;return h>=0?(i=(e.min.x-g.x)*h,r=(e.max.x-g.x)*h):(i=(e.max.x-g.x)*h,r=(e.min.x-g.x)*h),m>=0?(s=(e.min.y-g.y)*m,a=(e.max.y-g.y)*m):(s=(e.max.y-g.y)*m,a=(e.min.y-g.y)*m),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),u>=0?(l=(e.min.z-g.z)*u,d=(e.max.z-g.z)*u):(l=(e.max.z-g.z)*u,d=(e.min.z-g.z)*u),i>d||l>r)||((l>i||i!==i)&&(i=l),(d<r||r!==r)&&(r=d),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Kr)!==null}intersectTriangle(e,t,i,r,s){ep.subVectors(t,e),Nu.subVectors(i,e),tp.crossVectors(ep,Nu);let a=this.direction.dot(tp),l;if(a>0){if(r)return null;l=1}else if(a<0)l=-1,a=-a;else return null;Es.subVectors(this.origin,e);const d=l*this.direction.dot(Nu.crossVectors(Es,Nu));if(d<0)return null;const h=l*this.direction.dot(ep.cross(Es));if(h<0||d+h>a)return null;const m=-l*Es.dot(tp);return m<0?null:this.at(m/a,s)}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 ot{constructor(e,t,i,r,s,a,l,d,h,m,u,g,v,w,T,M){ot.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,l,d,h,m,u,g,v,w,T,M)}set(e,t,i,r,s,a,l,d,h,m,u,g,v,w,T,M){const b=this.elements;return b[0]=e,b[4]=t,b[8]=i,b[12]=r,b[1]=s,b[5]=a,b[9]=l,b[13]=d,b[2]=h,b[6]=m,b[10]=u,b[14]=g,b[3]=v,b[7]=w,b[11]=T,b[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ot().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Ka.setFromMatrixColumn(e,0).length(),s=1/Ka.setFromMatrixColumn(e,1).length(),a=1/Ka.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),l=Math.sin(i),d=Math.cos(r),h=Math.sin(r),m=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const g=a*m,v=a*u,w=l*m,T=l*u;t[0]=d*m,t[4]=-d*u,t[8]=h,t[1]=v+w*h,t[5]=g-T*h,t[9]=-l*d,t[2]=T-g*h,t[6]=w+v*h,t[10]=a*d}else if(e.order==="YXZ"){const g=d*m,v=d*u,w=h*m,T=h*u;t[0]=g+T*l,t[4]=w*l-v,t[8]=a*h,t[1]=a*u,t[5]=a*m,t[9]=-l,t[2]=v*l-w,t[6]=T+g*l,t[10]=a*d}else if(e.order==="ZXY"){const g=d*m,v=d*u,w=h*m,T=h*u;t[0]=g-T*l,t[4]=-a*u,t[8]=w+v*l,t[1]=v+w*l,t[5]=a*m,t[9]=T-g*l,t[2]=-a*h,t[6]=l,t[10]=a*d}else if(e.order==="ZYX"){const g=a*m,v=a*u,w=l*m,T=l*u;t[0]=d*m,t[4]=w*h-v,t[8]=g*h+T,t[1]=d*u,t[5]=T*h+g,t[9]=v*h-w,t[2]=-h,t[6]=l*d,t[10]=a*d}else if(e.order==="YZX"){const g=a*d,v=a*h,w=l*d,T=l*h;t[0]=d*m,t[4]=T-g*u,t[8]=w*u+v,t[1]=u,t[5]=a*m,t[9]=-l*m,t[2]=-h*m,t[6]=v*u+w,t[10]=g-T*u}else if(e.order==="XZY"){const g=a*d,v=a*h,w=l*d,T=l*h;t[0]=d*m,t[4]=-u,t[8]=h*m,t[1]=g*u+T,t[5]=a*m,t[9]=v*u-w,t[2]=w*u-v,t[6]=l*m,t[10]=T*u+g}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(WD,e,jD)}lookAt(e,t,i){const r=this.elements;return Vi.subVectors(e,t),Vi.lengthSq()===0&&(Vi.z=1),Vi.normalize(),Ts.crossVectors(i,Vi),Ts.lengthSq()===0&&(Math.abs(i.z)===1?Vi.x+=1e-4:Vi.z+=1e-4,Vi.normalize(),Ts.crossVectors(i,Vi)),Ts.normalize(),Bu.crossVectors(Vi,Ts),r[0]=Ts.x,r[4]=Bu.x,r[8]=Vi.x,r[1]=Ts.y,r[5]=Bu.y,r[9]=Vi.y,r[2]=Ts.z,r[6]=Bu.z,r[10]=Vi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],l=i[4],d=i[8],h=i[12],m=i[1],u=i[5],g=i[9],v=i[13],w=i[2],T=i[6],M=i[10],b=i[14],A=i[3],E=i[7],P=i[11],G=i[15],O=r[0],B=r[4],F=r[8],D=r[12],L=r[1],V=r[5],ie=r[9],re=r[13],de=r[2],me=r[6],$=r[10],ue=r[14],Y=r[3],pe=r[7],_e=r[11],Ae=r[15];return s[0]=a*O+l*L+d*de+h*Y,s[4]=a*B+l*V+d*me+h*pe,s[8]=a*F+l*ie+d*$+h*_e,s[12]=a*D+l*re+d*ue+h*Ae,s[1]=m*O+u*L+g*de+v*Y,s[5]=m*B+u*V+g*me+v*pe,s[9]=m*F+u*ie+g*$+v*_e,s[13]=m*D+u*re+g*ue+v*Ae,s[2]=w*O+T*L+M*de+b*Y,s[6]=w*B+T*V+M*me+b*pe,s[10]=w*F+T*ie+M*$+b*_e,s[14]=w*D+T*re+M*ue+b*Ae,s[3]=A*O+E*L+P*de+G*Y,s[7]=A*B+E*V+P*me+G*pe,s[11]=A*F+E*ie+P*$+G*_e,s[15]=A*D+E*re+P*ue+G*Ae,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],i=e[4],r=e[8],s=e[12],a=e[1],l=e[5],d=e[9],h=e[13],m=e[2],u=e[6],g=e[10],v=e[14],w=e[3],T=e[7],M=e[11],b=e[15];return w*(+s*d*u-r*h*u-s*l*g+i*h*g+r*l*v-i*d*v)+T*(+t*d*v-t*h*g+s*a*g-r*a*v+r*h*m-s*d*m)+M*(+t*h*u-t*l*v-s*a*u+i*a*v+s*l*m-i*h*m)+b*(-r*l*m-t*d*u+t*l*g+r*a*u-i*a*g+i*d*m)}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,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],l=e[5],d=e[6],h=e[7],m=e[8],u=e[9],g=e[10],v=e[11],w=e[12],T=e[13],M=e[14],b=e[15],A=u*M*h-T*g*h+T*d*v-l*M*v-u*d*b+l*g*b,E=w*g*h-m*M*h-w*d*v+a*M*v+m*d*b-a*g*b,P=m*T*h-w*u*h+w*l*v-a*T*v-m*l*b+a*u*b,G=w*u*d-m*T*d-w*l*g+a*T*g+m*l*M-a*u*M,O=t*A+i*E+r*P+s*G;if(O===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/O;return e[0]=A*B,e[1]=(T*g*s-u*M*s-T*r*v+i*M*v+u*r*b-i*g*b)*B,e[2]=(l*M*s-T*d*s+T*r*h-i*M*h-l*r*b+i*d*b)*B,e[3]=(u*d*s-l*g*s-u*r*h+i*g*h+l*r*v-i*d*v)*B,e[4]=E*B,e[5]=(m*M*s-w*g*s+w*r*v-t*M*v-m*r*b+t*g*b)*B,e[6]=(w*d*s-a*M*s-w*r*h+t*M*h+a*r*b-t*d*b)*B,e[7]=(a*g*s-m*d*s+m*r*h-t*g*h-a*r*v+t*d*v)*B,e[8]=P*B,e[9]=(w*u*s-m*T*s-w*i*v+t*T*v+m*i*b-t*u*b)*B,e[10]=(a*T*s-w*l*s+w*i*h-t*T*h-a*i*b+t*l*b)*B,e[11]=(m*l*s-a*u*s-m*i*h+t*u*h+a*i*v-t*l*v)*B,e[12]=G*B,e[13]=(m*T*r-w*u*r+w*i*g-t*T*g-m*i*M+t*u*M)*B,e[14]=(w*l*r-a*T*r-w*i*d+t*T*d+a*i*M-t*l*M)*B,e[15]=(a*u*r-m*l*r+m*i*d-t*u*d-a*i*g+t*l*g)*B,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,l=e.y,d=e.z,h=s*a,m=s*l;return this.set(h*a+i,h*l-r*d,h*d+r*l,0,h*l+r*d,m*l+i,m*d-r*a,0,h*d-r*l,m*d+r*a,s*d*d+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,l=t._z,d=t._w,h=s+s,m=a+a,u=l+l,g=s*h,v=s*m,w=s*u,T=a*m,M=a*u,b=l*u,A=d*h,E=d*m,P=d*u,G=i.x,O=i.y,B=i.z;return r[0]=(1-(T+b))*G,r[1]=(v+P)*G,r[2]=(w-E)*G,r[3]=0,r[4]=(v-P)*O,r[5]=(1-(g+b))*O,r[6]=(M+A)*O,r[7]=0,r[8]=(w+E)*B,r[9]=(M-A)*B,r[10]=(1-(g+T))*B,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Ka.set(r[0],r[1],r[2]).length();const a=Ka.set(r[4],r[5],r[6]).length(),l=Ka.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],gr.copy(this);const h=1/s,m=1/a,u=1/l;return gr.elements[0]*=h,gr.elements[1]*=h,gr.elements[2]*=h,gr.elements[4]*=m,gr.elements[5]*=m,gr.elements[6]*=m,gr.elements[8]*=u,gr.elements[9]*=u,gr.elements[10]*=u,t.setFromRotationMatrix(gr),i.x=s,i.y=a,i.z=l,this}makePerspective(e,t,i,r,s,a,l=cs){const d=this.elements,h=2*s/(t-e),m=2*s/(i-r),u=(t+e)/(t-e),g=(i+r)/(i-r);let v,w;if(l===cs)v=-(a+s)/(a-s),w=-2*a*s/(a-s);else if(l===mh)v=-a/(a-s),w=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return d[0]=h,d[4]=0,d[8]=u,d[12]=0,d[1]=0,d[5]=m,d[9]=g,d[13]=0,d[2]=0,d[6]=0,d[10]=v,d[14]=w,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,t,i,r,s,a,l=cs){const d=this.elements,h=1/(t-e),m=1/(i-r),u=1/(a-s),g=(t+e)*h,v=(i+r)*m;let w,T;if(l===cs)w=(a+s)*u,T=-2*u;else if(l===mh)w=s*u,T=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return d[0]=2*h,d[4]=0,d[8]=0,d[12]=-g,d[1]=0,d[5]=2*m,d[9]=0,d[13]=-v,d[2]=0,d[6]=0,d[10]=T,d[14]=-w,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Ka=new j,gr=new ot,WD=new j(0,0,0),jD=new j(1,1,1),Ts=new j,Bu=new j,Vi=new j,fw=new ot,pw=new Gn;class Pn{constructor(e=0,t=0,i=0,r=Pn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],l=r[8],d=r[1],h=r[5],m=r[9],u=r[2],g=r[6],v=r[10];switch(t){case"XYZ":this._y=Math.asin(Wn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-m,v),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(g,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Wn(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(l,v),this._z=Math.atan2(d,h)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Wn(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-u,v),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(d,s));break;case"ZYX":this._y=Math.asin(-Wn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(g,v),this._z=Math.atan2(d,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Wn(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-m,h),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(l,v));break;case"XZY":this._z=Math.asin(-Wn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(g,h),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-m,v),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return fw.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fw,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return pw.setFromEuler(this),this.setFromQuaternion(pw,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Pn.DEFAULT_ORDER="XYZ";class A_{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let XD=0;const mw=new j,Za=new Gn,Zr=new ot,zu=new j,Ul=new j,YD=new j,$D=new Gn,gw=new j(1,0,0),_w=new j(0,1,0),vw=new j(0,0,1),yw={type:"added"},qD={type:"removed"},Qa={type:"childadded",child:null},np={type:"childremoved",child:null};class sn extends ul{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:XD++}),this.uuid=Cr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=sn.DEFAULT_UP.clone();const e=new j,t=new Pn,i=new Gn,r=new j(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ot},normalMatrix:{value:new At}}),this.matrix=new ot,this.matrixWorld=new ot,this.matrixAutoUpdate=sn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=sn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new A_,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 Za.setFromAxisAngle(e,t),this.quaternion.multiply(Za),this}rotateOnWorldAxis(e,t){return Za.setFromAxisAngle(e,t),this.quaternion.premultiply(Za),this}rotateX(e){return this.rotateOnAxis(gw,e)}rotateY(e){return this.rotateOnAxis(_w,e)}rotateZ(e){return this.rotateOnAxis(vw,e)}translateOnAxis(e,t){return mw.copy(e).applyQuaternion(this.quaternion),this.position.add(mw.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(gw,e)}translateY(e){return this.translateOnAxis(_w,e)}translateZ(e){return this.translateOnAxis(vw,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Zr.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?zu.copy(e):zu.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Ul.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zr.lookAt(Ul,zu,this.up):Zr.lookAt(zu,Ul,this.up),this.quaternion.setFromRotationMatrix(Zr),r&&(Zr.extractRotation(r.matrixWorld),Za.setFromRotationMatrix(Zr),this.quaternion.premultiply(Za.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(yw),Qa.child=e,this.dispatchEvent(Qa),Qa.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(qD),np.child=e,this.dispatchEvent(np),np.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Zr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Zr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Zr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(yw),Qa.child=e,this.dispatchEvent(Qa),Qa.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ul,e,YD),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ul,$D,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 i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(l,d){return l[d.uuid]===void 0&&(l[d.uuid]=d.toJSON(e)),d.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const d=l.shapes;if(Array.isArray(d))for(let h=0,m=d.length;h<m;h++){const u=d[h];s(e.shapes,u)}else s(e.shapes,d)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let d=0,h=this.material.length;d<h;d++)l.push(s(e.materials,this.material[d]));r.material=l}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let l=0;l<this.children.length;l++)r.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let l=0;l<this.animations.length;l++){const d=this.animations[l];r.animations.push(s(e.animations,d))}}if(t){const l=a(e.geometries),d=a(e.materials),h=a(e.textures),m=a(e.images),u=a(e.shapes),g=a(e.skeletons),v=a(e.animations),w=a(e.nodes);l.length>0&&(i.geometries=l),d.length>0&&(i.materials=d),h.length>0&&(i.textures=h),m.length>0&&(i.images=m),u.length>0&&(i.shapes=u),g.length>0&&(i.skeletons=g),v.length>0&&(i.animations=v),w.length>0&&(i.nodes=w)}return i.object=r,i;function a(l){const d=[];for(const h in l){const m=l[h];delete m.metadata,d.push(m)}return d}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}sn.DEFAULT_UP=new j(0,1,0);sn.DEFAULT_MATRIX_AUTO_UPDATE=!0;sn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const _r=new j,Qr=new j,ip=new j,Jr=new j,Ja=new j,eo=new j,bw=new j,rp=new j,sp=new j,ap=new j;class Ur{constructor(e=new j,t=new j,i=new j){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),_r.subVectors(e,t),r.cross(_r);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){_r.subVectors(r,t),Qr.subVectors(i,t),ip.subVectors(e,t);const a=_r.dot(_r),l=_r.dot(Qr),d=_r.dot(ip),h=Qr.dot(Qr),m=Qr.dot(ip),u=a*h-l*l;if(u===0)return s.set(0,0,0),null;const g=1/u,v=(h*d-l*m)*g,w=(a*m-l*d)*g;return s.set(1-v-w,w,v)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Jr)===null?!1:Jr.x>=0&&Jr.y>=0&&Jr.x+Jr.y<=1}static getInterpolation(e,t,i,r,s,a,l,d){return this.getBarycoord(e,t,i,r,Jr)===null?(d.x=0,d.y=0,"z"in d&&(d.z=0),"w"in d&&(d.w=0),null):(d.setScalar(0),d.addScaledVector(s,Jr.x),d.addScaledVector(a,Jr.y),d.addScaledVector(l,Jr.z),d)}static isFrontFacing(e,t,i,r){return _r.subVectors(i,t),Qr.subVectors(e,t),_r.cross(Qr).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),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 _r.subVectors(this.c,this.b),Qr.subVectors(this.a,this.b),_r.cross(Qr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ur.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ur.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return Ur.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Ur.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ur.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,l;Ja.subVectors(r,i),eo.subVectors(s,i),rp.subVectors(e,i);const d=Ja.dot(rp),h=eo.dot(rp);if(d<=0&&h<=0)return t.copy(i);sp.subVectors(e,r);const m=Ja.dot(sp),u=eo.dot(sp);if(m>=0&&u<=m)return t.copy(r);const g=d*u-m*h;if(g<=0&&d>=0&&m<=0)return a=d/(d-m),t.copy(i).addScaledVector(Ja,a);ap.subVectors(e,s);const v=Ja.dot(ap),w=eo.dot(ap);if(w>=0&&v<=w)return t.copy(s);const T=v*h-d*w;if(T<=0&&h>=0&&w<=0)return l=h/(h-w),t.copy(i).addScaledVector(eo,l);const M=m*w-v*u;if(M<=0&&u-m>=0&&v-w>=0)return bw.subVectors(s,r),l=(u-m)/(u-m+(v-w)),t.copy(r).addScaledVector(bw,l);const b=1/(M+T+g);return a=T*b,l=g*b,t.copy(i).addScaledVector(Ja,a).addScaledVector(eo,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const ME={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},As={h:0,s:0,l:0},Hu={h:0,s:0,l:0};function op(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Je{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=on){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Kt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Kt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Kt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Kt.workingColorSpace){if(e=E_(e,1),t=Wn(t,0,1),i=Wn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=op(a,s,e+1/3),this.g=op(a,s,e),this.b=op(a,s,e-1/3)}return Kt.toWorkingColorSpace(this,r),this}setStyle(e,t=on){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],l=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,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=on){const i=ME[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=zo(e.r),this.g=zo(e.g),this.b=zo(e.b),this}copyLinearToSRGB(e){return this.r=$f(e.r),this.g=$f(e.g),this.b=$f(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=on){return Kt.fromWorkingColorSpace(fi.copy(this),e),Math.round(Wn(fi.r*255,0,255))*65536+Math.round(Wn(fi.g*255,0,255))*256+Math.round(Wn(fi.b*255,0,255))}getHexString(e=on){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Kt.workingColorSpace){Kt.fromWorkingColorSpace(fi.copy(this),t);const i=fi.r,r=fi.g,s=fi.b,a=Math.max(i,r,s),l=Math.min(i,r,s);let d,h;const m=(l+a)/2;if(l===a)d=0,h=0;else{const u=a-l;switch(h=m<=.5?u/(a+l):u/(2-a-l),a){case i:d=(r-s)/u+(r<s?6:0);break;case r:d=(s-i)/u+2;break;case s:d=(i-r)/u+4;break}d/=6}return e.h=d,e.s=h,e.l=m,e}getRGB(e,t=Kt.workingColorSpace){return Kt.fromWorkingColorSpace(fi.copy(this),t),e.r=fi.r,e.g=fi.g,e.b=fi.b,e}getStyle(e=on){Kt.fromWorkingColorSpace(fi.copy(this),e);const t=fi.r,i=fi.g,r=fi.b;return e!==on?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(As),this.setHSL(As.h+e,As.s+t,As.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(As),e.getHSL(Hu);const i=uc(As.h,Hu.h,t),r=uc(As.s,Hu.s,t),s=uc(As.l,Hu.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,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 fi=new Je;Je.NAMES=ME;let KD=0;class _i extends ul{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:KD++}),this.uuid=Cr(),this.name="",this.type="Material",this.blending=No,this.side=gs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Pm,this.blendDst=Lm,this.blendEquation=ya,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Je(0,0,0),this.blendAlpha=0,this.depthFunc=uh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=aw,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ja,this.stencilZFail=ja,this.stencilZPass=ja,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}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==No&&(i.blending=this.blending),this.side!==gs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Pm&&(i.blendSrc=this.blendSrc),this.blendDst!==Lm&&(i.blendDst=this.blendDst),this.blendEquation!==ya&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==uh&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==aw&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ja&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ja&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ja&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const l in s){const d=s[l];delete d.metadata,a.push(d)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Or extends _i{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Je(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 Pn,this.combine=Bh,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 as=ZD();function ZD(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let d=0;d<256;++d){const h=d-127;h<-27?(i[d]=0,i[d|256]=32768,r[d]=24,r[d|256]=24):h<-14?(i[d]=1024>>-h-14,i[d|256]=1024>>-h-14|32768,r[d]=-h-1,r[d|256]=-h-1):h<=15?(i[d]=h+15<<10,i[d|256]=h+15<<10|32768,r[d]=13,r[d|256]=13):h<128?(i[d]=31744,i[d|256]=64512,r[d]=24,r[d|256]=24):(i[d]=31744,i[d|256]=64512,r[d]=13,r[d|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let d=1;d<1024;++d){let h=d<<13,m=0;for(;!(h&8388608);)h<<=1,m-=8388608;h&=-8388609,m+=947912704,s[d]=h|m}for(let d=1024;d<2048;++d)s[d]=939524096+(d-1024<<13);for(let d=1;d<31;++d)a[d]=d<<23;a[31]=1199570944,a[32]=2147483648;for(let d=33;d<63;++d)a[d]=2147483648+(d-32<<23);a[63]=3347054592;for(let d=1;d<64;++d)d!==32&&(l[d]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:l}}function QD(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Wn(n,-65504,65504),as.floatView[0]=n;const e=as.uint32View[0],t=e>>23&511;return as.baseTable[t]+((e&8388607)>>as.shiftTable[t])}function JD(n){const e=n>>10;return as.uint32View[0]=as.mantissaTable[as.offsetTable[e]+(n&1023)]+as.exponentTable[e],as.floatView[0]}const Eo={toHalfFloat:QD,fromHalfFloat:JD},zn=new j,Gu=new et;class _n{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=ag,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Un,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return T_("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,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Gu.fromBufferAttribute(this,t),Gu.applyMatrix3(e),this.setXY(t,Gu.x,Gu.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)zn.fromBufferAttribute(this,t),zn.applyMatrix3(e),this.setXYZ(t,zn.x,zn.y,zn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)zn.fromBufferAttribute(this,t),zn.applyMatrix4(e),this.setXYZ(t,zn.x,zn.y,zn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)zn.fromBufferAttribute(this,t),zn.applyNormalMatrix(e),this.setXYZ(t,zn.x,zn.y,zn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)zn.fromBufferAttribute(this,t),zn.transformDirection(e),this.setXYZ(t,zn.x,zn.y,zn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Mr(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=tn(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Mr(t,this.array)),t}setX(e,t){return this.normalized&&(t=tn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Mr(t,this.array)),t}setY(e,t){return this.normalized&&(t=tn(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=Mr(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tn(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=Mr(t,this.array)),t}setW(e,t){return this.normalized&&(t=tn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),r=tn(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),r=tn(r,this.array),s=tn(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,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!==ag&&(e.usage=this.usage),e}}class C_ extends _n{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class EE extends _n{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class nn extends _n{constructor(e,t,i){super(new Float32Array(e),t,i)}}let ek=0;const tr=new ot,lp=new sn,to=new j,Wi=new Pr,Ol=new Pr,Jn=new j;class On extends ul{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ek++}),this.uuid=Cr(),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={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(xE(e)?EE:C_)(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 this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new At().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return tr.makeRotationFromQuaternion(e),this.applyMatrix4(tr),this}rotateX(e){return tr.makeRotationX(e),this.applyMatrix4(tr),this}rotateY(e){return tr.makeRotationY(e),this.applyMatrix4(tr),this}rotateZ(e){return tr.makeRotationZ(e),this.applyMatrix4(tr),this}translate(e,t,i){return tr.makeTranslation(e,t,i),this.applyMatrix4(tr),this}scale(e,t,i){return tr.makeScale(e,t,i),this.applyMatrix4(tr),this}lookAt(e){return lp.lookAt(e),lp.updateMatrix(),this.applyMatrix4(lp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(to).negate(),this.translate(to.x,to.y,to.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new nn(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Pr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new j(-1/0,-1/0,-1/0),new j(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Wi.setFromBufferAttribute(s),this.morphTargetsRelative?(Jn.addVectors(this.boundingBox.min,Wi.min),this.boundingBox.expandByPoint(Jn),Jn.addVectors(this.boundingBox.max,Wi.max),this.boundingBox.expandByPoint(Jn)):(this.boundingBox.expandByPoint(Wi.min),this.boundingBox.expandByPoint(Wi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new j,1/0);return}if(e){const i=this.boundingSphere.center;if(Wi.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const l=t[s];Ol.setFromBufferAttribute(l),this.morphTargetsRelative?(Jn.addVectors(Wi.min,Ol.min),Wi.expandByPoint(Jn),Jn.addVectors(Wi.max,Ol.max),Wi.expandByPoint(Jn)):(Wi.expandByPoint(Ol.min),Wi.expandByPoint(Ol.max))}Wi.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)Jn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Jn));if(t)for(let s=0,a=t.length;s<a;s++){const l=t[s],d=this.morphTargetsRelative;for(let h=0,m=l.count;h<m;h++)Jn.fromBufferAttribute(l,h),d&&(to.fromBufferAttribute(e,h),Jn.add(to)),r=Math.max(r,i.distanceToSquared(Jn))}this.boundingSphere.radius=Math.sqrt(r),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(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new _n(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),l=[],d=[];for(let F=0;F<i.count;F++)l[F]=new j,d[F]=new j;const h=new j,m=new j,u=new j,g=new et,v=new et,w=new et,T=new j,M=new j;function b(F,D,L){h.fromBufferAttribute(i,F),m.fromBufferAttribute(i,D),u.fromBufferAttribute(i,L),g.fromBufferAttribute(s,F),v.fromBufferAttribute(s,D),w.fromBufferAttribute(s,L),m.sub(h),u.sub(h),v.sub(g),w.sub(g);const V=1/(v.x*w.y-w.x*v.y);isFinite(V)&&(T.copy(m).multiplyScalar(w.y).addScaledVector(u,-v.y).multiplyScalar(V),M.copy(u).multiplyScalar(v.x).addScaledVector(m,-w.x).multiplyScalar(V),l[F].add(T),l[D].add(T),l[L].add(T),d[F].add(M),d[D].add(M),d[L].add(M))}let A=this.groups;A.length===0&&(A=[{start:0,count:e.count}]);for(let F=0,D=A.length;F<D;++F){const L=A[F],V=L.start,ie=L.count;for(let re=V,de=V+ie;re<de;re+=3)b(e.getX(re+0),e.getX(re+1),e.getX(re+2))}const E=new j,P=new j,G=new j,O=new j;function B(F){G.fromBufferAttribute(r,F),O.copy(G);const D=l[F];E.copy(D),E.sub(G.multiplyScalar(G.dot(D))).normalize(),P.crossVectors(O,D);const V=P.dot(d[F])<0?-1:1;a.setXYZW(F,E.x,E.y,E.z,V)}for(let F=0,D=A.length;F<D;++F){const L=A[F],V=L.start,ie=L.count;for(let re=V,de=V+ie;re<de;re+=3)B(e.getX(re+0)),B(e.getX(re+1)),B(e.getX(re+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new _n(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let g=0,v=i.count;g<v;g++)i.setXYZ(g,0,0,0);const r=new j,s=new j,a=new j,l=new j,d=new j,h=new j,m=new j,u=new j;if(e)for(let g=0,v=e.count;g<v;g+=3){const w=e.getX(g+0),T=e.getX(g+1),M=e.getX(g+2);r.fromBufferAttribute(t,w),s.fromBufferAttribute(t,T),a.fromBufferAttribute(t,M),m.subVectors(a,s),u.subVectors(r,s),m.cross(u),l.fromBufferAttribute(i,w),d.fromBufferAttribute(i,T),h.fromBufferAttribute(i,M),l.add(m),d.add(m),h.add(m),i.setXYZ(w,l.x,l.y,l.z),i.setXYZ(T,d.x,d.y,d.z),i.setXYZ(M,h.x,h.y,h.z)}else for(let g=0,v=t.count;g<v;g+=3)r.fromBufferAttribute(t,g+0),s.fromBufferAttribute(t,g+1),a.fromBufferAttribute(t,g+2),m.subVectors(a,s),u.subVectors(r,s),m.cross(u),i.setXYZ(g+0,m.x,m.y,m.z),i.setXYZ(g+1,m.x,m.y,m.z),i.setXYZ(g+2,m.x,m.y,m.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Jn.fromBufferAttribute(e,t),Jn.normalize(),e.setXYZ(t,Jn.x,Jn.y,Jn.z)}toNonIndexed(){function e(l,d){const h=l.array,m=l.itemSize,u=l.normalized,g=new h.constructor(d.length*m);let v=0,w=0;for(let T=0,M=d.length;T<M;T++){l.isInterleavedBufferAttribute?v=d[T]*l.data.stride+l.offset:v=d[T]*m;for(let b=0;b<m;b++)g[w++]=h[v++]}return new _n(g,m,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new On,i=this.index.array,r=this.attributes;for(const l in r){const d=r[l],h=e(d,i);t.setAttribute(l,h)}const s=this.morphAttributes;for(const l in s){const d=[],h=s[l];for(let m=0,u=h.length;m<u;m++){const g=h[m],v=e(g,i);d.push(v)}t.morphAttributes[l]=d}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let l=0,d=a.length;l<d;l++){const h=a[l];t.addGroup(h.start,h.count,h.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),this.parameters!==void 0){const d=this.parameters;for(const h in d)d[h]!==void 0&&(e[h]=d[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const d in i){const h=i[d];e.data.attributes[d]=h.toJSON(e.data)}const r={};let s=!1;for(const d in this.morphAttributes){const h=this.morphAttributes[d],m=[];for(let u=0,g=h.length;u<g;u++){const v=h[u];m.push(v.toJSON(e.data))}m.length>0&&(r[d]=m,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.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 i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const h in r){const m=r[h];this.setAttribute(h,m.clone(t))}const s=e.morphAttributes;for(const h in s){const m=[],u=s[h];for(let g=0,v=u.length;g<v;g++)m.push(u[g].clone(t));this.morphAttributes[h]=m}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let h=0,m=a.length;h<m;h++){const u=a[h];this.addGroup(u.start,u.count,u.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const d=e.boundingSphere;return d!==null&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const xw=new ot,ca=new jc,Vu=new Wr,ww=new j,no=new j,io=new j,ro=new j,cp=new j,Wu=new j,ju=new et,Xu=new et,Yu=new et,Sw=new j,Mw=new j,Ew=new j,$u=new j,qu=new j;class wn extends sn{constructor(e=new On,t=new Or){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const l=this.morphTargetInfluences;if(s&&l){Wu.set(0,0,0);for(let d=0,h=s.length;d<h;d++){const m=l[d],u=s[d];m!==0&&(cp.fromBufferAttribute(u,e),a?Wu.addScaledVector(cp,m):Wu.addScaledVector(cp.sub(t),m))}t.add(Wu)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Vu.copy(i.boundingSphere),Vu.applyMatrix4(s),ca.copy(e.ray).recast(e.near),!(Vu.containsPoint(ca.origin)===!1&&(ca.intersectSphere(Vu,ww)===null||ca.origin.distanceToSquared(ww)>(e.far-e.near)**2))&&(xw.copy(s).invert(),ca.copy(e.ray).applyMatrix4(xw),!(i.boundingBox!==null&&ca.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,ca)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,l=s.index,d=s.attributes.position,h=s.attributes.uv,m=s.attributes.uv1,u=s.attributes.normal,g=s.groups,v=s.drawRange;if(l!==null)if(Array.isArray(a))for(let w=0,T=g.length;w<T;w++){const M=g[w],b=a[M.materialIndex],A=Math.max(M.start,v.start),E=Math.min(l.count,Math.min(M.start+M.count,v.start+v.count));for(let P=A,G=E;P<G;P+=3){const O=l.getX(P),B=l.getX(P+1),F=l.getX(P+2);r=Ku(this,b,e,i,h,m,u,O,B,F),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=M.materialIndex,t.push(r))}}else{const w=Math.max(0,v.start),T=Math.min(l.count,v.start+v.count);for(let M=w,b=T;M<b;M+=3){const A=l.getX(M),E=l.getX(M+1),P=l.getX(M+2);r=Ku(this,a,e,i,h,m,u,A,E,P),r&&(r.faceIndex=Math.floor(M/3),t.push(r))}}else if(d!==void 0)if(Array.isArray(a))for(let w=0,T=g.length;w<T;w++){const M=g[w],b=a[M.materialIndex],A=Math.max(M.start,v.start),E=Math.min(d.count,Math.min(M.start+M.count,v.start+v.count));for(let P=A,G=E;P<G;P+=3){const O=P,B=P+1,F=P+2;r=Ku(this,b,e,i,h,m,u,O,B,F),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=M.materialIndex,t.push(r))}}else{const w=Math.max(0,v.start),T=Math.min(d.count,v.start+v.count);for(let M=w,b=T;M<b;M+=3){const A=M,E=M+1,P=M+2;r=Ku(this,a,e,i,h,m,u,A,E,P),r&&(r.faceIndex=Math.floor(M/3),t.push(r))}}}}function tk(n,e,t,i,r,s,a,l){let d;if(e.side===Ei?d=i.intersectTriangle(a,s,r,!0,l):d=i.intersectTriangle(r,s,a,e.side===gs,l),d===null)return null;qu.copy(l),qu.applyMatrix4(n.matrixWorld);const h=t.ray.origin.distanceTo(qu);return h<t.near||h>t.far?null:{distance:h,point:qu.clone(),object:n}}function Ku(n,e,t,i,r,s,a,l,d,h){n.getVertexPosition(l,no),n.getVertexPosition(d,io),n.getVertexPosition(h,ro);const m=tk(n,e,t,i,no,io,ro,$u);if(m){r&&(ju.fromBufferAttribute(r,l),Xu.fromBufferAttribute(r,d),Yu.fromBufferAttribute(r,h),m.uv=Ur.getInterpolation($u,no,io,ro,ju,Xu,Yu,new et)),s&&(ju.fromBufferAttribute(s,l),Xu.fromBufferAttribute(s,d),Yu.fromBufferAttribute(s,h),m.uv1=Ur.getInterpolation($u,no,io,ro,ju,Xu,Yu,new et)),a&&(Sw.fromBufferAttribute(a,l),Mw.fromBufferAttribute(a,d),Ew.fromBufferAttribute(a,h),m.normal=Ur.getInterpolation($u,no,io,ro,Sw,Mw,Ew,new j),m.normal.dot(i.direction)>0&&m.normal.multiplyScalar(-1));const u={a:l,b:d,c:h,normal:new j,materialIndex:0};Ur.getNormal(no,io,ro,u.normal),m.face=u}return m}class Xc extends On{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const l=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const d=[],h=[],m=[],u=[];let g=0,v=0;w("z","y","x",-1,-1,i,t,e,a,s,0),w("z","y","x",1,-1,i,t,-e,a,s,1),w("x","z","y",1,1,e,i,t,r,a,2),w("x","z","y",1,-1,e,i,-t,r,a,3),w("x","y","z",1,-1,e,t,i,r,s,4),w("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(d),this.setAttribute("position",new nn(h,3)),this.setAttribute("normal",new nn(m,3)),this.setAttribute("uv",new nn(u,2));function w(T,M,b,A,E,P,G,O,B,F,D){const L=P/B,V=G/F,ie=P/2,re=G/2,de=O/2,me=B+1,$=F+1;let ue=0,Y=0;const pe=new j;for(let _e=0;_e<$;_e++){const Ae=_e*V-re;for(let Pe=0;Pe<me;Pe++){const Ue=Pe*L-ie;pe[T]=Ue*A,pe[M]=Ae*E,pe[b]=de,h.push(pe.x,pe.y,pe.z),pe[T]=0,pe[M]=0,pe[b]=O>0?1:-1,m.push(pe.x,pe.y,pe.z),u.push(Pe/B),u.push(1-_e/F),ue+=1}}for(let _e=0;_e<F;_e++)for(let Ae=0;Ae<B;Ae++){const Pe=g+Ae+me*_e,Ue=g+Ae+me*(_e+1),ae=g+(Ae+1)+me*(_e+1),ge=g+(Ae+1)+me*_e;d.push(Pe,Ue,ge),d.push(Ue,ae,ge),Y+=6}l.addGroup(v,Y,D),v+=Y,g+=ue}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xc(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function rl(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][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()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function bi(n){const e={};for(let t=0;t<n.length;t++){const i=rl(n[t]);for(const r in i)e[r]=i[r]}return e}function nk(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function TE(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Kt.workingColorSpace}const AE={clone:rl,merge:bi};var ik=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,rk=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class zi extends _i{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ik,this.fragmentShader=rk,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=rl(e.uniforms),this.uniformsGroups=nk(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 r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}let CE=class extends sn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ot,this.projectionMatrix=new ot,this.projectionMatrixInverse=new ot,this.coordinateSystem=cs}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 Cs=new j,Tw=new et,Aw=new et;class mi extends CE{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=il*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(cc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return il*2*Math.atan(Math.tan(cc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Cs.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Cs.x,Cs.y).multiplyScalar(-e/Cs.z),Cs.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Cs.x,Cs.y).multiplyScalar(-e/Cs.z)}getViewSize(e,t){return this.getViewBounds(e,Tw,Aw),t.subVectors(Aw,Tw)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(cc*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const d=a.fullWidth,h=a.fullHeight;s+=a.offsetX*r/d,t-=a.offsetY*i/h,r*=a.width/d,i*=a.height/h}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const so=-90,ao=1;class RE extends sn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new mi(so,ao,e,t);r.layers=this.layers,this.add(r);const s=new mi(so,ao,e,t);s.layers=this.layers,this.add(s);const a=new mi(so,ao,e,t);a.layers=this.layers,this.add(a);const l=new mi(so,ao,e,t);l.layers=this.layers,this.add(l);const d=new mi(so,ao,e,t);d.layers=this.layers,this.add(d);const h=new mi(so,ao,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,l,d]=t;for(const h of t)this.remove(h);if(e===cs)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),d.up.set(0,1,0),d.lookAt(0,0,-1);else if(e===mh)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),d.up.set(0,-1,0),d.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,l,d,h,m]=this.children,u=e.getRenderTarget(),g=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),w=e.xr.enabled;e.xr.enabled=!1;const T=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,a),e.setRenderTarget(i,2,r),e.render(t,l),e.setRenderTarget(i,3,r),e.render(t,d),e.setRenderTarget(i,4,r),e.render(t,h),i.texture.generateMipmaps=T,e.setRenderTarget(i,5,r),e.render(t,m),e.setRenderTarget(u,g,v),e.xr.enabled=w,i.texture.needsPMREMUpdate=!0}}class PE extends qn{constructor(e,t,i,r,s,a,l,d,h,m){e=e!==void 0?e:[],t=t!==void 0?t:Qo,super(e,t,i,r,s,a,l,d,h,m),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class LE extends Zs{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new PE(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:ln}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 i={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},r=new Xc(5,5,5),s=new zi({name:"CubemapFromEquirect",uniforms:rl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ei,blending:Gr});s.uniforms.tEquirect.value=t;const a=new wn(r,s),l=t.minFilter;return t.minFilter===Er&&(t.minFilter=ln),new RE(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}const up=new j,sk=new j,ak=new At;let ga=class{constructor(e=new j(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=up.subVectors(i,t).cross(sk.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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 i=e.delta(up),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||ak.getNormalMatrix(e),r=this.coplanarPoint(up).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),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 ua=new Wr,Zu=new j;class R_{constructor(e=new ga,t=new ga,i=new ga,r=new ga,s=new ga,a=new ga){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(i),l[3].copy(r),l[4].copy(s),l[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=cs){const i=this.planes,r=e.elements,s=r[0],a=r[1],l=r[2],d=r[3],h=r[4],m=r[5],u=r[6],g=r[7],v=r[8],w=r[9],T=r[10],M=r[11],b=r[12],A=r[13],E=r[14],P=r[15];if(i[0].setComponents(d-s,g-h,M-v,P-b).normalize(),i[1].setComponents(d+s,g+h,M+v,P+b).normalize(),i[2].setComponents(d+a,g+m,M+w,P+A).normalize(),i[3].setComponents(d-a,g-m,M-w,P-A).normalize(),i[4].setComponents(d-l,g-u,M-T,P-E).normalize(),t===cs)i[5].setComponents(d+l,g+u,M+T,P+E).normalize();else if(t===mh)i[5].setComponents(l,u,T,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),ua.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ua.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ua)}intersectsSprite(e){return ua.center.set(0,0,0),ua.radius=.7071067811865476,ua.applyMatrix4(e.matrixWorld),this.intersectsSphere(ua)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Zu.x=r.normal.x>0?e.max.x:e.min.x,Zu.y=r.normal.y>0?e.max.y:e.min.y,Zu.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Zu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function IE(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function ok(n){const e=new WeakMap;function t(l,d){const h=l.array,m=l.usage,u=h.byteLength,g=n.createBuffer();n.bindBuffer(d,g),n.bufferData(d,h,m),l.onUploadCallback();let v;if(h instanceof Float32Array)v=n.FLOAT;else if(h instanceof Uint16Array)l.isFloat16BufferAttribute?v=n.HALF_FLOAT:v=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)v=n.SHORT;else if(h instanceof Uint32Array)v=n.UNSIGNED_INT;else if(h instanceof Int32Array)v=n.INT;else if(h instanceof Int8Array)v=n.BYTE;else if(h instanceof Uint8Array)v=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)v=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:g,type:v,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version,size:u}}function i(l,d,h){const m=d.array,u=d._updateRange,g=d.updateRanges;if(n.bindBuffer(h,l),u.count===-1&&g.length===0&&n.bufferSubData(h,0,m),g.length!==0){for(let v=0,w=g.length;v<w;v++){const T=g[v];n.bufferSubData(h,T.start*m.BYTES_PER_ELEMENT,m,T.start,T.count)}d.clearUpdateRanges()}u.count!==-1&&(n.bufferSubData(h,u.offset*m.BYTES_PER_ELEMENT,m,u.offset,u.count),u.count=-1),d.onUploadCallback()}function r(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function s(l){l.isInterleavedBufferAttribute&&(l=l.data);const d=e.get(l);d&&(n.deleteBuffer(d.buffer),e.delete(l))}function a(l,d){if(l.isGLBufferAttribute){const m=e.get(l);(!m||m.version<l.version)&&e.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}l.isInterleavedBufferAttribute&&(l=l.data);const h=e.get(l);if(h===void 0)e.set(l,t(l,d));else if(h.version<l.version){if(h.size!==l.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(h.buffer,l,d),h.version=l.version}}return{get:r,remove:s,update:a}}class Yc extends On{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,l=Math.floor(i),d=Math.floor(r),h=l+1,m=d+1,u=e/l,g=t/d,v=[],w=[],T=[],M=[];for(let b=0;b<m;b++){const A=b*g-a;for(let E=0;E<h;E++){const P=E*u-s;w.push(P,-A,0),T.push(0,0,1),M.push(E/l),M.push(1-b/d)}}for(let b=0;b<d;b++)for(let A=0;A<l;A++){const E=A+h*b,P=A+h*(b+1),G=A+1+h*(b+1),O=A+1+h*b;v.push(E,P,O),v.push(P,G,O)}this.setIndex(v),this.setAttribute("position",new nn(w,3)),this.setAttribute("normal",new nn(T,3)),this.setAttribute("uv",new nn(M,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yc(e.width,e.height,e.widthSegments,e.heightSegments)}}var lk=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,ck=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
}
float hash3D( vec3 value ) {
return hash2D( vec2( hash2D( value.xy ), value.z ) );
}
float getAlphaHashThreshold( vec3 position ) {
float maxDeriv = max(
length( dFdx( position.xyz ) ),
length( dFdy( position.xyz ) )
);
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
vec2 pixScales = vec2(
exp2( floor( log2( pixScale ) ) ),
exp2( ceil( log2( pixScale ) ) )
);
vec2 alpha = vec2(
hash3D( floor( pixScales.x * position.xyz ) ),
hash3D( floor( pixScales.y * position.xyz ) )
);
float lerpFactor = fract( log2( pixScale ) );
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
float a = min( lerpFactor, 1.0 - lerpFactor );
vec3 cases = vec3(
x * x / ( 2.0 * a * ( 1.0 - a ) ),
( x - 0.5 * a ) / ( 1.0 - a ),
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
);
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases.x : cases.y )
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
#endif`,uk=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,dk=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,hk=`#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
#endif`,fk=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,pk=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_SHEEN )
sheenSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
#endif`,mk=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,gk=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
#endif
uniform highp sampler2D batchingTexture;
uniform highp usampler2D batchingIdTexture;
mat4 getBatchingMatrix( const in float i ) {
int size = textureSize( batchingTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
float getIndirectIndex( const in int i ) {
int size = textureSize( batchingIdTexture, 0 ).x;
int x = i % size;
int y = i / size;
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
}
#endif
#ifdef USE_BATCHING_COLOR
uniform sampler2D batchingColorTexture;
vec3 getBatchingColor( const in float i ) {
int size = textureSize( batchingColorTexture, 0 ).x;
int j = int( i );
int x = j % size;
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
}
#endif`,_k=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,vk=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
#endif`,yk=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,bk=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
} // validated`,xk=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
#endif`,wk=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,Sk=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
float clipOpacity = 1.0;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
distanceGradient = fwidth( distanceToPlane ) / 2.0;
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
if ( clipOpacity == 0.0 ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
float unionClipOpacity = 1.0;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
distanceGradient = fwidth( distanceToPlane ) / 2.0;
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
}
#pragma unroll_loop_end
clipOpacity *= 1.0 - unionClipOpacity;
#endif
diffuseColor.a *= clipOpacity;
if ( diffuseColor.a == 0.0 ) discard;
#else
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
#endif
#endif`,Mk=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,Ek=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,Tk=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,Ak=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,Ck=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,Rk=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
#endif`,Pk=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
vColor.xyz *= batchingColor.xyz;
#endif`,Lk=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
mat3 tmp;
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
return tmp;
}
float luminance( const in vec3 rgb ) {
const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
return dot( weights, rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,Ik=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
uv.x *= CUBEUV_TEXEL_WIDTH;
uv.y *= CUBEUV_TEXEL_HEIGHT;
#ifdef texture2DGradEXT
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
#else
return texture2D( envMap, uv ).rgb;
#endif
}
#define cubeUV_r0 1.0
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= cubeUV_r1 ) {
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
} else if ( roughness >= cubeUV_r4 ) {
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
} else if ( roughness >= cubeUV_r5 ) {
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
} else if ( roughness >= cubeUV_r6 ) {
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
#endif`,Dk=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
mat3 bm = mat3( batchingMatrix );
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
transformedNormal = bm * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = bm * transformedTangent;
#endif
#endif
#ifdef USE_INSTANCING
mat3 im = mat3( instanceMatrix );
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
transformedNormal = im * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = im * transformedTangent;
#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,kk=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,Fk=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,Uk=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,Ok=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,Nk="gl_FragColor = linearToOutputTexel( gl_FragColor );",Bk=`
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
vec3( 0.8224621, 0.177538, 0.0 ),
vec3( 0.0331941, 0.9668058, 0.0 ),
vec3( 0.0170827, 0.0723974, 0.9105199 )
);
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
vec3( 1.2249401, - 0.2249404, 0.0 ),
vec3( - 0.0420569, 1.0420571, 0.0 ),
vec3( - 0.0196376, - 0.0786361, 1.0982735 )
);
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
}
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
}
vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}
vec4 LinearToLinear( in vec4 value ) {
return value;
}
vec4 LinearTosRGB( in vec4 value ) {
return sRGBTransferOETF( value );
}`,zk=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif`,Hk=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform mat3 envMapRotation;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,Gk=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
#endif`,Vk=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
#endif`,Wk=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,jk=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,Xk=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,Yk=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,$k=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,qk=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return vec3( texture2D( gradientMap, coord ).r );
#else
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
}`,Kk=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,Zk=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,Qk=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Jk=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
light.color = directionalLight.color;
light.direction = directionalLight.direction;
light.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometryPosition;
light.direction = normalize( lVector );
float lightDistance = length( lVector );
light.color = pointLight.color;
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometryPosition;
light.direction = normalize( lVector );
float angleCos = dot( light.direction, spotLight.direction );
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
if ( spotAttenuation > 0.0 ) {
float lightDistance = length( lVector );
light.color = spotLight.color * spotAttenuation;
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
} else {
light.color = vec3( 0.0 );
light.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
float dotNL = dot( normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
#endif`,e3=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
return PI * envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 reflectVec = reflect( - viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
return envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
#ifdef USE_ANISOTROPY
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 bentNormal = cross( bitangent, viewDir );
bentNormal = normalize( cross( bentNormal, bitangent ) );
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
return getIBLRadiance( viewDir, bentNormal, roughness );
#else
return vec3( 0.0 );
#endif
}
#endif
#endif`,t3=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,n3=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,i3=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,r3=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,s3=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
material.ior = ior;
#ifdef USE_SPECULAR
float specularIntensityFactor = specularIntensity;
vec3 specularColorFactor = specularColor;
#ifdef USE_SPECULAR_COLORMAP
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
#endif
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
#else
float specularIntensityFactor = 1.0;
vec3 specularColorFactor = vec3( 1.0 );
material.specularF90 = 1.0;
#endif
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
material.clearcoatF0 = vec3( 0.04 );
material.clearcoatF90 = 1.0;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
material.iridescence = iridescence;
material.iridescenceIOR = iridescenceIOR;
#ifdef USE_IRIDESCENCEMAP
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
#else
material.iridescenceThickness = iridescenceThicknessMaximum;
#endif
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
#ifdef USE_SHEEN_COLORMAP
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
#endif
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
#ifdef USE_SHEEN_ROUGHNESSMAP
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
#endif
#endif
#ifdef USE_ANISOTROPY
#ifdef USE_ANISOTROPYMAP
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
#else
vec2 anisotropyV = anisotropyVector;
#endif
material.anisotropy = length( anisotropyV );
if( material.anisotropy == 0.0 ) {
anisotropyV = vec2( 1.0, 0.0 );
} else {
anisotropyV /= material.anisotropy;
material.anisotropy = saturate( material.anisotropy );
}
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,a3=`struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
float specularF90;
float dispersion;
#ifdef USE_CLEARCOAT
float clearcoat;
float clearcoatRoughness;
vec3 clearcoatF0;
float clearcoatF90;
#endif
#ifdef USE_IRIDESCENCE
float iridescence;
float iridescenceIOR;
float iridescenceThickness;
vec3 iridescenceFresnel;
vec3 iridescenceF0;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
float sheenRoughness;
#endif
#ifdef IOR
float ior;
#endif
#ifdef USE_TRANSMISSION
float transmission;
float transmissionAlpha;
float thickness;
float attenuationDistance;
vec3 attenuationColor;
#endif
#ifdef USE_ANISOTROPY
float anisotropy;
float alphaT;
vec3 anisotropyT;
vec3 anisotropyB;
#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
float x2 = x * x;
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
float v = 0.5 / ( gv + gl );
return saturate(v);
}
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
float a2 = alphaT * alphaB;
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
highp float v2 = dot( v, v );
float w2 = a2 / v2;
return RECIPROCAL_PI * a2 * pow2 ( w2 );
}
#endif
#ifdef USE_CLEARCOAT
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
vec3 f0 = material.clearcoatF0;
float f90 = material.clearcoatF90;
float roughness = material.clearcoatRoughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 f0 = material.specularColor;
float f90 = material.specularF90;
float roughness = material.roughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
#ifdef USE_IRIDESCENCE
F = mix( F, material.iridescenceFresnel, material.iridescence );
#endif
#ifdef USE_ANISOTROPY
float dotTL = dot( material.anisotropyT, lightDir );
float dotTV = dot( material.anisotropyT, viewDir );
float dotTH = dot( material.anisotropyT, halfDir );
float dotBL = dot( material.anisotropyB, lightDir );
float dotBV = dot( material.anisotropyB, viewDir );
float dotBH = dot( material.anisotropyB, halfDir );
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
#else
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
#endif
return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
float alpha = pow2( roughness );
float invAlpha = 1.0 / alpha;
float cos2h = dotNH * dotNH;
float sin2h = max( 1.0 - cos2h, 0.0078125 );
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
float r2 = roughness * roughness;
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
vec4 r = roughness * c0 + c1;
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
vec2 fab = DFGApprox( normal, viewDir, roughness );
return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
vec2 fab = DFGApprox( normal, viewDir, roughness );
#ifdef USE_IRIDESCENCE
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
#else
vec3 Fr = specularColor;
#endif
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
float Ess = fab.x + fab.y;
float Ems = 1.0 - Ess;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometryNormal;
vec3 viewDir = geometryViewDir;
vec3 position = geometryPosition;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.roughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef USE_CLEARCOAT
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
#endif
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
#else
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
#endif
vec3 totalScattering = singleScattering + multiScattering;
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
reflectedLight.indirectSpecular += radiance * singleScattering;
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,o3=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometryViewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
material.iridescence = 0.0;
} else {
material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointLightInfo( pointLight, geometryPosition, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
vec4 spotColor;
vec3 spotLightCoord;
bool inSpotLightMap;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotLightInfo( spotLight, geometryPosition, directLight );
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
#else
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#endif
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
#endif
#undef SPOT_LIGHT_MAP_INDEX
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
#if defined( USE_LIGHT_PROBES )
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
#endif
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,l3=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getIBLIrradiance( geometryNormal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
#ifdef USE_ANISOTROPY
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
#else
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
#endif
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
#endif`,c3=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,u3=`#if defined( USE_LOGDEPTHBUF )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,d3=`#if defined( USE_LOGDEPTHBUF )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,h3=`#ifdef USE_LOGDEPTHBUF
varying float vFragDepth;
varying float vIsPerspective;
#endif`,f3=`#ifdef USE_LOGDEPTHBUF
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,p3=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = 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 );
#endif
diffuseColor *= sampledDiffuseColor;
#endif`,m3=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,g3=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#endif
#ifdef USE_MAP
diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,_3=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,v3=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,y3=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,b3=`#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
#endif`,x3=`#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
#elif defined( USE_COLOR )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
#endif`,w3=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#endif`,S3=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
#endif
uniform sampler2DArray morphTargetsTexture;
uniform ivec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
int y = texelIndex / morphTargetsTextureSize.x;
int x = texelIndex - y * morphTargetsTextureSize.x;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
#endif`,M3=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#endif`,E3=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal *= faceDirection;
#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
#ifdef USE_TANGENT
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal,
#if defined( USE_NORMALMAP )
vNormalMapUv
#elif defined( USE_CLEARCOAT_NORMALMAP )
vClearcoatNormalMapUv
#else
vUv
#endif
);
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn[0] *= faceDirection;
tbn[1] *= faceDirection;
#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
vec3 nonPerturbedNormal = normal;`,T3=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,A3=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,C3=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,R3=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,P3=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
vec3 q0 = dFdx( eye_pos.xyz );
vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( uv.st );
vec2 st1 = dFdy( uv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
#endif`,L3=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,I3=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,D3=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
#endif`,k3=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,F3=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,U3=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
vec4 r = vec4( fract( v * PackFactors ), v );
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors );
}
vec2 packDepthToRG( in highp float v ) {
return packDepthToRGBA( v ).yx;
}
float unpackRGToDepth( const in highp vec2 v ) {
return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
}
vec4 pack2HalfToRGBA( vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
}`,O3=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,N3=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,B3=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,z3=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
#endif`,H3=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,G3=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,V3=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
struct SpotLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
}
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
return unpackRGBATo2Half( texture2D( shadow, uv ) );
}
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
float occlusion = 1.0;
vec2 distribution = texture2DDistribution( shadow, uv );
float hard_shadow = step( compare , distribution.x );
if (hard_shadow != 1.0 ) {
float distance = compare - distribution.x ;
float variance = max( 0.00000, distribution.y * distribution.y );
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
}
return occlusion;
}
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
#if defined( SHADOWMAP_TYPE_PCF )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx0 = - texelSize.x * shadowRadius;
float dy0 = - texelSize.y * shadowRadius;
float dx1 = + texelSize.x * shadowRadius;
float dy1 = + texelSize.y * shadowRadius;
float dx2 = dx0 / 2.0;
float dy2 = dy0 / 2.0;
float dx3 = dx1 / 2.0;
float dy3 = dy1 / 2.0;
shadow = (
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
) * ( 1.0 / 17.0 );
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx = texelSize.x;
float dy = texelSize.y;
vec2 uv = shadowCoord.xy;
vec2 f = fract( uv * shadowMapSize + 0.5 );
uv -= f * texelSize;
shadow = (
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
f.x ),
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
f.x ),
f.y )
) * ( 1.0 / 9.0 );
#elif defined( SHADOWMAP_TYPE_VSM )
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
#else
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
#endif
}
return mix( 1.0, shadow, shadowIntensity );
}
vec2 cubeToUV( vec3 v, float texelSizeY ) {
vec3 absV = abs( v );
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
absV *= scaleToCube;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
vec2 planar = v.xy;
float almostATexel = 1.5 * texelSizeY;
float almostOne = 1.0 - almostATexel;
if ( absV.z >= almostOne ) {
if ( v.z > 0.0 )
planar.x = 4.0 - v.x;
} else if ( absV.x >= almostOne ) {
float signX = sign( v.x );
planar.x = v.z * signX + 2.0 * signX;
} else if ( absV.y >= almostOne ) {
float signY = sign( v.y );
planar.x = v.x + 2.0 * signY + 2.0;
planar.y = v.z * signY - 2.0;
}
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
}
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
float shadow = 1.0;
vec3 lightToPosition = shadowCoord.xyz;
float lightToPositionLength = length( lightToPosition );
if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
shadow = (
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
) * ( 1.0 / 9.0 );
#else
shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
return mix( 1.0, shadow, shadowIntensity );
}
#endif`,W3=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,j3=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
shadowWorldPosition = worldPosition;
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
#endif
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif`,X3=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
}`,Y3=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,$3=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
mat4 getBoneMatrix( const in float i ) {
int size = textureSize( boneTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
#endif`,q3=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,K3=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
#endif`,Z3=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,Q3=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,J3=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,eF=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
vec3( 1.6605, - 0.1246, - 0.0182 ),
vec3( - 0.5876, 1.1329, - 0.1006 ),
vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
vec3( 0.6274, 0.0691, 0.0164 ),
vec3( 0.3293, 0.9195, 0.0880 ),
vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
vec3 x2 = x * x;
vec3 x4 = x2 * x2;
return + 15.5 * x4 * x2
- 40.14 * x4 * x
+ 31.96 * x4
- 6.868 * x2 * x
+ 0.4298 * x2
+ 0.1191 * x
- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
const mat3 AgXInsetMatrix = mat3(
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
);
const mat3 AgXOutsetMatrix = mat3(
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
);
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
color *= toneMappingExposure;
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
color = AgXInsetMatrix * color;
color = max( color, 1e-10 ); color = log2( color );
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
color = clamp( color, 0.0, 1.0 );
color = agxDefaultContrastApprox( color );
color = AgXOutsetMatrix * color;
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
color = clamp( color, 0.0, 1.0 );
return color;
}
vec3 NeutralToneMapping( vec3 color ) {
const float StartCompression = 0.8 - 0.04;
const float Desaturation = 0.15;
color *= toneMappingExposure;
float x = min( color.r, min( color.g, color.b ) );
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
color -= offset;
float peak = max( color.r, max( color.g, color.b ) );
if ( peak < StartCompression ) return color;
float d = 1. - StartCompression;
float newPeak = 1. - d * d / ( peak + d - StartCompression );
color *= newPeak / peak;
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,tF=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
material.attenuationDistance = attenuationDistance;
material.attenuationColor = attenuationColor;
#ifdef USE_TRANSMISSIONMAP
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
#endif
#ifdef USE_THICKNESSMAP
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
#endif
vec3 pos = vWorldPosition;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
vec4 transmitted = getIBLVolumeRefraction(
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,nF=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationColor;
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec3 vWorldPosition;
float w0( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
}
float w1( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
}
float w2( float a ){
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
}
float w3( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a );
}
float g0( float a ) {
return w0( a ) + w1( a );
}
float g1( float a ) {
return w2( a ) + w3( a );
}
float h0( float a ) {
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
}
float h1( float a ) {
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
}
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
uv = uv * texelSize.zw + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
float g0x = g0( fuv.x );
float g1x = g1( fuv.x );
float h0x = h0( fuv.x );
float h1x = h1( fuv.x );
float h0y = h0( fuv.y );
float h1y = h1( fuv.y );
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
}
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
vec2 fLodSizeInv = 1.0 / fLodSize;
vec2 cLodSizeInv = 1.0 / cLodSize;
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
return mix( fSample, cSample, fract( lod ) );
}
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
return normalize( refractionVector ) * thickness * modelScale;
}
float applyIorToRoughness( const in float roughness, const in float ior ) {
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
}
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
}
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
if ( isinf( attenuationDistance ) ) {
return vec3( 1.0 );
} else {
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
}
}
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
vec4 transmittedLight;
vec3 transmittance;
#ifdef USE_DISPERSION
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
for ( int i = 0; i < 3; i ++ ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
transmittedLight[ i ] = transmissionSample[ i ];
transmittedLight.a += transmissionSample.a;
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
}
transmittedLight.a /= 3.0;
#else
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
#endif
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
#endif`,iF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,rF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
uniform mat3 mapTransform;
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
uniform mat3 alphaMapTransform;
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
uniform mat3 lightMapTransform;
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
uniform mat3 aoMapTransform;
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
uniform mat3 bumpMapTransform;
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
uniform mat3 normalMapTransform;
varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
uniform mat3 displacementMapTransform;
varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
uniform mat3 emissiveMapTransform;
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
uniform mat3 metalnessMapTransform;
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
uniform mat3 roughnessMapTransform;
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
uniform mat3 anisotropyMapTransform;
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
uniform mat3 clearcoatMapTransform;
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform mat3 clearcoatNormalMapTransform;
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform;
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
uniform mat3 sheenColorMapTransform;
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform;
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform;
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform;
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
uniform mat3 specularMapTransform;
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
uniform mat3 specularColorMapTransform;
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform mat3 specularIntensityMapTransform;
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,sF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,aF=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
#endif
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`;const oF=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,lF=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
#ifdef DECODE_VIDEO_TEXTURE
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,cF=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,uF=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
#else
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,dF=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,hF=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
gl_FragColor = texColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,fF=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
}`,pF=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <logdepthbuf_fragment>
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#endif
}`,mF=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,gF=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
}`,_F=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,vF=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,yF=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,bF=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,xF=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,wF=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,SF=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,MF=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,EF=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,TF=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
#else
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,AF=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
}`,CF=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
}`,RF=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,PF=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,LF=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
}`,IF=`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
uniform float ior;
#endif
#ifdef USE_SPECULAR
uniform float specularIntensity;
uniform vec3 specularColor;
#ifdef USE_SPECULAR_COLORMAP
uniform sampler2D specularColorMap;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#endif
#ifdef USE_CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
uniform float iridescence;
uniform float iridescenceIOR;
uniform float iridescenceThicknessMinimum;
uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform float sheenRoughness;
#ifdef USE_SHEEN_COLORMAP
uniform sampler2D sheenColorMap;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap;
#endif
#endif
#ifdef USE_ANISOTROPY
uniform vec2 anisotropyVector;
#ifdef USE_ANISOTROPYMAP
uniform sampler2D anisotropyMap;
#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
#ifdef USE_SHEEN
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
#endif
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,DF=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,kF=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,FF=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
varying vec2 vUv;
uniform mat3 uvTransform;
#endif
void main() {
#ifdef USE_POINTS_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,UF=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,OF=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,NF=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,BF=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
vec2 scale;
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,zF=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,xt={alphahash_fragment:lk,alphahash_pars_fragment:ck,alphamap_fragment:uk,alphamap_pars_fragment:dk,alphatest_fragment:hk,alphatest_pars_fragment:fk,aomap_fragment:pk,aomap_pars_fragment:mk,batching_pars_vertex:gk,batching_vertex:_k,begin_vertex:vk,beginnormal_vertex:yk,bsdfs:bk,iridescence_fragment:xk,bumpmap_pars_fragment:wk,clipping_planes_fragment:Sk,clipping_planes_pars_fragment:Mk,clipping_planes_pars_vertex:Ek,clipping_planes_vertex:Tk,color_fragment:Ak,color_pars_fragment:Ck,color_pars_vertex:Rk,color_vertex:Pk,common:Lk,cube_uv_reflection_fragment:Ik,defaultnormal_vertex:Dk,displacementmap_pars_vertex:kk,displacementmap_vertex:Fk,emissivemap_fragment:Uk,emissivemap_pars_fragment:Ok,colorspace_fragment:Nk,colorspace_pars_fragment:Bk,envmap_fragment:zk,envmap_common_pars_fragment:Hk,envmap_pars_fragment:Gk,envmap_pars_vertex:Vk,envmap_physical_pars_fragment:e3,envmap_vertex:Wk,fog_vertex:jk,fog_pars_vertex:Xk,fog_fragment:Yk,fog_pars_fragment:$k,gradientmap_pars_fragment:qk,lightmap_pars_fragment:Kk,lights_lambert_fragment:Zk,lights_lambert_pars_fragment:Qk,lights_pars_begin:Jk,lights_toon_fragment:t3,lights_toon_pars_fragment:n3,lights_phong_fragment:i3,lights_phong_pars_fragment:r3,lights_physical_fragment:s3,lights_physical_pars_fragment:a3,lights_fragment_begin:o3,lights_fragment_maps:l3,lights_fragment_end:c3,logdepthbuf_fragment:u3,logdepthbuf_pars_fragment:d3,logdepthbuf_pars_vertex:h3,logdepthbuf_vertex:f3,map_fragment:p3,map_pars_fragment:m3,map_particle_fragment:g3,map_particle_pars_fragment:_3,metalnessmap_fragment:v3,metalnessmap_pars_fragment:y3,morphinstance_vertex:b3,morphcolor_vertex:x3,morphnormal_vertex:w3,morphtarget_pars_vertex:S3,morphtarget_vertex:M3,normal_fragment_begin:E3,normal_fragment_maps:T3,normal_pars_fragment:A3,normal_pars_vertex:C3,normal_vertex:R3,normalmap_pars_fragment:P3,clearcoat_normal_fragment_begin:L3,clearcoat_normal_fragment_maps:I3,clearcoat_pars_fragment:D3,iridescence_pars_fragment:k3,opaque_fragment:F3,packing:U3,premultiplied_alpha_fragment:O3,project_vertex:N3,dithering_fragment:B3,dithering_pars_fragment:z3,roughnessmap_fragment:H3,roughnessmap_pars_fragment:G3,shadowmap_pars_fragment:V3,shadowmap_pars_vertex:W3,shadowmap_vertex:j3,shadowmask_pars_fragment:X3,skinbase_vertex:Y3,skinning_pars_vertex:$3,skinning_vertex:q3,skinnormal_vertex:K3,specularmap_fragment:Z3,specularmap_pars_fragment:Q3,tonemapping_fragment:J3,tonemapping_pars_fragment:eF,transmission_fragment:tF,transmission_pars_fragment:nF,uv_pars_fragment:iF,uv_pars_vertex:rF,uv_vertex:sF,worldpos_vertex:aF,background_vert:oF,background_frag:lF,backgroundCube_vert:cF,backgroundCube_frag:uF,cube_vert:dF,cube_frag:hF,depth_vert:fF,depth_frag:pF,distanceRGBA_vert:mF,distanceRGBA_frag:gF,equirect_vert:_F,equirect_frag:vF,linedashed_vert:yF,linedashed_frag:bF,meshbasic_vert:xF,meshbasic_frag:wF,meshlambert_vert:SF,meshlambert_frag:MF,meshmatcap_vert:EF,meshmatcap_frag:TF,meshnormal_vert:AF,meshnormal_frag:CF,meshphong_vert:RF,meshphong_frag:PF,meshphysical_vert:LF,meshphysical_frag:IF,meshtoon_vert:DF,meshtoon_frag:kF,points_vert:FF,points_frag:UF,shadow_vert:OF,shadow_frag:NF,sprite_vert:BF,sprite_frag:zF},Ze={common:{diffuse:{value:new Je(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new At},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new At}},envmap:{envMap:{value:null},envMapRotation:{value:new At},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new At}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new At}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new At},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new At},normalScale:{value:new et(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new At},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new At}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new At}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new At}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Je(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 Je(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0},uvTransform:{value:new At}},sprite:{diffuse:{value:new Je(16777215)},opacity:{value:1},center:{value:new et(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new At},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0}}},ki={basic:{uniforms:bi([Ze.common,Ze.specularmap,Ze.envmap,Ze.aomap,Ze.lightmap,Ze.fog]),vertexShader:xt.meshbasic_vert,fragmentShader:xt.meshbasic_frag},lambert:{uniforms:bi([Ze.common,Ze.specularmap,Ze.envmap,Ze.aomap,Ze.lightmap,Ze.emissivemap,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.fog,Ze.lights,{emissive:{value:new Je(0)}}]),vertexShader:xt.meshlambert_vert,fragmentShader:xt.meshlambert_frag},phong:{uniforms:bi([Ze.common,Ze.specularmap,Ze.envmap,Ze.aomap,Ze.lightmap,Ze.emissivemap,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.fog,Ze.lights,{emissive:{value:new Je(0)},specular:{value:new Je(1118481)},shininess:{value:30}}]),vertexShader:xt.meshphong_vert,fragmentShader:xt.meshphong_frag},standard:{uniforms:bi([Ze.common,Ze.envmap,Ze.aomap,Ze.lightmap,Ze.emissivemap,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.roughnessmap,Ze.metalnessmap,Ze.fog,Ze.lights,{emissive:{value:new Je(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag},toon:{uniforms:bi([Ze.common,Ze.aomap,Ze.lightmap,Ze.emissivemap,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.gradientmap,Ze.fog,Ze.lights,{emissive:{value:new Je(0)}}]),vertexShader:xt.meshtoon_vert,fragmentShader:xt.meshtoon_frag},matcap:{uniforms:bi([Ze.common,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,Ze.fog,{matcap:{value:null}}]),vertexShader:xt.meshmatcap_vert,fragmentShader:xt.meshmatcap_frag},points:{uniforms:bi([Ze.points,Ze.fog]),vertexShader:xt.points_vert,fragmentShader:xt.points_frag},dashed:{uniforms:bi([Ze.common,Ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xt.linedashed_vert,fragmentShader:xt.linedashed_frag},depth:{uniforms:bi([Ze.common,Ze.displacementmap]),vertexShader:xt.depth_vert,fragmentShader:xt.depth_frag},normal:{uniforms:bi([Ze.common,Ze.bumpmap,Ze.normalmap,Ze.displacementmap,{opacity:{value:1}}]),vertexShader:xt.meshnormal_vert,fragmentShader:xt.meshnormal_frag},sprite:{uniforms:bi([Ze.sprite,Ze.fog]),vertexShader:xt.sprite_vert,fragmentShader:xt.sprite_frag},background:{uniforms:{uvTransform:{value:new At},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:xt.background_vert,fragmentShader:xt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new At}},vertexShader:xt.backgroundCube_vert,fragmentShader:xt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xt.cube_vert,fragmentShader:xt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xt.equirect_vert,fragmentShader:xt.equirect_frag},distanceRGBA:{uniforms:bi([Ze.common,Ze.displacementmap,{referencePosition:{value:new j},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xt.distanceRGBA_vert,fragmentShader:xt.distanceRGBA_frag},shadow:{uniforms:bi([Ze.lights,Ze.fog,{color:{value:new Je(0)},opacity:{value:1}}]),vertexShader:xt.shadow_vert,fragmentShader:xt.shadow_frag}};ki.physical={uniforms:bi([ki.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new At},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new At},clearcoatNormalScale:{value:new et(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new At},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new At},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new At},sheen:{value:0},sheenColor:{value:new Je(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new At},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new At},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new At},transmissionSamplerSize:{value:new et},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new At},attenuationDistance:{value:0},attenuationColor:{value:new Je(0)},specularColor:{value:new Je(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new At},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new At},anisotropyVector:{value:new et},anisotropyMap:{value:null},anisotropyMapTransform:{value:new At}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag};const Qu={r:0,b:0,g:0},da=new Pn,HF=new ot;function GF(n,e,t,i,r,s,a){const l=new Je(0);let d=s===!0?0:1,h,m,u=null,g=0,v=null;function w(A){let E=A.isScene===!0?A.background:null;return E&&E.isTexture&&(E=(A.backgroundBlurriness>0?t:e).get(E)),E}function T(A){let E=!1;const P=w(A);P===null?b(l,d):P&&P.isColor&&(b(P,1),E=!0);const G=n.xr.getEnvironmentBlendMode();G==="additive"?i.buffers.color.setClear(0,0,0,1,a):G==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(n.autoClear||E)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function M(A,E){const P=w(E);P&&(P.isCubeTexture||P.mapping===zh)?(m===void 0&&(m=new wn(new Xc(1,1,1),new zi({name:"BackgroundCubeMaterial",uniforms:rl(ki.backgroundCube.uniforms),vertexShader:ki.backgroundCube.vertexShader,fragmentShader:ki.backgroundCube.fragmentShader,side:Ei,depthTest:!1,depthWrite:!1,fog:!1})),m.geometry.deleteAttribute("normal"),m.geometry.deleteAttribute("uv"),m.onBeforeRender=function(G,O,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(m.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(m)),da.copy(E.backgroundRotation),da.x*=-1,da.y*=-1,da.z*=-1,P.isCubeTexture&&P.isRenderTargetTexture===!1&&(da.y*=-1,da.z*=-1),m.material.uniforms.envMap.value=P,m.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,m.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,m.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,m.material.uniforms.backgroundRotation.value.setFromMatrix4(HF.makeRotationFromEuler(da)),m.material.toneMapped=Kt.getTransfer(P.colorSpace)!==pn,(u!==P||g!==P.version||v!==n.toneMapping)&&(m.material.needsUpdate=!0,u=P,g=P.version,v=n.toneMapping),m.layers.enableAll(),A.unshift(m,m.geometry,m.material,0,0,null)):P&&P.isTexture&&(h===void 0&&(h=new wn(new Yc(2,2),new zi({name:"BackgroundMaterial",uniforms:rl(ki.background.uniforms),vertexShader:ki.background.vertexShader,fragmentShader:ki.background.fragmentShader,side:gs,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(h)),h.material.uniforms.t2D.value=P,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.toneMapped=Kt.getTransfer(P.colorSpace)!==pn,P.matrixAutoUpdate===!0&&P.updateMatrix(),h.material.uniforms.uvTransform.value.copy(P.matrix),(u!==P||g!==P.version||v!==n.toneMapping)&&(h.material.needsUpdate=!0,u=P,g=P.version,v=n.toneMapping),h.layers.enableAll(),A.unshift(h,h.geometry,h.material,0,0,null))}function b(A,E){A.getRGB(Qu,TE(n)),i.buffers.color.setClear(Qu.r,Qu.g,Qu.b,E,a)}return{getClearColor:function(){return l},setClearColor:function(A,E=1){l.set(A),d=E,b(l,d)},getClearAlpha:function(){return d},setClearAlpha:function(A){d=A,b(l,d)},render:T,addToRenderList:M}}function VF(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=g(null);let s=r,a=!1;function l(L,V,ie,re,de){let me=!1;const $=u(re,ie,V);s!==$&&(s=$,h(s.object)),me=v(L,re,ie,de),me&&w(L,re,ie,de),de!==null&&e.update(de,n.ELEMENT_ARRAY_BUFFER),(me||a)&&(a=!1,P(L,V,ie,re),de!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(de).buffer))}function d(){return n.createVertexArray()}function h(L){return n.bindVertexArray(L)}function m(L){return n.deleteVertexArray(L)}function u(L,V,ie){const re=ie.wireframe===!0;let de=i[L.id];de===void 0&&(de={},i[L.id]=de);let me=de[V.id];me===void 0&&(me={},de[V.id]=me);let $=me[re];return $===void 0&&($=g(d()),me[re]=$),$}function g(L){const V=[],ie=[],re=[];for(let de=0;de<t;de++)V[de]=0,ie[de]=0,re[de]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:V,enabledAttributes:ie,attributeDivisors:re,object:L,attributes:{},index:null}}function v(L,V,ie,re){const de=s.attributes,me=V.attributes;let $=0;const ue=ie.getAttributes();for(const Y in ue)if(ue[Y].location>=0){const _e=de[Y];let Ae=me[Y];if(Ae===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(Ae=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(Ae=L.instanceColor)),_e===void 0||_e.attribute!==Ae||Ae&&_e.data!==Ae.data)return!0;$++}return s.attributesNum!==$||s.index!==re}function w(L,V,ie,re){const de={},me=V.attributes;let $=0;const ue=ie.getAttributes();for(const Y in ue)if(ue[Y].location>=0){let _e=me[Y];_e===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(_e=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(_e=L.instanceColor));const Ae={};Ae.attribute=_e,_e&&_e.data&&(Ae.data=_e.data),de[Y]=Ae,$++}s.attributes=de,s.attributesNum=$,s.index=re}function T(){const L=s.newAttributes;for(let V=0,ie=L.length;V<ie;V++)L[V]=0}function M(L){b(L,0)}function b(L,V){const ie=s.newAttributes,re=s.enabledAttributes,de=s.attributeDivisors;ie[L]=1,re[L]===0&&(n.enableVertexAttribArray(L),re[L]=1),de[L]!==V&&(n.vertexAttribDivisor(L,V),de[L]=V)}function A(){const L=s.newAttributes,V=s.enabledAttributes;for(let ie=0,re=V.length;ie<re;ie++)V[ie]!==L[ie]&&(n.disableVertexAttribArray(ie),V[ie]=0)}function E(L,V,ie,re,de,me,$){$===!0?n.vertexAttribIPointer(L,V,ie,de,me):n.vertexAttribPointer(L,V,ie,re,de,me)}function P(L,V,ie,re){T();const de=re.attributes,me=ie.getAttributes(),$=V.defaultAttributeValues;for(const ue in me){const Y=me[ue];if(Y.location>=0){let pe=de[ue];if(pe===void 0&&(ue==="instanceMatrix"&&L.instanceMatrix&&(pe=L.instanceMatrix),ue==="instanceColor"&&L.instanceColor&&(pe=L.instanceColor)),pe!==void 0){const _e=pe.normalized,Ae=pe.itemSize,Pe=e.get(pe);if(Pe===void 0)continue;const Ue=Pe.buffer,ae=Pe.type,ge=Pe.bytesPerElement,ce=ae===n.INT||ae===n.UNSIGNED_INT||pe.gpuType===v_;if(pe.isInterleavedBufferAttribute){const Me=pe.data,Ye=Me.stride,ht=pe.offset;if(Me.isInstancedInterleavedBuffer){for(let ft=0;ft<Y.locationSize;ft++)b(Y.location+ft,Me.meshPerAttribute);L.isInstancedMesh!==!0&&re._maxInstanceCount===void 0&&(re._maxInstanceCount=Me.meshPerAttribute*Me.count)}else for(let ft=0;ft<Y.locationSize;ft++)M(Y.location+ft);n.bindBuffer(n.ARRAY_BUFFER,Ue);for(let ft=0;ft<Y.locationSize;ft++)E(Y.location+ft,Ae/Y.locationSize,ae,_e,Ye*ge,(ht+Ae/Y.locationSize*ft)*ge,ce)}else{if(pe.isInstancedBufferAttribute){for(let Me=0;Me<Y.locationSize;Me++)b(Y.location+Me,pe.meshPerAttribute);L.isInstancedMesh!==!0&&re._maxInstanceCount===void 0&&(re._maxInstanceCount=pe.meshPerAttribute*pe.count)}else for(let Me=0;Me<Y.locationSize;Me++)M(Y.location+Me);n.bindBuffer(n.ARRAY_BUFFER,Ue);for(let Me=0;Me<Y.locationSize;Me++)E(Y.location+Me,Ae/Y.locationSize,ae,_e,Ae*ge,Ae/Y.locationSize*Me*ge,ce)}}else if($!==void 0){const _e=$[ue];if(_e!==void 0)switch(_e.length){case 2:n.vertexAttrib2fv(Y.location,_e);break;case 3:n.vertexAttrib3fv(Y.location,_e);break;case 4:n.vertexAttrib4fv(Y.location,_e);break;default:n.vertexAttrib1fv(Y.location,_e)}}}}A()}function G(){F();for(const L in i){const V=i[L];for(const ie in V){const re=V[ie];for(const de in re)m(re[de].object),delete re[de];delete V[ie]}delete i[L]}}function O(L){if(i[L.id]===void 0)return;const V=i[L.id];for(const ie in V){const re=V[ie];for(const de in re)m(re[de].object),delete re[de];delete V[ie]}delete i[L.id]}function B(L){for(const V in i){const ie=i[V];if(ie[L.id]===void 0)continue;const re=ie[L.id];for(const de in re)m(re[de].object),delete re[de];delete ie[L.id]}}function F(){D(),a=!0,s!==r&&(s=r,h(s.object))}function D(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:l,reset:F,resetDefaultState:D,dispose:G,releaseStatesOfGeometry:O,releaseStatesOfProgram:B,initAttributes:T,enableAttribute:M,disableUnusedAttributes:A}}function WF(n,e,t){let i;function r(h){i=h}function s(h,m){n.drawArrays(i,h,m),t.update(m,i,1)}function a(h,m,u){u!==0&&(n.drawArraysInstanced(i,h,m,u),t.update(m,i,u))}function l(h,m,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,h,0,m,0,u);let v=0;for(let w=0;w<u;w++)v+=m[w];t.update(v,i,1)}function d(h,m,u,g){if(u===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let w=0;w<h.length;w++)a(h[w],m[w],g[w]);else{v.multiDrawArraysInstancedWEBGL(i,h,0,m,0,g,0,u);let w=0;for(let T=0;T<u;T++)w+=m[T];for(let T=0;T<g.length;T++)t.update(w,i,g[T])}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=l,this.renderMultiDrawInstances=d}function jF(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const O=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(O.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(O){return!(O!==Vn&&i.convert(O)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(O){const B=O===gi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(O!==Bi&&i.convert(O)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&O!==Un&&!B)}function d(O){if(O==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";O="mediump"}return O==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const m=d(h);m!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",m,"instead."),h=m);const u=t.logarithmicDepthBuffer===!0,g=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=n.getParameter(n.MAX_TEXTURE_SIZE),T=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),M=n.getParameter(n.MAX_VERTEX_ATTRIBS),b=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),A=n.getParameter(n.MAX_VARYING_VECTORS),E=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),P=v>0,G=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:d,textureFormatReadable:a,textureTypeReadable:l,precision:h,logarithmicDepthBuffer:u,maxTextures:g,maxVertexTextures:v,maxTextureSize:w,maxCubemapSize:T,maxAttributes:M,maxVertexUniforms:b,maxVaryings:A,maxFragmentUniforms:E,vertexTextures:P,maxSamples:G}}function XF(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new ga,l=new At,d={value:null,needsUpdate:!1};this.uniform=d,this.numPlanes=0,this.numIntersection=0,this.init=function(u,g){const v=u.length!==0||g||i!==0||r;return r=g,i=u.length,v},this.beginShadows=function(){s=!0,m(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,g){t=m(u,g,0)},this.setState=function(u,g,v){const w=u.clippingPlanes,T=u.clipIntersection,M=u.clipShadows,b=n.get(u);if(!r||w===null||w.length===0||s&&!M)s?m(null):h();else{const A=s?0:i,E=A*4;let P=b.clippingState||null;d.value=P,P=m(w,g,E,v);for(let G=0;G!==E;++G)P[G]=t[G];b.clippingState=P,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=A}};function h(){d.value!==t&&(d.value=t,d.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function m(u,g,v,w){const T=u!==null?u.length:0;let M=null;if(T!==0){if(M=d.value,w!==!0||M===null){const b=v+T*4,A=g.matrixWorldInverse;l.getNormalMatrix(A),(M===null||M.length<b)&&(M=new Float32Array(b));for(let E=0,P=v;E!==T;++E,P+=4)a.copy(u[E]).applyMatrix4(A,l),a.normal.toArray(M,P),M[P+3]=a.constant}d.value=M,d.needsUpdate=!0}return e.numPlanes=T,e.numIntersection=0,M}}function YF(n){let e=new WeakMap;function t(a,l){return l===el?a.mapping=Qo:l===Im&&(a.mapping=Jo),a}function i(a){if(a&&a.isTexture){const l=a.mapping;if(l===el||l===Im)if(e.has(a)){const d=e.get(a).texture;return t(d,a.mapping)}else{const d=a.image;if(d&&d.height>0){const h=new LE(d.height);return h.fromEquirectangularTexture(n,a),e.set(a,h),a.addEventListener("dispose",r),t(h.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const d=e.get(l);d!==void 0&&(e.delete(l),d.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class dl extends CE{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,l=r+t,d=r-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,a=s+h*this.view.width,l-=m*this.view.offsetY,d=l-m*this.view.height}this.projectionMatrix.makeOrthographic(s,a,l,d,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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const To=4,Cw=[.125,.215,.35,.446,.526,.582],ba=20,dp=new dl,Rw=new Je;let hp=null,fp=0,pp=0,mp=!1;const _a=(1+Math.sqrt(5))/2,oo=1/_a,Pw=[new j(-_a,oo,0),new j(_a,oo,0),new j(-oo,0,_a),new j(oo,0,_a),new j(0,_a,-oo),new j(0,_a,oo),new j(-1,1,-1),new j(1,1,-1),new j(-1,1,1),new j(1,1,1)];class gh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){hp=this._renderer.getRenderTarget(),fp=this._renderer.getActiveCubeFace(),pp=this._renderer.getActiveMipmapLevel(),mp=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Dw(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Iw(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(hp,fp,pp),this._renderer.xr.enabled=mp,e.scissorTest=!1,Ju(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Qo||e.mapping===Jo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),hp=this._renderer.getRenderTarget(),fp=this._renderer.getActiveCubeFace(),pp=this._renderer.getActiveMipmapLevel(),mp=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:ln,minFilter:ln,generateMipmaps:!1,type:gi,format:Vn,colorSpace:Sn,depthBuffer:!1},r=Lw(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Lw(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=$F(s)),this._blurMaterial=qF(s,e,t)}return r}_compileMaterial(e){const t=new wn(this._lodPlanes[0],e);this._renderer.compile(t,dp)}_sceneToCubeUV(e,t,i,r){const l=new mi(90,1,t,i),d=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],m=this._renderer,u=m.autoClear,g=m.toneMapping;m.getClearColor(Rw),m.toneMapping=$s,m.autoClear=!1;const v=new Or({name:"PMREM.Background",side:Ei,depthWrite:!1,depthTest:!1}),w=new wn(new Xc,v);let T=!1;const M=e.background;M?M.isColor&&(v.color.copy(M),e.background=null,T=!0):(v.color.copy(Rw),T=!0);for(let b=0;b<6;b++){const A=b%3;A===0?(l.up.set(0,d[b],0),l.lookAt(h[b],0,0)):A===1?(l.up.set(0,0,d[b]),l.lookAt(0,h[b],0)):(l.up.set(0,d[b],0),l.lookAt(0,0,h[b]));const E=this._cubeSize;Ju(r,A*E,b>2?E:0,E,E),m.setRenderTarget(r),T&&m.render(w,l),m.render(e,l)}w.geometry.dispose(),w.material.dispose(),m.toneMapping=g,m.autoClear=u,e.background=M}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Qo||e.mapping===Jo;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Dw()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Iw());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new wn(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const d=this._cubeSize;Ju(t,0,0,3*d,2*d),i.setRenderTarget(t),i.render(a,dp)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),l=Pw[(r-s-1)%Pw.length];this._blur(e,s-1,s,a,l)}t.autoClear=i}_blur(e,t,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,l){const d=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const m=3,u=new wn(this._lodPlanes[r],h),g=h.uniforms,v=this._sizeLods[i]-1,w=isFinite(s)?Math.PI/(2*v):2*Math.PI/(2*ba-1),T=s/w,M=isFinite(s)?1+Math.floor(m*T):ba;M>ba&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${M} samples when the maximum is set to ${ba}`);const b=[];let A=0;for(let B=0;B<ba;++B){const F=B/T,D=Math.exp(-F*F/2);b.push(D),B===0?A+=D:B<M&&(A+=2*D)}for(let B=0;B<b.length;B++)b[B]=b[B]/A;g.envMap.value=e.texture,g.samples.value=M,g.weights.value=b,g.latitudinal.value=a==="latitudinal",l&&(g.poleAxis.value=l);const{_lodMax:E}=this;g.dTheta.value=w,g.mipInt.value=E-i;const P=this._sizeLods[r],G=3*P*(r>E-To?r-E+To:0),O=4*(this._cubeSize-P);Ju(t,G,O,3*P,2*P),d.setRenderTarget(t),d.render(u,dp)}}function $F(n){const e=[],t=[],i=[];let r=n;const s=n-To+1+Cw.length;for(let a=0;a<s;a++){const l=Math.pow(2,r);t.push(l);let d=1/l;a>n-To?d=Cw[a-n+To-1]:a===0&&(d=0),i.push(d);const h=1/(l-2),m=-h,u=1+h,g=[m,m,u,m,u,u,m,m,u,u,m,u],v=6,w=6,T=3,M=2,b=1,A=new Float32Array(T*w*v),E=new Float32Array(M*w*v),P=new Float32Array(b*w*v);for(let O=0;O<v;O++){const B=O%3*2/3-1,F=O>2?0:-1,D=[B,F,0,B+2/3,F,0,B+2/3,F+1,0,B,F,0,B+2/3,F+1,0,B,F+1,0];A.set(D,T*w*O),E.set(g,M*w*O);const L=[O,O,O,O,O,O];P.set(L,b*w*O)}const G=new On;G.setAttribute("position",new _n(A,T)),G.setAttribute("uv",new _n(E,M)),G.setAttribute("faceIndex",new _n(P,b)),e.push(G),r>To&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function Lw(n,e,t){const i=new Zs(n,e,t);return i.texture.mapping=zh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ju(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function qF(n,e,t){const i=new Float32Array(ba),r=new j(0,1,0);return new zi({name:"SphericalGaussianBlur",defines:{n:ba,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:P_(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
}
`,blending:Gr,depthTest:!1,depthWrite:!1})}function Iw(){return new zi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:P_(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
`,blending:Gr,depthTest:!1,depthWrite:!1})}function Dw(){return new zi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:P_(),fragmentShader:`
precision mediump float;
precision mediump int;
uniform float flipEnvMap;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
`,blending:Gr,depthTest:!1,depthWrite:!1})}function P_(){return`
precision mediump float;
precision mediump int;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function KF(n){let e=new WeakMap,t=null;function i(l){if(l&&l.isTexture){const d=l.mapping,h=d===el||d===Im,m=d===Qo||d===Jo;if(h||m){let u=e.get(l);const g=u!==void 0?u.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==g)return t===null&&(t=new gh(n)),u=h?t.fromEquirectangular(l,u):t.fromCubemap(l,u),u.texture.pmremVersion=l.pmremVersion,e.set(l,u),u.texture;if(u!==void 0)return u.texture;{const v=l.image;return h&&v&&v.height>0||m&&v&&r(v)?(t===null&&(t=new gh(n)),u=h?t.fromEquirectangular(l):t.fromCubemap(l),u.texture.pmremVersion=l.pmremVersion,e.set(l,u),l.addEventListener("dispose",s),u.texture):null}}}return l}function r(l){let d=0;const h=6;for(let m=0;m<h;m++)l[m]!==void 0&&d++;return d===h}function s(l){const d=l.target;d.removeEventListener("dispose",s);const h=e.get(d);h!==void 0&&(e.delete(d),h.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:a}}function ZF(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&T_("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function QF(n,e,t,i){const r={},s=new WeakMap;function a(u){const g=u.target;g.index!==null&&e.remove(g.index);for(const w in g.attributes)e.remove(g.attributes[w]);for(const w in g.morphAttributes){const T=g.morphAttributes[w];for(let M=0,b=T.length;M<b;M++)e.remove(T[M])}g.removeEventListener("dispose",a),delete r[g.id];const v=s.get(g);v&&(e.remove(v),s.delete(g)),i.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,t.memory.geometries--}function l(u,g){return r[g.id]===!0||(g.addEventListener("dispose",a),r[g.id]=!0,t.memory.geometries++),g}function d(u){const g=u.attributes;for(const w in g)e.update(g[w],n.ARRAY_BUFFER);const v=u.morphAttributes;for(const w in v){const T=v[w];for(let M=0,b=T.length;M<b;M++)e.update(T[M],n.ARRAY_BUFFER)}}function h(u){const g=[],v=u.index,w=u.attributes.position;let T=0;if(v!==null){const A=v.array;T=v.version;for(let E=0,P=A.length;E<P;E+=3){const G=A[E+0],O=A[E+1],B=A[E+2];g.push(G,O,O,B,B,G)}}else if(w!==void 0){const A=w.array;T=w.version;for(let E=0,P=A.length/3-1;E<P;E+=3){const G=E+0,O=E+1,B=E+2;g.push(G,O,O,B,B,G)}}else return;const M=new(xE(g)?EE:C_)(g,1);M.version=T;const b=s.get(u);b&&e.remove(b),s.set(u,M)}function m(u){const g=s.get(u);if(g){const v=u.index;v!==null&&g.version<v.version&&h(u)}else h(u);return s.get(u)}return{get:l,update:d,getWireframeAttribute:m}}function JF(n,e,t){let i;function r(g){i=g}let s,a;function l(g){s=g.type,a=g.bytesPerElement}function d(g,v){n.drawElements(i,v,s,g*a),t.update(v,i,1)}function h(g,v,w){w!==0&&(n.drawElementsInstanced(i,v,s,g*a,w),t.update(v,i,w))}function m(g,v,w){if(w===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,v,0,s,g,0,w);let M=0;for(let b=0;b<w;b++)M+=v[b];t.update(M,i,1)}function u(g,v,w,T){if(w===0)return;const M=e.get("WEBGL_multi_draw");if(M===null)for(let b=0;b<g.length;b++)h(g[b]/a,v[b],T[b]);else{M.multiDrawElementsInstancedWEBGL(i,v,0,s,g,0,T,0,w);let b=0;for(let A=0;A<w;A++)b+=v[A];for(let A=0;A<T.length;A++)t.update(b,i,T[A])}}this.setMode=r,this.setIndex=l,this.render=d,this.renderInstances=h,this.renderMultiDraw=m,this.renderMultiDrawInstances=u}function eU(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,l){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=l*(s/3);break;case n.LINES:t.lines+=l*(s/2);break;case n.LINE_STRIP:t.lines+=l*(s-1);break;case n.LINE_LOOP:t.lines+=l*s;break;case n.POINTS:t.points+=l*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function tU(n,e,t){const i=new WeakMap,r=new $t;function s(a,l,d){const h=a.morphTargetInfluences,m=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,u=m!==void 0?m.length:0;let g=i.get(l);if(g===void 0||g.count!==u){let L=function(){F.dispose(),i.delete(l),l.removeEventListener("dispose",L)};var v=L;g!==void 0&&g.texture.dispose();const w=l.morphAttributes.position!==void 0,T=l.morphAttributes.normal!==void 0,M=l.morphAttributes.color!==void 0,b=l.morphAttributes.position||[],A=l.morphAttributes.normal||[],E=l.morphAttributes.color||[];let P=0;w===!0&&(P=1),T===!0&&(P=2),M===!0&&(P=3);let G=l.attributes.position.count*P,O=1;G>e.maxTextureSize&&(O=Math.ceil(G/e.maxTextureSize),G=e.maxTextureSize);const B=new Float32Array(G*O*4*u),F=new SE(B,G,O,u);F.type=Un,F.needsUpdate=!0;const D=P*4;for(let V=0;V<u;V++){const ie=b[V],re=A[V],de=E[V],me=G*O*4*V;for(let $=0;$<ie.count;$++){const ue=$*D;w===!0&&(r.fromBufferAttribute(ie,$),B[me+ue+0]=r.x,B[me+ue+1]=r.y,B[me+ue+2]=r.z,B[me+ue+3]=0),T===!0&&(r.fromBufferAttribute(re,$),B[me+ue+4]=r.x,B[me+ue+5]=r.y,B[me+ue+6]=r.z,B[me+ue+7]=0),M===!0&&(r.fromBufferAttribute(de,$),B[me+ue+8]=r.x,B[me+ue+9]=r.y,B[me+ue+10]=r.z,B[me+ue+11]=de.itemSize===4?r.w:1)}}g={count:u,texture:F,size:new et(G,O)},i.set(l,g),l.addEventListener("dispose",L)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)d.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let w=0;for(let M=0;M<h.length;M++)w+=h[M];const T=l.morphTargetsRelative?1:1-w;d.getUniforms().setValue(n,"morphTargetBaseInfluence",T),d.getUniforms().setValue(n,"morphTargetInfluences",h)}d.getUniforms().setValue(n,"morphTargetsTexture",g.texture,t),d.getUniforms().setValue(n,"morphTargetsTextureSize",g.size)}return{update:s}}function nU(n,e,t,i){let r=new WeakMap;function s(d){const h=i.render.frame,m=d.geometry,u=e.get(d,m);if(r.get(u)!==h&&(e.update(u),r.set(u,h)),d.isInstancedMesh&&(d.hasEventListener("dispose",l)===!1&&d.addEventListener("dispose",l),r.get(d)!==h&&(t.update(d.instanceMatrix,n.ARRAY_BUFFER),d.instanceColor!==null&&t.update(d.instanceColor,n.ARRAY_BUFFER),r.set(d,h))),d.isSkinnedMesh){const g=d.skeleton;r.get(g)!==h&&(g.update(),r.set(g,h))}return u}function a(){r=new WeakMap}function l(d){const h=d.target;h.removeEventListener("dispose",l),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:s,dispose:a}}class DE extends qn{constructor(e,t,i,r,s,a,l,d,h,m=Bo){if(m!==Bo&&m!==nl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&m===Bo&&(i=Da),i===void 0&&m===nl&&(i=tl),super(null,r,s,a,l,d,m,i,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=l!==void 0?l:Fn,this.minFilter=d!==void 0?d:Fn,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 this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const kE=new qn,kw=new DE(1,1),FE=new SE,UE=new GD,OE=new PE,Fw=[],Uw=[],Ow=new Float32Array(16),Nw=new Float32Array(9),Bw=new Float32Array(4);function hl(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=Fw[r];if(s===void 0&&(s=new Float32Array(r),Fw[r]=s),e!==0){i.toArray(s,0);for(let a=1,l=0;a!==e;++a)l+=t,n[a].toArray(s,l)}return s}function Kn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Zn(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Gh(n,e){let t=Uw[e];t===void 0&&(t=new Int32Array(e),Uw[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function iU(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function rU(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Kn(t,e))return;n.uniform2fv(this.addr,e),Zn(t,e)}}function sU(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Kn(t,e))return;n.uniform3fv(this.addr,e),Zn(t,e)}}function aU(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Kn(t,e))return;n.uniform4fv(this.addr,e),Zn(t,e)}}function oU(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Kn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Zn(t,e)}else{if(Kn(t,i))return;Bw.set(i),n.uniformMatrix2fv(this.addr,!1,Bw),Zn(t,i)}}function lU(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Kn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Zn(t,e)}else{if(Kn(t,i))return;Nw.set(i),n.uniformMatrix3fv(this.addr,!1,Nw),Zn(t,i)}}function cU(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Kn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Zn(t,e)}else{if(Kn(t,i))return;Ow.set(i),n.uniformMatrix4fv(this.addr,!1,Ow),Zn(t,i)}}function uU(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function dU(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Kn(t,e))return;n.uniform2iv(this.addr,e),Zn(t,e)}}function hU(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Kn(t,e))return;n.uniform3iv(this.addr,e),Zn(t,e)}}function fU(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Kn(t,e))return;n.uniform4iv(this.addr,e),Zn(t,e)}}function pU(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function mU(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Kn(t,e))return;n.uniform2uiv(this.addr,e),Zn(t,e)}}function gU(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Kn(t,e))return;n.uniform3uiv(this.addr,e),Zn(t,e)}}function _U(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Kn(t,e))return;n.uniform4uiv(this.addr,e),Zn(t,e)}}function vU(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(kw.compareFunction=bE,s=kw):s=kE,t.setTexture2D(e||s,r)}function yU(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||UE,r)}function bU(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||OE,r)}function xU(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||FE,r)}function wU(n){switch(n){case 5126:return iU;case 35664:return rU;case 35665:return sU;case 35666:return aU;case 35674:return oU;case 35675:return lU;case 35676:return cU;case 5124:case 35670:return uU;case 35667:case 35671:return dU;case 35668:case 35672:return hU;case 35669:case 35673:return fU;case 5125:return pU;case 36294:return mU;case 36295:return gU;case 36296:return _U;case 35678:case 36198:case 36298:case 36306:case 35682:return vU;case 35679:case 36299:case 36307:return yU;case 35680:case 36300:case 36308:case 36293:return bU;case 36289:case 36303:case 36311:case 36292:return xU}}function SU(n,e){n.uniform1fv(this.addr,e)}function MU(n,e){const t=hl(e,this.size,2);n.uniform2fv(this.addr,t)}function EU(n,e){const t=hl(e,this.size,3);n.uniform3fv(this.addr,t)}function TU(n,e){const t=hl(e,this.size,4);n.uniform4fv(this.addr,t)}function AU(n,e){const t=hl(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function CU(n,e){const t=hl(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function RU(n,e){const t=hl(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function PU(n,e){n.uniform1iv(this.addr,e)}function LU(n,e){n.uniform2iv(this.addr,e)}function IU(n,e){n.uniform3iv(this.addr,e)}function DU(n,e){n.uniform4iv(this.addr,e)}function kU(n,e){n.uniform1uiv(this.addr,e)}function FU(n,e){n.uniform2uiv(this.addr,e)}function UU(n,e){n.uniform3uiv(this.addr,e)}function OU(n,e){n.uniform4uiv(this.addr,e)}function NU(n,e,t){const i=this.cache,r=e.length,s=Gh(t,r);Kn(i,s)||(n.uniform1iv(this.addr,s),Zn(i,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||kE,s[a])}function BU(n,e,t){const i=this.cache,r=e.length,s=Gh(t,r);Kn(i,s)||(n.uniform1iv(this.addr,s),Zn(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||UE,s[a])}function zU(n,e,t){const i=this.cache,r=e.length,s=Gh(t,r);Kn(i,s)||(n.uniform1iv(this.addr,s),Zn(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||OE,s[a])}function HU(n,e,t){const i=this.cache,r=e.length,s=Gh(t,r);Kn(i,s)||(n.uniform1iv(this.addr,s),Zn(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||FE,s[a])}function GU(n){switch(n){case 5126:return SU;case 35664:return MU;case 35665:return EU;case 35666:return TU;case 35674:return AU;case 35675:return CU;case 35676:return RU;case 5124:case 35670:return PU;case 35667:case 35671:return LU;case 35668:case 35672:return IU;case 35669:case 35673:return DU;case 5125:return kU;case 36294:return FU;case 36295:return UU;case 36296:return OU;case 35678:case 36198:case 36298:case 36306:case 35682:return NU;case 35679:case 36299:case 36307:return BU;case 35680:case 36300:case 36308:case 36293:return zU;case 36289:case 36303:case 36311:case 36292:return HU}}class VU{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=wU(t.type)}}class WU{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=GU(t.type)}}class jU{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const l=r[s];l.setValue(e,t[l.id],i)}}}const gp=/(\w+)(\])?(\[|\.)?/g;function zw(n,e){n.seq.push(e),n.map[e.id]=e}function XU(n,e,t){const i=n.name,r=i.length;for(gp.lastIndex=0;;){const s=gp.exec(i),a=gp.lastIndex;let l=s[1];const d=s[2]==="]",h=s[3];if(d&&(l=l|0),h===void 0||h==="["&&a+2===r){zw(t,h===void 0?new VU(l,n,e):new WU(l,n,e));break}else{let u=t.map[l];u===void 0&&(u=new jU(l),zw(t,u)),t=u}}}class Fd{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);XU(s,a,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){const l=t[s],d=i[l.id];d.needsUpdate!==!1&&l.setValue(e,d.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&i.push(a)}return i}}function Hw(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const YU=37297;let $U=0;function qU(n,e){const t=n.split(`
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const l=a+1;i.push(`${l===e?">":" "} ${l}: ${t[a]}`)}return i.join(`
`)}function KU(n){const e=Kt.getPrimaries(Kt.workingColorSpace),t=Kt.getPrimaries(n);let i;switch(e===t?i="":e===ph&&t===fh?i="LinearDisplayP3ToLinearSRGB":e===fh&&t===ph&&(i="LinearSRGBToLinearDisplayP3"),n){case Sn:case Hh:return[i,"LinearTransferOETF"];case on:case M_:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function Gw(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
`+r+`
`+qU(n.getShaderSource(e),a)}else return r}function ZU(n,e){const t=KU(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function QU(n,e){let t;switch(e){case lE:t="Linear";break;case eD:t="Reinhard";break;case tD:t="OptimizedCineon";break;case nD:t="ACESFilmic";break;case rD:t="AgX";break;case sD:t="Neutral";break;case iD:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function JU(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Kl).join(`
`)}function eO(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function tO(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),a=s.name;let l=1;s.type===n.FLOAT_MAT2&&(l=2),s.type===n.FLOAT_MAT3&&(l=3),s.type===n.FLOAT_MAT4&&(l=4),t[a]={type:s.type,location:n.getAttribLocation(e,a),locationSize:l}}return t}function Kl(n){return n!==""}function Vw(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ww(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const nO=/^[ \t]*#include +<([\w\d./]+)>/gm;function og(n){return n.replace(nO,rO)}const iO=new Map;function rO(n,e){let t=xt[e];if(t===void 0){const i=iO.get(e);if(i!==void 0)t=xt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return og(t)}const sO=/#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 jw(n){return n.replace(sO,aO)}function aO(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Xw(n){let e=`precision ${n.precision} float;
precision ${n.precision} int;
precision ${n.precision} sampler2D;
precision ${n.precision} samplerCube;
precision ${n.precision} sampler3D;
precision ${n.precision} sampler2DArray;
precision ${n.precision} sampler2DShadow;
precision ${n.precision} samplerCubeShadow;
precision ${n.precision} sampler2DArrayShadow;
precision ${n.precision} isampler2D;
precision ${n.precision} isampler3D;
precision ${n.precision} isamplerCube;
precision ${n.precision} isampler2DArray;
precision ${n.precision} usampler2D;
precision ${n.precision} usampler3D;
precision ${n.precision} usamplerCube;
precision ${n.precision} usampler2DArray;
`;return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function oO(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===aE?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===oE?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===ts&&(e="SHADOWMAP_TYPE_VSM"),e}function lO(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Qo:case Jo:e="ENVMAP_TYPE_CUBE";break;case zh:e="ENVMAP_TYPE_CUBE_UV";break}return e}function cO(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Jo:e="ENVMAP_MODE_REFRACTION";break}return e}function uO(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Bh:e="ENVMAP_BLENDING_MULTIPLY";break;case QI:e="ENVMAP_BLENDING_MIX";break;case JI:e="ENVMAP_BLENDING_ADD";break}return e}function dO(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function hO(n,e,t,i){const r=n.getContext(),s=t.defines;let a=t.vertexShader,l=t.fragmentShader;const d=oO(t),h=lO(t),m=cO(t),u=uO(t),g=dO(t),v=JU(t),w=eO(s),T=r.createProgram();let M,b,A=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(M=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w].filter(Kl).join(`
`),M.length>0&&(M+=`
`),b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w].filter(Kl).join(`
`),b.length>0&&(b+=`
`)):(M=[Xw(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+m:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+d:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.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"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(Kl).join(`
`),b=[Xw(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+m:"",t.envMap?"#define "+u:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+d:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==$s?"#define TONE_MAPPING":"",t.toneMapping!==$s?xt.tonemapping_pars_fragment:"",t.toneMapping!==$s?QU("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",xt.colorspace_pars_fragment,ZU("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(Kl).join(`
`)),a=og(a),a=Vw(a,t),a=Ww(a,t),l=og(l),l=Vw(l,t),l=Ww(l,t),a=jw(a),l=jw(l),t.isRawShaderMaterial!==!0&&(A=`#version 300 es
`,M=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+M,b=["#define varying in",t.glslVersion===ow?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ow?"":"#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(`
`)+`
`+b);const E=A+M+a,P=A+b+l,G=Hw(r,r.VERTEX_SHADER,E),O=Hw(r,r.FRAGMENT_SHADER,P);r.attachShader(T,G),r.attachShader(T,O),t.index0AttributeName!==void 0?r.bindAttribLocation(T,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(T,0,"position"),r.linkProgram(T);function B(V){if(n.debug.checkShaderErrors){const ie=r.getProgramInfoLog(T).trim(),re=r.getShaderInfoLog(G).trim(),de=r.getShaderInfoLog(O).trim();let me=!0,$=!0;if(r.getProgramParameter(T,r.LINK_STATUS)===!1)if(me=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,T,G,O);else{const ue=Gw(r,G,"vertex"),Y=Gw(r,O,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(T,r.VALIDATE_STATUS)+`
Material Name: `+V.name+`
Material Type: `+V.type+`
Program Info Log: `+ie+`
`+ue+`
`+Y)}else ie!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ie):(re===""||de==="")&&($=!1);$&&(V.diagnostics={runnable:me,programLog:ie,vertexShader:{log:re,prefix:M},fragmentShader:{log:de,prefix:b}})}r.deleteShader(G),r.deleteShader(O),F=new Fd(r,T),D=tO(r,T)}let F;this.getUniforms=function(){return F===void 0&&B(this),F};let D;this.getAttributes=function(){return D===void 0&&B(this),D};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=r.getProgramParameter(T,YU)),L},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(T),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=$U++,this.cacheKey=e,this.usedTimes=1,this.program=T,this.vertexShader=G,this.fragmentShader=O,this}let fO=0;class pO{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new mO(e),t.set(e,i)),i}}class mO{constructor(e){this.id=fO++,this.code=e,this.usedTimes=0}}function gO(n,e,t,i,r,s,a){const l=new A_,d=new pO,h=new Set,m=[],u=r.logarithmicDepthBuffer,g=r.vertexTextures;let v=r.precision;const w={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function T(D){return h.add(D),D===0?"uv":`uv${D}`}function M(D,L,V,ie,re){const de=ie.fog,me=re.geometry,$=D.isMeshStandardMaterial?ie.environment:null,ue=(D.isMeshStandardMaterial?t:e).get(D.envMap||$),Y=ue&&ue.mapping===zh?ue.image.height:null,pe=w[D.type];D.precision!==null&&(v=r.getMaxPrecision(D.precision),v!==D.precision&&console.warn("THREE.WebGLProgram.getParameters:",D.precision,"not supported, using",v,"instead."));const _e=me.morphAttributes.position||me.morphAttributes.normal||me.morphAttributes.color,Ae=_e!==void 0?_e.length:0;let Pe=0;me.morphAttributes.position!==void 0&&(Pe=1),me.morphAttributes.normal!==void 0&&(Pe=2),me.morphAttributes.color!==void 0&&(Pe=3);let Ue,ae,ge,ce;if(pe){const Ot=ki[pe];Ue=Ot.vertexShader,ae=Ot.fragmentShader}else Ue=D.vertexShader,ae=D.fragmentShader,d.update(D),ge=d.getVertexShaderID(D),ce=d.getFragmentShaderID(D);const Me=n.getRenderTarget(),Ye=re.isInstancedMesh===!0,ht=re.isBatchedMesh===!0,ft=!!D.map,Wt=!!D.matcap,Z=!!ue,Jt=!!D.aoMap,Ut=!!D.lightMap,jt=!!D.bumpMap,ut=!!D.normalMap,yn=!!D.displacementMap,yt=!!D.emissiveMap,wt=!!D.metalnessMap,X=!!D.roughnessMap,N=D.anisotropy>0,ve=D.clearcoat>0,De=D.dispersion>0,ke=D.iridescence>0,Le=D.sheen>0,lt=D.transmission>0,Qe=N&&!!D.anisotropyMap,tt=ve&&!!D.clearcoatMap,vt=ve&&!!D.clearcoatNormalMap,Ne=ve&&!!D.clearcoatRoughnessMap,nt=ke&&!!D.iridescenceMap,Rt=ke&&!!D.iridescenceThicknessMap,ct=Le&&!!D.sheenColorMap,$e=Le&&!!D.sheenRoughnessMap,bt=!!D.specularMap,Ie=!!D.specularColorMap,it=!!D.specularIntensityMap,ee=lt&&!!D.transmissionMap,He=lt&&!!D.thicknessMap,oe=!!D.gradientMap,Ce=!!D.alphaMap,Ge=D.alphaTest>0,gt=!!D.alphaHash,Pt=!!D.extensions;let un=$s;D.toneMapped&&(Me===null||Me.isXRRenderTarget===!0)&&(un=n.toneMapping);const Ln={shaderID:pe,shaderType:D.type,shaderName:D.name,vertexShader:Ue,fragmentShader:ae,defines:D.defines,customVertexShaderID:ge,customFragmentShaderID:ce,isRawShaderMaterial:D.isRawShaderMaterial===!0,glslVersion:D.glslVersion,precision:v,batching:ht,batchingColor:ht&&re._colorsTexture!==null,instancing:Ye,instancingColor:Ye&&re.instanceColor!==null,instancingMorph:Ye&&re.morphTexture!==null,supportsVertexTextures:g,outputColorSpace:Me===null?n.outputColorSpace:Me.isXRRenderTarget===!0?Me.texture.colorSpace:Sn,alphaToCoverage:!!D.alphaToCoverage,map:ft,matcap:Wt,envMap:Z,envMapMode:Z&&ue.mapping,envMapCubeUVHeight:Y,aoMap:Jt,lightMap:Ut,bumpMap:jt,normalMap:ut,displacementMap:g&&yn,emissiveMap:yt,normalMapObjectSpace:ut&&D.normalMapType===dD,normalMapTangentSpace:ut&&D.normalMapType===cl,metalnessMap:wt,roughnessMap:X,anisotropy:N,anisotropyMap:Qe,clearcoat:ve,clearcoatMap:tt,clearcoatNormalMap:vt,clearcoatRoughnessMap:Ne,dispersion:De,iridescence:ke,iridescenceMap:nt,iridescenceThicknessMap:Rt,sheen:Le,sheenColorMap:ct,sheenRoughnessMap:$e,specularMap:bt,specularColorMap:Ie,specularIntensityMap:it,transmission:lt,transmissionMap:ee,thicknessMap:He,gradientMap:oe,opaque:D.transparent===!1&&D.blending===No&&D.alphaToCoverage===!1,alphaMap:Ce,alphaTest:Ge,alphaHash:gt,combine:D.combine,mapUv:ft&&T(D.map.channel),aoMapUv:Jt&&T(D.aoMap.channel),lightMapUv:Ut&&T(D.lightMap.channel),bumpMapUv:jt&&T(D.bumpMap.channel),normalMapUv:ut&&T(D.normalMap.channel),displacementMapUv:yn&&T(D.displacementMap.channel),emissiveMapUv:yt&&T(D.emissiveMap.channel),metalnessMapUv:wt&&T(D.metalnessMap.channel),roughnessMapUv:X&&T(D.roughnessMap.channel),anisotropyMapUv:Qe&&T(D.anisotropyMap.channel),clearcoatMapUv:tt&&T(D.clearcoatMap.channel),clearcoatNormalMapUv:vt&&T(D.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ne&&T(D.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&T(D.iridescenceMap.channel),iridescenceThicknessMapUv:Rt&&T(D.iridescenceThicknessMap.channel),sheenColorMapUv:ct&&T(D.sheenColorMap.channel),sheenRoughnessMapUv:$e&&T(D.sheenRoughnessMap.channel),specularMapUv:bt&&T(D.specularMap.channel),specularColorMapUv:Ie&&T(D.specularColorMap.channel),specularIntensityMapUv:it&&T(D.specularIntensityMap.channel),transmissionMapUv:ee&&T(D.transmissionMap.channel),thicknessMapUv:He&&T(D.thicknessMap.channel),alphaMapUv:Ce&&T(D.alphaMap.channel),vertexTangents:!!me.attributes.tangent&&(ut||N),vertexColors:D.vertexColors,vertexAlphas:D.vertexColors===!0&&!!me.attributes.color&&me.attributes.color.itemSize===4,pointsUvs:re.isPoints===!0&&!!me.attributes.uv&&(ft||Ce),fog:!!de,useFog:D.fog===!0,fogExp2:!!de&&de.isFogExp2,flatShading:D.flatShading===!0,sizeAttenuation:D.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:re.isSkinnedMesh===!0,morphTargets:me.morphAttributes.position!==void 0,morphNormals:me.morphAttributes.normal!==void 0,morphColors:me.morphAttributes.color!==void 0,morphTargetsCount:Ae,morphTextureStride:Pe,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:D.dithering,shadowMapEnabled:n.shadowMap.enabled&&V.length>0,shadowMapType:n.shadowMap.type,toneMapping:un,decodeVideoTexture:ft&&D.map.isVideoTexture===!0&&Kt.getTransfer(D.map.colorSpace)===pn,premultipliedAlpha:D.premultipliedAlpha,doubleSided:D.side===Si,flipSided:D.side===Ei,useDepthPacking:D.depthPacking>=0,depthPacking:D.depthPacking||0,index0AttributeName:D.index0AttributeName,extensionClipCullDistance:Pt&&D.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Pt&&D.extensions.multiDraw===!0||ht)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:D.customProgramCacheKey()};return Ln.vertexUv1s=h.has(1),Ln.vertexUv2s=h.has(2),Ln.vertexUv3s=h.has(3),h.clear(),Ln}function b(D){const L=[];if(D.shaderID?L.push(D.shaderID):(L.push(D.customVertexShaderID),L.push(D.customFragmentShaderID)),D.defines!==void 0)for(const V in D.defines)L.push(V),L.push(D.defines[V]);return D.isRawShaderMaterial===!1&&(A(L,D),E(L,D),L.push(n.outputColorSpace)),L.push(D.customProgramCacheKey),L.join()}function A(D,L){D.push(L.precision),D.push(L.outputColorSpace),D.push(L.envMapMode),D.push(L.envMapCubeUVHeight),D.push(L.mapUv),D.push(L.alphaMapUv),D.push(L.lightMapUv),D.push(L.aoMapUv),D.push(L.bumpMapUv),D.push(L.normalMapUv),D.push(L.displacementMapUv),D.push(L.emissiveMapUv),D.push(L.metalnessMapUv),D.push(L.roughnessMapUv),D.push(L.anisotropyMapUv),D.push(L.clearcoatMapUv),D.push(L.clearcoatNormalMapUv),D.push(L.clearcoatRoughnessMapUv),D.push(L.iridescenceMapUv),D.push(L.iridescenceThicknessMapUv),D.push(L.sheenColorMapUv),D.push(L.sheenRoughnessMapUv),D.push(L.specularMapUv),D.push(L.specularColorMapUv),D.push(L.specularIntensityMapUv),D.push(L.transmissionMapUv),D.push(L.thicknessMapUv),D.push(L.combine),D.push(L.fogExp2),D.push(L.sizeAttenuation),D.push(L.morphTargetsCount),D.push(L.morphAttributeCount),D.push(L.numDirLights),D.push(L.numPointLights),D.push(L.numSpotLights),D.push(L.numSpotLightMaps),D.push(L.numHemiLights),D.push(L.numRectAreaLights),D.push(L.numDirLightShadows),D.push(L.numPointLightShadows),D.push(L.numSpotLightShadows),D.push(L.numSpotLightShadowsWithMaps),D.push(L.numLightProbes),D.push(L.shadowMapType),D.push(L.toneMapping),D.push(L.numClippingPlanes),D.push(L.numClipIntersection),D.push(L.depthPacking)}function E(D,L){l.disableAll(),L.supportsVertexTextures&&l.enable(0),L.instancing&&l.enable(1),L.instancingColor&&l.enable(2),L.instancingMorph&&l.enable(3),L.matcap&&l.enable(4),L.envMap&&l.enable(5),L.normalMapObjectSpace&&l.enable(6),L.normalMapTangentSpace&&l.enable(7),L.clearcoat&&l.enable(8),L.iridescence&&l.enable(9),L.alphaTest&&l.enable(10),L.vertexColors&&l.enable(11),L.vertexAlphas&&l.enable(12),L.vertexUv1s&&l.enable(13),L.vertexUv2s&&l.enable(14),L.vertexUv3s&&l.enable(15),L.vertexTangents&&l.enable(16),L.anisotropy&&l.enable(17),L.alphaHash&&l.enable(18),L.batching&&l.enable(19),L.dispersion&&l.enable(20),L.batchingColor&&l.enable(21),D.push(l.mask),l.disableAll(),L.fog&&l.enable(0),L.useFog&&l.enable(1),L.flatShading&&l.enable(2),L.logarithmicDepthBuffer&&l.enable(3),L.skinning&&l.enable(4),L.morphTargets&&l.enable(5),L.morphNormals&&l.enable(6),L.morphColors&&l.enable(7),L.premultipliedAlpha&&l.enable(8),L.shadowMapEnabled&&l.enable(9),L.doubleSided&&l.enable(10),L.flipSided&&l.enable(11),L.useDepthPacking&&l.enable(12),L.dithering&&l.enable(13),L.transmission&&l.enable(14),L.sheen&&l.enable(15),L.opaque&&l.enable(16),L.pointsUvs&&l.enable(17),L.decodeVideoTexture&&l.enable(18),L.alphaToCoverage&&l.enable(19),D.push(l.mask)}function P(D){const L=w[D.type];let V;if(L){const ie=ki[L];V=AE.clone(ie.uniforms)}else V=D.uniforms;return V}function G(D,L){let V;for(let ie=0,re=m.length;ie<re;ie++){const de=m[ie];if(de.cacheKey===L){V=de,++V.usedTimes;break}}return V===void 0&&(V=new hO(n,L,D,s),m.push(V)),V}function O(D){if(--D.usedTimes===0){const L=m.indexOf(D);m[L]=m[m.length-1],m.pop(),D.destroy()}}function B(D){d.remove(D)}function F(){d.dispose()}return{getParameters:M,getProgramCacheKey:b,getUniforms:P,acquireProgram:G,releaseProgram:O,releaseShaderCache:B,programs:m,dispose:F}}function _O(){let n=new WeakMap;function e(s){let a=n.get(s);return a===void 0&&(a={},n.set(s,a)),a}function t(s){n.delete(s)}function i(s,a,l){n.get(s)[a]=l}function r(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function vO(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function Yw(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function $w(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(u,g,v,w,T,M){let b=n[e];return b===void 0?(b={id:u.id,object:u,geometry:g,material:v,groupOrder:w,renderOrder:u.renderOrder,z:T,group:M},n[e]=b):(b.id=u.id,b.object=u,b.geometry=g,b.material=v,b.groupOrder=w,b.renderOrder=u.renderOrder,b.z=T,b.group=M),e++,b}function l(u,g,v,w,T,M){const b=a(u,g,v,w,T,M);v.transmission>0?i.push(b):v.transparent===!0?r.push(b):t.push(b)}function d(u,g,v,w,T,M){const b=a(u,g,v,w,T,M);v.transmission>0?i.unshift(b):v.transparent===!0?r.unshift(b):t.unshift(b)}function h(u,g){t.length>1&&t.sort(u||vO),i.length>1&&i.sort(g||Yw),r.length>1&&r.sort(g||Yw)}function m(){for(let u=e,g=n.length;u<g;u++){const v=n[u];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:l,unshift:d,finish:m,sort:h}}function yO(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new $w,n.set(i,[a])):r>=s.length?(a=new $w,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function bO(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new j,color:new Je};break;case"SpotLight":t={position:new j,direction:new j,color:new Je,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new j,color:new Je,distance:0,decay:0};break;case"HemisphereLight":t={direction:new j,skyColor:new Je,groundColor:new Je};break;case"RectAreaLight":t={color:new Je,position:new j,halfWidth:new j,halfHeight:new j};break}return n[e.id]=t,t}}}function xO(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let wO=0;function SO(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function MO(n){const e=new bO,t=xO(),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 h=0;h<9;h++)i.probe.push(new j);const r=new j,s=new ot,a=new ot;function l(h){let m=0,u=0,g=0;for(let D=0;D<9;D++)i.probe[D].set(0,0,0);let v=0,w=0,T=0,M=0,b=0,A=0,E=0,P=0,G=0,O=0,B=0;h.sort(SO);for(let D=0,L=h.length;D<L;D++){const V=h[D],ie=V.color,re=V.intensity,de=V.distance,me=V.shadow&&V.shadow.map?V.shadow.map.texture:null;if(V.isAmbientLight)m+=ie.r*re,u+=ie.g*re,g+=ie.b*re;else if(V.isLightProbe){for(let $=0;$<9;$++)i.probe[$].addScaledVector(V.sh.coefficients[$],re);B++}else if(V.isDirectionalLight){const $=e.get(V);if($.color.copy(V.color).multiplyScalar(V.intensity),V.castShadow){const ue=V.shadow,Y=t.get(V);Y.shadowIntensity=ue.intensity,Y.shadowBias=ue.bias,Y.shadowNormalBias=ue.normalBias,Y.shadowRadius=ue.radius,Y.shadowMapSize=ue.mapSize,i.directionalShadow[v]=Y,i.directionalShadowMap[v]=me,i.directionalShadowMatrix[v]=V.shadow.matrix,A++}i.directional[v]=$,v++}else if(V.isSpotLight){const $=e.get(V);$.position.setFromMatrixPosition(V.matrixWorld),$.color.copy(ie).multiplyScalar(re),$.distance=de,$.coneCos=Math.cos(V.angle),$.penumbraCos=Math.cos(V.angle*(1-V.penumbra)),$.decay=V.decay,i.spot[T]=$;const ue=V.shadow;if(V.map&&(i.spotLightMap[G]=V.map,G++,ue.updateMatrices(V),V.castShadow&&O++),i.spotLightMatrix[T]=ue.matrix,V.castShadow){const Y=t.get(V);Y.shadowIntensity=ue.intensity,Y.shadowBias=ue.bias,Y.shadowNormalBias=ue.normalBias,Y.shadowRadius=ue.radius,Y.shadowMapSize=ue.mapSize,i.spotShadow[T]=Y,i.spotShadowMap[T]=me,P++}T++}else if(V.isRectAreaLight){const $=e.get(V);$.color.copy(ie).multiplyScalar(re),$.halfWidth.set(V.width*.5,0,0),$.halfHeight.set(0,V.height*.5,0),i.rectArea[M]=$,M++}else if(V.isPointLight){const $=e.get(V);if($.color.copy(V.color).multiplyScalar(V.intensity),$.distance=V.distance,$.decay=V.decay,V.castShadow){const ue=V.shadow,Y=t.get(V);Y.shadowIntensity=ue.intensity,Y.shadowBias=ue.bias,Y.shadowNormalBias=ue.normalBias,Y.shadowRadius=ue.radius,Y.shadowMapSize=ue.mapSize,Y.shadowCameraNear=ue.camera.near,Y.shadowCameraFar=ue.camera.far,i.pointShadow[w]=Y,i.pointShadowMap[w]=me,i.pointShadowMatrix[w]=V.shadow.matrix,E++}i.point[w]=$,w++}else if(V.isHemisphereLight){const $=e.get(V);$.skyColor.copy(V.color).multiplyScalar(re),$.groundColor.copy(V.groundColor).multiplyScalar(re),i.hemi[b]=$,b++}}M>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ze.LTC_FLOAT_1,i.rectAreaLTC2=Ze.LTC_FLOAT_2):(i.rectAreaLTC1=Ze.LTC_HALF_1,i.rectAreaLTC2=Ze.LTC_HALF_2)),i.ambient[0]=m,i.ambient[1]=u,i.ambient[2]=g;const F=i.hash;(F.directionalLength!==v||F.pointLength!==w||F.spotLength!==T||F.rectAreaLength!==M||F.hemiLength!==b||F.numDirectionalShadows!==A||F.numPointShadows!==E||F.numSpotShadows!==P||F.numSpotMaps!==G||F.numLightProbes!==B)&&(i.directional.length=v,i.spot.length=T,i.rectArea.length=M,i.point.length=w,i.hemi.length=b,i.directionalShadow.length=A,i.directionalShadowMap.length=A,i.pointShadow.length=E,i.pointShadowMap.length=E,i.spotShadow.length=P,i.spotShadowMap.length=P,i.directionalShadowMatrix.length=A,i.pointShadowMatrix.length=E,i.spotLightMatrix.length=P+G-O,i.spotLightMap.length=G,i.numSpotLightShadowsWithMaps=O,i.numLightProbes=B,F.directionalLength=v,F.pointLength=w,F.spotLength=T,F.rectAreaLength=M,F.hemiLength=b,F.numDirectionalShadows=A,F.numPointShadows=E,F.numSpotShadows=P,F.numSpotMaps=G,F.numLightProbes=B,i.version=wO++)}function d(h,m){let u=0,g=0,v=0,w=0,T=0;const M=m.matrixWorldInverse;for(let b=0,A=h.length;b<A;b++){const E=h[b];if(E.isDirectionalLight){const P=i.directional[u];P.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(M),u++}else if(E.isSpotLight){const P=i.spot[v];P.position.setFromMatrixPosition(E.matrixWorld),P.position.applyMatrix4(M),P.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(M),v++}else if(E.isRectAreaLight){const P=i.rectArea[w];P.position.setFromMatrixPosition(E.matrixWorld),P.position.applyMatrix4(M),a.identity(),s.copy(E.matrixWorld),s.premultiply(M),a.extractRotation(s),P.halfWidth.set(E.width*.5,0,0),P.halfHeight.set(0,E.height*.5,0),P.halfWidth.applyMatrix4(a),P.halfHeight.applyMatrix4(a),w++}else if(E.isPointLight){const P=i.point[g];P.position.setFromMatrixPosition(E.matrixWorld),P.position.applyMatrix4(M),g++}else if(E.isHemisphereLight){const P=i.hemi[T];P.direction.setFromMatrixPosition(E.matrixWorld),P.direction.transformDirection(M),T++}}}return{setup:l,setupView:d,state:i}}function qw(n){const e=new MO(n),t=[],i=[];function r(m){h.camera=m,t.length=0,i.length=0}function s(m){t.push(m)}function a(m){i.push(m)}function l(){e.setup(t)}function d(m){e.setupView(t,m)}const h={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:h,setupLights:l,setupLightsView:d,pushLight:s,pushShadow:a}}function EO(n){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let l;return a===void 0?(l=new qw(n),e.set(r,[l])):s>=a.length?(l=new qw(n),a.push(l)):l=a[s],l}function i(){e=new WeakMap}return{get:t,dispose:i}}class TO extends _i{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=cD,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 AO extends _i{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}}const CO=`void main() {
gl_Position = vec4( position, 1.0 );
}`,RO=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
const float samples = float( VSM_SAMPLES );
float mean = 0.0;
float squared_mean = 0.0;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
for ( float i = 0.0; i < samples; i ++ ) {
float uvOffset = uvStart + i * uvStride;
#ifdef HORIZONTAL_PASS
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean / samples;
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function PO(n,e,t){let i=new R_;const r=new et,s=new et,a=new $t,l=new TO({depthPacking:uD}),d=new AO,h={},m=t.maxTextureSize,u={[gs]:Ei,[Ei]:gs,[Si]:Si},g=new zi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new et},radius:{value:4}},vertexShader:CO,fragmentShader:RO}),v=g.clone();v.defines.HORIZONTAL_PASS=1;const w=new On;w.setAttribute("position",new _n(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const T=new wn(w,g),M=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=aE;let b=this.type;this.render=function(O,B,F){if(M.enabled===!1||M.autoUpdate===!1&&M.needsUpdate===!1||O.length===0)return;const D=n.getRenderTarget(),L=n.getActiveCubeFace(),V=n.getActiveMipmapLevel(),ie=n.state;ie.setBlending(Gr),ie.buffers.color.setClear(1,1,1,1),ie.buffers.depth.setTest(!0),ie.setScissorTest(!1);const re=b!==ts&&this.type===ts,de=b===ts&&this.type!==ts;for(let me=0,$=O.length;me<$;me++){const ue=O[me],Y=ue.shadow;if(Y===void 0){console.warn("THREE.WebGLShadowMap:",ue,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;r.copy(Y.mapSize);const pe=Y.getFrameExtents();if(r.multiply(pe),s.copy(Y.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(s.x=Math.floor(m/pe.x),r.x=s.x*pe.x,Y.mapSize.x=s.x),r.y>m&&(s.y=Math.floor(m/pe.y),r.y=s.y*pe.y,Y.mapSize.y=s.y)),Y.map===null||re===!0||de===!0){const Ae=this.type!==ts?{minFilter:Fn,magFilter:Fn}:{};Y.map!==null&&Y.map.dispose(),Y.map=new Zs(r.x,r.y,Ae),Y.map.texture.name=ue.name+".shadowMap",Y.camera.updateProjectionMatrix()}n.setRenderTarget(Y.map),n.clear();const _e=Y.getViewportCount();for(let Ae=0;Ae<_e;Ae++){const Pe=Y.getViewport(Ae);a.set(s.x*Pe.x,s.y*Pe.y,s.x*Pe.z,s.y*Pe.w),ie.viewport(a),Y.updateMatrices(ue,Ae),i=Y.getFrustum(),P(B,F,Y.camera,ue,this.type)}Y.isPointLightShadow!==!0&&this.type===ts&&A(Y,F),Y.needsUpdate=!1}b=this.type,M.needsUpdate=!1,n.setRenderTarget(D,L,V)};function A(O,B){const F=e.update(T);g.defines.VSM_SAMPLES!==O.blurSamples&&(g.defines.VSM_SAMPLES=O.blurSamples,v.defines.VSM_SAMPLES=O.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),O.mapPass===null&&(O.mapPass=new Zs(r.x,r.y)),g.uniforms.shadow_pass.value=O.map.texture,g.uniforms.resolution.value=O.mapSize,g.uniforms.radius.value=O.radius,n.setRenderTarget(O.mapPass),n.clear(),n.renderBufferDirect(B,null,F,g,T,null),v.uniforms.shadow_pass.value=O.mapPass.texture,v.uniforms.resolution.value=O.mapSize,v.uniforms.radius.value=O.radius,n.setRenderTarget(O.map),n.clear(),n.renderBufferDirect(B,null,F,v,T,null)}function E(O,B,F,D){let L=null;const V=F.isPointLight===!0?O.customDistanceMaterial:O.customDepthMaterial;if(V!==void 0)L=V;else if(L=F.isPointLight===!0?d:l,n.localClippingEnabled&&B.clipShadows===!0&&Array.isArray(B.clippingPlanes)&&B.clippingPlanes.length!==0||B.displacementMap&&B.displacementScale!==0||B.alphaMap&&B.alphaTest>0||B.map&&B.alphaTest>0){const ie=L.uuid,re=B.uuid;let de=h[ie];de===void 0&&(de={},h[ie]=de);let me=de[re];me===void 0&&(me=L.clone(),de[re]=me,B.addEventListener("dispose",G)),L=me}if(L.visible=B.visible,L.wireframe=B.wireframe,D===ts?L.side=B.shadowSide!==null?B.shadowSide:B.side:L.side=B.shadowSide!==null?B.shadowSide:u[B.side],L.alphaMap=B.alphaMap,L.alphaTest=B.alphaTest,L.map=B.map,L.clipShadows=B.clipShadows,L.clippingPlanes=B.clippingPlanes,L.clipIntersection=B.clipIntersection,L.displacementMap=B.displacementMap,L.displacementScale=B.displacementScale,L.displacementBias=B.displacementBias,L.wireframeLinewidth=B.wireframeLinewidth,L.linewidth=B.linewidth,F.isPointLight===!0&&L.isMeshDistanceMaterial===!0){const ie=n.properties.get(L);ie.light=F}return L}function P(O,B,F,D,L){if(O.visible===!1)return;if(O.layers.test(B.layers)&&(O.isMesh||O.isLine||O.isPoints)&&(O.castShadow||O.receiveShadow&&L===ts)&&(!O.frustumCulled||i.intersectsObject(O))){O.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,O.matrixWorld);const re=e.update(O),de=O.material;if(Array.isArray(de)){const me=re.groups;for(let $=0,ue=me.length;$<ue;$++){const Y=me[$],pe=de[Y.materialIndex];if(pe&&pe.visible){const _e=E(O,pe,D,L);O.onBeforeShadow(n,O,B,F,re,_e,Y),n.renderBufferDirect(F,null,re,_e,O,Y),O.onAfterShadow(n,O,B,F,re,_e,Y)}}}else if(de.visible){const me=E(O,de,D,L);O.onBeforeShadow(n,O,B,F,re,me,null),n.renderBufferDirect(F,null,re,me,O,null),O.onAfterShadow(n,O,B,F,re,me,null)}}const ie=O.children;for(let re=0,de=ie.length;re<de;re++)P(ie[re],B,F,D,L)}function G(O){O.target.removeEventListener("dispose",G);for(const F in h){const D=h[F],L=O.target.uuid;L in D&&(D[L].dispose(),delete D[L])}}}function LO(n){function e(){let ee=!1;const He=new $t;let oe=null;const Ce=new $t(0,0,0,0);return{setMask:function(Ge){oe!==Ge&&!ee&&(n.colorMask(Ge,Ge,Ge,Ge),oe=Ge)},setLocked:function(Ge){ee=Ge},setClear:function(Ge,gt,Pt,un,Ln){Ln===!0&&(Ge*=un,gt*=un,Pt*=un),He.set(Ge,gt,Pt,un),Ce.equals(He)===!1&&(n.clearColor(Ge,gt,Pt,un),Ce.copy(He))},reset:function(){ee=!1,oe=null,Ce.set(-1,0,0,0)}}}function t(){let ee=!1,He=null,oe=null,Ce=null;return{setTest:function(Ge){Ge?ce(n.DEPTH_TEST):Me(n.DEPTH_TEST)},setMask:function(Ge){He!==Ge&&!ee&&(n.depthMask(Ge),He=Ge)},setFunc:function(Ge){if(oe!==Ge){switch(Ge){case jI:n.depthFunc(n.NEVER);break;case XI:n.depthFunc(n.ALWAYS);break;case YI:n.depthFunc(n.LESS);break;case uh:n.depthFunc(n.LEQUAL);break;case $I:n.depthFunc(n.EQUAL);break;case qI:n.depthFunc(n.GEQUAL);break;case KI:n.depthFunc(n.GREATER);break;case ZI:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}oe=Ge}},setLocked:function(Ge){ee=Ge},setClear:function(Ge){Ce!==Ge&&(n.clearDepth(Ge),Ce=Ge)},reset:function(){ee=!1,He=null,oe=null,Ce=null}}}function i(){let ee=!1,He=null,oe=null,Ce=null,Ge=null,gt=null,Pt=null,un=null,Ln=null;return{setTest:function(Ot){ee||(Ot?ce(n.STENCIL_TEST):Me(n.STENCIL_TEST))},setMask:function(Ot){He!==Ot&&!ee&&(n.stencilMask(Ot),He=Ot)},setFunc:function(Ot,oi,ii){(oe!==Ot||Ce!==oi||Ge!==ii)&&(n.stencilFunc(Ot,oi,ii),oe=Ot,Ce=oi,Ge=ii)},setOp:function(Ot,oi,ii){(gt!==Ot||Pt!==oi||un!==ii)&&(n.stencilOp(Ot,oi,ii),gt=Ot,Pt=oi,un=ii)},setLocked:function(Ot){ee=Ot},setClear:function(Ot){Ln!==Ot&&(n.clearStencil(Ot),Ln=Ot)},reset:function(){ee=!1,He=null,oe=null,Ce=null,Ge=null,gt=null,Pt=null,un=null,Ln=null}}}const r=new e,s=new t,a=new i,l=new WeakMap,d=new WeakMap;let h={},m={},u=new WeakMap,g=[],v=null,w=!1,T=null,M=null,b=null,A=null,E=null,P=null,G=null,O=new Je(0,0,0),B=0,F=!1,D=null,L=null,V=null,ie=null,re=null;const de=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let me=!1,$=0;const ue=n.getParameter(n.VERSION);ue.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(ue)[1]),me=$>=1):ue.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(ue)[1]),me=$>=2);let Y=null,pe={};const _e=n.getParameter(n.SCISSOR_BOX),Ae=n.getParameter(n.VIEWPORT),Pe=new $t().fromArray(_e),Ue=new $t().fromArray(Ae);function ae(ee,He,oe,Ce){const Ge=new Uint8Array(4),gt=n.createTexture();n.bindTexture(ee,gt),n.texParameteri(ee,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(ee,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Pt=0;Pt<oe;Pt++)ee===n.TEXTURE_3D||ee===n.TEXTURE_2D_ARRAY?n.texImage3D(He,0,n.RGBA,1,1,Ce,0,n.RGBA,n.UNSIGNED_BYTE,Ge):n.texImage2D(He+Pt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Ge);return gt}const ge={};ge[n.TEXTURE_2D]=ae(n.TEXTURE_2D,n.TEXTURE_2D,1),ge[n.TEXTURE_CUBE_MAP]=ae(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ge[n.TEXTURE_2D_ARRAY]=ae(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ge[n.TEXTURE_3D]=ae(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),ce(n.DEPTH_TEST),s.setFunc(uh),jt(!1),ut(Qx),ce(n.CULL_FACE),Jt(Gr);function ce(ee){h[ee]!==!0&&(n.enable(ee),h[ee]=!0)}function Me(ee){h[ee]!==!1&&(n.disable(ee),h[ee]=!1)}function Ye(ee,He){return m[ee]!==He?(n.bindFramebuffer(ee,He),m[ee]=He,ee===n.DRAW_FRAMEBUFFER&&(m[n.FRAMEBUFFER]=He),ee===n.FRAMEBUFFER&&(m[n.DRAW_FRAMEBUFFER]=He),!0):!1}function ht(ee,He){let oe=g,Ce=!1;if(ee){oe=u.get(He),oe===void 0&&(oe=[],u.set(He,oe));const Ge=ee.textures;if(oe.length!==Ge.length||oe[0]!==n.COLOR_ATTACHMENT0){for(let gt=0,Pt=Ge.length;gt<Pt;gt++)oe[gt]=n.COLOR_ATTACHMENT0+gt;oe.length=Ge.length,Ce=!0}}else oe[0]!==n.BACK&&(oe[0]=n.BACK,Ce=!0);Ce&&n.drawBuffers(oe)}function ft(ee){return v!==ee?(n.useProgram(ee),v=ee,!0):!1}const Wt={[ya]:n.FUNC_ADD,[CI]:n.FUNC_SUBTRACT,[RI]:n.FUNC_REVERSE_SUBTRACT};Wt[PI]=n.MIN,Wt[LI]=n.MAX;const Z={[II]:n.ZERO,[DI]:n.ONE,[kI]:n.SRC_COLOR,[Pm]:n.SRC_ALPHA,[zI]:n.SRC_ALPHA_SATURATE,[NI]:n.DST_COLOR,[UI]:n.DST_ALPHA,[FI]:n.ONE_MINUS_SRC_COLOR,[Lm]:n.ONE_MINUS_SRC_ALPHA,[BI]:n.ONE_MINUS_DST_COLOR,[OI]:n.ONE_MINUS_DST_ALPHA,[HI]:n.CONSTANT_COLOR,[GI]:n.ONE_MINUS_CONSTANT_COLOR,[VI]:n.CONSTANT_ALPHA,[WI]:n.ONE_MINUS_CONSTANT_ALPHA};function Jt(ee,He,oe,Ce,Ge,gt,Pt,un,Ln,Ot){if(ee===Gr){w===!0&&(Me(n.BLEND),w=!1);return}if(w===!1&&(ce(n.BLEND),w=!0),ee!==AI){if(ee!==T||Ot!==F){if((M!==ya||E!==ya)&&(n.blendEquation(n.FUNC_ADD),M=ya,E=ya),Ot)switch(ee){case No:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ch:n.blendFunc(n.ONE,n.ONE);break;case Jx:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case ew:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",ee);break}else switch(ee){case No:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ch:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Jx:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case ew:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",ee);break}b=null,A=null,P=null,G=null,O.set(0,0,0),B=0,T=ee,F=Ot}return}Ge=Ge||He,gt=gt||oe,Pt=Pt||Ce,(He!==M||Ge!==E)&&(n.blendEquationSeparate(Wt[He],Wt[Ge]),M=He,E=Ge),(oe!==b||Ce!==A||gt!==P||Pt!==G)&&(n.blendFuncSeparate(Z[oe],Z[Ce],Z[gt],Z[Pt]),b=oe,A=Ce,P=gt,G=Pt),(un.equals(O)===!1||Ln!==B)&&(n.blendColor(un.r,un.g,un.b,Ln),O.copy(un),B=Ln),T=ee,F=!1}function Ut(ee,He){ee.side===Si?Me(n.CULL_FACE):ce(n.CULL_FACE);let oe=ee.side===Ei;He&&(oe=!oe),jt(oe),ee.blending===No&&ee.transparent===!1?Jt(Gr):Jt(ee.blending,ee.blendEquation,ee.blendSrc,ee.blendDst,ee.blendEquationAlpha,ee.blendSrcAlpha,ee.blendDstAlpha,ee.blendColor,ee.blendAlpha,ee.premultipliedAlpha),s.setFunc(ee.depthFunc),s.setTest(ee.depthTest),s.setMask(ee.depthWrite),r.setMask(ee.colorWrite);const Ce=ee.stencilWrite;a.setTest(Ce),Ce&&(a.setMask(ee.stencilWriteMask),a.setFunc(ee.stencilFunc,ee.stencilRef,ee.stencilFuncMask),a.setOp(ee.stencilFail,ee.stencilZFail,ee.stencilZPass)),yt(ee.polygonOffset,ee.polygonOffsetFactor,ee.polygonOffsetUnits),ee.alphaToCoverage===!0?ce(n.SAMPLE_ALPHA_TO_COVERAGE):Me(n.SAMPLE_ALPHA_TO_COVERAGE)}function jt(ee){D!==ee&&(ee?n.frontFace(n.CW):n.frontFace(n.CCW),D=ee)}function ut(ee){ee!==EI?(ce(n.CULL_FACE),ee!==L&&(ee===Qx?n.cullFace(n.BACK):ee===TI?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Me(n.CULL_FACE),L=ee}function yn(ee){ee!==V&&(me&&n.lineWidth(ee),V=ee)}function yt(ee,He,oe){ee?(ce(n.POLYGON_OFFSET_FILL),(ie!==He||re!==oe)&&(n.polygonOffset(He,oe),ie=He,re=oe)):Me(n.POLYGON_OFFSET_FILL)}function wt(ee){ee?ce(n.SCISSOR_TEST):Me(n.SCISSOR_TEST)}function X(ee){ee===void 0&&(ee=n.TEXTURE0+de-1),Y!==ee&&(n.activeTexture(ee),Y=ee)}function N(ee,He,oe){oe===void 0&&(Y===null?oe=n.TEXTURE0+de-1:oe=Y);let Ce=pe[oe];Ce===void 0&&(Ce={type:void 0,texture:void 0},pe[oe]=Ce),(Ce.type!==ee||Ce.texture!==He)&&(Y!==oe&&(n.activeTexture(oe),Y=oe),n.bindTexture(ee,He||ge[ee]),Ce.type=ee,Ce.texture=He)}function ve(){const ee=pe[Y];ee!==void 0&&ee.type!==void 0&&(n.bindTexture(ee.type,null),ee.type=void 0,ee.texture=void 0)}function De(){try{n.compressedTexImage2D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function ke(){try{n.compressedTexImage3D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function Le(){try{n.texSubImage2D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function lt(){try{n.texSubImage3D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function Qe(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function tt(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function vt(){try{n.texStorage2D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function Ne(){try{n.texStorage3D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function nt(){try{n.texImage2D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function Rt(){try{n.texImage3D.apply(n,arguments)}catch(ee){console.error("THREE.WebGLState:",ee)}}function ct(ee){Pe.equals(ee)===!1&&(n.scissor(ee.x,ee.y,ee.z,ee.w),Pe.copy(ee))}function $e(ee){Ue.equals(ee)===!1&&(n.viewport(ee.x,ee.y,ee.z,ee.w),Ue.copy(ee))}function bt(ee,He){let oe=d.get(He);oe===void 0&&(oe=new WeakMap,d.set(He,oe));let Ce=oe.get(ee);Ce===void 0&&(Ce=n.getUniformBlockIndex(He,ee.name),oe.set(ee,Ce))}function Ie(ee,He){const Ce=d.get(He).get(ee);l.get(He)!==Ce&&(n.uniformBlockBinding(He,Ce,ee.__bindingPointIndex),l.set(He,Ce))}function it(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),h={},Y=null,pe={},m={},u=new WeakMap,g=[],v=null,w=!1,T=null,M=null,b=null,A=null,E=null,P=null,G=null,O=new Je(0,0,0),B=0,F=!1,D=null,L=null,V=null,ie=null,re=null,Pe.set(0,0,n.canvas.width,n.canvas.height),Ue.set(0,0,n.canvas.width,n.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:ce,disable:Me,bindFramebuffer:Ye,drawBuffers:ht,useProgram:ft,setBlending:Jt,setMaterial:Ut,setFlipSided:jt,setCullFace:ut,setLineWidth:yn,setPolygonOffset:yt,setScissorTest:wt,activeTexture:X,bindTexture:N,unbindTexture:ve,compressedTexImage2D:De,compressedTexImage3D:ke,texImage2D:nt,texImage3D:Rt,updateUBOMapping:bt,uniformBlockBinding:Ie,texStorage2D:vt,texStorage3D:Ne,texSubImage2D:Le,texSubImage3D:lt,compressedTexSubImage2D:Qe,compressedTexSubImage3D:tt,scissor:ct,viewport:$e,reset:it}}function Kw(n,e,t,i){const r=IO(i);switch(t){case fE:return n*e;case mE:return n*e;case gE:return n*e*2;case Wc:return n*e/r.components*r.byteLength;case x_:return n*e/r.components*r.byteLength;case _E:return n*e*2/r.components*r.byteLength;case w_:return n*e*2/r.components*r.byteLength;case pE:return n*e*3/r.components*r.byteLength;case Vn:return n*e*4/r.components*r.byteLength;case S_:return n*e*4/r.components*r.byteLength;case Pd:case Ld:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Id:case Dd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case km:case Um:return Math.max(n,16)*Math.max(e,8)/4;case Dm:case Fm:return Math.max(n,8)*Math.max(e,8)/2;case Om:case Nm:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Bm:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case zm:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Hm:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Gm:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Vm:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Wm:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case jm:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Xm:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Ym:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case $m:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case qm:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Km:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Zm:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Qm:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Jm:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case kd:case eg:case tg:return Math.ceil(n/4)*Math.ceil(e/4)*16;case vE:case ng:return Math.ceil(n/4)*Math.ceil(e/4)*8;case ig:case rg:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function IO(n){switch(n){case Bi:case uE:return{byteLength:1,components:1};case Pc:case dE:case gi:return{byteLength:2,components:1};case y_:case b_:return{byteLength:2,components:4};case Da:case v_:case Un:return{byteLength:4,components:1};case hE:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}function DO(n,e,t,i,r,s,a){const l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new et,m=new WeakMap;let u;const g=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(X,N){return v?new OffscreenCanvas(X,N):Dc("canvas")}function T(X,N,ve){let De=1;const ke=wt(X);if((ke.width>ve||ke.height>ve)&&(De=ve/Math.max(ke.width,ke.height)),De<1)if(typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&X instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&X instanceof ImageBitmap||typeof VideoFrame<"u"&&X instanceof VideoFrame){const Le=Math.floor(De*ke.width),lt=Math.floor(De*ke.height);u===void 0&&(u=w(Le,lt));const Qe=N?w(Le,lt):u;return Qe.width=Le,Qe.height=lt,Qe.getContext("2d").drawImage(X,0,0,Le,lt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ke.width+"x"+ke.height+") to ("+Le+"x"+lt+")."),Qe}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ke.width+"x"+ke.height+")."),X;return X}function M(X){return X.generateMipmaps&&X.minFilter!==Fn&&X.minFilter!==ln}function b(X){n.generateMipmap(X)}function A(X,N,ve,De,ke=!1){if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}let Le=N;if(N===n.RED&&(ve===n.FLOAT&&(Le=n.R32F),ve===n.HALF_FLOAT&&(Le=n.R16F),ve===n.UNSIGNED_BYTE&&(Le=n.R8)),N===n.RED_INTEGER&&(ve===n.UNSIGNED_BYTE&&(Le=n.R8UI),ve===n.UNSIGNED_SHORT&&(Le=n.R16UI),ve===n.UNSIGNED_INT&&(Le=n.R32UI),ve===n.BYTE&&(Le=n.R8I),ve===n.SHORT&&(Le=n.R16I),ve===n.INT&&(Le=n.R32I)),N===n.RG&&(ve===n.FLOAT&&(Le=n.RG32F),ve===n.HALF_FLOAT&&(Le=n.RG16F),ve===n.UNSIGNED_BYTE&&(Le=n.RG8)),N===n.RG_INTEGER&&(ve===n.UNSIGNED_BYTE&&(Le=n.RG8UI),ve===n.UNSIGNED_SHORT&&(Le=n.RG16UI),ve===n.UNSIGNED_INT&&(Le=n.RG32UI),ve===n.BYTE&&(Le=n.RG8I),ve===n.SHORT&&(Le=n.RG16I),ve===n.INT&&(Le=n.RG32I)),N===n.RGB&&ve===n.UNSIGNED_INT_5_9_9_9_REV&&(Le=n.RGB9_E5),N===n.RGBA){const lt=ke?hh:Kt.getTransfer(De);ve===n.FLOAT&&(Le=n.RGBA32F),ve===n.HALF_FLOAT&&(Le=n.RGBA16F),ve===n.UNSIGNED_BYTE&&(Le=lt===pn?n.SRGB8_ALPHA8:n.RGBA8),ve===n.UNSIGNED_SHORT_4_4_4_4&&(Le=n.RGBA4),ve===n.UNSIGNED_SHORT_5_5_5_1&&(Le=n.RGB5_A1)}return(Le===n.R16F||Le===n.R32F||Le===n.RG16F||Le===n.RG32F||Le===n.RGBA16F||Le===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Le}function E(X,N){let ve;return X?N===null||N===Da||N===tl?ve=n.DEPTH24_STENCIL8:N===Un?ve=n.DEPTH32F_STENCIL8:N===Pc&&(ve=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):N===null||N===Da||N===tl?ve=n.DEPTH_COMPONENT24:N===Un?ve=n.DEPTH_COMPONENT32F:N===Pc&&(ve=n.DEPTH_COMPONENT16),ve}function P(X,N){return M(X)===!0||X.isFramebufferTexture&&X.minFilter!==Fn&&X.minFilter!==ln?Math.log2(Math.max(N.width,N.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?N.mipmaps.length:1}function G(X){const N=X.target;N.removeEventListener("dispose",G),B(N),N.isVideoTexture&&m.delete(N)}function O(X){const N=X.target;N.removeEventListener("dispose",O),D(N)}function B(X){const N=i.get(X);if(N.__webglInit===void 0)return;const ve=X.source,De=g.get(ve);if(De){const ke=De[N.__cacheKey];ke.usedTimes--,ke.usedTimes===0&&F(X),Object.keys(De).length===0&&g.delete(ve)}i.remove(X)}function F(X){const N=i.get(X);n.deleteTexture(N.__webglTexture);const ve=X.source,De=g.get(ve);delete De[N.__cacheKey],a.memory.textures--}function D(X){const N=i.get(X);if(X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let De=0;De<6;De++){if(Array.isArray(N.__webglFramebuffer[De]))for(let ke=0;ke<N.__webglFramebuffer[De].length;ke++)n.deleteFramebuffer(N.__webglFramebuffer[De][ke]);else n.deleteFramebuffer(N.__webglFramebuffer[De]);N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer[De])}else{if(Array.isArray(N.__webglFramebuffer))for(let De=0;De<N.__webglFramebuffer.length;De++)n.deleteFramebuffer(N.__webglFramebuffer[De]);else n.deleteFramebuffer(N.__webglFramebuffer);if(N.__webglDepthbuffer&&n.deleteRenderbuffer(N.__webglDepthbuffer),N.__webglMultisampledFramebuffer&&n.deleteFramebuffer(N.__webglMultisampledFramebuffer),N.__webglColorRenderbuffer)for(let De=0;De<N.__webglColorRenderbuffer.length;De++)N.__webglColorRenderbuffer[De]&&n.deleteRenderbuffer(N.__webglColorRenderbuffer[De]);N.__webglDepthRenderbuffer&&n.deleteRenderbuffer(N.__webglDepthRenderbuffer)}const ve=X.textures;for(let De=0,ke=ve.length;De<ke;De++){const Le=i.get(ve[De]);Le.__webglTexture&&(n.deleteTexture(Le.__webglTexture),a.memory.textures--),i.remove(ve[De])}i.remove(X)}let L=0;function V(){L=0}function ie(){const X=L;return X>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+r.maxTextures),L+=1,X}function re(X){const N=[];return N.push(X.wrapS),N.push(X.wrapT),N.push(X.wrapR||0),N.push(X.magFilter),N.push(X.minFilter),N.push(X.anisotropy),N.push(X.internalFormat),N.push(X.format),N.push(X.type),N.push(X.generateMipmaps),N.push(X.premultiplyAlpha),N.push(X.flipY),N.push(X.unpackAlignment),N.push(X.colorSpace),N.join()}function de(X,N){const ve=i.get(X);if(X.isVideoTexture&&yn(X),X.isRenderTargetTexture===!1&&X.version>0&&ve.__version!==X.version){const De=X.image;if(De===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(De.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ue(ve,X,N);return}}t.bindTexture(n.TEXTURE_2D,ve.__webglTexture,n.TEXTURE0+N)}function me(X,N){const ve=i.get(X);if(X.version>0&&ve.__version!==X.version){Ue(ve,X,N);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ve.__webglTexture,n.TEXTURE0+N)}function $(X,N){const ve=i.get(X);if(X.version>0&&ve.__version!==X.version){Ue(ve,X,N);return}t.bindTexture(n.TEXTURE_3D,ve.__webglTexture,n.TEXTURE0+N)}function ue(X,N){const ve=i.get(X);if(X.version>0&&ve.__version!==X.version){ae(ve,X,N);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ve.__webglTexture,n.TEXTURE0+N)}const Y={[Vr]:n.REPEAT,[ti]:n.CLAMP_TO_EDGE,[dh]:n.MIRRORED_REPEAT},pe={[Fn]:n.NEAREST,[cE]:n.NEAREST_MIPMAP_NEAREST,[ql]:n.NEAREST_MIPMAP_LINEAR,[ln]:n.LINEAR,[Rd]:n.LINEAR_MIPMAP_NEAREST,[Er]:n.LINEAR_MIPMAP_LINEAR},_e={[hD]:n.NEVER,[vD]:n.ALWAYS,[fD]:n.LESS,[bE]:n.LEQUAL,[pD]:n.EQUAL,[_D]:n.GEQUAL,[mD]:n.GREATER,[gD]:n.NOTEQUAL};function Ae(X,N){if(N.type===Un&&e.has("OES_texture_float_linear")===!1&&(N.magFilter===ln||N.magFilter===Rd||N.magFilter===ql||N.magFilter===Er||N.minFilter===ln||N.minFilter===Rd||N.minFilter===ql||N.minFilter===Er)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(X,n.TEXTURE_WRAP_S,Y[N.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,Y[N.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,Y[N.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,pe[N.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,pe[N.minFilter]),N.compareFunction&&(n.texParameteri(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,_e[N.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(N.magFilter===Fn||N.minFilter!==ql&&N.minFilter!==Er||N.type===Un&&e.has("OES_texture_float_linear")===!1)return;if(N.anisotropy>1||i.get(N).__currentAnisotropy){const ve=e.get("EXT_texture_filter_anisotropic");n.texParameterf(X,ve.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,r.getMaxAnisotropy())),i.get(N).__currentAnisotropy=N.anisotropy}}}function Pe(X,N){let ve=!1;X.__webglInit===void 0&&(X.__webglInit=!0,N.addEventListener("dispose",G));const De=N.source;let ke=g.get(De);ke===void 0&&(ke={},g.set(De,ke));const Le=re(N);if(Le!==X.__cacheKey){ke[Le]===void 0&&(ke[Le]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,ve=!0),ke[Le].usedTimes++;const lt=ke[X.__cacheKey];lt!==void 0&&(ke[X.__cacheKey].usedTimes--,lt.usedTimes===0&&F(N)),X.__cacheKey=Le,X.__webglTexture=ke[Le].texture}return ve}function Ue(X,N,ve){let De=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(De=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(De=n.TEXTURE_3D);const ke=Pe(X,N),Le=N.source;t.bindTexture(De,X.__webglTexture,n.TEXTURE0+ve);const lt=i.get(Le);if(Le.version!==lt.__version||ke===!0){t.activeTexture(n.TEXTURE0+ve);const Qe=Kt.getPrimaries(Kt.workingColorSpace),tt=N.colorSpace===ss?null:Kt.getPrimaries(N.colorSpace),vt=N.colorSpace===ss||Qe===tt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,vt);let Ne=T(N.image,!1,r.maxTextureSize);Ne=yt(N,Ne);const nt=s.convert(N.format,N.colorSpace),Rt=s.convert(N.type);let ct=A(N.internalFormat,nt,Rt,N.colorSpace,N.isVideoTexture);Ae(De,N);let $e;const bt=N.mipmaps,Ie=N.isVideoTexture!==!0,it=lt.__version===void 0||ke===!0,ee=Le.dataReady,He=P(N,Ne);if(N.isDepthTexture)ct=E(N.format===nl,N.type),it&&(Ie?t.texStorage2D(n.TEXTURE_2D,1,ct,Ne.width,Ne.height):t.texImage2D(n.TEXTURE_2D,0,ct,Ne.width,Ne.height,0,nt,Rt,null));else if(N.isDataTexture)if(bt.length>0){Ie&&it&&t.texStorage2D(n.TEXTURE_2D,He,ct,bt[0].width,bt[0].height);for(let oe=0,Ce=bt.length;oe<Ce;oe++)$e=bt[oe],Ie?ee&&t.texSubImage2D(n.TEXTURE_2D,oe,0,0,$e.width,$e.height,nt,Rt,$e.data):t.texImage2D(n.TEXTURE_2D,oe,ct,$e.width,$e.height,0,nt,Rt,$e.data);N.generateMipmaps=!1}else Ie?(it&&t.texStorage2D(n.TEXTURE_2D,He,ct,Ne.width,Ne.height),ee&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Ne.width,Ne.height,nt,Rt,Ne.data)):t.texImage2D(n.TEXTURE_2D,0,ct,Ne.width,Ne.height,0,nt,Rt,Ne.data);else if(N.isCompressedTexture)if(N.isCompressedArrayTexture){Ie&&it&&t.texStorage3D(n.TEXTURE_2D_ARRAY,He,ct,bt[0].width,bt[0].height,Ne.depth);for(let oe=0,Ce=bt.length;oe<Ce;oe++)if($e=bt[oe],N.format!==Vn)if(nt!==null)if(Ie){if(ee)if(N.layerUpdates.size>0){const Ge=Kw($e.width,$e.height,N.format,N.type);for(const gt of N.layerUpdates){const Pt=$e.data.subarray(gt*Ge/$e.data.BYTES_PER_ELEMENT,(gt+1)*Ge/$e.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,gt,$e.width,$e.height,1,nt,Pt,0,0)}N.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,0,$e.width,$e.height,Ne.depth,nt,$e.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,oe,ct,$e.width,$e.height,Ne.depth,0,$e.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ie?ee&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,0,$e.width,$e.height,Ne.depth,nt,Rt,$e.data):t.texImage3D(n.TEXTURE_2D_ARRAY,oe,ct,$e.width,$e.height,Ne.depth,0,nt,Rt,$e.data)}else{Ie&&it&&t.texStorage2D(n.TEXTURE_2D,He,ct,bt[0].width,bt[0].height);for(let oe=0,Ce=bt.length;oe<Ce;oe++)$e=bt[oe],N.format!==Vn?nt!==null?Ie?ee&&t.compressedTexSubImage2D(n.TEXTURE_2D,oe,0,0,$e.width,$e.height,nt,$e.data):t.compressedTexImage2D(n.TEXTURE_2D,oe,ct,$e.width,$e.height,0,$e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ie?ee&&t.texSubImage2D(n.TEXTURE_2D,oe,0,0,$e.width,$e.height,nt,Rt,$e.data):t.texImage2D(n.TEXTURE_2D,oe,ct,$e.width,$e.height,0,nt,Rt,$e.data)}else if(N.isDataArrayTexture)if(Ie){if(it&&t.texStorage3D(n.TEXTURE_2D_ARRAY,He,ct,Ne.width,Ne.height,Ne.depth),ee)if(N.layerUpdates.size>0){const oe=Kw(Ne.width,Ne.height,N.format,N.type);for(const Ce of N.layerUpdates){const Ge=Ne.data.subarray(Ce*oe/Ne.data.BYTES_PER_ELEMENT,(Ce+1)*oe/Ne.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Ce,Ne.width,Ne.height,1,nt,Rt,Ge)}N.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Ne.width,Ne.height,Ne.depth,nt,Rt,Ne.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,ct,Ne.width,Ne.height,Ne.depth,0,nt,Rt,Ne.data);else if(N.isData3DTexture)Ie?(it&&t.texStorage3D(n.TEXTURE_3D,He,ct,Ne.width,Ne.height,Ne.depth),ee&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Ne.width,Ne.height,Ne.depth,nt,Rt,Ne.data)):t.texImage3D(n.TEXTURE_3D,0,ct,Ne.width,Ne.height,Ne.depth,0,nt,Rt,Ne.data);else if(N.isFramebufferTexture){if(it)if(Ie)t.texStorage2D(n.TEXTURE_2D,He,ct,Ne.width,Ne.height);else{let oe=Ne.width,Ce=Ne.height;for(let Ge=0;Ge<He;Ge++)t.texImage2D(n.TEXTURE_2D,Ge,ct,oe,Ce,0,nt,Rt,null),oe>>=1,Ce>>=1}}else if(bt.length>0){if(Ie&&it){const oe=wt(bt[0]);t.texStorage2D(n.TEXTURE_2D,He,ct,oe.width,oe.height)}for(let oe=0,Ce=bt.length;oe<Ce;oe++)$e=bt[oe],Ie?ee&&t.texSubImage2D(n.TEXTURE_2D,oe,0,0,nt,Rt,$e):t.texImage2D(n.TEXTURE_2D,oe,ct,nt,Rt,$e);N.generateMipmaps=!1}else if(Ie){if(it){const oe=wt(Ne);t.texStorage2D(n.TEXTURE_2D,He,ct,oe.width,oe.height)}ee&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,nt,Rt,Ne)}else t.texImage2D(n.TEXTURE_2D,0,ct,nt,Rt,Ne);M(N)&&b(De),lt.__version=Le.version,N.onUpdate&&N.onUpdate(N)}X.__version=N.version}function ae(X,N,ve){if(N.image.length!==6)return;const De=Pe(X,N),ke=N.source;t.bindTexture(n.TEXTURE_CUBE_MAP,X.__webglTexture,n.TEXTURE0+ve);const Le=i.get(ke);if(ke.version!==Le.__version||De===!0){t.activeTexture(n.TEXTURE0+ve);const lt=Kt.getPrimaries(Kt.workingColorSpace),Qe=N.colorSpace===ss?null:Kt.getPrimaries(N.colorSpace),tt=N.colorSpace===ss||lt===Qe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,tt);const vt=N.isCompressedTexture||N.image[0].isCompressedTexture,Ne=N.image[0]&&N.image[0].isDataTexture,nt=[];for(let Ce=0;Ce<6;Ce++)!vt&&!Ne?nt[Ce]=T(N.image[Ce],!0,r.maxCubemapSize):nt[Ce]=Ne?N.image[Ce].image:N.image[Ce],nt[Ce]=yt(N,nt[Ce]);const Rt=nt[0],ct=s.convert(N.format,N.colorSpace),$e=s.convert(N.type),bt=A(N.internalFormat,ct,$e,N.colorSpace),Ie=N.isVideoTexture!==!0,it=Le.__version===void 0||De===!0,ee=ke.dataReady;let He=P(N,Rt);Ae(n.TEXTURE_CUBE_MAP,N);let oe;if(vt){Ie&&it&&t.texStorage2D(n.TEXTURE_CUBE_MAP,He,bt,Rt.width,Rt.height);for(let Ce=0;Ce<6;Ce++){oe=nt[Ce].mipmaps;for(let Ge=0;Ge<oe.length;Ge++){const gt=oe[Ge];N.format!==Vn?ct!==null?Ie?ee&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,Ge,0,0,gt.width,gt.height,ct,gt.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,Ge,bt,gt.width,gt.height,0,gt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ie?ee&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,Ge,0,0,gt.width,gt.height,ct,$e,gt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,Ge,bt,gt.width,gt.height,0,ct,$e,gt.data)}}}else{if(oe=N.mipmaps,Ie&&it){oe.length>0&&He++;const Ce=wt(nt[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,He,bt,Ce.width,Ce.height)}for(let Ce=0;Ce<6;Ce++)if(Ne){Ie?ee&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,nt[Ce].width,nt[Ce].height,ct,$e,nt[Ce].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,bt,nt[Ce].width,nt[Ce].height,0,ct,$e,nt[Ce].data);for(let Ge=0;Ge<oe.length;Ge++){const Pt=oe[Ge].image[Ce].image;Ie?ee&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,Ge+1,0,0,Pt.width,Pt.height,ct,$e,Pt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,Ge+1,bt,Pt.width,Pt.height,0,ct,$e,Pt.data)}}else{Ie?ee&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,ct,$e,nt[Ce]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,bt,ct,$e,nt[Ce]);for(let Ge=0;Ge<oe.length;Ge++){const gt=oe[Ge];Ie?ee&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,Ge+1,0,0,ct,$e,gt.image[Ce]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,Ge+1,bt,ct,$e,gt.image[Ce])}}}M(N)&&b(n.TEXTURE_CUBE_MAP),Le.__version=ke.version,N.onUpdate&&N.onUpdate(N)}X.__version=N.version}function ge(X,N,ve,De,ke,Le){const lt=s.convert(ve.format,ve.colorSpace),Qe=s.convert(ve.type),tt=A(ve.internalFormat,lt,Qe,ve.colorSpace);if(!i.get(N).__hasExternalTextures){const Ne=Math.max(1,N.width>>Le),nt=Math.max(1,N.height>>Le);ke===n.TEXTURE_3D||ke===n.TEXTURE_2D_ARRAY?t.texImage3D(ke,Le,tt,Ne,nt,N.depth,0,lt,Qe,null):t.texImage2D(ke,Le,tt,Ne,nt,0,lt,Qe,null)}t.bindFramebuffer(n.FRAMEBUFFER,X),ut(N)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,De,ke,i.get(ve).__webglTexture,0,jt(N)):(ke===n.TEXTURE_2D||ke>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ke<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,De,ke,i.get(ve).__webglTexture,Le),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ce(X,N,ve){if(n.bindRenderbuffer(n.RENDERBUFFER,X),N.depthBuffer){const De=N.depthTexture,ke=De&&De.isDepthTexture?De.type:null,Le=E(N.stencilBuffer,ke),lt=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Qe=jt(N);ut(N)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Qe,Le,N.width,N.height):ve?n.renderbufferStorageMultisample(n.RENDERBUFFER,Qe,Le,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,Le,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,lt,n.RENDERBUFFER,X)}else{const De=N.textures;for(let ke=0;ke<De.length;ke++){const Le=De[ke],lt=s.convert(Le.format,Le.colorSpace),Qe=s.convert(Le.type),tt=A(Le.internalFormat,lt,Qe,Le.colorSpace),vt=jt(N);ve&&ut(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,vt,tt,N.width,N.height):ut(N)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,vt,tt,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,tt,N.width,N.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Me(X,N){if(N&&N.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,X),!(N.depthTexture&&N.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(N.depthTexture).__webglTexture||N.depthTexture.image.width!==N.width||N.depthTexture.image.height!==N.height)&&(N.depthTexture.image.width=N.width,N.depthTexture.image.height=N.height,N.depthTexture.needsUpdate=!0),de(N.depthTexture,0);const De=i.get(N.depthTexture).__webglTexture,ke=jt(N);if(N.depthTexture.format===Bo)ut(N)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,De,0,ke):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,De,0);else if(N.depthTexture.format===nl)ut(N)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,De,0,ke):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,De,0);else throw new Error("Unknown depthTexture format")}function Ye(X){const N=i.get(X),ve=X.isWebGLCubeRenderTarget===!0;if(X.depthTexture&&!N.__autoAllocateDepthBuffer){if(ve)throw new Error("target.depthTexture not supported in Cube render targets");Me(N.__webglFramebuffer,X)}else if(ve){N.__webglDepthbuffer=[];for(let De=0;De<6;De++)t.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer[De]),N.__webglDepthbuffer[De]=n.createRenderbuffer(),ce(N.__webglDepthbuffer[De],X,!1)}else t.bindFramebuffer(n.FRAMEBUFFER,N.__webglFramebuffer),N.__webglDepthbuffer=n.createRenderbuffer(),ce(N.__webglDepthbuffer,X,!1);t.bindFramebuffer(n.FRAMEBUFFER,null)}function ht(X,N,ve){const De=i.get(X);N!==void 0&&ge(De.__webglFramebuffer,X,X.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),ve!==void 0&&Ye(X)}function ft(X){const N=X.texture,ve=i.get(X),De=i.get(N);X.addEventListener("dispose",O);const ke=X.textures,Le=X.isWebGLCubeRenderTarget===!0,lt=ke.length>1;if(lt||(De.__webglTexture===void 0&&(De.__webglTexture=n.createTexture()),De.__version=N.version,a.memory.textures++),Le){ve.__webglFramebuffer=[];for(let Qe=0;Qe<6;Qe++)if(N.mipmaps&&N.mipmaps.length>0){ve.__webglFramebuffer[Qe]=[];for(let tt=0;tt<N.mipmaps.length;tt++)ve.__webglFramebuffer[Qe][tt]=n.createFramebuffer()}else ve.__webglFramebuffer[Qe]=n.createFramebuffer()}else{if(N.mipmaps&&N.mipmaps.length>0){ve.__webglFramebuffer=[];for(let Qe=0;Qe<N.mipmaps.length;Qe++)ve.__webglFramebuffer[Qe]=n.createFramebuffer()}else ve.__webglFramebuffer=n.createFramebuffer();if(lt)for(let Qe=0,tt=ke.length;Qe<tt;Qe++){const vt=i.get(ke[Qe]);vt.__webglTexture===void 0&&(vt.__webglTexture=n.createTexture(),a.memory.textures++)}if(X.samples>0&&ut(X)===!1){ve.__webglMultisampledFramebuffer=n.createFramebuffer(),ve.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ve.__webglMultisampledFramebuffer);for(let Qe=0;Qe<ke.length;Qe++){const tt=ke[Qe];ve.__webglColorRenderbuffer[Qe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,ve.__webglColorRenderbuffer[Qe]);const vt=s.convert(tt.format,tt.colorSpace),Ne=s.convert(tt.type),nt=A(tt.internalFormat,vt,Ne,tt.colorSpace,X.isXRRenderTarget===!0),Rt=jt(X);n.renderbufferStorageMultisample(n.RENDERBUFFER,Rt,nt,X.width,X.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Qe,n.RENDERBUFFER,ve.__webglColorRenderbuffer[Qe])}n.bindRenderbuffer(n.RENDERBUFFER,null),X.depthBuffer&&(ve.__webglDepthRenderbuffer=n.createRenderbuffer(),ce(ve.__webglDepthRenderbuffer,X,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Le){t.bindTexture(n.TEXTURE_CUBE_MAP,De.__webglTexture),Ae(n.TEXTURE_CUBE_MAP,N);for(let Qe=0;Qe<6;Qe++)if(N.mipmaps&&N.mipmaps.length>0)for(let tt=0;tt<N.mipmaps.length;tt++)ge(ve.__webglFramebuffer[Qe][tt],X,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,tt);else ge(ve.__webglFramebuffer[Qe],X,N,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0);M(N)&&b(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(lt){for(let Qe=0,tt=ke.length;Qe<tt;Qe++){const vt=ke[Qe],Ne=i.get(vt);t.bindTexture(n.TEXTURE_2D,Ne.__webglTexture),Ae(n.TEXTURE_2D,vt),ge(ve.__webglFramebuffer,X,vt,n.COLOR_ATTACHMENT0+Qe,n.TEXTURE_2D,0),M(vt)&&b(n.TEXTURE_2D)}t.unbindTexture()}else{let Qe=n.TEXTURE_2D;if((X.isWebGL3DRenderTarget||X.isWebGLArrayRenderTarget)&&(Qe=X.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Qe,De.__webglTexture),Ae(Qe,N),N.mipmaps&&N.mipmaps.length>0)for(let tt=0;tt<N.mipmaps.length;tt++)ge(ve.__webglFramebuffer[tt],X,N,n.COLOR_ATTACHMENT0,Qe,tt);else ge(ve.__webglFramebuffer,X,N,n.COLOR_ATTACHMENT0,Qe,0);M(N)&&b(Qe),t.unbindTexture()}X.depthBuffer&&Ye(X)}function Wt(X){const N=X.textures;for(let ve=0,De=N.length;ve<De;ve++){const ke=N[ve];if(M(ke)){const Le=X.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,lt=i.get(ke).__webglTexture;t.bindTexture(Le,lt),b(Le),t.unbindTexture()}}}const Z=[],Jt=[];function Ut(X){if(X.samples>0){if(ut(X)===!1){const N=X.textures,ve=X.width,De=X.height;let ke=n.COLOR_BUFFER_BIT;const Le=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,lt=i.get(X),Qe=N.length>1;if(Qe)for(let tt=0;tt<N.length;tt++)t.bindFramebuffer(n.FRAMEBUFFER,lt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+tt,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,lt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+tt,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,lt.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,lt.__webglFramebuffer);for(let tt=0;tt<N.length;tt++){if(X.resolveDepthBuffer&&(X.depthBuffer&&(ke|=n.DEPTH_BUFFER_BIT),X.stencilBuffer&&X.resolveStencilBuffer&&(ke|=n.STENCIL_BUFFER_BIT)),Qe){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,lt.__webglColorRenderbuffer[tt]);const vt=i.get(N[tt]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,vt,0)}n.blitFramebuffer(0,0,ve,De,0,0,ve,De,ke,n.NEAREST),d===!0&&(Z.length=0,Jt.length=0,Z.push(n.COLOR_ATTACHMENT0+tt),X.depthBuffer&&X.resolveDepthBuffer===!1&&(Z.push(Le),Jt.push(Le),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,Jt)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Z))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Qe)for(let tt=0;tt<N.length;tt++){t.bindFramebuffer(n.FRAMEBUFFER,lt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+tt,n.RENDERBUFFER,lt.__webglColorRenderbuffer[tt]);const vt=i.get(N[tt]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,lt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+tt,n.TEXTURE_2D,vt,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,lt.__webglMultisampledFramebuffer)}else if(X.depthBuffer&&X.resolveDepthBuffer===!1&&d){const N=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[N])}}}function jt(X){return Math.min(r.maxSamples,X.samples)}function ut(X){const N=i.get(X);return X.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function yn(X){const N=a.render.frame;m.get(X)!==N&&(m.set(X,N),X.update())}function yt(X,N){const ve=X.colorSpace,De=X.format,ke=X.type;return X.isCompressedTexture===!0||X.isVideoTexture===!0||ve!==Sn&&ve!==ss&&(Kt.getTransfer(ve)===pn?(De!==Vn||ke!==Bi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ve)),N}function wt(X){return typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement?(h.width=X.naturalWidth||X.width,h.height=X.naturalHeight||X.height):typeof VideoFrame<"u"&&X instanceof VideoFrame?(h.width=X.displayWidth,h.height=X.displayHeight):(h.width=X.width,h.height=X.height),h}this.allocateTextureUnit=ie,this.resetTextureUnits=V,this.setTexture2D=de,this.setTexture2DArray=me,this.setTexture3D=$,this.setTextureCube=ue,this.rebindTextures=ht,this.setupRenderTarget=ft,this.updateRenderTargetMipmap=Wt,this.updateMultisampleRenderTarget=Ut,this.setupDepthRenderbuffer=Ye,this.setupFrameBufferTexture=ge,this.useMultisampledRTT=ut}function kO(n,e){function t(i,r=ss){let s;const a=Kt.getTransfer(r);if(i===Bi)return n.UNSIGNED_BYTE;if(i===y_)return n.UNSIGNED_SHORT_4_4_4_4;if(i===b_)return n.UNSIGNED_SHORT_5_5_5_1;if(i===hE)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===uE)return n.BYTE;if(i===dE)return n.SHORT;if(i===Pc)return n.UNSIGNED_SHORT;if(i===v_)return n.INT;if(i===Da)return n.UNSIGNED_INT;if(i===Un)return n.FLOAT;if(i===gi)return n.HALF_FLOAT;if(i===fE)return n.ALPHA;if(i===pE)return n.RGB;if(i===Vn)return n.RGBA;if(i===mE)return n.LUMINANCE;if(i===gE)return n.LUMINANCE_ALPHA;if(i===Bo)return n.DEPTH_COMPONENT;if(i===nl)return n.DEPTH_STENCIL;if(i===Wc)return n.RED;if(i===x_)return n.RED_INTEGER;if(i===_E)return n.RG;if(i===w_)return n.RG_INTEGER;if(i===S_)return n.RGBA_INTEGER;if(i===Pd||i===Ld||i===Id||i===Dd)if(a===pn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Pd)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ld)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Id)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Dd)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Pd)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ld)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Id)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Dd)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Dm||i===km||i===Fm||i===Um)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Dm)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===km)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Fm)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Um)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Om||i===Nm||i===Bm)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Om||i===Nm)return a===pn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Bm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===zm||i===Hm||i===Gm||i===Vm||i===Wm||i===jm||i===Xm||i===Ym||i===$m||i===qm||i===Km||i===Zm||i===Qm||i===Jm)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===zm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Hm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Gm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Vm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Wm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===jm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Xm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Ym)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===$m)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===qm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Km)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Zm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Qm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Jm)return a===pn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===kd||i===eg||i===tg)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===kd)return a===pn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===eg)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===tg)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===vE||i===ng||i===ig||i===rg)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===kd)return s.COMPRESSED_RED_RGTC1_EXT;if(i===ng)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===ig)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===rg)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===tl?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class FO extends mi{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let Nr=class extends sn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const UO={type:"move"};class _p{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Nr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Nr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Nr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const l=this._targetRay,d=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const T of e.hand.values()){const M=t.getJointPose(T,i),b=this._getHandJoint(h,T);M!==null&&(b.matrix.fromArray(M.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=M.radius),b.visible=M!==null}const m=h.joints["index-finger-tip"],u=h.joints["thumb-tip"],g=m.position.distanceTo(u.position),v=.02,w=.005;h.inputState.pinching&&g>v+w?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&g<=v-w&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else d!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(d.matrix.fromArray(s.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,s.linearVelocity?(d.hasLinearVelocity=!0,d.linearVelocity.copy(s.linearVelocity)):d.hasLinearVelocity=!1,s.angularVelocity?(d.hasAngularVelocity=!0,d.angularVelocity.copy(s.angularVelocity)):d.hasAngularVelocity=!1));l!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(UO)))}return l!==null&&(l.visible=r!==null),d!==null&&(d.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Nr;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const OO=`
void main() {
gl_Position = vec4( position, 1.0 );
}`,NO=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
void main() {
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
if ( coord.x >= 1.0 ) {
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
} else {
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
}
}`;class BO{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new qn,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new zi({vertexShader:OO,fragmentShader:NO,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new wn(new Yc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class zO extends ul{constructor(e,t){super();const i=this;let r=null,s=1,a=null,l="local-floor",d=1,h=null,m=null,u=null,g=null,v=null,w=null;const T=new BO,M=t.getContextAttributes();let b=null,A=null;const E=[],P=[],G=new et;let O=null;const B=new mi;B.layers.enable(1),B.viewport=new $t;const F=new mi;F.layers.enable(2),F.viewport=new $t;const D=[B,F],L=new FO;L.layers.enable(1),L.layers.enable(2);let V=null,ie=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ae){let ge=E[ae];return ge===void 0&&(ge=new _p,E[ae]=ge),ge.getTargetRaySpace()},this.getControllerGrip=function(ae){let ge=E[ae];return ge===void 0&&(ge=new _p,E[ae]=ge),ge.getGripSpace()},this.getHand=function(ae){let ge=E[ae];return ge===void 0&&(ge=new _p,E[ae]=ge),ge.getHandSpace()};function re(ae){const ge=P.indexOf(ae.inputSource);if(ge===-1)return;const ce=E[ge];ce!==void 0&&(ce.update(ae.inputSource,ae.frame,h||a),ce.dispatchEvent({type:ae.type,data:ae.inputSource}))}function de(){r.removeEventListener("select",re),r.removeEventListener("selectstart",re),r.removeEventListener("selectend",re),r.removeEventListener("squeeze",re),r.removeEventListener("squeezestart",re),r.removeEventListener("squeezeend",re),r.removeEventListener("end",de),r.removeEventListener("inputsourceschange",me);for(let ae=0;ae<E.length;ae++){const ge=P[ae];ge!==null&&(P[ae]=null,E[ae].disconnect(ge))}V=null,ie=null,T.reset(),e.setRenderTarget(b),v=null,g=null,u=null,r=null,A=null,Ue.stop(),i.isPresenting=!1,e.setPixelRatio(O),e.setSize(G.width,G.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ae){s=ae,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ae){l=ae,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(ae){h=ae},this.getBaseLayer=function(){return g!==null?g:v},this.getBinding=function(){return u},this.getFrame=function(){return w},this.getSession=function(){return r},this.setSession=async function(ae){if(r=ae,r!==null){if(b=e.getRenderTarget(),r.addEventListener("select",re),r.addEventListener("selectstart",re),r.addEventListener("selectend",re),r.addEventListener("squeeze",re),r.addEventListener("squeezestart",re),r.addEventListener("squeezeend",re),r.addEventListener("end",de),r.addEventListener("inputsourceschange",me),M.xrCompatible!==!0&&await t.makeXRCompatible(),O=e.getPixelRatio(),e.getSize(G),r.renderState.layers===void 0){const ge={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(r,t,ge),r.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),A=new Zs(v.framebufferWidth,v.framebufferHeight,{format:Vn,type:Bi,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil})}else{let ge=null,ce=null,Me=null;M.depth&&(Me=M.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ge=M.stencil?nl:Bo,ce=M.stencil?tl:Da);const Ye={colorFormat:t.RGBA8,depthFormat:Me,scaleFactor:s};u=new XRWebGLBinding(r,t),g=u.createProjectionLayer(Ye),r.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),A=new Zs(g.textureWidth,g.textureHeight,{format:Vn,type:Bi,depthTexture:new DE(g.textureWidth,g.textureHeight,ce,void 0,void 0,void 0,void 0,void 0,void 0,ge),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1})}A.isXRRenderTarget=!0,this.setFoveation(d),h=null,a=await r.requestReferenceSpace(l),Ue.setContext(r),Ue.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return T.getDepthTexture()};function me(ae){for(let ge=0;ge<ae.removed.length;ge++){const ce=ae.removed[ge],Me=P.indexOf(ce);Me>=0&&(P[Me]=null,E[Me].disconnect(ce))}for(let ge=0;ge<ae.added.length;ge++){const ce=ae.added[ge];let Me=P.indexOf(ce);if(Me===-1){for(let ht=0;ht<E.length;ht++)if(ht>=P.length){P.push(ce),Me=ht;break}else if(P[ht]===null){P[ht]=ce,Me=ht;break}if(Me===-1)break}const Ye=E[Me];Ye&&Ye.connect(ce)}}const $=new j,ue=new j;function Y(ae,ge,ce){$.setFromMatrixPosition(ge.matrixWorld),ue.setFromMatrixPosition(ce.matrixWorld);const Me=$.distanceTo(ue),Ye=ge.projectionMatrix.elements,ht=ce.projectionMatrix.elements,ft=Ye[14]/(Ye[10]-1),Wt=Ye[14]/(Ye[10]+1),Z=(Ye[9]+1)/Ye[5],Jt=(Ye[9]-1)/Ye[5],Ut=(Ye[8]-1)/Ye[0],jt=(ht[8]+1)/ht[0],ut=ft*Ut,yn=ft*jt,yt=Me/(-Ut+jt),wt=yt*-Ut;ge.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(wt),ae.translateZ(yt),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert();const X=ft+yt,N=Wt+yt,ve=ut-wt,De=yn+(Me-wt),ke=Z*Wt/N*X,Le=Jt*Wt/N*X;ae.projectionMatrix.makePerspective(ve,De,ke,Le,X,N),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}function pe(ae,ge){ge===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(ge.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(r===null)return;T.texture!==null&&(ae.near=T.depthNear,ae.far=T.depthFar),L.near=F.near=B.near=ae.near,L.far=F.far=B.far=ae.far,(V!==L.near||ie!==L.far)&&(r.updateRenderState({depthNear:L.near,depthFar:L.far}),V=L.near,ie=L.far,B.near=V,B.far=ie,F.near=V,F.far=ie,B.updateProjectionMatrix(),F.updateProjectionMatrix(),ae.updateProjectionMatrix());const ge=ae.parent,ce=L.cameras;pe(L,ge);for(let Me=0;Me<ce.length;Me++)pe(ce[Me],ge);ce.length===2?Y(L,B,F):L.projectionMatrix.copy(B.projectionMatrix),_e(ae,L,ge)};function _e(ae,ge,ce){ce===null?ae.matrix.copy(ge.matrixWorld):(ae.matrix.copy(ce.matrixWorld),ae.matrix.invert(),ae.matrix.multiply(ge.matrixWorld)),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.updateMatrixWorld(!0),ae.projectionMatrix.copy(ge.projectionMatrix),ae.projectionMatrixInverse.copy(ge.projectionMatrixInverse),ae.isPerspectiveCamera&&(ae.fov=il*2*Math.atan(1/ae.projectionMatrix.elements[5]),ae.zoom=1)}this.getCamera=function(){return L},this.getFoveation=function(){if(!(g===null&&v===null))return d},this.setFoveation=function(ae){d=ae,g!==null&&(g.fixedFoveation=ae),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=ae)},this.hasDepthSensing=function(){return T.texture!==null},this.getDepthSensingMesh=function(){return T.getMesh(L)};let Ae=null;function Pe(ae,ge){if(m=ge.getViewerPose(h||a),w=ge,m!==null){const ce=m.views;v!==null&&(e.setRenderTargetFramebuffer(A,v.framebuffer),e.setRenderTarget(A));let Me=!1;ce.length!==L.cameras.length&&(L.cameras.length=0,Me=!0);for(let ht=0;ht<ce.length;ht++){const ft=ce[ht];let Wt=null;if(v!==null)Wt=v.getViewport(ft);else{const Jt=u.getViewSubImage(g,ft);Wt=Jt.viewport,ht===0&&(e.setRenderTargetTextures(A,Jt.colorTexture,g.ignoreDepthValues?void 0:Jt.depthStencilTexture),e.setRenderTarget(A))}let Z=D[ht];Z===void 0&&(Z=new mi,Z.layers.enable(ht),Z.viewport=new $t,D[ht]=Z),Z.matrix.fromArray(ft.transform.matrix),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.projectionMatrix.fromArray(ft.projectionMatrix),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert(),Z.viewport.set(Wt.x,Wt.y,Wt.width,Wt.height),ht===0&&(L.matrix.copy(Z.matrix),L.matrix.decompose(L.position,L.quaternion,L.scale)),Me===!0&&L.cameras.push(Z)}const Ye=r.enabledFeatures;if(Ye&&Ye.includes("depth-sensing")){const ht=u.getDepthInformation(ce[0]);ht&&ht.isValid&&ht.texture&&T.init(e,ht,r.renderState)}}for(let ce=0;ce<E.length;ce++){const Me=P[ce],Ye=E[ce];Me!==null&&Ye!==void 0&&Ye.update(Me,ge,h||a)}Ae&&Ae(ae,ge),ge.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ge}),w=null}const Ue=new IE;Ue.setAnimationLoop(Pe),this.setAnimationLoop=function(ae){Ae=ae},this.dispose=function(){}}}const ha=new Pn,HO=new ot;function GO(n,e){function t(M,b){M.matrixAutoUpdate===!0&&M.updateMatrix(),b.value.copy(M.matrix)}function i(M,b){b.color.getRGB(M.fogColor.value,TE(n)),b.isFog?(M.fogNear.value=b.near,M.fogFar.value=b.far):b.isFogExp2&&(M.fogDensity.value=b.density)}function r(M,b,A,E,P){b.isMeshBasicMaterial||b.isMeshLambertMaterial?s(M,b):b.isMeshToonMaterial?(s(M,b),u(M,b)):b.isMeshPhongMaterial?(s(M,b),m(M,b)):b.isMeshStandardMaterial?(s(M,b),g(M,b),b.isMeshPhysicalMaterial&&v(M,b,P)):b.isMeshMatcapMaterial?(s(M,b),w(M,b)):b.isMeshDepthMaterial?s(M,b):b.isMeshDistanceMaterial?(s(M,b),T(M,b)):b.isMeshNormalMaterial?s(M,b):b.isLineBasicMaterial?(a(M,b),b.isLineDashedMaterial&&l(M,b)):b.isPointsMaterial?d(M,b,A,E):b.isSpriteMaterial?h(M,b):b.isShadowMaterial?(M.color.value.copy(b.color),M.opacity.value=b.opacity):b.isShaderMaterial&&(b.uniformsNeedUpdate=!1)}function s(M,b){M.opacity.value=b.opacity,b.color&&M.diffuse.value.copy(b.color),b.emissive&&M.emissive.value.copy(b.emissive).multiplyScalar(b.emissiveIntensity),b.map&&(M.map.value=b.map,t(b.map,M.mapTransform)),b.alphaMap&&(M.alphaMap.value=b.alphaMap,t(b.alphaMap,M.alphaMapTransform)),b.bumpMap&&(M.bumpMap.value=b.bumpMap,t(b.bumpMap,M.bumpMapTransform),M.bumpScale.value=b.bumpScale,b.side===Ei&&(M.bumpScale.value*=-1)),b.normalMap&&(M.normalMap.value=b.normalMap,t(b.normalMap,M.normalMapTransform),M.normalScale.value.copy(b.normalScale),b.side===Ei&&M.normalScale.value.negate()),b.displacementMap&&(M.displacementMap.value=b.displacementMap,t(b.displacementMap,M.displacementMapTransform),M.displacementScale.value=b.displacementScale,M.displacementBias.value=b.displacementBias),b.emissiveMap&&(M.emissiveMap.value=b.emissiveMap,t(b.emissiveMap,M.emissiveMapTransform)),b.specularMap&&(M.specularMap.value=b.specularMap,t(b.specularMap,M.specularMapTransform)),b.alphaTest>0&&(M.alphaTest.value=b.alphaTest);const A=e.get(b),E=A.envMap,P=A.envMapRotation;E&&(M.envMap.value=E,ha.copy(P),ha.x*=-1,ha.y*=-1,ha.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(ha.y*=-1,ha.z*=-1),M.envMapRotation.value.setFromMatrix4(HO.makeRotationFromEuler(ha)),M.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,M.reflectivity.value=b.reflectivity,M.ior.value=b.ior,M.refractionRatio.value=b.refractionRatio),b.lightMap&&(M.lightMap.value=b.lightMap,M.lightMapIntensity.value=b.lightMapIntensity,t(b.lightMap,M.lightMapTransform)),b.aoMap&&(M.aoMap.value=b.aoMap,M.aoMapIntensity.value=b.aoMapIntensity,t(b.aoMap,M.aoMapTransform))}function a(M,b){M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,b.map&&(M.map.value=b.map,t(b.map,M.mapTransform))}function l(M,b){M.dashSize.value=b.dashSize,M.totalSize.value=b.dashSize+b.gapSize,M.scale.value=b.scale}function d(M,b,A,E){M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,M.size.value=b.size*A,M.scale.value=E*.5,b.map&&(M.map.value=b.map,t(b.map,M.uvTransform)),b.alphaMap&&(M.alphaMap.value=b.alphaMap,t(b.alphaMap,M.alphaMapTransform)),b.alphaTest>0&&(M.alphaTest.value=b.alphaTest)}function h(M,b){M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,M.rotation.value=b.rotation,b.map&&(M.map.value=b.map,t(b.map,M.mapTransform)),b.alphaMap&&(M.alphaMap.value=b.alphaMap,t(b.alphaMap,M.alphaMapTransform)),b.alphaTest>0&&(M.alphaTest.value=b.alphaTest)}function m(M,b){M.specular.value.copy(b.specular),M.shininess.value=Math.max(b.shininess,1e-4)}function u(M,b){b.gradientMap&&(M.gradientMap.value=b.gradientMap)}function g(M,b){M.metalness.value=b.metalness,b.metalnessMap&&(M.metalnessMap.value=b.metalnessMap,t(b.metalnessMap,M.metalnessMapTransform)),M.roughness.value=b.roughness,b.roughnessMap&&(M.roughnessMap.value=b.roughnessMap,t(b.roughnessMap,M.roughnessMapTransform)),b.envMap&&(M.envMapIntensity.value=b.envMapIntensity)}function v(M,b,A){M.ior.value=b.ior,b.sheen>0&&(M.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),M.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(M.sheenColorMap.value=b.sheenColorMap,t(b.sheenColorMap,M.sheenColorMapTransform)),b.sheenRoughnessMap&&(M.sheenRoughnessMap.value=b.sheenRoughnessMap,t(b.sheenRoughnessMap,M.sheenRoughnessMapTransform))),b.clearcoat>0&&(M.clearcoat.value=b.clearcoat,M.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(M.clearcoatMap.value=b.clearcoatMap,t(b.clearcoatMap,M.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(M.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,t(b.clearcoatRoughnessMap,M.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(M.clearcoatNormalMap.value=b.clearcoatNormalMap,t(b.clearcoatNormalMap,M.clearcoatNormalMapTransform),M.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===Ei&&M.clearcoatNormalScale.value.negate())),b.dispersion>0&&(M.dispersion.value=b.dispersion),b.iridescence>0&&(M.iridescence.value=b.iridescence,M.iridescenceIOR.value=b.iridescenceIOR,M.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],M.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(M.iridescenceMap.value=b.iridescenceMap,t(b.iridescenceMap,M.iridescenceMapTransform)),b.iridescenceThicknessMap&&(M.iridescenceThicknessMap.value=b.iridescenceThicknessMap,t(b.iridescenceThicknessMap,M.iridescenceThicknessMapTransform))),b.transmission>0&&(M.transmission.value=b.transmission,M.transmissionSamplerMap.value=A.texture,M.transmissionSamplerSize.value.set(A.width,A.height),b.transmissionMap&&(M.transmissionMap.value=b.transmissionMap,t(b.transmissionMap,M.transmissionMapTransform)),M.thickness.value=b.thickness,b.thicknessMap&&(M.thicknessMap.value=b.thicknessMap,t(b.thicknessMap,M.thicknessMapTransform)),M.attenuationDistance.value=b.attenuationDistance,M.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(M.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(M.anisotropyMap.value=b.anisotropyMap,t(b.anisotropyMap,M.anisotropyMapTransform))),M.specularIntensity.value=b.specularIntensity,M.specularColor.value.copy(b.specularColor),b.specularColorMap&&(M.specularColorMap.value=b.specularColorMap,t(b.specularColorMap,M.specularColorMapTransform)),b.specularIntensityMap&&(M.specularIntensityMap.value=b.specularIntensityMap,t(b.specularIntensityMap,M.specularIntensityMapTransform))}function w(M,b){b.matcap&&(M.matcap.value=b.matcap)}function T(M,b){const A=e.get(b).light;M.referencePosition.value.setFromMatrixPosition(A.matrixWorld),M.nearDistance.value=A.shadow.camera.near,M.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function VO(n,e,t,i){let r={},s={},a=[];const l=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function d(A,E){const P=E.program;i.uniformBlockBinding(A,P)}function h(A,E){let P=r[A.id];P===void 0&&(w(A),P=m(A),r[A.id]=P,A.addEventListener("dispose",M));const G=E.program;i.updateUBOMapping(A,G);const O=e.render.frame;s[A.id]!==O&&(g(A),s[A.id]=O)}function m(A){const E=u();A.__bindingPointIndex=E;const P=n.createBuffer(),G=A.__size,O=A.usage;return n.bindBuffer(n.UNIFORM_BUFFER,P),n.bufferData(n.UNIFORM_BUFFER,G,O),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,E,P),P}function u(){for(let A=0;A<l;A++)if(a.indexOf(A)===-1)return a.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(A){const E=r[A.id],P=A.uniforms,G=A.__cache;n.bindBuffer(n.UNIFORM_BUFFER,E);for(let O=0,B=P.length;O<B;O++){const F=Array.isArray(P[O])?P[O]:[P[O]];for(let D=0,L=F.length;D<L;D++){const V=F[D];if(v(V,O,D,G)===!0){const ie=V.__offset,re=Array.isArray(V.value)?V.value:[V.value];let de=0;for(let me=0;me<re.length;me++){const $=re[me],ue=T($);typeof $=="number"||typeof $=="boolean"?(V.__data[0]=$,n.bufferSubData(n.UNIFORM_BUFFER,ie+de,V.__data)):$.isMatrix3?(V.__data[0]=$.elements[0],V.__data[1]=$.elements[1],V.__data[2]=$.elements[2],V.__data[3]=0,V.__data[4]=$.elements[3],V.__data[5]=$.elements[4],V.__data[6]=$.elements[5],V.__data[7]=0,V.__data[8]=$.elements[6],V.__data[9]=$.elements[7],V.__data[10]=$.elements[8],V.__data[11]=0):($.toArray(V.__data,de),de+=ue.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,ie,V.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function v(A,E,P,G){const O=A.value,B=E+"_"+P;if(G[B]===void 0)return typeof O=="number"||typeof O=="boolean"?G[B]=O:G[B]=O.clone(),!0;{const F=G[B];if(typeof O=="number"||typeof O=="boolean"){if(F!==O)return G[B]=O,!0}else if(F.equals(O)===!1)return F.copy(O),!0}return!1}function w(A){const E=A.uniforms;let P=0;const G=16;for(let B=0,F=E.length;B<F;B++){const D=Array.isArray(E[B])?E[B]:[E[B]];for(let L=0,V=D.length;L<V;L++){const ie=D[L],re=Array.isArray(ie.value)?ie.value:[ie.value];for(let de=0,me=re.length;de<me;de++){const $=re[de],ue=T($),Y=P%G;Y!==0&&G-Y<ue.boundary&&(P+=G-Y),ie.__data=new Float32Array(ue.storage/Float32Array.BYTES_PER_ELEMENT),ie.__offset=P,P+=ue.storage}}}const O=P%G;return O>0&&(P+=G-O),A.__size=P,A.__cache={},this}function T(A){const E={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(E.boundary=4,E.storage=4):A.isVector2?(E.boundary=8,E.storage=8):A.isVector3||A.isColor?(E.boundary=16,E.storage=12):A.isVector4?(E.boundary=16,E.storage=16):A.isMatrix3?(E.boundary=48,E.storage=48):A.isMatrix4?(E.boundary=64,E.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),E}function M(A){const E=A.target;E.removeEventListener("dispose",M);const P=a.indexOf(E.__bindingPointIndex);a.splice(P,1),n.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function b(){for(const A in r)n.deleteBuffer(r[A]);a=[],r={},s={}}return{bind:d,update:h,dispose:b}}class WO{constructor(e={}){const{canvas:t=FD(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:d=!0,preserveDrawingBuffer:h=!1,powerPreference:m="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let g;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=i.getContextAttributes().alpha}else g=a;const v=new Uint32Array(4),w=new Int32Array(4);let T=null,M=null;const b=[],A=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=on,this.toneMapping=$s,this.toneMappingExposure=1;const E=this;let P=!1,G=0,O=0,B=null,F=-1,D=null;const L=new $t,V=new $t;let ie=null;const re=new Je(0);let de=0,me=t.width,$=t.height,ue=1,Y=null,pe=null;const _e=new $t(0,0,me,$),Ae=new $t(0,0,me,$);let Pe=!1;const Ue=new R_;let ae=!1,ge=!1;const ce=new ot,Me=new j,Ye=new $t,ht={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ft=!1;function Wt(){return B===null?ue:1}let Z=i;function Jt(z,q){return t.getContext(z,q)}try{const z={alpha:!0,depth:r,stencil:s,antialias:l,premultipliedAlpha:d,preserveDrawingBuffer:h,powerPreference:m,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${g_}`),t.addEventListener("webglcontextlost",oe,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",Ge,!1),Z===null){const q="webgl2";if(Z=Jt(q,z),Z===null)throw Jt(q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(z){throw console.error("THREE.WebGLRenderer: "+z.message),z}let Ut,jt,ut,yn,yt,wt,X,N,ve,De,ke,Le,lt,Qe,tt,vt,Ne,nt,Rt,ct,$e,bt,Ie,it;function ee(){Ut=new ZF(Z),Ut.init(),bt=new kO(Z,Ut),jt=new jF(Z,Ut,e,bt),ut=new LO(Z),yn=new eU(Z),yt=new _O,wt=new DO(Z,Ut,ut,yt,jt,bt,yn),X=new YF(E),N=new KF(E),ve=new ok(Z),Ie=new VF(Z,ve),De=new QF(Z,ve,yn,Ie),ke=new nU(Z,De,ve,yn),Rt=new tU(Z,jt,wt),vt=new XF(yt),Le=new gO(E,X,N,Ut,jt,Ie,vt),lt=new GO(E,yt),Qe=new yO,tt=new EO(Ut),nt=new GF(E,X,N,ut,ke,g,d),Ne=new PO(E,ke,jt),it=new VO(Z,yn,jt,ut),ct=new WF(Z,Ut,yn),$e=new JF(Z,Ut,yn),yn.programs=Le.programs,E.capabilities=jt,E.extensions=Ut,E.properties=yt,E.renderLists=Qe,E.shadowMap=Ne,E.state=ut,E.info=yn}ee();const He=new zO(E,Z);this.xr=He,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const z=Ut.get("WEBGL_lose_context");z&&z.loseContext()},this.forceContextRestore=function(){const z=Ut.get("WEBGL_lose_context");z&&z.restoreContext()},this.getPixelRatio=function(){return ue},this.setPixelRatio=function(z){z!==void 0&&(ue=z,this.setSize(me,$,!1))},this.getSize=function(z){return z.set(me,$)},this.setSize=function(z,q,S=!0){if(He.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}me=z,$=q,t.width=Math.floor(z*ue),t.height=Math.floor(q*ue),S===!0&&(t.style.width=z+"px",t.style.height=q+"px"),this.setViewport(0,0,z,q)},this.getDrawingBufferSize=function(z){return z.set(me*ue,$*ue).floor()},this.setDrawingBufferSize=function(z,q,S){me=z,$=q,ue=S,t.width=Math.floor(z*S),t.height=Math.floor(q*S),this.setViewport(0,0,z,q)},this.getCurrentViewport=function(z){return z.copy(L)},this.getViewport=function(z){return z.copy(_e)},this.setViewport=function(z,q,S,I){z.isVector4?_e.set(z.x,z.y,z.z,z.w):_e.set(z,q,S,I),ut.viewport(L.copy(_e).multiplyScalar(ue).round())},this.getScissor=function(z){return z.copy(Ae)},this.setScissor=function(z,q,S,I){z.isVector4?Ae.set(z.x,z.y,z.z,z.w):Ae.set(z,q,S,I),ut.scissor(V.copy(Ae).multiplyScalar(ue).round())},this.getScissorTest=function(){return Pe},this.setScissorTest=function(z){ut.setScissorTest(Pe=z)},this.setOpaqueSort=function(z){Y=z},this.setTransparentSort=function(z){pe=z},this.getClearColor=function(z){return z.copy(nt.getClearColor())},this.setClearColor=function(){nt.setClearColor.apply(nt,arguments)},this.getClearAlpha=function(){return nt.getClearAlpha()},this.setClearAlpha=function(){nt.setClearAlpha.apply(nt,arguments)},this.clear=function(z=!0,q=!0,S=!0){let I=0;if(z){let k=!1;if(B!==null){const W=B.texture.format;k=W===S_||W===w_||W===x_}if(k){const W=B.texture.type,te=W===Bi||W===Da||W===Pc||W===tl||W===y_||W===b_,Q=nt.getClearColor(),le=nt.getClearAlpha(),R=Q.r,fe=Q.g,J=Q.b;te?(v[0]=R,v[1]=fe,v[2]=J,v[3]=le,Z.clearBufferuiv(Z.COLOR,0,v)):(w[0]=R,w[1]=fe,w[2]=J,w[3]=le,Z.clearBufferiv(Z.COLOR,0,w))}else I|=Z.COLOR_BUFFER_BIT}q&&(I|=Z.DEPTH_BUFFER_BIT),S&&(I|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.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",oe,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",Ge,!1),Qe.dispose(),tt.dispose(),yt.dispose(),X.dispose(),N.dispose(),ke.dispose(),Ie.dispose(),it.dispose(),Le.dispose(),He.dispose(),He.removeEventListener("sessionstart",ii),He.removeEventListener("sessionend",Nt),fr.stop()};function oe(z){z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function Ce(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const z=yn.autoReset,q=Ne.enabled,S=Ne.autoUpdate,I=Ne.needsUpdate,k=Ne.type;ee(),yn.autoReset=z,Ne.enabled=q,Ne.autoUpdate=S,Ne.needsUpdate=I,Ne.type=k}function Ge(z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",z.statusMessage)}function gt(z){const q=z.target;q.removeEventListener("dispose",gt),Pt(q)}function Pt(z){un(z),yt.remove(z)}function un(z){const q=yt.get(z).programs;q!==void 0&&(q.forEach(function(S){Le.releaseProgram(S)}),z.isShaderMaterial&&Le.releaseShaderCache(z))}this.renderBufferDirect=function(z,q,S,I,k,W){q===null&&(q=ht);const te=k.isMesh&&k.matrixWorld.determinant()<0,Q=Ba(z,q,S,I,k);ut.setMaterial(I,te);let le=S.index,R=1;if(I.wireframe===!0){if(le=De.getWireframeAttribute(S),le===void 0)return;R=2}const fe=S.drawRange,J=S.attributes.position;let be=fe.start*R,Fe=(fe.start+fe.count)*R;W!==null&&(be=Math.max(be,W.start*R),Fe=Math.min(Fe,(W.start+W.count)*R)),le!==null?(be=Math.max(be,0),Fe=Math.min(Fe,le.count)):J!=null&&(be=Math.max(be,0),Fe=Math.min(Fe,J.count));const Oe=Fe-be;if(Oe<0||Oe===1/0)return;Ie.setup(k,I,Q,S,le);let We,Ee=ct;if(le!==null&&(We=ve.get(le),Ee=$e,Ee.setIndex(We)),k.isMesh)I.wireframe===!0?(ut.setLineWidth(I.wireframeLinewidth*Wt()),Ee.setMode(Z.LINES)):Ee.setMode(Z.TRIANGLES);else if(k.isLine){let Te=I.linewidth;Te===void 0&&(Te=1),ut.setLineWidth(Te*Wt()),k.isLineSegments?Ee.setMode(Z.LINES):k.isLineLoop?Ee.setMode(Z.LINE_LOOP):Ee.setMode(Z.LINE_STRIP)}else k.isPoints?Ee.setMode(Z.POINTS):k.isSprite&&Ee.setMode(Z.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)Ee.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(Ut.get("WEBGL_multi_draw"))Ee.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const Te=k._multiDrawStarts,Xe=k._multiDrawCounts,qe=k._multiDrawCount,Tt=le?ve.get(le).bytesPerElement:1,Ht=yt.get(I).currentProgram.getUniforms();for(let en=0;en<qe;en++)Ht.setValue(Z,"_gl_DrawID",en),Ee.render(Te[en]/Tt,Xe[en])}else if(k.isInstancedMesh)Ee.renderInstances(be,Oe,k.count);else if(S.isInstancedBufferGeometry){const Te=S._maxInstanceCount!==void 0?S._maxInstanceCount:1/0,Xe=Math.min(S.instanceCount,Te);Ee.renderInstances(be,Oe,Xe)}else Ee.render(be,Oe)};function Ln(z,q,S){z.transparent===!0&&z.side===Si&&z.forceSinglePass===!1?(z.side=Ei,z.needsUpdate=!0,Qi(z,q,S),z.side=gs,z.needsUpdate=!0,Qi(z,q,S),z.side=Si):Qi(z,q,S)}this.compile=function(z,q,S=null){S===null&&(S=z),M=tt.get(S),M.init(q),A.push(M),S.traverseVisible(function(k){k.isLight&&k.layers.test(q.layers)&&(M.pushLight(k),k.castShadow&&M.pushShadow(k))}),z!==S&&z.traverseVisible(function(k){k.isLight&&k.layers.test(q.layers)&&(M.pushLight(k),k.castShadow&&M.pushShadow(k))}),M.setupLights();const I=new Set;return z.traverse(function(k){const W=k.material;if(W)if(Array.isArray(W))for(let te=0;te<W.length;te++){const Q=W[te];Ln(Q,S,k),I.add(Q)}else Ln(W,S,k),I.add(W)}),A.pop(),M=null,I},this.compileAsync=function(z,q,S=null){const I=this.compile(z,q,S);return new Promise(k=>{function W(){if(I.forEach(function(te){yt.get(te).currentProgram.isReady()&&I.delete(te)}),I.size===0){k(z);return}setTimeout(W,10)}Ut.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let Ot=null;function oi(z){Ot&&Ot(z)}function ii(){fr.stop()}function Nt(){fr.start()}const fr=new IE;fr.setAnimationLoop(oi),typeof self<"u"&&fr.setContext(self),this.setAnimationLoop=function(z){Ot=z,He.setAnimationLoop(z),z===null?fr.stop():fr.start()},He.addEventListener("sessionstart",ii),He.addEventListener("sessionend",Nt),this.render=function(z,q){if(q!==void 0&&q.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),q.parent===null&&q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),He.enabled===!0&&He.isPresenting===!0&&(He.cameraAutoUpdate===!0&&He.updateCamera(q),q=He.getCamera()),z.isScene===!0&&z.onBeforeRender(E,z,q,B),M=tt.get(z,A.length),M.init(q),A.push(M),ce.multiplyMatrices(q.projectionMatrix,q.matrixWorldInverse),Ue.setFromProjectionMatrix(ce),ge=this.localClippingEnabled,ae=vt.init(this.clippingPlanes,ge),T=Qe.get(z,b.length),T.init(),b.push(T),He.enabled===!0&&He.isPresenting===!0){const W=E.xr.getDepthSensingMesh();W!==null&&ys(W,q,-1/0,E.sortObjects)}ys(z,q,0,E.sortObjects),T.finish(),E.sortObjects===!0&&T.sort(Y,pe),ft=He.enabled===!1||He.isPresenting===!1||He.hasDepthSensing()===!1,ft&&nt.addToRenderList(T,z),this.info.render.frame++,ae===!0&&vt.beginShadows();const S=M.state.shadowsArray;Ne.render(S,z,q),ae===!0&&vt.endShadows(),this.info.autoReset===!0&&this.info.reset();const I=T.opaque,k=T.transmissive;if(M.setupLights(),q.isArrayCamera){const W=q.cameras;if(k.length>0)for(let te=0,Q=W.length;te<Q;te++){const le=W[te];ra(I,k,z,le)}ft&&nt.render(z);for(let te=0,Q=W.length;te<Q;te++){const le=W[te];Ci(T,z,le,le.viewport)}}else k.length>0&&ra(I,k,z,q),ft&&nt.render(z),Ci(T,z,q);B!==null&&(wt.updateMultisampleRenderTarget(B),wt.updateRenderTargetMipmap(B)),z.isScene===!0&&z.onAfterRender(E,z,q),Ie.resetDefaultState(),F=-1,D=null,A.pop(),A.length>0?(M=A[A.length-1],ae===!0&&vt.setGlobalState(E.clippingPlanes,M.state.camera)):M=null,b.pop(),b.length>0?T=b[b.length-1]:T=null};function ys(z,q,S,I){if(z.visible===!1)return;if(z.layers.test(q.layers)){if(z.isGroup)S=z.renderOrder;else if(z.isLOD)z.autoUpdate===!0&&z.update(q);else if(z.isLight)M.pushLight(z),z.castShadow&&M.pushShadow(z);else if(z.isSprite){if(!z.frustumCulled||Ue.intersectsSprite(z)){I&&Ye.setFromMatrixPosition(z.matrixWorld).applyMatrix4(ce);const te=ke.update(z),Q=z.material;Q.visible&&T.push(z,te,Q,S,Ye.z,null)}}else if((z.isMesh||z.isLine||z.isPoints)&&(!z.frustumCulled||Ue.intersectsObject(z))){const te=ke.update(z),Q=z.material;if(I&&(z.boundingSphere!==void 0?(z.boundingSphere===null&&z.computeBoundingSphere(),Ye.copy(z.boundingSphere.center)):(te.boundingSphere===null&&te.computeBoundingSphere(),Ye.copy(te.boundingSphere.center)),Ye.applyMatrix4(z.matrixWorld).applyMatrix4(ce)),Array.isArray(Q)){const le=te.groups;for(let R=0,fe=le.length;R<fe;R++){const J=le[R],be=Q[J.materialIndex];be&&be.visible&&T.push(z,te,be,S,Ye.z,J)}}else Q.visible&&T.push(z,te,Q,S,Ye.z,null)}}const W=z.children;for(let te=0,Q=W.length;te<Q;te++)ys(W[te],q,S,I)}function Ci(z,q,S,I){const k=z.opaque,W=z.transmissive,te=z.transparent;M.setupLightsView(S),ae===!0&&vt.setGlobalState(E.clippingPlanes,S),I&&ut.viewport(L.copy(I)),k.length>0&&Ri(k,q,S),W.length>0&&Ri(W,q,S),te.length>0&&Ri(te,q,S),ut.buffers.depth.setTest(!0),ut.buffers.depth.setMask(!0),ut.buffers.color.setMask(!0),ut.setPolygonOffset(!1)}function ra(z,q,S,I){if((S.isScene===!0?S.overrideMaterial:null)!==null)return;M.state.transmissionRenderTarget[I.id]===void 0&&(M.state.transmissionRenderTarget[I.id]=new Zs(1,1,{generateMipmaps:!0,type:Ut.has("EXT_color_buffer_half_float")||Ut.has("EXT_color_buffer_float")?gi:Bi,minFilter:Er,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));const W=M.state.transmissionRenderTarget[I.id],te=I.viewport||L;W.setSize(te.z,te.w);const Q=E.getRenderTarget();E.setRenderTarget(W),E.getClearColor(re),de=E.getClearAlpha(),de<1&&E.setClearColor(16777215,.5),ft?nt.render(S):E.clear();const le=E.toneMapping;E.toneMapping=$s;const R=I.viewport;if(I.viewport!==void 0&&(I.viewport=void 0),M.setupLightsView(I),ae===!0&&vt.setGlobalState(E.clippingPlanes,I),Ri(z,S,I),wt.updateMultisampleRenderTarget(W),wt.updateRenderTargetMipmap(W),Ut.has("WEBGL_multisampled_render_to_texture")===!1){let fe=!1;for(let J=0,be=q.length;J<be;J++){const Fe=q[J],Oe=Fe.object,We=Fe.geometry,Ee=Fe.material,Te=Fe.group;if(Ee.side===Si&&Oe.layers.test(I.layers)){const Xe=Ee.side;Ee.side=Ei,Ee.needsUpdate=!0,bs(Oe,S,I,We,Ee,Te),Ee.side=Xe,Ee.needsUpdate=!0,fe=!0}}fe===!0&&(wt.updateMultisampleRenderTarget(W),wt.updateRenderTargetMipmap(W))}E.setRenderTarget(Q),E.setClearColor(re,de),R!==void 0&&(I.viewport=R),E.toneMapping=le}function Ri(z,q,S){const I=q.isScene===!0?q.overrideMaterial:null;for(let k=0,W=z.length;k<W;k++){const te=z[k],Q=te.object,le=te.geometry,R=I===null?te.material:I,fe=te.group;Q.layers.test(S.layers)&&bs(Q,q,S,le,R,fe)}}function bs(z,q,S,I,k,W){z.onBeforeRender(E,q,S,I,k,W),z.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,z.matrixWorld),z.normalMatrix.getNormalMatrix(z.modelViewMatrix),k.transparent===!0&&k.side===Si&&k.forceSinglePass===!1?(k.side=Ei,k.needsUpdate=!0,E.renderBufferDirect(S,q,I,k,z,W),k.side=gs,k.needsUpdate=!0,E.renderBufferDirect(S,q,I,k,z,W),k.side=Si):E.renderBufferDirect(S,q,I,k,z,W),z.onAfterRender(E,q,S,I,k,W)}function Qi(z,q,S){q.isScene!==!0&&(q=ht);const I=yt.get(z),k=M.state.lights,W=M.state.shadowsArray,te=k.state.version,Q=Le.getParameters(z,k.state,W,q,S),le=Le.getProgramCacheKey(Q);let R=I.programs;I.environment=z.isMeshStandardMaterial?q.environment:null,I.fog=q.fog,I.envMap=(z.isMeshStandardMaterial?N:X).get(z.envMap||I.environment),I.envMapRotation=I.environment!==null&&z.envMap===null?q.environmentRotation:z.envMapRotation,R===void 0&&(z.addEventListener("dispose",gt),R=new Map,I.programs=R);let fe=R.get(le);if(fe!==void 0){if(I.currentProgram===fe&&I.lightsStateVersion===te)return Xr(z,Q),fe}else Q.uniforms=Le.getUniforms(z),z.onBeforeCompile(Q,E),fe=Le.acquireProgram(Q,le),R.set(le,fe),I.uniforms=Q.uniforms;const J=I.uniforms;return(!z.isShaderMaterial&&!z.isRawShaderMaterial||z.clipping===!0)&&(J.clippingPlanes=vt.uniform),Xr(z,Q),I.needsLights=gl(z),I.lightsStateVersion=te,I.needsLights&&(J.ambientLightColor.value=k.state.ambient,J.lightProbe.value=k.state.probe,J.directionalLights.value=k.state.directional,J.directionalLightShadows.value=k.state.directionalShadow,J.spotLights.value=k.state.spot,J.spotLightShadows.value=k.state.spotShadow,J.rectAreaLights.value=k.state.rectArea,J.ltc_1.value=k.state.rectAreaLTC1,J.ltc_2.value=k.state.rectAreaLTC2,J.pointLights.value=k.state.point,J.pointLightShadows.value=k.state.pointShadow,J.hemisphereLights.value=k.state.hemi,J.directionalShadowMap.value=k.state.directionalShadowMap,J.directionalShadowMatrix.value=k.state.directionalShadowMatrix,J.spotShadowMap.value=k.state.spotShadowMap,J.spotLightMatrix.value=k.state.spotLightMatrix,J.spotLightMap.value=k.state.spotLightMap,J.pointShadowMap.value=k.state.pointShadowMap,J.pointShadowMatrix.value=k.state.pointShadowMatrix),I.currentProgram=fe,I.uniformsList=null,fe}function xs(z){if(z.uniformsList===null){const q=z.currentProgram.getUniforms();z.uniformsList=Fd.seqWithValue(q.seq,z.uniforms)}return z.uniformsList}function Xr(z,q){const S=yt.get(z);S.outputColorSpace=q.outputColorSpace,S.batching=q.batching,S.batchingColor=q.batchingColor,S.instancing=q.instancing,S.instancingColor=q.instancingColor,S.instancingMorph=q.instancingMorph,S.skinning=q.skinning,S.morphTargets=q.morphTargets,S.morphNormals=q.morphNormals,S.morphColors=q.morphColors,S.morphTargetsCount=q.morphTargetsCount,S.numClippingPlanes=q.numClippingPlanes,S.numIntersection=q.numClipIntersection,S.vertexAlphas=q.vertexAlphas,S.vertexTangents=q.vertexTangents,S.toneMapping=q.toneMapping}function Ba(z,q,S,I,k){q.isScene!==!0&&(q=ht),wt.resetTextureUnits();const W=q.fog,te=I.isMeshStandardMaterial?q.environment:null,Q=B===null?E.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:Sn,le=(I.isMeshStandardMaterial?N:X).get(I.envMap||te),R=I.vertexColors===!0&&!!S.attributes.color&&S.attributes.color.itemSize===4,fe=!!S.attributes.tangent&&(!!I.normalMap||I.anisotropy>0),J=!!S.morphAttributes.position,be=!!S.morphAttributes.normal,Fe=!!S.morphAttributes.color;let Oe=$s;I.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(Oe=E.toneMapping);const We=S.morphAttributes.position||S.morphAttributes.normal||S.morphAttributes.color,Ee=We!==void 0?We.length:0,Te=yt.get(I),Xe=M.state.lights;if(ae===!0&&(ge===!0||z!==D)){const Xt=z===D&&I.id===F;vt.setState(I,z,Xt)}let qe=!1;I.version===Te.__version?(Te.needsLights&&Te.lightsStateVersion!==Xe.state.version||Te.outputColorSpace!==Q||k.isBatchedMesh&&Te.batching===!1||!k.isBatchedMesh&&Te.batching===!0||k.isBatchedMesh&&Te.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&Te.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&Te.instancing===!1||!k.isInstancedMesh&&Te.instancing===!0||k.isSkinnedMesh&&Te.skinning===!1||!k.isSkinnedMesh&&Te.skinning===!0||k.isInstancedMesh&&Te.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&Te.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&Te.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&Te.instancingMorph===!1&&k.morphTexture!==null||Te.envMap!==le||I.fog===!0&&Te.fog!==W||Te.numClippingPlanes!==void 0&&(Te.numClippingPlanes!==vt.numPlanes||Te.numIntersection!==vt.numIntersection)||Te.vertexAlphas!==R||Te.vertexTangents!==fe||Te.morphTargets!==J||Te.morphNormals!==be||Te.morphColors!==Fe||Te.toneMapping!==Oe||Te.morphTargetsCount!==Ee)&&(qe=!0):(qe=!0,Te.__version=I.version);let Tt=Te.currentProgram;qe===!0&&(Tt=Qi(I,q,k));let Ht=!1,en=!1,Bt=!1;const pt=Tt.getUniforms(),Gt=Te.uniforms;if(ut.useProgram(Tt.program)&&(Ht=!0,en=!0,Bt=!0),I.id!==F&&(F=I.id,en=!0),Ht||D!==z){pt.setValue(Z,"projectionMatrix",z.projectionMatrix),pt.setValue(Z,"viewMatrix",z.matrixWorldInverse);const Xt=pt.map.cameraPosition;Xt!==void 0&&Xt.setValue(Z,Me.setFromMatrixPosition(z.matrixWorld)),jt.logarithmicDepthBuffer&&pt.setValue(Z,"logDepthBufFC",2/(Math.log(z.far+1)/Math.LN2)),(I.isMeshPhongMaterial||I.isMeshToonMaterial||I.isMeshLambertMaterial||I.isMeshBasicMaterial||I.isMeshStandardMaterial||I.isShaderMaterial)&&pt.setValue(Z,"isOrthographic",z.isOrthographicCamera===!0),D!==z&&(D=z,en=!0,Bt=!0)}if(k.isSkinnedMesh){pt.setOptional(Z,k,"bindMatrix"),pt.setOptional(Z,k,"bindMatrixInverse");const Xt=k.skeleton;Xt&&(Xt.boneTexture===null&&Xt.computeBoneTexture(),pt.setValue(Z,"boneTexture",Xt.boneTexture,wt))}k.isBatchedMesh&&(pt.setOptional(Z,k,"batchingTexture"),pt.setValue(Z,"batchingTexture",k._matricesTexture,wt),pt.setOptional(Z,k,"batchingIdTexture"),pt.setValue(Z,"batchingIdTexture",k._indirectTexture,wt),pt.setOptional(Z,k,"batchingColorTexture"),k._colorsTexture!==null&&pt.setValue(Z,"batchingColorTexture",k._colorsTexture,wt));const In=S.morphAttributes;if((In.position!==void 0||In.normal!==void 0||In.color!==void 0)&&Rt.update(k,S,Tt),(en||Te.receiveShadow!==k.receiveShadow)&&(Te.receiveShadow=k.receiveShadow,pt.setValue(Z,"receiveShadow",k.receiveShadow)),I.isMeshGouraudMaterial&&I.envMap!==null&&(Gt.envMap.value=le,Gt.flipEnvMap.value=le.isCubeTexture&&le.isRenderTargetTexture===!1?-1:1),I.isMeshStandardMaterial&&I.envMap===null&&q.environment!==null&&(Gt.envMapIntensity.value=q.environmentIntensity),en&&(pt.setValue(Z,"toneMappingExposure",E.toneMappingExposure),Te.needsLights&&Ji(Gt,Bt),W&&I.fog===!0&&lt.refreshFogUniforms(Gt,W),lt.refreshMaterialUniforms(Gt,I,ue,$,M.state.transmissionRenderTarget[z.id]),Fd.upload(Z,xs(Te),Gt,wt)),I.isShaderMaterial&&I.uniformsNeedUpdate===!0&&(Fd.upload(Z,xs(Te),Gt,wt),I.uniformsNeedUpdate=!1),I.isSpriteMaterial&&pt.setValue(Z,"center",k.center),pt.setValue(Z,"modelViewMatrix",k.modelViewMatrix),pt.setValue(Z,"normalMatrix",k.normalMatrix),pt.setValue(Z,"modelMatrix",k.matrixWorld),I.isShaderMaterial||I.isRawShaderMaterial){const Xt=I.uniformsGroups;for(let St=0,Zt=Xt.length;St<Zt;St++){const Qn=Xt[St];it.update(Qn,Tt),it.bind(Qn,Tt)}}return Tt}function Ji(z,q){z.ambientLightColor.needsUpdate=q,z.lightProbe.needsUpdate=q,z.directionalLights.needsUpdate=q,z.directionalLightShadows.needsUpdate=q,z.pointLights.needsUpdate=q,z.pointLightShadows.needsUpdate=q,z.spotLights.needsUpdate=q,z.spotLightShadows.needsUpdate=q,z.rectAreaLights.needsUpdate=q,z.hemisphereLights.needsUpdate=q}function gl(z){return z.isMeshLambertMaterial||z.isMeshToonMaterial||z.isMeshPhongMaterial||z.isMeshStandardMaterial||z.isShadowMaterial||z.isShaderMaterial&&z.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return O},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(z,q,S){yt.get(z.texture).__webglTexture=q,yt.get(z.depthTexture).__webglTexture=S;const I=yt.get(z);I.__hasExternalTextures=!0,I.__autoAllocateDepthBuffer=S===void 0,I.__autoAllocateDepthBuffer||Ut.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),I.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(z,q){const S=yt.get(z);S.__webglFramebuffer=q,S.__useDefaultFramebuffer=q===void 0},this.setRenderTarget=function(z,q=0,S=0){B=z,G=q,O=S;let I=!0,k=null,W=!1,te=!1;if(z){const le=yt.get(z);le.__useDefaultFramebuffer!==void 0?(ut.bindFramebuffer(Z.FRAMEBUFFER,null),I=!1):le.__webglFramebuffer===void 0?wt.setupRenderTarget(z):le.__hasExternalTextures&&wt.rebindTextures(z,yt.get(z.texture).__webglTexture,yt.get(z.depthTexture).__webglTexture);const R=z.texture;(R.isData3DTexture||R.isDataArrayTexture||R.isCompressedArrayTexture)&&(te=!0);const fe=yt.get(z).__webglFramebuffer;z.isWebGLCubeRenderTarget?(Array.isArray(fe[q])?k=fe[q][S]:k=fe[q],W=!0):z.samples>0&&wt.useMultisampledRTT(z)===!1?k=yt.get(z).__webglMultisampledFramebuffer:Array.isArray(fe)?k=fe[S]:k=fe,L.copy(z.viewport),V.copy(z.scissor),ie=z.scissorTest}else L.copy(_e).multiplyScalar(ue).floor(),V.copy(Ae).multiplyScalar(ue).floor(),ie=Pe;if(ut.bindFramebuffer(Z.FRAMEBUFFER,k)&&I&&ut.drawBuffers(z,k),ut.viewport(L),ut.scissor(V),ut.setScissorTest(ie),W){const le=yt.get(z.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+q,le.__webglTexture,S)}else if(te){const le=yt.get(z.texture),R=q||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,le.__webglTexture,S||0,R)}F=-1},this.readRenderTargetPixels=function(z,q,S,I,k,W,te){if(!(z&&z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Q=yt.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&te!==void 0&&(Q=Q[te]),Q){ut.bindFramebuffer(Z.FRAMEBUFFER,Q);try{const le=z.texture,R=le.format,fe=le.type;if(!jt.textureFormatReadable(R)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!jt.textureTypeReadable(fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q>=0&&q<=z.width-I&&S>=0&&S<=z.height-k&&Z.readPixels(q,S,I,k,bt.convert(R),bt.convert(fe),W)}finally{const le=B!==null?yt.get(B).__webglFramebuffer:null;ut.bindFramebuffer(Z.FRAMEBUFFER,le)}}},this.readRenderTargetPixelsAsync=async function(z,q,S,I,k,W,te){if(!(z&&z.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Q=yt.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&te!==void 0&&(Q=Q[te]),Q){ut.bindFramebuffer(Z.FRAMEBUFFER,Q);try{const le=z.texture,R=le.format,fe=le.type;if(!jt.textureFormatReadable(R))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!jt.textureTypeReadable(fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(q>=0&&q<=z.width-I&&S>=0&&S<=z.height-k){const J=Z.createBuffer();Z.bindBuffer(Z.PIXEL_PACK_BUFFER,J),Z.bufferData(Z.PIXEL_PACK_BUFFER,W.byteLength,Z.STREAM_READ),Z.readPixels(q,S,I,k,bt.convert(R),bt.convert(fe),0),Z.flush();const be=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);await UD(Z,be,4);try{Z.bindBuffer(Z.PIXEL_PACK_BUFFER,J),Z.getBufferSubData(Z.PIXEL_PACK_BUFFER,0,W)}finally{Z.deleteBuffer(J),Z.deleteSync(be)}return W}}finally{const le=B!==null?yt.get(B).__webglFramebuffer:null;ut.bindFramebuffer(Z.FRAMEBUFFER,le)}}},this.copyFramebufferToTexture=function(z,q=null,S=0){z.isTexture!==!0&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),q=arguments[0]||null,z=arguments[1]);const I=Math.pow(2,-S),k=Math.floor(z.image.width*I),W=Math.floor(z.image.height*I),te=q!==null?q.x:0,Q=q!==null?q.y:0;wt.setTexture2D(z,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,S,0,0,te,Q,k,W),ut.unbindTexture()},this.copyTextureToTexture=function(z,q,S=null,I=null,k=0){z.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),I=arguments[0]||null,z=arguments[1],q=arguments[2],k=arguments[3]||0,S=null);let W,te,Q,le,R,fe;S!==null?(W=S.max.x-S.min.x,te=S.max.y-S.min.y,Q=S.min.x,le=S.min.y):(W=z.image.width,te=z.image.height,Q=0,le=0),I!==null?(R=I.x,fe=I.y):(R=0,fe=0);const J=bt.convert(q.format),be=bt.convert(q.type);wt.setTexture2D(q,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,q.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,q.unpackAlignment);const Fe=Z.getParameter(Z.UNPACK_ROW_LENGTH),Oe=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),We=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Ee=Z.getParameter(Z.UNPACK_SKIP_ROWS),Te=Z.getParameter(Z.UNPACK_SKIP_IMAGES),Xe=z.isCompressedTexture?z.mipmaps[k]:z.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Xe.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,Xe.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Q),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,le),z.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,k,R,fe,W,te,J,be,Xe.data):z.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,k,R,fe,Xe.width,Xe.height,J,Xe.data):Z.texSubImage2D(Z.TEXTURE_2D,k,R,fe,W,te,J,be,Xe),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Fe),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,Oe),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,We),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ee),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Te),k===0&&q.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),ut.unbindTexture()},this.copyTextureToTexture3D=function(z,q,S=null,I=null,k=0){z.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),S=arguments[0]||null,I=arguments[1]||null,z=arguments[2],q=arguments[3],k=arguments[4]||0);let W,te,Q,le,R,fe,J,be,Fe;const Oe=z.isCompressedTexture?z.mipmaps[k]:z.image;S!==null?(W=S.max.x-S.min.x,te=S.max.y-S.min.y,Q=S.max.z-S.min.z,le=S.min.x,R=S.min.y,fe=S.min.z):(W=Oe.width,te=Oe.height,Q=Oe.depth,le=0,R=0,fe=0),I!==null?(J=I.x,be=I.y,Fe=I.z):(J=0,be=0,Fe=0);const We=bt.convert(q.format),Ee=bt.convert(q.type);let Te;if(q.isData3DTexture)wt.setTexture3D(q,0),Te=Z.TEXTURE_3D;else if(q.isDataArrayTexture||q.isCompressedArrayTexture)wt.setTexture2DArray(q,0),Te=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,q.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,q.unpackAlignment);const Xe=Z.getParameter(Z.UNPACK_ROW_LENGTH),qe=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Tt=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Ht=Z.getParameter(Z.UNPACK_SKIP_ROWS),en=Z.getParameter(Z.UNPACK_SKIP_IMAGES);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Oe.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,Oe.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,le),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,R),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,fe),z.isDataTexture||z.isData3DTexture?Z.texSubImage3D(Te,k,J,be,Fe,W,te,Q,We,Ee,Oe.data):q.isCompressedArrayTexture?Z.compressedTexSubImage3D(Te,k,J,be,Fe,W,te,Q,We,Oe.data):Z.texSubImage3D(Te,k,J,be,Fe,W,te,Q,We,Ee,Oe),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Xe),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,qe),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Tt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ht),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,en),k===0&&q.generateMipmaps&&Z.generateMipmap(Te),ut.unbindTexture()},this.initRenderTarget=function(z){yt.get(z).__webglFramebuffer===void 0&&wt.setupRenderTarget(z)},this.initTexture=function(z){z.isCubeTexture?wt.setTextureCube(z,0):z.isData3DTexture?wt.setTexture3D(z,0):z.isDataArrayTexture||z.isCompressedArrayTexture?wt.setTexture2DArray(z,0):wt.setTexture2D(z,0),ut.unbindTexture()},this.resetState=function(){G=0,O=0,B=null,ut.reset(),Ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return cs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===M_?"display-p3":"srgb",t.unpackColorSpace=Kt.workingColorSpace===Hh?"display-p3":"srgb"}}class kc extends sn{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 Pn,this.environmentIntensity=1,this.environmentRotation=new Pn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class jO{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ag,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Cr()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return T_("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,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Cr()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Cr()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const yi=new j;class L_{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}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,i=this.data.count;t<i;t++)yi.fromBufferAttribute(this,t),yi.applyMatrix4(e),this.setXYZ(t,yi.x,yi.y,yi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)yi.fromBufferAttribute(this,t),yi.applyNormalMatrix(e),this.setXYZ(t,yi.x,yi.y,yi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)yi.fromBufferAttribute(this,t),yi.transformDirection(e),this.setXYZ(t,yi.x,yi.y,yi.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=Mr(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=tn(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=tn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=tn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=tn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=tn(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=Mr(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Mr(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Mr(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Mr(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),r=tn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),r=tn(r,this.array),s=tn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new _n(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new L_(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const Zw=new j,Qw=new $t,Jw=new $t,XO=new j,eS=new ot,ed=new j,vp=new Wr,tS=new ot,yp=new jc;class NE extends wn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=tw,this.bindMatrix=new ot,this.bindMatrixInverse=new ot,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Pr),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,ed),this.boundingBox.expandByPoint(ed)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Wr),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,ed),this.boundingSphere.expandByPoint(ed)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),vp.copy(this.boundingSphere),vp.applyMatrix4(r),e.ray.intersectsSphere(vp)!==!1&&(tS.copy(r).invert(),yp.copy(e.ray).applyMatrix4(tS),!(this.boundingBox!==null&&yp.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,yp)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new $t,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===tw?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===aD?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;Qw.fromBufferAttribute(r.attributes.skinIndex,e),Jw.fromBufferAttribute(r.attributes.skinWeight,e),Zw.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Jw.getComponent(s);if(a!==0){const l=Qw.getComponent(s);eS.multiplyMatrices(i.bones[l].matrixWorld,i.boneInverses[l]),t.addScaledVector(XO.copy(Zw).applyMatrix4(eS),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class _h extends sn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class $c extends qn{constructor(e=null,t=1,i=1,r,s,a,l,d,h=Fn,m=Fn,u,g){super(null,a,l,d,h,m,r,s,u,g),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const nS=new ot,YO=new ot;class Vh{constructor(e=[],t=[]){this.uuid=Cr(),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(e.length*16),t.length===0)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 i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new ot)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ot;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const l=e[s]?e[s].matrixWorld:YO;nS.multiplyMatrices(l,t[s]),nS.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Vh(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new $c(t,e,e,Vn,Un);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new _h),this.bones.push(a),this.boneInverses.push(new ot().fromArray(e.boneInverses[i]))}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,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const l=i[r];e.boneInverses.push(l.toArray())}return e}}class lg extends _n{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 lo=new ot,iS=new ot,td=[],rS=new Pr,$O=new ot,Nl=new wn,Bl=new Wr;class qO extends wn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new lg(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,$O)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Pr),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,lo),rS.copy(e.boundingBox).applyMatrix4(lo),this.boundingBox.union(rS)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Wr),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,lo),Bl.copy(e.boundingSphere).applyMatrix4(lo),this.boundingSphere.union(Bl)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,a=e*s+1;for(let l=0;l<i.length;l++)i[l]=r[a+l]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(Nl.geometry=this.geometry,Nl.material=this.material,Nl.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Bl.copy(this.boundingSphere),Bl.applyMatrix4(i),e.ray.intersectsSphere(Bl)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,lo),iS.multiplyMatrices(i,lo),Nl.matrixWorld=iS,Nl.raycast(e,td);for(let a=0,l=td.length;a<l;a++){const d=td[a];d.instanceId=s,d.object=this,t.push(d)}td.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new lg(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new $c(new Float32Array(r*this.count),r,this.count,Wc,Un));const s=this.morphTexture.source.data.data;let a=0;for(let h=0;h<i.length;h++)a+=i[h];const l=this.geometry.morphTargetsRelative?1:1-a,d=r*e;s[d]=l,s.set(i,d+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class Aa extends _i{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Je(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}}const vh=new j,yh=new j,sS=new ot,zl=new jc,nd=new Wr,bp=new j,aS=new j;class Wh extends sn{constructor(e=new On,t=new Aa){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(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)vh.fromBufferAttribute(t,r-1),yh.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=vh.distanceTo(yh);e.setAttribute("lineDistance",new nn(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),nd.copy(i.boundingSphere),nd.applyMatrix4(r),nd.radius+=s,e.ray.intersectsSphere(nd)===!1)return;sS.copy(r).invert(),zl.copy(e.ray).applyMatrix4(sS);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),d=l*l,h=this.isLineSegments?2:1,m=i.index,g=i.attributes.position;if(m!==null){const v=Math.max(0,a.start),w=Math.min(m.count,a.start+a.count);for(let T=v,M=w-1;T<M;T+=h){const b=m.getX(T),A=m.getX(T+1),E=id(this,e,zl,d,b,A);E&&t.push(E)}if(this.isLineLoop){const T=m.getX(w-1),M=m.getX(v),b=id(this,e,zl,d,T,M);b&&t.push(b)}}else{const v=Math.max(0,a.start),w=Math.min(g.count,a.start+a.count);for(let T=v,M=w-1;T<M;T+=h){const b=id(this,e,zl,d,T,T+1);b&&t.push(b)}if(this.isLineLoop){const T=id(this,e,zl,d,w-1,v);T&&t.push(T)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}}function id(n,e,t,i,r,s){const a=n.geometry.attributes.position;if(vh.fromBufferAttribute(a,r),yh.fromBufferAttribute(a,s),t.distanceSqToSegment(vh,yh,bp,aS)>i)return;bp.applyMatrix4(n.matrixWorld);const d=e.ray.origin.distanceTo(bp);if(!(d<e.near||d>e.far))return{distance:d,point:aS.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}const oS=new j,lS=new j;class bh extends Wh{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)oS.fromBufferAttribute(t,r),lS.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+oS.distanceTo(lS);e.setAttribute("lineDistance",new nn(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class KO extends Wh{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Ao extends _i{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Je(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}}const cS=new ot,cg=new jc,rd=new Wr,sd=new j;class Ud extends sn{constructor(e=new On,t=new Ao){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 i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),rd.copy(i.boundingSphere),rd.applyMatrix4(r),rd.radius+=s,e.ray.intersectsSphere(rd)===!1)return;cS.copy(r).invert(),cg.copy(e.ray).applyMatrix4(cS);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),d=l*l,h=i.index,u=i.attributes.position;if(h!==null){const g=Math.max(0,a.start),v=Math.min(h.count,a.start+a.count);for(let w=g,T=v;w<T;w++){const M=h.getX(w);sd.fromBufferAttribute(u,M),uS(sd,M,d,r,e,t,this)}}else{const g=Math.max(0,a.start),v=Math.min(u.count,a.start+a.count);for(let w=g,T=v;w<T;w++)sd.fromBufferAttribute(u,w),uS(sd,w,d,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}}function uS(n,e,t,i,r,s,a){const l=cg.distanceSqToPoint(n);if(l<t){const d=new j;cg.closestPointToPoint(n,d),d.applyMatrix4(i);const h=r.ray.origin.distanceTo(d);if(h<r.near||h>r.far)return;s.push({distance:h,distanceToRay:Math.sqrt(l),point:d,index:e,face:null,object:a})}}class ZO{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let a;t?a=t:a=e*i[s-1];let l=0,d=s-1,h;for(;l<=d;)if(r=Math.floor(l+(d-l)/2),h=i[r]-a,h<0)l=r+1;else if(h>0)d=r-1;else{d=r;break}if(r=d,i[r]===a)return r/(s-1);const m=i[r],g=i[r+1]-m,v=(a-m)/g;return(r+v)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),l=this.getPoint(s),d=t||(a.isVector2?new et:new j);return d.copy(l).sub(a).normalize(),d}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new j,r=[],s=[],a=[],l=new j,d=new ot;for(let v=0;v<=e;v++){const w=v/e;r[v]=this.getTangentAt(w,new j)}s[0]=new j,a[0]=new j;let h=Number.MAX_VALUE;const m=Math.abs(r[0].x),u=Math.abs(r[0].y),g=Math.abs(r[0].z);m<=h&&(h=m,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),g<=h&&i.set(0,0,1),l.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],l),a[0].crossVectors(r[0],s[0]);for(let v=1;v<=e;v++){if(s[v]=s[v-1].clone(),a[v]=a[v-1].clone(),l.crossVectors(r[v-1],r[v]),l.length()>Number.EPSILON){l.normalize();const w=Math.acos(Wn(r[v-1].dot(r[v]),-1,1));s[v].applyMatrix4(d.makeRotationAxis(l,w))}a[v].crossVectors(r[v],s[v])}if(t===!0){let v=Math.acos(Wn(s[0].dot(s[e]),-1,1));v/=e,r[0].dot(l.crossVectors(s[0],s[e]))>0&&(v=-v);for(let w=1;w<=e;w++)s[w].applyMatrix4(d.makeRotationAxis(r[w],v*w)),a[w].crossVectors(r[w],s[w])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}const QO={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=BE(n,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let l,d,h,m,u,g,v;if(i&&(s=iN(n,e,s,t)),n.length>80*t){l=h=n[0],d=m=n[1];for(let w=t;w<r;w+=t)u=n[w],g=n[w+1],u<l&&(l=u),g<d&&(d=g),u>h&&(h=u),g>m&&(m=g);v=Math.max(h-l,m-d),v=v!==0?32767/v:0}return Fc(s,a,t,l,d,v,0),a}};function BE(n,e,t,i,r){let s,a;if(r===pN(n,e,t,i)>0)for(s=e;s<t;s+=i)a=dS(s,n[s],n[s+1],a);else for(s=t-i;s>=e;s-=i)a=dS(s,n[s],n[s+1],a);return a&&jh(a,a.next)&&(Oc(a),a=a.next),a}function ka(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(jh(t,t.next)||Tn(t.prev,t,t.next)===0)){if(Oc(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Fc(n,e,t,i,r,s,a){if(!n)return;!a&&s&&lN(n,i,r,s);let l=n,d,h;for(;n.prev!==n.next;){if(d=n.prev,h=n.next,s?eN(n,i,r,s):JO(n)){e.push(d.i/t|0),e.push(n.i/t|0),e.push(h.i/t|0),Oc(n),n=h.next,l=h.next;continue}if(n=h,n===l){a?a===1?(n=tN(ka(n),e,t),Fc(n,e,t,i,r,s,2)):a===2&&nN(n,e,t,i,r,s):Fc(ka(n),e,t,i,r,s,1);break}}}function JO(n){const e=n.prev,t=n,i=n.next;if(Tn(e,t,i)>=0)return!1;const r=e.x,s=t.x,a=i.x,l=e.y,d=t.y,h=i.y,m=r<s?r<a?r:a:s<a?s:a,u=l<d?l<h?l:h:d<h?d:h,g=r>s?r>a?r:a:s>a?s:a,v=l>d?l>h?l:h:d>h?d:h;let w=i.next;for(;w!==e;){if(w.x>=m&&w.x<=g&&w.y>=u&&w.y<=v&&Co(r,l,s,d,a,h,w.x,w.y)&&Tn(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function eN(n,e,t,i){const r=n.prev,s=n,a=n.next;if(Tn(r,s,a)>=0)return!1;const l=r.x,d=s.x,h=a.x,m=r.y,u=s.y,g=a.y,v=l<d?l<h?l:h:d<h?d:h,w=m<u?m<g?m:g:u<g?u:g,T=l>d?l>h?l:h:d>h?d:h,M=m>u?m>g?m:g:u>g?u:g,b=ug(v,w,e,t,i),A=ug(T,M,e,t,i);let E=n.prevZ,P=n.nextZ;for(;E&&E.z>=b&&P&&P.z<=A;){if(E.x>=v&&E.x<=T&&E.y>=w&&E.y<=M&&E!==r&&E!==a&&Co(l,m,d,u,h,g,E.x,E.y)&&Tn(E.prev,E,E.next)>=0||(E=E.prevZ,P.x>=v&&P.x<=T&&P.y>=w&&P.y<=M&&P!==r&&P!==a&&Co(l,m,d,u,h,g,P.x,P.y)&&Tn(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;E&&E.z>=b;){if(E.x>=v&&E.x<=T&&E.y>=w&&E.y<=M&&E!==r&&E!==a&&Co(l,m,d,u,h,g,E.x,E.y)&&Tn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;P&&P.z<=A;){if(P.x>=v&&P.x<=T&&P.y>=w&&P.y<=M&&P!==r&&P!==a&&Co(l,m,d,u,h,g,P.x,P.y)&&Tn(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function tN(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!jh(r,s)&&zE(r,i,i.next,s)&&Uc(r,s)&&Uc(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Oc(i),Oc(i.next),i=n=s),i=i.next}while(i!==n);return ka(i)}function nN(n,e,t,i,r,s){let a=n;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&dN(a,l)){let d=HE(a,l);a=ka(a,a.next),d=ka(d,d.next),Fc(a,e,t,i,r,s,0),Fc(d,e,t,i,r,s,0);return}l=l.next}a=a.next}while(a!==n)}function iN(n,e,t,i){const r=[];let s,a,l,d,h;for(s=0,a=e.length;s<a;s++)l=e[s]*i,d=s<a-1?e[s+1]*i:n.length,h=BE(n,l,d,i,!1),h===h.next&&(h.steiner=!0),r.push(uN(h));for(r.sort(rN),s=0;s<r.length;s++)t=sN(r[s],t);return t}function rN(n,e){return n.x-e.x}function sN(n,e){const t=aN(n,e);if(!t)return e;const i=HE(t,n);return ka(i,i.next),ka(t,t.next)}function aN(n,e){let t=e,i=-1/0,r;const s=n.x,a=n.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const g=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=s&&g>i&&(i=g,r=t.x<t.next.x?t:t.next,g===s))return r}t=t.next}while(t!==e);if(!r)return null;const l=r,d=r.x,h=r.y;let m=1/0,u;t=r;do s>=t.x&&t.x>=d&&s!==t.x&&Co(a<h?s:i,a,d,h,a<h?i:s,a,t.x,t.y)&&(u=Math.abs(a-t.y)/(s-t.x),Uc(t,n)&&(u<m||u===m&&(t.x>r.x||t.x===r.x&&oN(r,t)))&&(r=t,m=u)),t=t.next;while(t!==l);return r}function oN(n,e){return Tn(n.prev,n,e.prev)<0&&Tn(e.next,n,n.next)<0}function lN(n,e,t,i){let r=n;do r.z===0&&(r.z=ug(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,cN(r)}function cN(n){let e,t,i,r,s,a,l,d,h=1;do{for(t=n,n=null,s=null,a=0;t;){for(a++,i=t,l=0,e=0;e<h&&(l++,i=i.nextZ,!!i);e++);for(d=h;l>0||d>0&&i;)l!==0&&(d===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,l--):(r=i,i=i.nextZ,d--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,h*=2}while(a>1);return n}function ug(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function uN(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Co(n,e,t,i,r,s,a,l){return(r-a)*(e-l)>=(n-a)*(s-l)&&(n-a)*(i-l)>=(t-a)*(e-l)&&(t-a)*(s-l)>=(r-a)*(i-l)}function dN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!hN(n,e)&&(Uc(n,e)&&Uc(e,n)&&fN(n,e)&&(Tn(n.prev,n,e.prev)||Tn(n,e.prev,e))||jh(n,e)&&Tn(n.prev,n,n.next)>0&&Tn(e.prev,e,e.next)>0)}function Tn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function jh(n,e){return n.x===e.x&&n.y===e.y}function zE(n,e,t,i){const r=od(Tn(n,e,t)),s=od(Tn(n,e,i)),a=od(Tn(t,i,n)),l=od(Tn(t,i,e));return!!(r!==s&&a!==l||r===0&&ad(n,t,e)||s===0&&ad(n,i,e)||a===0&&ad(t,n,i)||l===0&&ad(t,e,i))}function ad(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function od(n){return n>0?1:n<0?-1:0}function hN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&zE(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Uc(n,e){return Tn(n.prev,n,n.next)<0?Tn(n,e,n.next)>=0&&Tn(n,n.prev,e)>=0:Tn(n,e,n.prev)<0||Tn(n,n.next,e)<0}function fN(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function HE(n,e){const t=new dg(n.i,n.x,n.y),i=new dg(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function dS(n,e,t,i){const r=new dg(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Oc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function dg(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pN(n,e,t,i){let r=0;for(let s=e,a=t-i;s<t;s+=i)r+=(n[a]-n[s])*(n[s+1]+n[a+1]),a=s;return r}class I_{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return I_.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];hS(e),fS(i,e);let a=e.length;t.forEach(hS);for(let d=0;d<t.length;d++)r.push(a),a+=t[d].length,fS(i,t[d]);const l=QO.triangulate(i,r);for(let d=0;d<l.length;d+=3)s.push(l.slice(d,d+3));return s}}function hS(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function fS(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class na extends _i{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Je(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 Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(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 Pn,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 qi extends na{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 et(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Wn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Je(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 Je(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Je(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 Od extends _i{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Je(16777215),this.specular=new Je(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pn,this.combine=Bh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class mN extends _i{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Je(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class gN extends _i{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Je(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pn,this.combine=Bh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class _N extends _i{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Je(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cl,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,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.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}function ld(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function vN(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function yN(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function pS(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,a=0;a!==i;++s){const l=t[s]*e;for(let d=0;d!==e;++d)r[a++]=n[l+d]}return r}function GE(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let a=s[i];if(a!==void 0)if(Array.isArray(a))do a=s[i],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=n[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[i],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do a=s[i],a!==void 0&&(e.push(s.time),t.push(a)),s=n[r++];while(s!==void 0)}class qc{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let a;n:{i:if(!(e<r)){for(let l=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===l)break;if(s=r,r=t[++i],e<r)break t}a=t.length;break n}if(!(e>=s)){const l=t[1];e<l&&(i=2,s=l);for(let d=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===d)break;if(r=s,s=t[--i-1],e>=s)break t}a=i,i=0;break n}break e}for(;i<a;){const l=i+a>>>1;e<t[l]?a=l:i=l+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=i[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class bN extends qc{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:iw,endingEnd:iw}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,a=e+1,l=r[s],d=r[a];if(l===void 0)switch(this.getSettings_().endingStart){case rw:s=e,l=2*t-i;break;case sw:s=r.length-2,l=t+r[s]-r[s+1];break;default:s=e,l=i}if(d===void 0)switch(this.getSettings_().endingEnd){case rw:a=e,d=2*i-t;break;case sw:a=1,d=i+r[1]-r[0];break;default:a=e-1,d=t}const h=(i-t)*.5,m=this.valueSize;this._weightPrev=h/(t-l),this._weightNext=h/(d-i),this._offsetPrev=s*m,this._offsetNext=a*m}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=e*l,h=d-l,m=this._offsetPrev,u=this._offsetNext,g=this._weightPrev,v=this._weightNext,w=(i-t)/(r-t),T=w*w,M=T*w,b=-g*M+2*g*T-g*w,A=(1+g)*M+(-1.5-2*g)*T+(-.5+g)*w+1,E=(-1-v)*M+(1.5+v)*T+.5*w,P=v*M-v*T;for(let G=0;G!==l;++G)s[G]=b*a[m+G]+A*a[h+G]+E*a[d+G]+P*a[u+G];return s}}class xN extends qc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=e*l,h=d-l,m=(i-t)/(r-t),u=1-m;for(let g=0;g!==l;++g)s[g]=a[h+g]*u+a[d+g]*m;return s}}class wN extends qc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class jr{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ld(t,this.TimeBufferType),this.values=ld(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:ld(e.times,Array),values:ld(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new wN(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new xN(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new bN(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Lc:t=this.InterpolantFactoryMethodDiscrete;break;case Ic:t=this.InterpolantFactoryMethodLinear;break;case Xf:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Lc;case this.InterpolantFactoryMethodLinear:return Ic;case this.InterpolantFactoryMethodSmooth:return Xf}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,a=r-1;for(;s!==r&&i[s]<e;)++s;for(;a!==-1&&i[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const l=this.getValueSize();this.times=i.slice(s,a),this.values=this.values.slice(s*l,a*l)}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 i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==s;l++){const d=i[l];if(typeof d=="number"&&isNaN(d)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,d),e=!1;break}if(a!==null&&a>d){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,d,a),e=!1;break}a=d}if(r!==void 0&&vN(r))for(let l=0,d=r.length;l!==d;++l){const h=r[l];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===Xf,s=e.length-1;let a=1;for(let l=1;l<s;++l){let d=!1;const h=e[l],m=e[l+1];if(h!==m&&(l!==1||h!==e[0]))if(r)d=!0;else{const u=l*i,g=u-i,v=u+i;for(let w=0;w!==i;++w){const T=t[u+w];if(T!==t[g+w]||T!==t[v+w]){d=!0;break}}}if(d){if(l!==a){e[a]=e[l];const u=l*i,g=a*i;for(let v=0;v!==i;++v)t[g+v]=t[u+v]}++a}}if(s>0){e[a]=e[s];for(let l=s*i,d=a*i,h=0;h!==i;++h)t[d+h]=t[l+h];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}jr.prototype.TimeBufferType=Float32Array;jr.prototype.ValueBufferType=Float32Array;jr.prototype.DefaultInterpolation=Ic;class fl extends jr{constructor(e,t,i){super(e,t,i)}}fl.prototype.ValueTypeName="bool";fl.prototype.ValueBufferType=Array;fl.prototype.DefaultInterpolation=Lc;fl.prototype.InterpolantFactoryMethodLinear=void 0;fl.prototype.InterpolantFactoryMethodSmooth=void 0;class VE extends jr{}VE.prototype.ValueTypeName="color";class Fa extends jr{}Fa.prototype.ValueTypeName="number";class SN extends qc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=(i-t)/(r-t);let h=e*l;for(let m=h+l;h!==m;h+=4)Gn.slerpFlat(s,0,a,h-l,a,h,d);return s}}class Qs extends jr{InterpolantFactoryMethodLinear(e){return new SN(this.times,this.values,this.getValueSize(),e)}}Qs.prototype.ValueTypeName="quaternion";Qs.prototype.InterpolantFactoryMethodSmooth=void 0;class pl extends jr{constructor(e,t,i){super(e,t,i)}}pl.prototype.ValueTypeName="string";pl.prototype.ValueBufferType=Array;pl.prototype.DefaultInterpolation=Lc;pl.prototype.InterpolantFactoryMethodLinear=void 0;pl.prototype.InterpolantFactoryMethodSmooth=void 0;class Ua extends jr{}Ua.prototype.ValueTypeName="vector";class WE{constructor(e="",t=-1,i=[],r=oD){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Cr(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let a=0,l=i.length;a!==l;++a)t.push(EN(i[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=i.length;s!==a;++s)t.push(jr.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,a=[];for(let l=0;l<s;l++){let d=[],h=[];d.push((l+s-1)%s,l,(l+1)%s),h.push(0,1,0);const m=yN(d);d=pS(d,1,m),h=pS(h,1,m),!r&&d[0]===0&&(d.push(s),h.push(h[0])),a.push(new Fa(".morphTargetInfluences["+t[l].name+"]",d,h).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let l=0,d=e.length;l<d;l++){const h=e[l],m=h.name.match(s);if(m&&m.length>1){const u=m[1];let g=r[u];g||(r[u]=g=[]),g.push(h)}}const a=[];for(const l in r)a.push(this.CreateFromMorphTargetSequence(l,r[l],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(u,g,v,w,T){if(v.length!==0){const M=[],b=[];GE(v,M,b,w),M.length!==0&&T.push(new u(g,M,b))}},r=[],s=e.name||"default",a=e.fps||30,l=e.blendMode;let d=e.length||-1;const h=e.hierarchy||[];for(let u=0;u<h.length;u++){const g=h[u].keys;if(!(!g||g.length===0))if(g[0].morphTargets){const v={};let w;for(w=0;w<g.length;w++)if(g[w].morphTargets)for(let T=0;T<g[w].morphTargets.length;T++)v[g[w].morphTargets[T]]=-1;for(const T in v){const M=[],b=[];for(let A=0;A!==g[w].morphTargets.length;++A){const E=g[w];M.push(E.time),b.push(E.morphTarget===T?1:0)}r.push(new Fa(".morphTargetInfluence["+T+"]",M,b))}d=v.length*a}else{const v=".bones["+t[u].name+"]";i(Ua,v+".position",g,"pos",r),i(Qs,v+".quaternion",g,"rot",r),i(Ua,v+".scale",g,"scl",r)}}return r.length===0?null:new this(s,d,r,l)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){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 MN(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Fa;case"vector":case"vector2":case"vector3":case"vector4":return Ua;case"color":return VE;case"quaternion":return Qs;case"bool":case"boolean":return fl;case"string":return pl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function EN(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=MN(n.type);if(n.times===void 0){const t=[],i=[];GE(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Bs={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class jE{constructor(e,t,i){const r=this;let s=!1,a=0,l=0,d;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(m){l++,s===!1&&r.onStart!==void 0&&r.onStart(m,a,l),s=!0},this.itemEnd=function(m){a++,r.onProgress!==void 0&&r.onProgress(m,a,l),a===l&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(m){r.onError!==void 0&&r.onError(m)},this.resolveURL=function(m){return d?d(m):m},this.setURLModifier=function(m){return d=m,this},this.addHandler=function(m,u){return h.push(m,u),this},this.removeHandler=function(m){const u=h.indexOf(m);return u!==-1&&h.splice(u,2),this},this.getHandler=function(m){for(let u=0,g=h.length;u<g;u+=2){const v=h[u],w=h[u+1];if(v.global&&(v.lastIndex=0),v.test(m))return w}return null}}}const TN=new jE;class Hi{constructor(e){this.manager=e!==void 0?e:TN,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}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}}Hi.DEFAULT_MATERIAL_NAME="__DEFAULT";const es={};class AN extends Error{constructor(e,t){super(e),this.response=t}}class _s extends Hi{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Bs.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(es[e]!==void 0){es[e].push({onLoad:t,onProgress:i,onError:r});return}es[e]=[],es[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,d=this.responseType;fetch(a).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const m=es[e],u=h.body.getReader(),g=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),v=g?parseInt(g):0,w=v!==0;let T=0;const M=new ReadableStream({start(b){A();function A(){u.read().then(({done:E,value:P})=>{if(E)b.close();else{T+=P.byteLength;const G=new ProgressEvent("progress",{lengthComputable:w,loaded:T,total:v});for(let O=0,B=m.length;O<B;O++){const F=m[O];F.onProgress&&F.onProgress(G)}b.enqueue(P),A()}},E=>{b.error(E)})}}});return new Response(M)}else throw new AN(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(d){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(m=>new DOMParser().parseFromString(m,l));case"json":return h.json();default:if(l===void 0)return h.text();{const u=/charset="?([^;"\s]*)"?/i.exec(l),g=u&&u[1]?u[1].toLowerCase():void 0,v=new TextDecoder(g);return h.arrayBuffer().then(w=>v.decode(w))}}}).then(h=>{Bs.add(e,h);const m=es[e];delete es[e];for(let u=0,g=m.length;u<g;u++){const v=m[u];v.onLoad&&v.onLoad(h)}}).catch(h=>{const m=es[e];if(m===void 0)throw this.manager.itemError(e),h;delete es[e];for(let u=0,g=m.length;u<g;u++){const v=m[u];v.onError&&v.onError(h)}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 CN extends Hi{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Bs.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const l=Dc("img");function d(){m(),Bs.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(u){m(),r&&r(u),s.manager.itemError(e),s.manager.itemEnd(e)}function m(){l.removeEventListener("load",d,!1),l.removeEventListener("error",h,!1)}return l.addEventListener("load",d,!1),l.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),s.manager.itemStart(e),l.src=e,l}}class D_ extends Hi{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new $c,l=new _s(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(s.withCredentials),l.load(e,function(d){let h;try{h=s.parse(d)}catch(m){if(r!==void 0)r(m);else{console.error(m);return}}h.image!==void 0?a.image=h.image:h.data!==void 0&&(a.image.width=h.width,a.image.height=h.height,a.image.data=h.data),a.wrapS=h.wrapS!==void 0?h.wrapS:ti,a.wrapT=h.wrapT!==void 0?h.wrapT:ti,a.magFilter=h.magFilter!==void 0?h.magFilter:ln,a.minFilter=h.minFilter!==void 0?h.minFilter:ln,a.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(a.colorSpace=h.colorSpace),h.flipY!==void 0&&(a.flipY=h.flipY),h.format!==void 0&&(a.format=h.format),h.type!==void 0&&(a.type=h.type),h.mipmaps!==void 0&&(a.mipmaps=h.mipmaps,a.minFilter=Er),h.mipmapCount===1&&(a.minFilter=ln),h.generateMipmaps!==void 0&&(a.generateMipmaps=h.generateMipmaps),a.needsUpdate=!0,t&&t(a,h)},i,r),a}}class Xh extends Hi{constructor(e){super(e)}load(e,t,i,r){const s=new qn,a=new CN(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(l){s.image=l,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Yh extends sn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Je(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,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const xp=new ot,mS=new j,gS=new j;class k_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new et(512,512),this.map=null,this.mapPass=null,this.matrix=new ot,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new R_,this._frameExtents=new et(1,1),this._viewportCount=1,this._viewports=[new $t(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;mS.setFromMatrixPosition(e.matrixWorld),t.position.copy(mS),gS.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(gS),t.updateMatrixWorld(),xp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xp),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(xp)}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 this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class RN extends k_{constructor(){super(new mi(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=il*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class XE extends Yh{constructor(e,t,i=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(sn.DEFAULT_UP),this.updateMatrix(),this.target=new sn,this.distance=i,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new RN}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 _S=new ot,Hl=new j,wp=new j;class PN extends k_{constructor(){super(new mi(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new et(4,2),this._viewportCount=6,this._viewports=[new $t(2,1,1,1),new $t(0,1,1,1),new $t(3,1,1,1),new $t(1,1,1,1),new $t(3,0,1,1),new $t(1,0,1,1)],this._cubeDirections=[new j(1,0,0),new j(-1,0,0),new j(0,0,1),new j(0,0,-1),new j(0,1,0),new j(0,-1,0)],this._cubeUps=[new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,0,1),new j(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Hl.setFromMatrixPosition(e.matrixWorld),i.position.copy(Hl),wp.copy(i.position),wp.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(wp),i.updateMatrixWorld(),r.makeTranslation(-Hl.x,-Hl.y,-Hl.z),_S.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_S)}}class hg extends Yh{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new PN}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class LN extends k_{constructor(){super(new dl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class F_ extends Yh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(sn.DEFAULT_UP),this.updateMatrix(),this.target=new sn,this.shadow=new LN}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class YE extends Yh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ho{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class IN extends Hi{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Bs.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(h=>{t&&t(h),s.manager.itemEnd(e)}).catch(h=>{r&&r(h)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader;const d=fetch(e,l).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return Bs.add(e,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){r&&r(h),Bs.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Bs.add(e,d),s.manager.itemStart(e)}}const U_="\\[\\]\\.:\\/",DN=new RegExp("["+U_+"]","g"),O_="[^"+U_+"]",kN="[^"+U_.replace("\\.","")+"]",FN=/((?:WC+[\/:])*)/.source.replace("WC",O_),UN=/(WCOD+)?/.source.replace("WCOD",kN),ON=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",O_),NN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",O_),BN=new RegExp("^"+FN+UN+ON+NN+"$"),zN=["material","materials","bones","map"];class HN{constructor(e,t,i){const r=i||Yt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Yt{constructor(e,t,i){this.path=t,this.parsedPath=i||Yt.parseTrackName(t),this.node=Yt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Yt.Composite(e,t,i):new Yt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(DN,"")}static parseTrackName(e){const t=BN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);zN.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let a=0;a<s.length;a++){const l=s[a];if(l.name===t||l.uuid===t)return l;const d=i(l.children);if(d)return d}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_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 i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=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,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=Yt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let h=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let m=0;m<e.length;m++)if(e[m].name===h){h=m;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const a=e[r];if(a===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+r+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let d=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}d=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(d=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(d=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[d],this.setValue=this.SetterByBindingTypeAndVersioning[d][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Yt.Composite=HN;Yt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Yt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Yt.prototype.GetterByBindingType=[Yt.prototype._getValue_direct,Yt.prototype._getValue_array,Yt.prototype._getValue_arrayElement,Yt.prototype._getValue_toArray];Yt.prototype.SetterByBindingTypeAndVersioning=[[Yt.prototype._setValue_direct,Yt.prototype._setValue_direct_setNeedsUpdate,Yt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Yt.prototype._setValue_array,Yt.prototype._setValue_array_setNeedsUpdate,Yt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Yt.prototype._setValue_arrayElement,Yt.prototype._setValue_arrayElement_setNeedsUpdate,Yt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Yt.prototype._setValue_fromArray,Yt.prototype._setValue_fromArray_setNeedsUpdate,Yt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];const vS=new ot;class GN{constructor(e,t,i=0,r=1/0){this.ray=new jc(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new A_,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return vS.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(vS),this}intersectObject(e,t=!0,i=[]){return fg(e,this,i,t),i.sort(yS),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)fg(e[r],this,i,t);return i.sort(yS),i}}function yS(n,e){return n.distance-e.distance}function fg(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let a=0,l=s.length;a<l;a++)fg(s[a],e,t,!0)}}class N_{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Wn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class VN extends bh{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new On;s.setIndex(new _n(i,1)),s.setAttribute("position",new nn(r,3)),super(s,new Aa({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:g_}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=g_);/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.8.2
*/var or=Uint8Array,Ro=Uint16Array,WN=Int32Array,$E=new or([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]),qE=new or([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]),jN=new or([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),KE=function(n,e){for(var t=new Ro(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new WN(t[30]),i=1;i<30;++i)for(var s=t[i];s<t[i+1];++s)r[s]=s-t[i]<<5|i;return{b:t,r}},ZE=KE($E,2),QE=ZE.b,XN=ZE.r;QE[28]=258,XN[258]=28;var YN=KE(qE,0),$N=YN.b,pg=new Ro(32768);for(var mn=0;mn<32768;++mn){var Rs=(mn&43690)>>1|(mn&21845)<<1;Rs=(Rs&52428)>>2|(Rs&13107)<<2,Rs=(Rs&61680)>>4|(Rs&3855)<<4,pg[mn]=((Rs&65280)>>8|(Rs&255)<<8)>>1}var dc=function(n,e,t){for(var i=n.length,r=0,s=new Ro(e);r<i;++r)n[r]&&++s[n[r]-1];var a=new Ro(e);for(r=1;r<e;++r)a[r]=a[r-1]+s[r-1]<<1;var l;if(t){l=new Ro(1<<e);var d=15-e;for(r=0;r<i;++r)if(n[r])for(var h=r<<4|n[r],m=e-n[r],u=a[n[r]-1]++<<m,g=u|(1<<m)-1;u<=g;++u)l[pg[u]>>d]=h}else for(l=new Ro(i),r=0;r<i;++r)n[r]&&(l[r]=pg[a[n[r]-1]++]>>15-n[r]);return l},Kc=new or(288);for(var mn=0;mn<144;++mn)Kc[mn]=8;for(var mn=144;mn<256;++mn)Kc[mn]=9;for(var mn=256;mn<280;++mn)Kc[mn]=7;for(var mn=280;mn<288;++mn)Kc[mn]=8;var JE=new or(32);for(var mn=0;mn<32;++mn)JE[mn]=5;var qN=dc(Kc,9,1),KN=dc(JE,5,1),Sp=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},vr=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},Mp=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},ZN=function(n){return(n+7)/8|0},QN=function(n,e,t){return(t==null||t>n.length)&&(t=n.length),new or(n.subarray(e,t))},JN=["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"],xr=function(n,e,t){var i=new Error(e||JN[n]);if(i.code=n,Error.captureStackTrace&&Error.captureStackTrace(i,xr),!t)throw i;return i},eB=function(n,e,t,i){var r=n.length,s=0;if(!r||e.f&&!e.l)return t||new or(0);var a=!t,l=a||e.i!=2,d=e.i;a&&(t=new or(r*3));var h=function(Wt){var Z=t.length;if(Wt>Z){var Jt=new or(Math.max(Z*2,Wt));Jt.set(t),t=Jt}},m=e.f||0,u=e.p||0,g=e.b||0,v=e.l,w=e.d,T=e.m,M=e.n,b=r*8;do{if(!v){m=vr(n,u,1);var A=vr(n,u+1,3);if(u+=3,A)if(A==1)v=qN,w=KN,T=9,M=5;else if(A==2){var O=vr(n,u,31)+257,B=vr(n,u+10,15)+4,F=O+vr(n,u+5,31)+1;u+=14;for(var D=new or(F),L=new or(19),V=0;V<B;++V)L[jN[V]]=vr(n,u+V*3,7);u+=B*3;for(var ie=Sp(L),re=(1<<ie)-1,de=dc(L,ie,1),V=0;V<F;){var me=de[vr(n,u,re)];u+=me&15;var E=me>>4;if(E<16)D[V++]=E;else{var $=0,ue=0;for(E==16?(ue=3+vr(n,u,3),u+=2,$=D[V-1]):E==17?(ue=3+vr(n,u,7),u+=3):E==18&&(ue=11+vr(n,u,127),u+=7);ue--;)D[V++]=$}}var Y=D.subarray(0,O),pe=D.subarray(O);T=Sp(Y),M=Sp(pe),v=dc(Y,T,1),w=dc(pe,M,1)}else xr(1);else{var E=ZN(u)+4,P=n[E-4]|n[E-3]<<8,G=E+P;if(G>r){d&&xr(0);break}l&&h(g+P),t.set(n.subarray(E,G),g),e.b=g+=P,e.p=u=G*8,e.f=m;continue}if(u>b){d&&xr(0);break}}l&&h(g+131072);for(var _e=(1<<T)-1,Ae=(1<<M)-1,Pe=u;;Pe=u){var $=v[Mp(n,u)&_e],Ue=$>>4;if(u+=$&15,u>b){d&&xr(0);break}if($||xr(2),Ue<256)t[g++]=Ue;else if(Ue==256){Pe=u,v=null;break}else{var ae=Ue-254;if(Ue>264){var V=Ue-257,ge=$E[V];ae=vr(n,u,(1<<ge)-1)+QE[V],u+=ge}var ce=w[Mp(n,u)&Ae],Me=ce>>4;ce||xr(3),u+=ce&15;var pe=$N[Me];if(Me>3){var ge=qE[Me];pe+=Mp(n,u)&(1<<ge)-1,u+=ge}if(u>b){d&&xr(0);break}l&&h(g+131072);var Ye=g+ae;if(g<pe){var ht=s-pe,ft=Math.min(pe,Ye);for(ht+g<0&&xr(3);g<ft;++g)t[g]=i[ht+g]}for(;g<Ye;++g)t[g]=t[g-pe]}}e.l=v,e.p=Pe,e.b=g,e.f=m,v&&(m=1,e.m=T,e.d=w,e.n=M)}while(!m);return g!=t.length&&a?QN(t,0,g):t.subarray(0,g)},tB=new or(0),nB=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&xr(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&xr(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function Zl(n,e){return eB(n.subarray(nB(n,e),-4),{i:2},e,e)}var iB=typeof TextDecoder<"u"&&new TextDecoder,rB=0;try{iB.decode(tB,{stream:!0}),rB=1}catch{}class eT extends D_{constructor(e){super(e),this.type=gi}parse(e){const D=Math.pow(2.7182818,2.2);function L(S,I){let k=0;for(let te=0;te<65536;++te)(te==0||S[te>>3]&1<<(te&7))&&(I[k++]=te);const W=k-1;for(;k<65536;)I[k++]=0;return W}function V(S){for(let I=0;I<16384;I++)S[I]={},S[I].len=0,S[I].lit=0,S[I].p=null}const ie={l:0,c:0,lc:0};function re(S,I,k,W,te){for(;k<S;)I=I<<8|bt(W,te),k+=8;k-=S,ie.l=I>>k&(1<<S)-1,ie.c=I,ie.lc=k}const de=new Array(59);function me(S){for(let k=0;k<=58;++k)de[k]=0;for(let k=0;k<65537;++k)de[S[k]]+=1;let I=0;for(let k=58;k>0;--k){const W=I+de[k]>>1;de[k]=I,I=W}for(let k=0;k<65537;++k){const W=S[k];W>0&&(S[k]=W|de[W]++<<6)}}function $(S,I,k,W,te,Q){const le=I;let R=0,fe=0;for(;W<=te;W++){if(le.value-I.value>k)return!1;re(6,R,fe,S,le);const J=ie.l;if(R=ie.c,fe=ie.lc,Q[W]=J,J==63){if(le.value-I.value>k)throw new Error("Something wrong with hufUnpackEncTable");re(8,R,fe,S,le);let be=ie.l+6;if(R=ie.c,fe=ie.lc,W+be>te+1)throw new Error("Something wrong with hufUnpackEncTable");for(;be--;)Q[W++]=0;W--}else if(J>=59){let be=J-59+2;if(W+be>te+1)throw new Error("Something wrong with hufUnpackEncTable");for(;be--;)Q[W++]=0;W--}}me(Q)}function ue(S){return S&63}function Y(S){return S>>6}function pe(S,I,k,W){for(;I<=k;I++){const te=Y(S[I]),Q=ue(S[I]);if(te>>Q)throw new Error("Invalid table entry");if(Q>14){const le=W[te>>Q-14];if(le.len)throw new Error("Invalid table entry");if(le.lit++,le.p){const R=le.p;le.p=new Array(le.lit);for(let fe=0;fe<le.lit-1;++fe)le.p[fe]=R[fe]}else le.p=new Array(1);le.p[le.lit-1]=I}else if(Q){let le=0;for(let R=1<<14-Q;R>0;R--){const fe=W[(te<<14-Q)+le];if(fe.len||fe.p)throw new Error("Invalid table entry");fe.len=Q,fe.lit=I,le++}}}return!0}const _e={c:0,lc:0};function Ae(S,I,k,W){S=S<<8|bt(k,W),I+=8,_e.c=S,_e.lc=I}const Pe={c:0,lc:0};function Ue(S,I,k,W,te,Q,le,R,fe){if(S==I){W<8&&(Ae(k,W,te,Q),k=_e.c,W=_e.lc),W-=8;let J=k>>W;if(J=new Uint8Array([J])[0],R.value+J>fe)return!1;const be=le[R.value-1];for(;J-- >0;)le[R.value++]=be}else if(R.value<fe)le[R.value++]=S;else return!1;Pe.c=k,Pe.lc=W}function ae(S){return S&65535}function ge(S){const I=ae(S);return I>32767?I-65536:I}const ce={a:0,b:0};function Me(S,I){const k=ge(S),te=ge(I),Q=k+(te&1)+(te>>1),le=Q,R=Q-te;ce.a=le,ce.b=R}function Ye(S,I){const k=ae(S),W=ae(I),te=k-(W>>1)&65535,Q=W+te-32768&65535;ce.a=Q,ce.b=te}function ht(S,I,k,W,te,Q,le){const R=le<16384,fe=k>te?te:k;let J=1,be,Fe;for(;J<=fe;)J<<=1;for(J>>=1,be=J,J>>=1;J>=1;){Fe=0;const Oe=Fe+Q*(te-be),We=Q*J,Ee=Q*be,Te=W*J,Xe=W*be;let qe,Tt,Ht,en;for(;Fe<=Oe;Fe+=Ee){let Bt=Fe;const pt=Fe+W*(k-be);for(;Bt<=pt;Bt+=Xe){const Gt=Bt+Te,In=Bt+We,Xt=In+Te;R?(Me(S[Bt+I],S[In+I]),qe=ce.a,Ht=ce.b,Me(S[Gt+I],S[Xt+I]),Tt=ce.a,en=ce.b,Me(qe,Tt),S[Bt+I]=ce.a,S[Gt+I]=ce.b,Me(Ht,en),S[In+I]=ce.a,S[Xt+I]=ce.b):(Ye(S[Bt+I],S[In+I]),qe=ce.a,Ht=ce.b,Ye(S[Gt+I],S[Xt+I]),Tt=ce.a,en=ce.b,Ye(qe,Tt),S[Bt+I]=ce.a,S[Gt+I]=ce.b,Ye(Ht,en),S[In+I]=ce.a,S[Xt+I]=ce.b)}if(k&J){const Gt=Bt+We;R?Me(S[Bt+I],S[Gt+I]):Ye(S[Bt+I],S[Gt+I]),qe=ce.a,S[Gt+I]=ce.b,S[Bt+I]=qe}}if(te&J){let Bt=Fe;const pt=Fe+W*(k-be);for(;Bt<=pt;Bt+=Xe){const Gt=Bt+Te;R?Me(S[Bt+I],S[Gt+I]):Ye(S[Bt+I],S[Gt+I]),qe=ce.a,S[Gt+I]=ce.b,S[Bt+I]=qe}}be=J,J>>=1}return Fe}function ft(S,I,k,W,te,Q,le,R,fe){let J=0,be=0;const Fe=le,Oe=Math.trunc(W.value+(te+7)/8);for(;W.value<Oe;)for(Ae(J,be,k,W),J=_e.c,be=_e.lc;be>=14;){const Ee=J>>be-14&16383,Te=I[Ee];if(Te.len)be-=Te.len,Ue(Te.lit,Q,J,be,k,W,R,fe,Fe),J=Pe.c,be=Pe.lc;else{if(!Te.p)throw new Error("hufDecode issues");let Xe;for(Xe=0;Xe<Te.lit;Xe++){const qe=ue(S[Te.p[Xe]]);for(;be<qe&&W.value<Oe;)Ae(J,be,k,W),J=_e.c,be=_e.lc;if(be>=qe&&Y(S[Te.p[Xe]])==(J>>be-qe&(1<<qe)-1)){be-=qe,Ue(Te.p[Xe],Q,J,be,k,W,R,fe,Fe),J=Pe.c,be=Pe.lc;break}}if(Xe==Te.lit)throw new Error("hufDecode issues")}}const We=8-te&7;for(J>>=We,be-=We;be>0;){const Ee=I[J<<14-be&16383];if(Ee.len)be-=Ee.len,Ue(Ee.lit,Q,J,be,k,W,R,fe,Fe),J=Pe.c,be=Pe.lc;else throw new Error("hufDecode issues")}return!0}function Wt(S,I,k,W,te,Q){const le={value:0},R=k.value,fe=$e(I,k),J=$e(I,k);k.value+=4;const be=$e(I,k);if(k.value+=4,fe<0||fe>=65537||J<0||J>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const Fe=new Array(65537),Oe=new Array(16384);V(Oe);const We=W-(k.value-R);if($(S,k,We,fe,J,Fe),be>8*(W-(k.value-R)))throw new Error("Something wrong with hufUncompress");pe(Fe,fe,J,Oe),ft(Fe,Oe,S,k,be,J,Q,te,le)}function Z(S,I,k){for(let W=0;W<k;++W)I[W]=S[I[W]]}function Jt(S){for(let I=1;I<S.length;I++){const k=S[I-1]+S[I]-128;S[I]=k}}function Ut(S,I){let k=0,W=Math.floor((S.length+1)/2),te=0;const Q=S.length-1;for(;!(te>Q||(I[te++]=S[k++],te>Q));)I[te++]=S[W++]}function jt(S){let I=S.byteLength;const k=new Array;let W=0;const te=new DataView(S);for(;I>0;){const Q=te.getInt8(W++);if(Q<0){const le=-Q;I-=le+1;for(let R=0;R<le;R++)k.push(te.getUint8(W++))}else{const le=Q;I-=2;const R=te.getUint8(W++);for(let fe=0;fe<le+1;fe++)k.push(R)}}return k}function ut(S,I,k,W,te,Q){let le=new DataView(Q.buffer);const R=k[S.idx[0]].width,fe=k[S.idx[0]].height,J=3,be=Math.floor(R/8),Fe=Math.ceil(R/8),Oe=Math.ceil(fe/8),We=R-(Fe-1)*8,Ee=fe-(Oe-1)*8,Te={value:0},Xe=new Array(J),qe=new Array(J),Tt=new Array(J),Ht=new Array(J),en=new Array(J);for(let pt=0;pt<J;++pt)en[pt]=I[S.idx[pt]],Xe[pt]=pt<1?0:Xe[pt-1]+Fe*Oe,qe[pt]=new Float32Array(64),Tt[pt]=new Uint16Array(64),Ht[pt]=new Uint16Array(Fe*64);for(let pt=0;pt<Oe;++pt){let Gt=8;pt==Oe-1&&(Gt=Ee);let In=8;for(let St=0;St<Fe;++St){St==Fe-1&&(In=We);for(let Zt=0;Zt<J;++Zt)Tt[Zt].fill(0),Tt[Zt][0]=te[Xe[Zt]++],yn(Te,W,Tt[Zt]),yt(Tt[Zt],qe[Zt]),wt(qe[Zt]);X(qe);for(let Zt=0;Zt<J;++Zt)N(qe[Zt],Ht[Zt],St*64)}let Xt=0;for(let St=0;St<J;++St){const Zt=k[S.idx[St]].type;for(let Qn=8*pt;Qn<8*pt+Gt;++Qn){Xt=en[St][Qn];for(let sa=0;sa<be;++sa){const Pi=sa*64+(Qn&7)*8;le.setUint16(Xt+0*2*Zt,Ht[St][Pi+0],!0),le.setUint16(Xt+1*2*Zt,Ht[St][Pi+1],!0),le.setUint16(Xt+2*2*Zt,Ht[St][Pi+2],!0),le.setUint16(Xt+3*2*Zt,Ht[St][Pi+3],!0),le.setUint16(Xt+4*2*Zt,Ht[St][Pi+4],!0),le.setUint16(Xt+5*2*Zt,Ht[St][Pi+5],!0),le.setUint16(Xt+6*2*Zt,Ht[St][Pi+6],!0),le.setUint16(Xt+7*2*Zt,Ht[St][Pi+7],!0),Xt+=8*2*Zt}}if(be!=Fe)for(let Qn=8*pt;Qn<8*pt+Gt;++Qn){const sa=en[St][Qn]+8*be*2*Zt,Pi=be*64+(Qn&7)*8;for(let za=0;za<In;++za)le.setUint16(sa+za*2*Zt,Ht[St][Pi+za],!0)}}}const Bt=new Uint16Array(R);le=new DataView(Q.buffer);for(let pt=0;pt<J;++pt){k[S.idx[pt]].decoded=!0;const Gt=k[S.idx[pt]].type;if(k[pt].type==2)for(let In=0;In<fe;++In){const Xt=en[pt][In];for(let St=0;St<R;++St)Bt[St]=le.getUint16(Xt+St*2*Gt,!0);for(let St=0;St<R;++St)le.setFloat32(Xt+St*2*Gt,oe(Bt[St]),!0)}}}function yn(S,I,k){let W,te=1;for(;te<64;)W=I[S.value],W==65280?te=64:W>>8==255?te+=W&255:(k[te]=W,te++),S.value++}function yt(S,I){I[0]=oe(S[0]),I[1]=oe(S[1]),I[2]=oe(S[5]),I[3]=oe(S[6]),I[4]=oe(S[14]),I[5]=oe(S[15]),I[6]=oe(S[27]),I[7]=oe(S[28]),I[8]=oe(S[2]),I[9]=oe(S[4]),I[10]=oe(S[7]),I[11]=oe(S[13]),I[12]=oe(S[16]),I[13]=oe(S[26]),I[14]=oe(S[29]),I[15]=oe(S[42]),I[16]=oe(S[3]),I[17]=oe(S[8]),I[18]=oe(S[12]),I[19]=oe(S[17]),I[20]=oe(S[25]),I[21]=oe(S[30]),I[22]=oe(S[41]),I[23]=oe(S[43]),I[24]=oe(S[9]),I[25]=oe(S[11]),I[26]=oe(S[18]),I[27]=oe(S[24]),I[28]=oe(S[31]),I[29]=oe(S[40]),I[30]=oe(S[44]),I[31]=oe(S[53]),I[32]=oe(S[10]),I[33]=oe(S[19]),I[34]=oe(S[23]),I[35]=oe(S[32]),I[36]=oe(S[39]),I[37]=oe(S[45]),I[38]=oe(S[52]),I[39]=oe(S[54]),I[40]=oe(S[20]),I[41]=oe(S[22]),I[42]=oe(S[33]),I[43]=oe(S[38]),I[44]=oe(S[46]),I[45]=oe(S[51]),I[46]=oe(S[55]),I[47]=oe(S[60]),I[48]=oe(S[21]),I[49]=oe(S[34]),I[50]=oe(S[37]),I[51]=oe(S[47]),I[52]=oe(S[50]),I[53]=oe(S[56]),I[54]=oe(S[59]),I[55]=oe(S[61]),I[56]=oe(S[35]),I[57]=oe(S[36]),I[58]=oe(S[48]),I[59]=oe(S[49]),I[60]=oe(S[57]),I[61]=oe(S[58]),I[62]=oe(S[62]),I[63]=oe(S[63])}function wt(S){const I=.5*Math.cos(.7853975),k=.5*Math.cos(3.14159/16),W=.5*Math.cos(3.14159/8),te=.5*Math.cos(3*3.14159/16),Q=.5*Math.cos(5*3.14159/16),le=.5*Math.cos(3*3.14159/8),R=.5*Math.cos(7*3.14159/16),fe=new Array(4),J=new Array(4),be=new Array(4),Fe=new Array(4);for(let Oe=0;Oe<8;++Oe){const We=Oe*8;fe[0]=W*S[We+2],fe[1]=le*S[We+2],fe[2]=W*S[We+6],fe[3]=le*S[We+6],J[0]=k*S[We+1]+te*S[We+3]+Q*S[We+5]+R*S[We+7],J[1]=te*S[We+1]-R*S[We+3]-k*S[We+5]-Q*S[We+7],J[2]=Q*S[We+1]-k*S[We+3]+R*S[We+5]+te*S[We+7],J[3]=R*S[We+1]-Q*S[We+3]+te*S[We+5]-k*S[We+7],be[0]=I*(S[We+0]+S[We+4]),be[3]=I*(S[We+0]-S[We+4]),be[1]=fe[0]+fe[3],be[2]=fe[1]-fe[2],Fe[0]=be[0]+be[1],Fe[1]=be[3]+be[2],Fe[2]=be[3]-be[2],Fe[3]=be[0]-be[1],S[We+0]=Fe[0]+J[0],S[We+1]=Fe[1]+J[1],S[We+2]=Fe[2]+J[2],S[We+3]=Fe[3]+J[3],S[We+4]=Fe[3]-J[3],S[We+5]=Fe[2]-J[2],S[We+6]=Fe[1]-J[1],S[We+7]=Fe[0]-J[0]}for(let Oe=0;Oe<8;++Oe)fe[0]=W*S[16+Oe],fe[1]=le*S[16+Oe],fe[2]=W*S[48+Oe],fe[3]=le*S[48+Oe],J[0]=k*S[8+Oe]+te*S[24+Oe]+Q*S[40+Oe]+R*S[56+Oe],J[1]=te*S[8+Oe]-R*S[24+Oe]-k*S[40+Oe]-Q*S[56+Oe],J[2]=Q*S[8+Oe]-k*S[24+Oe]+R*S[40+Oe]+te*S[56+Oe],J[3]=R*S[8+Oe]-Q*S[24+Oe]+te*S[40+Oe]-k*S[56+Oe],be[0]=I*(S[Oe]+S[32+Oe]),be[3]=I*(S[Oe]-S[32+Oe]),be[1]=fe[0]+fe[3],be[2]=fe[1]-fe[2],Fe[0]=be[0]+be[1],Fe[1]=be[3]+be[2],Fe[2]=be[3]-be[2],Fe[3]=be[0]-be[1],S[0+Oe]=Fe[0]+J[0],S[8+Oe]=Fe[1]+J[1],S[16+Oe]=Fe[2]+J[2],S[24+Oe]=Fe[3]+J[3],S[32+Oe]=Fe[3]-J[3],S[40+Oe]=Fe[2]-J[2],S[48+Oe]=Fe[1]-J[1],S[56+Oe]=Fe[0]-J[0]}function X(S){for(let I=0;I<64;++I){const k=S[0][I],W=S[1][I],te=S[2][I];S[0][I]=k+1.5747*te,S[1][I]=k-.1873*W-.4682*te,S[2][I]=k+1.8556*W}}function N(S,I,k){for(let W=0;W<64;++W)I[k+W]=Eo.toHalfFloat(ve(S[W]))}function ve(S){return S<=1?Math.sign(S)*Math.pow(Math.abs(S),2.2):Math.sign(S)*Math.pow(D,Math.abs(S)-1)}function De(S){return new DataView(S.array.buffer,S.offset.value,S.size)}function ke(S){const I=S.viewer.buffer.slice(S.offset.value,S.offset.value+S.size),k=new Uint8Array(jt(I)),W=new Uint8Array(k.length);return Jt(k),Ut(k,W),new DataView(W.buffer)}function Le(S){const I=S.array.slice(S.offset.value,S.offset.value+S.size),k=Zl(I),W=new Uint8Array(k.length);return Jt(k),Ut(k,W),new DataView(W.buffer)}function lt(S){const I=S.viewer,k={value:S.offset.value},W=new Uint16Array(S.columns*S.lines*(S.inputChannels.length*S.type)),te=new Uint8Array(8192);let Q=0;const le=new Array(S.inputChannels.length);for(let Ee=0,Te=S.inputChannels.length;Ee<Te;Ee++)le[Ee]={},le[Ee].start=Q,le[Ee].end=le[Ee].start,le[Ee].nx=S.columns,le[Ee].ny=S.lines,le[Ee].size=S.type,Q+=le[Ee].nx*le[Ee].ny*le[Ee].size;const R=Ce(I,k),fe=Ce(I,k);if(fe>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(R<=fe)for(let Ee=0;Ee<fe-R+1;Ee++)te[Ee+R]=Ie(I,k);const J=new Uint16Array(65536),be=L(te,J),Fe=$e(I,k);Wt(S.array,I,k,Fe,W,Q);for(let Ee=0;Ee<S.inputChannels.length;++Ee){const Te=le[Ee];for(let Xe=0;Xe<le[Ee].size;++Xe)ht(W,Te.start+Xe,Te.nx,Te.size,Te.ny,Te.nx*Te.size,be)}Z(J,W,Q);let Oe=0;const We=new Uint8Array(W.buffer.byteLength);for(let Ee=0;Ee<S.lines;Ee++)for(let Te=0;Te<S.inputChannels.length;Te++){const Xe=le[Te],qe=Xe.nx*Xe.size,Tt=new Uint8Array(W.buffer,Xe.end*2,qe*2);We.set(Tt,Oe),Oe+=qe*2,Xe.end+=qe}return new DataView(We.buffer)}function Qe(S){const I=S.array.slice(S.offset.value,S.offset.value+S.size),k=Zl(I),W=S.inputChannels.length*S.lines*S.columns*S.totalBytes,te=new ArrayBuffer(W),Q=new DataView(te);let le=0,R=0;const fe=new Array(4);for(let J=0;J<S.lines;J++)for(let be=0;be<S.inputChannels.length;be++){let Fe=0;switch(S.inputChannels[be].pixelType){case 1:fe[0]=le,fe[1]=fe[0]+S.columns,le=fe[1]+S.columns;for(let We=0;We<S.columns;++We){const Ee=k[fe[0]++]<<8|k[fe[1]++];Fe+=Ee,Q.setUint16(R,Fe,!0),R+=2}break;case 2:fe[0]=le,fe[1]=fe[0]+S.columns,fe[2]=fe[1]+S.columns,le=fe[2]+S.columns;for(let We=0;We<S.columns;++We){const Ee=k[fe[0]++]<<24|k[fe[1]++]<<16|k[fe[2]++]<<8;Fe+=Ee,Q.setUint32(R,Fe,!0),R+=4}break}}return Q}function tt(S){const I=S.viewer,k={value:S.offset.value},W=new Uint8Array(S.columns*S.lines*(S.inputChannels.length*S.type*2)),te={version:it(I,k),unknownUncompressedSize:it(I,k),unknownCompressedSize:it(I,k),acCompressedSize:it(I,k),dcCompressedSize:it(I,k),rleCompressedSize:it(I,k),rleUncompressedSize:it(I,k),rleRawSize:it(I,k),totalAcUncompressedCount:it(I,k),totalDcUncompressedCount:it(I,k),acCompression:it(I,k)};if(te.version<2)throw new Error("EXRLoader.parse: "+z.compression+" version "+te.version+" is unsupported");const Q=new Array;let le=Ce(I,k)-2;for(;le>0;){const Te=vt(I.buffer,k),Xe=Ie(I,k),qe=Xe>>2&3,Tt=(Xe>>4)-1,Ht=new Int8Array([Tt])[0],en=Ie(I,k);Q.push({name:Te,index:Ht,type:en,compression:qe}),le-=Te.length+3}const R=z.channels,fe=new Array(S.inputChannels.length);for(let Te=0;Te<S.inputChannels.length;++Te){const Xe=fe[Te]={},qe=R[Te];Xe.name=qe.name,Xe.compression=0,Xe.decoded=!1,Xe.type=qe.pixelType,Xe.pLinear=qe.pLinear,Xe.width=S.columns,Xe.height=S.lines}const J={idx:new Array(3)};for(let Te=0;Te<S.inputChannels.length;++Te){const Xe=fe[Te];for(let qe=0;qe<Q.length;++qe){const Tt=Q[qe];Xe.name==Tt.name&&(Xe.compression=Tt.compression,Tt.index>=0&&(J.idx[Tt.index]=Te),Xe.offset=Te)}}let be,Fe,Oe;if(te.acCompressedSize>0)switch(te.acCompression){case 0:be=new Uint16Array(te.totalAcUncompressedCount),Wt(S.array,I,k,te.acCompressedSize,be,te.totalAcUncompressedCount);break;case 1:const Te=S.array.slice(k.value,k.value+te.totalAcUncompressedCount),Xe=Zl(Te);be=new Uint16Array(Xe.buffer),k.value+=te.totalAcUncompressedCount;break}if(te.dcCompressedSize>0){const Te={array:S.array,offset:k,size:te.dcCompressedSize};Fe=new Uint16Array(Le(Te).buffer),k.value+=te.dcCompressedSize}if(te.rleRawSize>0){const Te=S.array.slice(k.value,k.value+te.rleCompressedSize),Xe=Zl(Te);Oe=jt(Xe.buffer),k.value+=te.rleCompressedSize}let We=0;const Ee=new Array(fe.length);for(let Te=0;Te<Ee.length;++Te)Ee[Te]=new Array;for(let Te=0;Te<S.lines;++Te)for(let Xe=0;Xe<fe.length;++Xe)Ee[Xe].push(We),We+=fe[Xe].width*S.type*2;ut(J,Ee,fe,be,Fe,W);for(let Te=0;Te<fe.length;++Te){const Xe=fe[Te];if(!Xe.decoded)switch(Xe.compression){case 2:let qe=0,Tt=0;for(let Ht=0;Ht<S.lines;++Ht){let en=Ee[Te][qe];for(let Bt=0;Bt<Xe.width;++Bt){for(let pt=0;pt<2*Xe.type;++pt)W[en++]=Oe[Tt+pt*Xe.width*Xe.height];Tt++}qe++}break;case 1:default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(W.buffer)}function vt(S,I){const k=new Uint8Array(S);let W=0;for(;k[I.value+W]!=0;)W+=1;const te=new TextDecoder().decode(k.slice(I.value,I.value+W));return I.value=I.value+W+1,te}function Ne(S,I,k){const W=new TextDecoder().decode(new Uint8Array(S).slice(I.value,I.value+k));return I.value=I.value+k,W}function nt(S,I){const k=ct(S,I),W=$e(S,I);return[k,W]}function Rt(S,I){const k=$e(S,I),W=$e(S,I);return[k,W]}function ct(S,I){const k=S.getInt32(I.value,!0);return I.value=I.value+4,k}function $e(S,I){const k=S.getUint32(I.value,!0);return I.value=I.value+4,k}function bt(S,I){const k=S[I.value];return I.value=I.value+1,k}function Ie(S,I){const k=S.getUint8(I.value);return I.value=I.value+1,k}const it=function(S,I){let k;return"getBigInt64"in DataView.prototype?k=Number(S.getBigInt64(I.value,!0)):k=S.getUint32(I.value+4,!0)+Number(S.getUint32(I.value,!0)<<32),I.value+=8,k};function ee(S,I){const k=S.getFloat32(I.value,!0);return I.value+=4,k}function He(S,I){return Eo.toHalfFloat(ee(S,I))}function oe(S){const I=(S&31744)>>10,k=S&1023;return(S>>15?-1:1)*(I?I===31?k?NaN:1/0:Math.pow(2,I-15)*(1+k/1024):6103515625e-14*(k/1024))}function Ce(S,I){const k=S.getUint16(I.value,!0);return I.value+=2,k}function Ge(S,I){return oe(Ce(S,I))}function gt(S,I,k,W){const te=k.value,Q=[];for(;k.value<te+W-1;){const le=vt(I,k),R=ct(S,k),fe=Ie(S,k);k.value+=3;const J=ct(S,k),be=ct(S,k);Q.push({name:le,pixelType:R,pLinear:fe,xSampling:J,ySampling:be})}return k.value+=1,Q}function Pt(S,I){const k=ee(S,I),W=ee(S,I),te=ee(S,I),Q=ee(S,I),le=ee(S,I),R=ee(S,I),fe=ee(S,I),J=ee(S,I);return{redX:k,redY:W,greenX:te,greenY:Q,blueX:le,blueY:R,whiteX:fe,whiteY:J}}function un(S,I){const k=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],W=Ie(S,I);return k[W]}function Ln(S,I){const k=ct(S,I),W=ct(S,I),te=ct(S,I),Q=ct(S,I);return{xMin:k,yMin:W,xMax:te,yMax:Q}}function Ot(S,I){const k=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],W=Ie(S,I);return k[W]}function oi(S,I){const k=["ENVMAP_LATLONG","ENVMAP_CUBE"],W=Ie(S,I);return k[W]}function ii(S,I){const k=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],W=["ROUND_DOWN","ROUND_UP"],te=$e(S,I),Q=$e(S,I),le=Ie(S,I);return{xSize:te,ySize:Q,levelMode:k[le&15],roundingMode:W[le>>4]}}function Nt(S,I){const k=ee(S,I),W=ee(S,I);return[k,W]}function fr(S,I){const k=ee(S,I),W=ee(S,I),te=ee(S,I);return[k,W,te]}function ys(S,I,k,W,te){if(W==="string"||W==="stringvector"||W==="iccProfile")return Ne(I,k,te);if(W==="chlist")return gt(S,I,k,te);if(W==="chromaticities")return Pt(S,k);if(W==="compression")return un(S,k);if(W==="box2i")return Ln(S,k);if(W==="envmap")return oi(S,k);if(W==="tiledesc")return ii(S,k);if(W==="lineOrder")return Ot(S,k);if(W==="float")return ee(S,k);if(W==="v2f")return Nt(S,k);if(W==="v3f")return fr(S,k);if(W==="int")return ct(S,k);if(W==="rational")return nt(S,k);if(W==="timecode")return Rt(S,k);if(W==="preview")return k.value+=te,"skipped";k.value+=te}function Ci(S,I){const k=Math.log2(S);return I=="ROUND_DOWN"?Math.floor(k):Math.ceil(k)}function ra(S,I,k){let W=0;switch(S.levelMode){case"ONE_LEVEL":W=1;break;case"MIPMAP_LEVELS":W=Ci(Math.max(I,k),S.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return W}function Ri(S,I,k,W){const te=new Array(S);for(let Q=0;Q<S;Q++){const le=1<<Q;let R=I/le|0;W=="ROUND_UP"&&R*le<I&&(R+=1);const fe=Math.max(R,1);te[Q]=(fe+k-1)/k|0}return te}function bs(){const S=this,I=S.offset,k={value:0};for(let W=0;W<S.tileCount;W++){const te=ct(S.viewer,I),Q=ct(S.viewer,I);I.value+=8,S.size=$e(S.viewer,I);const le=te*S.blockWidth,R=Q*S.blockHeight;S.columns=le+S.blockWidth>S.width?S.width-le:S.blockWidth,S.lines=R+S.blockHeight>S.height?S.height-R:S.blockHeight;const fe=S.columns*S.totalBytes,be=S.size<S.lines*fe?S.uncompress(S):De(S);I.value+=S.size;for(let Fe=0;Fe<S.lines;Fe++){const Oe=Fe*S.columns*S.totalBytes;for(let We=0;We<S.inputChannels.length;We++){const Ee=z.channels[We].name,Te=S.channelByteOffsets[Ee]*S.columns,Xe=S.decodeChannels[Ee];if(Xe===void 0)continue;k.value=Oe+Te;const qe=(S.height-(1+R+Fe))*S.outLineWidth;for(let Tt=0;Tt<S.columns;Tt++){const Ht=qe+(Tt+le)*S.outputChannels+Xe;S.byteArray[Ht]=S.getter(be,k)}}}}}function Qi(){const S=this,I=S.offset,k={value:0};for(let W=0;W<S.height/S.blockHeight;W++){const te=ct(S.viewer,I)-z.dataWindow.yMin;S.size=$e(S.viewer,I),S.lines=te+S.blockHeight>S.height?S.height-te:S.blockHeight;const Q=S.columns*S.totalBytes,R=S.size<S.lines*Q?S.uncompress(S):De(S);I.value+=S.size;for(let fe=0;fe<S.blockHeight;fe++){const J=W*S.blockHeight,be=fe+S.scanOrder(J);if(be>=S.height)continue;const Fe=fe*Q,Oe=(S.height-1-be)*S.outLineWidth;for(let We=0;We<S.inputChannels.length;We++){const Ee=z.channels[We].name,Te=S.channelByteOffsets[Ee]*S.columns,Xe=S.decodeChannels[Ee];if(Xe!==void 0){k.value=Fe+Te;for(let qe=0;qe<S.columns;qe++){const Tt=Oe+qe*S.outputChannels+Xe;S.byteArray[Tt]=S.getter(R,k)}}}}}}function xs(S,I,k){const W={};if(S.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");W.version=S.getUint8(4);const te=S.getUint8(5);W.spec={singleTile:!!(te&2),longName:!!(te&4),deepFormat:!!(te&8),multiPart:!!(te&16)},k.value=8;let Q=!0;for(;Q;){const le=vt(I,k);if(le==0)Q=!1;else{const R=vt(I,k),fe=$e(S,k),J=ys(S,I,k,R,fe);J===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${R}'.`):W[le]=J}}if(te&-7)throw console.error("THREE.EXRHeader:",W),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return W}function Xr(S,I,k,W,te){const Q={size:0,viewer:I,array:k,offset:W,width:S.dataWindow.xMax-S.dataWindow.xMin+1,height:S.dataWindow.yMax-S.dataWindow.yMin+1,inputChannels:S.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:Sn};switch(S.compression){case"NO_COMPRESSION":Q.blockHeight=1,Q.uncompress=De;break;case"RLE_COMPRESSION":Q.blockHeight=1,Q.uncompress=ke;break;case"ZIPS_COMPRESSION":Q.blockHeight=1,Q.uncompress=Le;break;case"ZIP_COMPRESSION":Q.blockHeight=16,Q.uncompress=Le;break;case"PIZ_COMPRESSION":Q.blockHeight=32,Q.uncompress=lt;break;case"PXR24_COMPRESSION":Q.blockHeight=16,Q.uncompress=Qe;break;case"DWAA_COMPRESSION":Q.blockHeight=32,Q.uncompress=tt;break;case"DWAB_COMPRESSION":Q.blockHeight=256,Q.uncompress=tt;break;default:throw new Error("EXRLoader.parse: "+S.compression+" is unsupported")}const le={};for(const be of S.channels)switch(be.name){case"Y":case"R":case"G":case"B":case"A":le[be.name]=!0,Q.type=be.pixelType}let R=!1;if(le.R&&le.G&&le.B)R=!le.A,Q.outputChannels=4,Q.decodeChannels={R:0,G:1,B:2,A:3};else if(le.Y)Q.outputChannels=1,Q.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(Q.type==1)switch(te){case Un:Q.getter=Ge;break;case gi:Q.getter=Ce;break}else if(Q.type==2)switch(te){case Un:Q.getter=ee;break;case gi:Q.getter=He}else throw new Error("EXRLoader.parse: unsupported pixelType "+Q.type+" for "+S.compression+".");Q.columns=Q.width;const fe=Q.width*Q.height*Q.outputChannels;switch(te){case Un:Q.byteArray=new Float32Array(fe),R&&Q.byteArray.fill(1,0,fe);break;case gi:Q.byteArray=new Uint16Array(fe),R&&Q.byteArray.fill(15360,0,fe);break;default:console.error("THREE.EXRLoader: unsupported type: ",te);break}let J=0;for(const be of S.channels)Q.decodeChannels[be.name]!==void 0&&(Q.channelByteOffsets[be.name]=J),J+=be.pixelType*2;if(Q.totalBytes=J,Q.outLineWidth=Q.width*Q.outputChannels,S.lineOrder==="INCREASING_Y"?Q.scanOrder=be=>be:Q.scanOrder=be=>Q.height-1-be,Q.outputChannels==4?(Q.format=Vn,Q.colorSpace=Sn):(Q.format=Wc,Q.colorSpace=ss),S.spec.singleTile){Q.blockHeight=S.tiles.ySize,Q.blockWidth=S.tiles.xSize;const be=ra(S.tiles,Q.width,Q.height),Fe=Ri(be,Q.width,S.tiles.xSize,S.tiles.roundingMode),Oe=Ri(be,Q.height,S.tiles.ySize,S.tiles.roundingMode);Q.tileCount=Fe[0]*Oe[0];for(let We=0;We<be;We++)for(let Ee=0;Ee<Oe[We];Ee++)for(let Te=0;Te<Fe[We];Te++)it(I,W);Q.decode=bs.bind(Q)}else{Q.blockWidth=Q.width;const be=Math.ceil(Q.height/Q.blockHeight);for(let Fe=0;Fe<be;Fe++)it(I,W);Q.decode=Qi.bind(Q)}return Q}const Ba={value:0},Ji=new DataView(e),gl=new Uint8Array(e),z=xs(Ji,e,Ba),q=Xr(z,Ji,gl,Ba,this.type);return q.decode(),{header:z,width:q.width,height:q.height,data:q.byteArray,format:q.format,colorSpace:q.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,i,r){function s(a,l){a.colorSpace=l.colorSpace,a.minFilter=ln,a.magFilter=ln,a.generateMipmaps=!1,a.flipY=!1,t&&t(a,l)}return super.load(e,s,i,r)}}function tT(n,e,t){const i=t.length-n-1;if(e>=t[i])return i-1;if(e<=t[n])return n;let r=n,s=i,a=Math.floor((r+s)/2);for(;e<t[a]||e>=t[a+1];)e<t[a]?s=a:r=a,a=Math.floor((r+s)/2);return a}function sB(n,e,t,i){const r=[],s=[],a=[];r[0]=1;for(let l=1;l<=t;++l){s[l]=e-i[n+1-l],a[l]=i[n+l]-e;let d=0;for(let h=0;h<l;++h){const m=a[h+1],u=s[l-h],g=r[h]/(m+u);r[h]=d+m*g,d=u*g}r[l]=d}return r}function aB(n,e,t,i){const r=tT(n,i,e),s=sB(r,i,n,e),a=new $t(0,0,0,0);for(let l=0;l<=n;++l){const d=t[r-n+l],h=s[l],m=d.w*h;a.x+=d.x*m,a.y+=d.y*m,a.z+=d.z*m,a.w+=d.w*h}return a}function oB(n,e,t,i,r){const s=[];for(let u=0;u<=t;++u)s[u]=0;const a=[];for(let u=0;u<=i;++u)a[u]=s.slice(0);const l=[];for(let u=0;u<=t;++u)l[u]=s.slice(0);l[0][0]=1;const d=s.slice(0),h=s.slice(0);for(let u=1;u<=t;++u){d[u]=e-r[n+1-u],h[u]=r[n+u]-e;let g=0;for(let v=0;v<u;++v){const w=h[v+1],T=d[u-v];l[u][v]=w+T;const M=l[v][u-1]/l[u][v];l[v][u]=g+w*M,g=T*M}l[u][u]=g}for(let u=0;u<=t;++u)a[0][u]=l[u][t];for(let u=0;u<=t;++u){let g=0,v=1;const w=[];for(let T=0;T<=t;++T)w[T]=s.slice(0);w[0][0]=1;for(let T=1;T<=i;++T){let M=0;const b=u-T,A=t-T;u>=T&&(w[v][0]=w[g][0]/l[A+1][b],M=w[v][0]*l[b][A]);const E=b>=-1?1:-b,P=u-1<=A?T-1:t-u;for(let O=E;O<=P;++O)w[v][O]=(w[g][O]-w[g][O-1])/l[A+1][b+O],M+=w[v][O]*l[b+O][A];u<=A&&(w[v][T]=-w[g][T-1]/l[A+1][u],M+=w[v][T]*l[u][A]),a[T][u]=M;const G=g;g=v,v=G}}let m=t;for(let u=1;u<=i;++u){for(let g=0;g<=t;++g)a[u][g]*=m;m*=t-u}return a}function lB(n,e,t,i,r){const s=r<n?r:n,a=[],l=tT(n,i,e),d=oB(l,i,n,s,e),h=[];for(let m=0;m<t.length;++m){const u=t[m].clone(),g=u.w;u.x*=g,u.y*=g,u.z*=g,h[m]=u}for(let m=0;m<=s;++m){const u=h[l-n].clone().multiplyScalar(d[m][0]);for(let g=1;g<=n;++g)u.add(h[l-n+g].clone().multiplyScalar(d[m][g]));a[m]=u}for(let m=s+1;m<=r+1;++m)a[m]=new $t(0,0,0);return a}function cB(n,e){let t=1;for(let r=2;r<=n;++r)t*=r;let i=1;for(let r=2;r<=e;++r)i*=r;for(let r=2;r<=n-e;++r)i*=r;return t/i}function uB(n){const e=n.length,t=[],i=[];for(let s=0;s<e;++s){const a=n[s];t[s]=new j(a.x,a.y,a.z),i[s]=a.w}const r=[];for(let s=0;s<e;++s){const a=t[s].clone();for(let l=1;l<=s;++l)a.sub(r[s-l].clone().multiplyScalar(cB(s,l)*i[l]));r[s]=a.divideScalar(i[0])}return r}function dB(n,e,t,i,r){const s=lB(n,e,t,i,r);return uB(s)}class hB extends ZO{constructor(e,t,i,r,s){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=s||this.knots.length-1;for(let a=0;a<i.length;++a){const l=i[a];this.controlPoints[a]=new $t(l.x,l.y,l.z,l.w)}}getPoint(e,t=new j){const i=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=aB(this.degree,this.knots,this.controlPoints,r);return s.w!==1&&s.divideScalar(s.w),i.set(s.x,s.y,s.z)}getTangent(e,t=new j){const i=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=dB(this.degree,this.knots,this.controlPoints,r,1);return i.copy(s[1]).normalize(),i}}let Ct,Dn,xi;class fB extends Hi{constructor(e){super(e)}load(e,t,i,r){const s=this,a=s.path===""?Ho.extractUrlBase(e):s.path,l=new _s(this.manager);l.setPath(s.path),l.setResponseType("arraybuffer"),l.setRequestHeader(s.requestHeader),l.setWithCredentials(s.withCredentials),l.load(e,function(d){try{t(s.parse(d,a))}catch(h){r?r(h):console.error(h),s.manager.itemError(e)}},i,r)}parse(e,t){if(yB(e))Ct=new vB().parse(e);else{const r=sT(e);if(!bB(r))throw new Error("THREE.FBXLoader: Unknown format.");if(xS(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+xS(r));Ct=new _B().parse(r)}const i=new Xh(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new pB(i,this.manager).parse(Ct)}}class pB{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Dn=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),r=this.parseDeformers(),s=new mB().parse(r);return this.parseScene(r,s,i),xi}parseConnections(){const e=new Map;return"Connections"in Ct&&Ct.Connections.connections.forEach(function(i){const r=i[0],s=i[1],a=i[2];e.has(r)||e.set(r,{parents:[],children:[]});const l={ID:s,relationship:a};e.get(r).parents.push(l),e.has(s)||e.set(s,{parents:[],children:[]});const d={ID:r,relationship:a};e.get(s).children.push(d)}),e}parseImages(){const e={},t={};if("Video"in Ct.Objects){const i=Ct.Objects.Video;for(const r in i){const s=i[r],a=parseInt(r);if(e[a]=s.RelativeFilename||s.Filename,"Content"in s){const l=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,d=typeof s.Content=="string"&&s.Content!=="";if(l||d){const h=this.parseImage(i[r]);t[s.RelativeFilename||s.Filename]=h}}}}for(const i in e){const r=e[i];t[r]!==void 0?e[i]=t[r]:e[i]=e[i].split("\\").pop()}return e}parseImage(e){const t=e.Content,i=e.RelativeFilename||e.Filename,r=i.slice(i.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",i),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in Ct.Objects){const i=Ct.Objects.Texture;for(const r in i){const s=this.parseTexture(i[r],e);t.set(parseInt(r),s)}}return t}parseTexture(e,t){const i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;const r=e.WrapModeU,s=e.WrapModeV,a=r!==void 0?r.value:0,l=s!==void 0?s.value:0;if(i.wrapS=a===0?Vr:ti,i.wrapT=l===0?Vr:ti,"Scaling"in e){const d=e.Scaling.value;i.repeat.x=d[0],i.repeat.y=d[1]}if("Translation"in e){const d=e.Translation.value;i.offset.x=d[0],i.offset.y=d[1]}return i}loadTexture(e,t){const i=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),r=e.FileName.split(".").pop().toLowerCase(),s=i.has(r)?this.manager.getHandler(`.${r}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${r.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new qn;const a=s.path;a||s.setPath(this.textureLoader.path);const l=Dn.get(e.id).children;let d;l!==void 0&&l.length>0&&t[l[0].ID]!==void 0&&(d=t[l[0].ID],(d.indexOf("blob:")===0||d.indexOf("data:")===0)&&s.setPath(void 0));const h=s.load(d);return s.setPath(a),h}parseMaterials(e){const t=new Map;if("Material"in Ct.Objects){const i=Ct.Objects.Material;for(const r in i){const s=this.parseMaterial(i[r],e);s!==null&&t.set(parseInt(r),s)}}return t}parseMaterial(e,t){const i=e.id,r=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!Dn.has(i))return null;const a=this.parseParameters(e,t,i);let l;switch(s.toLowerCase()){case"phong":l=new Od;break;case"lambert":l=new gN;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),l=new Od;break}return l.setValues(a),l.name=r,l}parseParameters(e,t,i){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new Je().fromArray(e.Diffuse.value).convertSRGBToLinear():e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new Je().fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new Je().fromArray(e.Emissive.value).convertSRGBToLinear():e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new Je().fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new Je().fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new Je().fromArray(e.SpecularColor.value).convertSRGBToLinear());const s=this;return Dn.get(i).children.forEach(function(a){const l=a.relationship;switch(l){case"Bump":r.bumpMap=s.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(t,a.ID),r.map!==void 0&&(r.map.colorSpace=on);break;case"DisplacementColor":r.displacementMap=s.getTexture(t,a.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(t,a.ID),r.emissiveMap!==void 0&&(r.emissiveMap.colorSpace=on);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(t,a.ID);break;case"ReflectionColor":r.envMap=s.getTexture(t,a.ID),r.envMap!==void 0&&(r.envMap.mapping=el,r.envMap.colorSpace=on);break;case"SpecularColor":r.specularMap=s.getTexture(t,a.ID),r.specularMap!==void 0&&(r.specularMap.colorSpace=on);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(t,a.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",l);break}}),r}getTexture(e,t){return"LayeredTexture"in Ct.Objects&&t in Ct.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Dn.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Ct.Objects){const i=Ct.Objects.Deformer;for(const r in i){const s=i[r],a=Dn.get(parseInt(r));if(s.attrType==="Skin"){const l=this.parseSkeleton(a,i);l.ID=r,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=a.parents[0].ID,e[r]=l}else if(s.attrType==="BlendShape"){const l={id:r};l.rawTargets=this.parseMorphTargets(a,i),l.id=r,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=l}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const i=[];return e.children.forEach(function(r){const s=t[r.ID];if(s.attrType!=="Cluster")return;const a={ID:r.ID,indices:[],weights:[],transformLink:new ot().fromArray(s.TransformLink.a)};"Indexes"in s&&(a.indices=s.Indexes.a,a.weights=s.Weights.a),i.push(a)}),{rawBones:i,bones:[]}}parseMorphTargets(e,t){const i=[];for(let r=0;r<e.children.length;r++){const s=e.children[r],a=t[s.ID],l={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;l.geoID=Dn.get(parseInt(s.ID)).children.filter(function(d){return d.relationship===void 0})[0].ID,i.push(l)}return i}parseScene(e,t,i){xi=new Nr;const r=this.parseModels(e.skeletons,t,i),s=Ct.Objects.Model,a=this;r.forEach(function(d){const h=s[d.ID];a.setLookAtProperties(d,h),Dn.get(d.ID).parents.forEach(function(u){const g=r.get(u.ID);g!==void 0&&g.add(d)}),d.parent===null&&xi.add(d)}),this.bindSkeleton(e.skeletons,t,r),this.addGlobalSceneSettings(),xi.traverse(function(d){if(d.userData.transformData){d.parent&&(d.userData.transformData.parentMatrix=d.parent.matrix,d.userData.transformData.parentMatrixWorld=d.parent.matrixWorld);const h=iT(d.userData.transformData);d.applyMatrix4(h),d.updateWorldMatrix()}});const l=new gB().parse();xi.children.length===1&&xi.children[0].isGroup&&(xi.children[0].animations=l,xi=xi.children[0]),xi.animations=l}parseModels(e,t,i){const r=new Map,s=Ct.Objects.Model;for(const a in s){const l=parseInt(a),d=s[a],h=Dn.get(l);let m=this.buildSkeleton(h,e,l,d.attrName);if(!m){switch(d.attrType){case"Camera":m=this.createCamera(h);break;case"Light":m=this.createLight(h);break;case"Mesh":m=this.createMesh(h,t,i);break;case"NurbsCurve":m=this.createCurve(h,t);break;case"LimbNode":case"Root":m=new _h;break;case"Null":default:m=new Nr;break}m.name=d.attrName?Yt.sanitizeNodeName(d.attrName):"",m.userData.originalName=d.attrName,m.ID=l}this.getTransformData(m,d),r.set(l,m)}return r}buildSkeleton(e,t,i,r){let s=null;return e.parents.forEach(function(a){for(const l in t){const d=t[l];d.rawBones.forEach(function(h,m){if(h.ID===a.ID){const u=s;s=new _h,s.matrixWorld.copy(h.transformLink),s.name=r?Yt.sanitizeNodeName(r):"",s.userData.originalName=r,s.ID=i,d.bones[m]=s,u!==null&&s.add(u)}})}}),s}createCamera(e){let t,i;if(e.children.forEach(function(r){const s=Ct.Objects.NodeAttribute[r.ID];s!==void 0&&(i=s)}),i===void 0)t=new sn;else{let r=0;i.CameraProjectionType!==void 0&&i.CameraProjectionType.value===1&&(r=1);let s=1;i.NearPlane!==void 0&&(s=i.NearPlane.value/1e3);let a=1e3;i.FarPlane!==void 0&&(a=i.FarPlane.value/1e3);let l=window.innerWidth,d=window.innerHeight;i.AspectWidth!==void 0&&i.AspectHeight!==void 0&&(l=i.AspectWidth.value,d=i.AspectHeight.value);const h=l/d;let m=45;i.FieldOfView!==void 0&&(m=i.FieldOfView.value);const u=i.FocalLength?i.FocalLength.value:null;switch(r){case 0:t=new mi(m,h,s,a),u!==null&&t.setFocalLength(u);break;case 1:t=new dl(-l/2,l/2,d/2,-d/2,s,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new sn;break}}return t}createLight(e){let t,i;if(e.children.forEach(function(r){const s=Ct.Objects.NodeAttribute[r.ID];s!==void 0&&(i=s)}),i===void 0)t=new sn;else{let r;i.LightType===void 0?r=0:r=i.LightType.value;let s=16777215;i.Color!==void 0&&(s=new Je().fromArray(i.Color.value).convertSRGBToLinear());let a=i.Intensity===void 0?1:i.Intensity.value/100;i.CastLightOnObject!==void 0&&i.CastLightOnObject.value===0&&(a=0);let l=0;i.FarAttenuationEnd!==void 0&&(i.EnableFarAttenuation!==void 0&&i.EnableFarAttenuation.value===0?l=0:l=i.FarAttenuationEnd.value);const d=1;switch(r){case 0:t=new hg(s,a,l,d);break;case 1:t=new F_(s,a);break;case 2:let h=Math.PI/3;i.InnerAngle!==void 0&&(h=bn.degToRad(i.InnerAngle.value));let m=0;i.OuterAngle!==void 0&&(m=bn.degToRad(i.OuterAngle.value),m=Math.max(m,1)),t=new XE(s,a,l,h,m,d);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new hg(s,a);break}i.CastShadows!==void 0&&i.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,i){let r,s=null,a=null;const l=[];return e.children.forEach(function(d){t.has(d.ID)&&(s=t.get(d.ID)),i.has(d.ID)&&l.push(i.get(d.ID))}),l.length>1?a=l:l.length>0?a=l[0]:(a=new Od({name:Hi.DEFAULT_MATERIAL_NAME,color:13421772}),l.push(a)),"color"in s.attributes&&l.forEach(function(d){d.vertexColors=!0}),s.FBX_Deformer?(r=new NE(s,a),r.normalizeSkinWeights()):r=new wn(s,a),r}createCurve(e,t){const i=e.children.reduce(function(s,a){return t.has(a.ID)&&(s=t.get(a.ID)),s},null),r=new Aa({name:Hi.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Wh(i,r)}getTransformData(e,t){const i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=rT(t.RotationOrder.value):i.eulerOrder="ZYX","Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(i.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(i.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(i.rotationPivot=t.RotationPivot.value),e.userData.transformData=i}setLookAtProperties(e,t){"LookAtProperty"in t&&Dn.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const s=Ct.Objects.Model[r.ID];if("Lcl_Translation"in s){const a=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),xi.add(e.target)):e.lookAt(new j().fromArray(a))}}})}bindSkeleton(e,t,i){const r=this.parsePoseNodes();for(const s in e){const a=e[s];Dn.get(parseInt(a.ID)).parents.forEach(function(d){if(t.has(d.ID)){const h=d.ID;Dn.get(h).parents.forEach(function(u){i.has(u.ID)&&i.get(u.ID).bind(new Vh(a.bones),r[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Ct.Objects){const t=Ct.Objects.Pose;for(const i in t)if(t[i].attrType==="BindPose"&&t[i].NbPoseNodes>0){const r=t[i].PoseNode;Array.isArray(r)?r.forEach(function(s){e[s.Node]=new ot().fromArray(s.Matrix.a)}):e[r.Node]=new ot().fromArray(r.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in Ct){if("AmbientColor"in Ct.GlobalSettings){const e=Ct.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],r=e[2];if(t!==0||i!==0||r!==0){const s=new Je(t,i,r).convertSRGBToLinear();xi.add(new YE(s,1))}}"UnitScaleFactor"in Ct.GlobalSettings&&(xi.userData.unitScaleFactor=Ct.GlobalSettings.UnitScaleFactor.value)}}}class mB{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Ct.Objects){const i=Ct.Objects.Geometry;for(const r in i){const s=Dn.get(parseInt(r)),a=this.parseGeometry(s,i[r],e);t.set(parseInt(r),a)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,i){const r=i.skeletons,s=[],a=e.parents.map(function(u){return Ct.Objects.Model[u.ID]});if(a.length===0)return;const l=e.children.reduce(function(u,g){return r[g.ID]!==void 0&&(u=r[g.ID]),u},null);e.children.forEach(function(u){i.morphTargets[u.ID]!==void 0&&s.push(i.morphTargets[u.ID])});const d=a[0],h={};"RotationOrder"in d&&(h.eulerOrder=rT(d.RotationOrder.value)),"InheritType"in d&&(h.inheritType=parseInt(d.InheritType.value)),"GeometricTranslation"in d&&(h.translation=d.GeometricTranslation.value),"GeometricRotation"in d&&(h.rotation=d.GeometricRotation.value),"GeometricScaling"in d&&(h.scale=d.GeometricScaling.value);const m=iT(h);return this.genGeometry(t,l,s,m)}genGeometry(e,t,i,r){const s=new On;e.attrName&&(s.name=e.attrName);const a=this.parseGeoNode(e,t),l=this.genBuffers(a),d=new nn(l.vertex,3);if(d.applyMatrix4(r),s.setAttribute("position",d),l.colors.length>0&&s.setAttribute("color",new nn(l.colors,3)),t&&(s.setAttribute("skinIndex",new C_(l.weightsIndices,4)),s.setAttribute("skinWeight",new nn(l.vertexWeights,4)),s.FBX_Deformer=t),l.normal.length>0){const h=new At().getNormalMatrix(r),m=new nn(l.normal,3);m.applyNormalMatrix(h),s.setAttribute("normal",m)}if(l.uvs.forEach(function(h,m){const u=m===0?"uv":`uv${m}`;s.setAttribute(u,new nn(l.uvs[m],2))}),a.material&&a.material.mappingType!=="AllSame"){let h=l.materialIndex[0],m=0;if(l.materialIndex.forEach(function(u,g){u!==h&&(s.addGroup(m,g-m,h),h=u,m=g)}),s.groups.length>0){const u=s.groups[s.groups.length-1],g=u.start+u.count;g!==l.materialIndex.length&&s.addGroup(g,l.materialIndex.length-g,h)}s.groups.length===0&&s.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(s,e,i,r),s}parseGeoNode(e,t){const i={};if(i.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],i.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&i.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return i.weightTable={},t!==null&&(i.skeleton=t,t.rawBones.forEach(function(r,s){r.indices.forEach(function(a,l){i.weightTable[a]===void 0&&(i.weightTable[a]=[]),i.weightTable[a].push({id:s,weight:r.weights[l]})})})),i}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let i=0,r=0,s=!1,a=[],l=[],d=[],h=[],m=[],u=[];const g=this;return e.vertexIndices.forEach(function(v,w){let T,M=!1;v<0&&(v=v^-1,M=!0);let b=[],A=[];if(a.push(v*3,v*3+1,v*3+2),e.color){const E=cd(w,i,v,e.color);d.push(E[0],E[1],E[2])}if(e.skeleton){if(e.weightTable[v]!==void 0&&e.weightTable[v].forEach(function(E){A.push(E.weight),b.push(E.id)}),A.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const E=[0,0,0,0],P=[0,0,0,0];A.forEach(function(G,O){let B=G,F=b[O];P.forEach(function(D,L,V){if(B>D){V[L]=B,B=D;const ie=E[L];E[L]=F,F=ie}})}),b=E,A=P}for(;A.length<4;)A.push(0),b.push(0);for(let E=0;E<4;++E)m.push(A[E]),u.push(b[E])}if(e.normal){const E=cd(w,i,v,e.normal);l.push(E[0],E[1],E[2])}e.material&&e.material.mappingType!=="AllSame"&&(T=cd(w,i,v,e.material)[0],T<0&&(g.negativeMaterialIndices=!0,T=0)),e.uv&&e.uv.forEach(function(E,P){const G=cd(w,i,v,E);h[P]===void 0&&(h[P]=[]),h[P].push(G[0]),h[P].push(G[1])}),r++,M&&(g.genFace(t,e,a,T,l,d,h,m,u,r),i++,r=0,a=[],l=[],d=[],h=[],m=[],u=[])}),t}getNormalNewell(e){const t=new j(0,0,0);for(let i=0;i<e.length;i++){const r=e[i],s=e[(i+1)%e.length];t.x+=(r.y-s.y)*(r.z+s.z),t.y+=(r.z-s.z)*(r.x+s.x),t.z+=(r.x-s.x)*(r.y+s.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){const t=this.getNormalNewell(e),r=(Math.abs(t.z)>.5?new j(0,1,0):new j(0,0,1)).cross(t).normalize(),s=t.clone().cross(r).normalize();return{normal:t,tangent:r,bitangent:s}}flattenVertex(e,t,i){return new et(e.dot(t),e.dot(i))}genFace(e,t,i,r,s,a,l,d,h,m){let u;if(m>3){const g=[],v=t.baseVertexPositions||t.vertexPositions;for(let b=0;b<i.length;b+=3)g.push(new j(v[i[b]],v[i[b+1]],v[i[b+2]]));const{tangent:w,bitangent:T}=this.getNormalTangentAndBitangent(g),M=[];for(const b of g)M.push(this.flattenVertex(b,w,T));u=I_.triangulateShape(M,[])}else u=[[0,1,2]];for(const[g,v,w]of u)e.vertex.push(t.vertexPositions[i[g*3]]),e.vertex.push(t.vertexPositions[i[g*3+1]]),e.vertex.push(t.vertexPositions[i[g*3+2]]),e.vertex.push(t.vertexPositions[i[v*3]]),e.vertex.push(t.vertexPositions[i[v*3+1]]),e.vertex.push(t.vertexPositions[i[v*3+2]]),e.vertex.push(t.vertexPositions[i[w*3]]),e.vertex.push(t.vertexPositions[i[w*3+1]]),e.vertex.push(t.vertexPositions[i[w*3+2]]),t.skeleton&&(e.vertexWeights.push(d[g*4]),e.vertexWeights.push(d[g*4+1]),e.vertexWeights.push(d[g*4+2]),e.vertexWeights.push(d[g*4+3]),e.vertexWeights.push(d[v*4]),e.vertexWeights.push(d[v*4+1]),e.vertexWeights.push(d[v*4+2]),e.vertexWeights.push(d[v*4+3]),e.vertexWeights.push(d[w*4]),e.vertexWeights.push(d[w*4+1]),e.vertexWeights.push(d[w*4+2]),e.vertexWeights.push(d[w*4+3]),e.weightsIndices.push(h[g*4]),e.weightsIndices.push(h[g*4+1]),e.weightsIndices.push(h[g*4+2]),e.weightsIndices.push(h[g*4+3]),e.weightsIndices.push(h[v*4]),e.weightsIndices.push(h[v*4+1]),e.weightsIndices.push(h[v*4+2]),e.weightsIndices.push(h[v*4+3]),e.weightsIndices.push(h[w*4]),e.weightsIndices.push(h[w*4+1]),e.weightsIndices.push(h[w*4+2]),e.weightsIndices.push(h[w*4+3])),t.color&&(e.colors.push(a[g*3]),e.colors.push(a[g*3+1]),e.colors.push(a[g*3+2]),e.colors.push(a[v*3]),e.colors.push(a[v*3+1]),e.colors.push(a[v*3+2]),e.colors.push(a[w*3]),e.colors.push(a[w*3+1]),e.colors.push(a[w*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(s[g*3]),e.normal.push(s[g*3+1]),e.normal.push(s[g*3+2]),e.normal.push(s[v*3]),e.normal.push(s[v*3+1]),e.normal.push(s[v*3+2]),e.normal.push(s[w*3]),e.normal.push(s[w*3+1]),e.normal.push(s[w*3+2])),t.uv&&t.uv.forEach(function(T,M){e.uvs[M]===void 0&&(e.uvs[M]=[]),e.uvs[M].push(l[M][g*2]),e.uvs[M].push(l[M][g*2+1]),e.uvs[M].push(l[M][v*2]),e.uvs[M].push(l[M][v*2+1]),e.uvs[M].push(l[M][w*2]),e.uvs[M].push(l[M][w*2+1])})}addMorphTargets(e,t,i,r){if(i.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const s=this;i.forEach(function(a){a.rawTargets.forEach(function(l){const d=Ct.Objects.Geometry[l.geoID];d!==void 0&&s.genMorphGeometry(e,t,d,r,l.name)})})}genMorphGeometry(e,t,i,r,s){const a=t.Vertices!==void 0?t.Vertices.a:[],l=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],d=i.Vertices!==void 0?i.Vertices.a:[],h=i.Indexes!==void 0?i.Indexes.a:[],m=e.attributes.position.count*3,u=new Float32Array(m);for(let T=0;T<h.length;T++){const M=h[T]*3;u[M]=d[T*3],u[M+1]=d[T*3+1],u[M+2]=d[T*3+2]}const g={vertexIndices:l,vertexPositions:u,baseVertexPositions:a},v=this.genBuffers(g),w=new nn(v.vertex,3);w.name=s||i.attrName,w.applyMatrix4(r),e.morphAttributes.position.push(w)}parseNormals(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.Normals.a;let s=[];return i==="IndexToDirect"&&("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&&(s=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:s,mappingType:t,referenceType:i}}parseUVs(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.UV.a;let s=[];return i==="IndexToDirect"&&(s=e.UVIndex.a),{dataSize:2,buffer:r,indices:s,mappingType:t,referenceType:i}}parseVertexColors(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.Colors.a;let s=[];i==="IndexToDirect"&&(s=e.ColorIndex.a);for(let a=0,l=new Je;a<r.length;a+=4)l.fromArray(r,a).convertSRGBToLinear().toArray(r,a);return{dataSize:4,buffer:r,indices:s,mappingType:t,referenceType:i}}parseMaterialIndices(e){const t=e.MappingInformationType,i=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};const r=e.Materials.a,s=[];for(let a=0;a<r.length;++a)s.push(a);return{dataSize:1,buffer:r,indices:s,mappingType:t,referenceType:i}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new On;const i=t-1,r=e.KnotVector.a,s=[],a=e.Points.a;for(let u=0,g=a.length;u<g;u+=4)s.push(new $t().fromArray(a,u));let l,d;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){l=i,d=r.length-1-l;for(let u=0;u<i;++u)s.push(s[u])}const m=new hB(i,r,s,l,d).getPoints(s.length*12);return new On().setFromPoints(m)}}class gB{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const i in t){const r=t[i],s=this.addClip(r);e.push(s)}return e}parseClips(){if(Ct.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=Ct.Objects.AnimationCurveNode,t=new Map;for(const i in e){const r=e[i];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:r.id,attr:r.attrName,curves:{}};t.set(s.id,s)}}return t}parseAnimationCurves(e){const t=Ct.Objects.AnimationCurve;for(const i in t){const r={id:t[i].id,times:t[i].KeyTime.a.map(xB),values:t[i].KeyValueFloat.a},s=Dn.get(r.id);if(s!==void 0){const a=s.parents[0].ID,l=s.parents[0].relationship;l.match(/X/)?e.get(a).curves.x=r:l.match(/Y/)?e.get(a).curves.y=r:l.match(/Z/)?e.get(a).curves.z=r:l.match(/DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=r)}}}parseAnimationLayers(e){const t=Ct.Objects.AnimationLayer,i=new Map;for(const r in t){const s=[],a=Dn.get(parseInt(r));a!==void 0&&(a.children.forEach(function(d,h){if(e.has(d.ID)){const m=e.get(d.ID);if(m.curves.x!==void 0||m.curves.y!==void 0||m.curves.z!==void 0){if(s[h]===void 0){const u=Dn.get(d.ID).parents.filter(function(g){return g.relationship!==void 0})[0].ID;if(u!==void 0){const g=Ct.Objects.Model[u.toString()];if(g===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",d);return}const v={modelName:g.attrName?Yt.sanitizeNodeName(g.attrName):"",ID:g.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};xi.traverse(function(w){w.ID===g.id&&(v.transform=w.matrix,w.userData.transformData&&(v.eulerOrder=w.userData.transformData.eulerOrder))}),v.transform||(v.transform=new ot),"PreRotation"in g&&(v.preRotation=g.PreRotation.value),"PostRotation"in g&&(v.postRotation=g.PostRotation.value),s[h]=v}}s[h]&&(s[h][m.attr]=m)}else if(m.curves.morph!==void 0){if(s[h]===void 0){const u=Dn.get(d.ID).parents.filter(function(b){return b.relationship!==void 0})[0].ID,g=Dn.get(u).parents[0].ID,v=Dn.get(g).parents[0].ID,w=Dn.get(v).parents[0].ID,T=Ct.Objects.Model[w],M={modelName:T.attrName?Yt.sanitizeNodeName(T.attrName):"",morphName:Ct.Objects.Deformer[u].attrName};s[h]=M}s[h][m.attr]=m}}}),i.set(parseInt(r),s))}return i}parseAnimStacks(e){const t=Ct.Objects.AnimationStack,i={};for(const r in t){const s=Dn.get(parseInt(r)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(s[0].ID);i[r]={name:t[r].attrName,layer:a}}return i}addClip(e){let t=[];const i=this;return e.layer.forEach(function(r){t=t.concat(i.generateTracks(r))}),new WE(e.name,-1,t)}generateTracks(e){const t=[];let i=new j,r=new j;if(e.transform&&e.transform.decompose(i,new Gn,r),i=i.toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,i,r){const s=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(s,t,i);return new Ua(e+"."+r,s,a)}generateRotationTrack(e,t,i,r,s){let a,l;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const u=this.interpolateRotations(t.x,t.y,t.z,s);a=u[0],l=u[1]}i!==void 0&&(i=i.map(bn.degToRad),i.push(s),i=new Pn().fromArray(i),i=new Gn().setFromEuler(i)),r!==void 0&&(r=r.map(bn.degToRad),r.push(s),r=new Pn().fromArray(r),r=new Gn().setFromEuler(r).invert());const d=new Gn,h=new Pn,m=[];if(!l||!a)return new Qs(e+".quaternion",[0],[0]);for(let u=0;u<l.length;u+=3)h.set(l[u],l[u+1],l[u+2],s),d.setFromEuler(h),i!==void 0&&d.premultiply(i),r!==void 0&&d.multiply(r),u>2&&new Gn().fromArray(m,(u-3)/3*4).dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w),d.toArray(m,u/3*4);return new Qs(e+".quaternion",a,m)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,i=t.values.map(function(s){return s/100}),r=xi.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Fa(e.modelName+".morphTargetInfluences["+r+"]",t.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(i,r){return i-r}),t.length>1){let i=1,r=t[0];for(let s=1;s<t.length;s++){const a=t[s];a!==r&&(t[i]=a,r=a,i++)}t=t.slice(0,i)}return t}getKeyframeTrackValues(e,t,i){const r=i,s=[];let a=-1,l=-1,d=-1;return e.forEach(function(h){if(t.x&&(a=t.x.times.indexOf(h)),t.y&&(l=t.y.times.indexOf(h)),t.z&&(d=t.z.times.indexOf(h)),a!==-1){const m=t.x.values[a];s.push(m),r[0]=m}else s.push(r[0]);if(l!==-1){const m=t.y.values[l];s.push(m),r[1]=m}else s.push(r[1]);if(d!==-1){const m=t.z.values[d];s.push(m),r[2]=m}else s.push(r[2])}),s}interpolateRotations(e,t,i,r){const s=[],a=[];s.push(e.times[0]),a.push(bn.degToRad(e.values[0])),a.push(bn.degToRad(t.values[0])),a.push(bn.degToRad(i.values[0]));for(let l=1;l<e.values.length;l++){const d=[e.values[l-1],t.values[l-1],i.values[l-1]];if(isNaN(d[0])||isNaN(d[1])||isNaN(d[2]))continue;const h=d.map(bn.degToRad),m=[e.values[l],t.values[l],i.values[l]];if(isNaN(m[0])||isNaN(m[1])||isNaN(m[2]))continue;const u=m.map(bn.degToRad),g=[m[0]-d[0],m[1]-d[1],m[2]-d[2]],v=[Math.abs(g[0]),Math.abs(g[1]),Math.abs(g[2])];if(v[0]>=180||v[1]>=180||v[2]>=180){const T=Math.max(...v)/180,M=new Pn(...h,r),b=new Pn(...u,r),A=new Gn().setFromEuler(M),E=new Gn().setFromEuler(b);A.dot(E)&&E.set(-E.x,-E.y,-E.z,-E.w);const P=e.times[l-1],G=e.times[l]-P,O=new Gn,B=new Pn;for(let F=0;F<1;F+=1/T)O.copy(A.clone().slerp(E.clone(),F)),s.push(P+F*G),B.setFromQuaternion(O,r),a.push(B.x),a.push(B.y),a.push(B.z)}else s.push(e.times[l]),a.push(bn.degToRad(e.values[l])),a.push(bn.degToRad(t.values[l])),a.push(bn.degToRad(i.values[l]))}return[s,a]}}class _B{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new nT,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,i=e.split(/[\r\n]+/);return i.forEach(function(r,s){const a=r.match(/^[\s\t]*;/),l=r.match(/^[\s\t]*$/);if(a||l)return;const d=r.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),h=r.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),m=r.match("^\\t{"+(t.currentIndent-1)+"}}");d?t.parseNodeBegin(r,d):h?t.parseNodeProperty(r,h,i[++s]):m?t.popStack():r.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(e,t){const i=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(d){return d.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:i},a=this.parseNodeAttr(r),l=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(i,s):i in l?(i==="PoseNode"?l.PoseNode.push(s):l[i].id!==void 0&&(l[i]={},l[i][l[i].id]=l[i]),a.id!==""&&(l[i][a.id]=s)):typeof a.id=="number"?(l[i]={},l[i][a.id]=s):i!=="Properties70"&&(i==="PoseNode"?l[i]=[s]:l[i]=s),typeof a.id=="number"&&(s.id=a.id),a.name!==""&&(s.attrName=a.name),a.type!==""&&(s.attrType=a.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let i="",r="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:i,type:r}}parseNodeProperty(e,t,i){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&s===","&&(s=i.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,r,s);return}if(r==="C"){const d=s.split(",").slice(1),h=parseInt(d[0]),m=parseInt(d[1]);let u=s.split(",").slice(3);u=u.map(function(g){return g.trim().replace(/^"/,"")}),r="connections",s=[h,m],SB(s,u),a[r]===void 0&&(a[r]=[])}r==="Node"&&(a.id=s),r in a&&Array.isArray(a[r])?a[r].push(s):r!=="a"?a[r]=s:a.a=s,this.setCurrentProp(a,r),r==="a"&&s.slice(-1)!==","&&(a.a=Tp(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Tp(t.a))}parseNodeSpecialProperty(e,t,i){const r=i.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],a=r[1],l=r[2],d=r[3];let h=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Tp(h);break}this.getPrevNode()[s]={type:a,type2:l,flag:d,value:h},this.setCurrentProp(this.getPrevNode(),s)}}class vB{parse(e){const t=new bS(e);t.skip(23);const i=t.getUint32();if(i<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+i);const r=new nT;for(;!this.endOfContent(t);){const s=this.parseNode(t,i);s!==null&&r.add(s.name,s)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const i={},r=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),l=e.getString(a);if(r===0)return null;const d=[];for(let g=0;g<s;g++)d.push(this.parseProperty(e));const h=d.length>0?d[0]:"",m=d.length>1?d[1]:"",u=d.length>2?d[2]:"";for(i.singleProperty=s===1&&e.getOffset()===r;r>e.getOffset();){const g=this.parseNode(e,t);g!==null&&this.parseSubNode(l,i,g)}return i.propertyList=d,typeof h=="number"&&(i.id=h),m!==""&&(i.attrName=m),u!==""&&(i.attrType=u),l!==""&&(i.name=l),i}parseSubNode(e,t,i){if(i.singleProperty===!0){const r=i.propertyList[0];Array.isArray(r)?(t[i.name]=i,i.a=r):t[i.name]=r}else if(e==="Connections"&&i.name==="C"){const r=[];i.propertyList.forEach(function(s,a){a!==0&&r.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(i.name==="Properties70")Object.keys(i).forEach(function(s){t[s]=i[s]});else if(e==="Properties70"&&i.name==="P"){let r=i.propertyList[0],s=i.propertyList[1];const a=i.propertyList[2],l=i.propertyList[3];let d;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?d=[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:d=i.propertyList[4],t[r]={type:s,type2:a,flag:l,value:d}}else t[i.name]===void 0?typeof i.id=="number"?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:i.name==="PoseNode"?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):t[i.name][i.id]===void 0&&(t[i.name][i.id]=i)}parseProperty(e){const t=e.getString(1);let i;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),s=e.getUint32(),a=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const l=Zl(new Uint8Array(e.getArrayBuffer(a))),d=new bS(l.buffer);switch(t){case"b":case"c":return d.getBooleanArray(r);case"d":return d.getFloat64Array(r);case"f":return d.getFloat32Array(r);case"i":return d.getInt32Array(r);case"l":return d.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class bS{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let i=0;i<e;i++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let i=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const r=i.indexOf(0);return r>=0&&(i=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(i)}}class nT{add(e,t){this[e]=t}}function yB(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===sT(n,0,e.length)}function bB(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function i(r){const s=n[r-1];return n=n.slice(t+r),t++,s}for(let r=0;r<e.length;++r)if(i(1)===e[r])return!1;return!0}function xS(n){const e=/FBXVersion: (\d+)/,t=n.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function xB(n){return n/46186158e3}const wB=[];function cd(n,e,t,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=n;break;case"ByPolygon":r=e;break;case"ByVertice":r=t;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}i.referenceType==="IndexToDirect"&&(r=i.indices[r]);const s=r*i.dataSize,a=s+i.dataSize;return MB(wB,i.buffer,s,a)}const Ep=new Pn,co=new j;function iT(n){const e=new ot,t=new ot,i=new ot,r=new ot,s=new ot,a=new ot,l=new ot,d=new ot,h=new ot,m=new ot,u=new ot,g=new ot,v=n.inheritType?n.inheritType:0;if(n.translation&&e.setPosition(co.fromArray(n.translation)),n.preRotation){const L=n.preRotation.map(bn.degToRad);L.push(n.eulerOrder||Pn.DEFAULT_ORDER),t.makeRotationFromEuler(Ep.fromArray(L))}if(n.rotation){const L=n.rotation.map(bn.degToRad);L.push(n.eulerOrder||Pn.DEFAULT_ORDER),i.makeRotationFromEuler(Ep.fromArray(L))}if(n.postRotation){const L=n.postRotation.map(bn.degToRad);L.push(n.eulerOrder||Pn.DEFAULT_ORDER),r.makeRotationFromEuler(Ep.fromArray(L)),r.invert()}n.scale&&s.scale(co.fromArray(n.scale)),n.scalingOffset&&l.setPosition(co.fromArray(n.scalingOffset)),n.scalingPivot&&a.setPosition(co.fromArray(n.scalingPivot)),n.rotationOffset&&d.setPosition(co.fromArray(n.rotationOffset)),n.rotationPivot&&h.setPosition(co.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(u.copy(n.parentMatrix),m.copy(n.parentMatrixWorld));const w=t.clone().multiply(i).multiply(r),T=new ot;T.extractRotation(m);const M=new ot;M.copyPosition(m);const b=M.clone().invert().multiply(m),A=T.clone().invert().multiply(b),E=s,P=new ot;if(v===0)P.copy(T).multiply(w).multiply(A).multiply(E);else if(v===1)P.copy(T).multiply(A).multiply(w).multiply(E);else{const V=new ot().scale(new j().setFromMatrixScale(u)).clone().invert(),ie=A.clone().multiply(V);P.copy(T).multiply(w).multiply(ie).multiply(E)}const G=h.clone().invert(),O=a.clone().invert();let B=e.clone().multiply(d).multiply(h).multiply(t).multiply(i).multiply(r).multiply(G).multiply(l).multiply(a).multiply(s).multiply(O);const F=new ot().copyPosition(B),D=m.clone().multiply(F);return g.copyPosition(D),B=g.clone().multiply(P),B.premultiply(m.invert()),B}function rT(n){n=n||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[n]}function Tp(n){return n.split(",").map(function(t){return parseFloat(t)})}function sT(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=n.byteLength),new TextDecoder().decode(new Uint8Array(n,e,t))}function SB(n,e){for(let t=0,i=n.length,r=e.length;t<r;t++,i++)n[i]=e[t]}function MB(n,e,t,i){for(let r=t,s=0;r<i;r++,s++)n[s]=e[r];return n}function wS(n,e){if(e===lD)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===sg||e===yE){let t=n.getIndex();if(t===null){const a=[],l=n.getAttribute("position");if(l!==void 0){for(let d=0;d<l.count;d++)a.push(d);n.setIndex(a),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,r=[];if(e===sg)for(let a=1;a<=i;a++)r.push(t.getX(0)),r.push(t.getX(a)),r.push(t.getX(a+1));else for(let a=0;a<i;a++)a%2===0?(r.push(t.getX(a)),r.push(t.getX(a+1)),r.push(t.getX(a+2))):(r.push(t.getX(a+2)),r.push(t.getX(a+1)),r.push(t.getX(a)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=n.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}class B_ extends Hi{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new RB(t)}),this.register(function(t){return new PB(t)}),this.register(function(t){return new BB(t)}),this.register(function(t){return new zB(t)}),this.register(function(t){return new HB(t)}),this.register(function(t){return new IB(t)}),this.register(function(t){return new DB(t)}),this.register(function(t){return new kB(t)}),this.register(function(t){return new FB(t)}),this.register(function(t){return new CB(t)}),this.register(function(t){return new UB(t)}),this.register(function(t){return new LB(t)}),this.register(function(t){return new NB(t)}),this.register(function(t){return new OB(t)}),this.register(function(t){return new TB(t)}),this.register(function(t){return new GB(t)}),this.register(function(t){return new VB(t)})}load(e,t,i,r){const s=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const h=Ho.extractUrlBase(e);a=Ho.resolveURL(h,this.path)}else a=Ho.extractUrlBase(e);this.manager.itemStart(e);const l=function(h){r?r(h):console.error(h),s.manager.itemError(e),s.manager.itemEnd(e)},d=new _s(this.manager);d.setPath(this.path),d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setWithCredentials(this.withCredentials),d.load(e,function(h){try{s.parse(h,a,function(m){t(m),s.manager.itemEnd(e)},l)}catch(m){l(m)}},i,l)}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 this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let s;const a={},l={},d=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(d.decode(new Uint8Array(e,0,4))===aT){try{a[It.KHR_BINARY_GLTF]=new WB(e)}catch(u){r&&r(u);return}s=JSON.parse(a[It.KHR_BINARY_GLTF].content)}else s=JSON.parse(d.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const h=new i4(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let m=0;m<this.pluginCallbacks.length;m++){const u=this.pluginCallbacks[m](h);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[u.name]=u,a[u.name]=!0}if(s.extensionsUsed)for(let m=0;m<s.extensionsUsed.length;++m){const u=s.extensionsUsed[m],g=s.extensionsRequired||[];switch(u){case It.KHR_MATERIALS_UNLIT:a[u]=new AB;break;case It.KHR_DRACO_MESH_COMPRESSION:a[u]=new jB(s,this.dracoLoader);break;case It.KHR_TEXTURE_TRANSFORM:a[u]=new XB;break;case It.KHR_MESH_QUANTIZATION:a[u]=new YB;break;default:g.indexOf(u)>=0&&l[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}h.setExtensions(a),h.setPlugins(l),h.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function EB(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const It={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"};class TB{constructor(e){this.parser=e,this.name=It.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const s=t[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const s=t.json,d=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let h;const m=new Je(16777215);d.color!==void 0&&m.setRGB(d.color[0],d.color[1],d.color[2],Sn);const u=d.range!==void 0?d.range:0;switch(d.type){case"directional":h=new F_(m),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new hg(m),h.distance=u;break;case"spot":h=new XE(m),h.distance=u,d.spot=d.spot||{},d.spot.innerConeAngle=d.spot.innerConeAngle!==void 0?d.spot.innerConeAngle:0,d.spot.outerConeAngle=d.spot.outerConeAngle!==void 0?d.spot.outerConeAngle:Math.PI/4,h.angle=d.spot.outerConeAngle,h.penumbra=1-d.spot.innerConeAngle/d.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+d.type)}return h.position.set(0,0,0),h.decay=2,is(h,d),d.intensity!==void 0&&(h.intensity=d.intensity),h.name=t.createUniqueName(d.name||"light_"+e),r=Promise.resolve(h),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,s=i.json.nodes[e],l=(s.extensions&&s.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(d){return i._getNodeRef(t.cache,l,d)})}}class AB{constructor(){this.name=It.KHR_MATERIALS_UNLIT}getMaterialType(){return Or}extendParams(e,t,i){const r=[];e.color=new Je(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Sn),e.opacity=a[3]}s.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",s.baseColorTexture,on))}return Promise.all(r)}}class CB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class RB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(s.push(i.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const l=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new et(l,l)}return Promise.all(s)}}class PB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class LB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(s)}}class IB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new Je(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=r.extensions[this.name];if(a.sheenColorFactor!==void 0){const l=a.sheenColorFactor;t.sheenColor.setRGB(l[0],l[1],l[2],Sn)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&s.push(i.assignTexture(t,"sheenColorMap",a.sheenColorTexture,on)),a.sheenRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(s)}}class DB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&s.push(i.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(s)}}class kB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&s.push(i.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const l=a.attenuationColor||[1,1,1];return t.attenuationColor=new Je().setRGB(l[0],l[1],l[2],Sn),Promise.all(s)}}class FB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class UB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&s.push(i.assignTexture(t,"specularIntensityMap",a.specularTexture));const l=a.specularColorFactor||[1,1,1];return t.specularColor=new Je().setRGB(l[0],l[1],l[2],Sn),a.specularColorTexture!==void 0&&s.push(i.assignTexture(t,"specularColorMap",a.specularColorTexture,on)),Promise.all(s)}}class OB{constructor(e){this.parser=e,this.name=It.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&s.push(i.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(s)}}class NB{constructor(e){this.parser=e,this.name=It.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:qi}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&s.push(i.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(s)}}class BB{constructor(e){this.parser=e,this.name=It.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class zB{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],l=r.images[a.source];let d=i.textureLoader;if(l.uri){const h=i.options.manager.getHandler(l.uri);h!==null&&(d=h)}return this.detectSupport().then(function(h){if(h)return i.loadTextureImage(e,a.source,d);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.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(t.height===1)}})),this.isSupported}}class HB{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],l=r.images[a.source];let d=i.textureLoader;if(l.uri){const h=i.options.manager.getHandler(l.uri);h!==null&&(d=h)}return this.detectSupport().then(function(h){if(h)return i.loadTextureImage(e,a.source,d);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.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(t.height===1)}})),this.isSupported}}class GB{constructor(e){this.name=It.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(l){const d=r.byteOffset||0,h=r.byteLength||0,m=r.count,u=r.byteStride,g=new Uint8Array(l,d,h);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(m,u,g,r.mode,r.filter).then(function(v){return v.buffer}):a.ready.then(function(){const v=new ArrayBuffer(m*u);return a.decodeGltfBuffer(new Uint8Array(v),m,u,g,r.mode,r.filter),v})})}else return null}}class VB{constructor(e){this.name=It.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const h of r.primitives)if(h.mode!==ir.TRIANGLES&&h.mode!==ir.TRIANGLE_STRIP&&h.mode!==ir.TRIANGLE_FAN&&h.mode!==void 0)return null;const a=i.extensions[this.name].attributes,l=[],d={};for(const h in a)l.push(this.parser.getDependency("accessor",a[h]).then(m=>(d[h]=m,d[h])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(h=>{const m=h.pop(),u=m.isGroup?m.children:[m],g=h[0].count,v=[];for(const w of u){const T=new ot,M=new j,b=new Gn,A=new j(1,1,1),E=new qO(w.geometry,w.material,g);for(let P=0;P<g;P++)d.TRANSLATION&&M.fromBufferAttribute(d.TRANSLATION,P),d.ROTATION&&b.fromBufferAttribute(d.ROTATION,P),d.SCALE&&A.fromBufferAttribute(d.SCALE,P),E.setMatrixAt(P,T.compose(M,b,A));for(const P in d)if(P==="_COLOR_0"){const G=d[P];E.instanceColor=new lg(G.array,G.itemSize,G.normalized)}else P!=="TRANSLATION"&&P!=="ROTATION"&&P!=="SCALE"&&w.geometry.setAttribute(P,d[P]);sn.prototype.copy.call(E,w),this.parser.assignFinalMaterial(E),v.push(E)}return m.isGroup?(m.clear(),m.add(...v),m):v[0]}))}}const aT="glTF",Gl=12,SS={JSON:1313821514,BIN:5130562};class WB{constructor(e){this.name=It.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Gl),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==aT)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-Gl,s=new DataView(e,Gl);let a=0;for(;a<r;){const l=s.getUint32(a,!0);a+=4;const d=s.getUint32(a,!0);if(a+=4,d===SS.JSON){const h=new Uint8Array(e,Gl+a,l);this.content=i.decode(h)}else if(d===SS.BIN){const h=Gl+a;this.body=e.slice(h,h+l)}a+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class jB{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=It.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,l={},d={},h={};for(const m in a){const u=mg[m]||m.toLowerCase();l[u]=a[m]}for(const m in e.attributes){const u=mg[m]||m.toLowerCase();if(a[m]!==void 0){const g=i.accessors[e.attributes[m]],v=Go[g.componentType];h[u]=v.name,d[u]=g.normalized===!0}}return t.getDependency("bufferView",s).then(function(m){return new Promise(function(u,g){r.decodeDracoFile(m,function(v){for(const w in v.attributes){const T=v.attributes[w],M=d[w];M!==void 0&&(T.normalized=M)}u(v)},l,h,Sn,g)})})}}class XB{constructor(){this.name=It.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class YB{constructor(){this.name=It.KHR_MESH_QUANTIZATION}}class oT extends qc{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let a=0;a!==r;a++)t[a]=i[s+a];return t}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=l*2,h=l*3,m=r-t,u=(i-t)/m,g=u*u,v=g*u,w=e*h,T=w-h,M=-2*v+3*g,b=v-g,A=1-M,E=b-g+u;for(let P=0;P!==l;P++){const G=a[T+P+l],O=a[T+P+d]*m,B=a[w+P+l],F=a[w+P]*m;s[P]=A*G+E*O+M*B+b*F}return s}}const $B=new Gn;class qB extends oT{interpolate_(e,t,i,r){const s=super.interpolate_(e,t,i,r);return $B.fromArray(s).normalize().toArray(s),s}}const ir={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Go={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},MS={9728:Fn,9729:ln,9984:cE,9985:Rd,9986:ql,9987:Er},ES={33071:ti,33648:dh,10497:Vr},Ap={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},mg={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"},Ps={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},KB={CUBICSPLINE:void 0,LINEAR:Ic,STEP:Lc},Cp={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function ZB(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new na({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:gs})),n.DefaultMaterial}function fa(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function is(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function QB(n,e,t){let i=!1,r=!1,s=!1;for(let h=0,m=e.length;h<m;h++){const u=e[h];if(u.POSITION!==void 0&&(i=!0),u.NORMAL!==void 0&&(r=!0),u.COLOR_0!==void 0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(n);const a=[],l=[],d=[];for(let h=0,m=e.length;h<m;h++){const u=e[h];if(i){const g=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):n.attributes.position;a.push(g)}if(r){const g=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):n.attributes.normal;l.push(g)}if(s){const g=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):n.attributes.color;d.push(g)}}return Promise.all([Promise.all(a),Promise.all(l),Promise.all(d)]).then(function(h){const m=h[0],u=h[1],g=h[2];return i&&(n.morphAttributes.position=m),r&&(n.morphAttributes.normal=u),s&&(n.morphAttributes.color=g),n.morphTargetsRelative=!0,n})}function JB(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function e4(n){let e;const t=n.extensions&&n.extensions[It.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Rp(t.attributes):e=n.indices+":"+Rp(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+Rp(n.targets[i]);return e}function Rp(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function gg(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function t4(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const n4=new ot;class i4{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new EB,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 i=!1,r=-1,s=!1,a=-1;if(typeof navigator<"u"){const l=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(l)===!0;const d=l.match(/Version\/(\d+)/);r=i&&d?parseInt(d[1],10):-1,s=l.indexOf("Firefox")>-1,a=s?l.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||s&&a<98?this.textureLoader=new Xh(this.options.manager):this.textureLoader=new IN(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new _s(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(a){const l={scene:a[0][r.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:r.asset,parser:i,userData:{}};return fa(s,l,r),is(l,r),Promise.all(i._invokeAll(function(d){return d.afterRoot&&d.afterRoot(l)})).then(function(){for(const d of l.scenes)d.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const a=t[r].joints;for(let l=0,d=a.length;l<d;l++)e[a[l]].isBone=!0}for(let r=0,s=e.length;r<s;r++){const a=e[r];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(i[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),s=(a,l)=>{const d=this.associations.get(a);d!=null&&this.associations.set(l,d);for(const[h,m]of a.children.entries())s(m,l.children[h])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const s=e(t[r]);s&&i.push(s)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,a){return i.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[It.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,a){i.load(Ho.resolveURL(t.uri,r.path),s,void 0,function(){a(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(i){const r=t.byteLength||0,s=t.byteOffset||0;return i.slice(s,s+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const a=Ap[r.type],l=Go[r.componentType],d=r.normalized===!0,h=new l(r.count*a);return Promise.resolve(new _n(h,a,d))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(a){const l=a[0],d=Ap[r.type],h=Go[r.componentType],m=h.BYTES_PER_ELEMENT,u=m*d,g=r.byteOffset||0,v=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,w=r.normalized===!0;let T,M;if(v&&v!==u){const b=Math.floor(g/v),A="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+b+":"+r.count;let E=t.cache.get(A);E||(T=new h(l,b*v,r.count*v/m),E=new jO(T,v/m),t.cache.add(A,E)),M=new L_(E,d,g%v/m,w)}else l===null?T=new h(r.count*d):T=new h(l,g,r.count*d),M=new _n(T,d,w);if(r.sparse!==void 0){const b=Ap.SCALAR,A=Go[r.sparse.indices.componentType],E=r.sparse.indices.byteOffset||0,P=r.sparse.values.byteOffset||0,G=new A(a[1],E,r.sparse.count*b),O=new h(a[2],P,r.sparse.count*d);l!==null&&(M=new _n(M.array.slice(),M.itemSize,M.normalized));for(let B=0,F=G.length;B<F;B++){const D=G[B];if(M.setX(D,O[B*d]),d>=2&&M.setY(D,O[B*d+1]),d>=3&&M.setZ(D,O[B*d+2]),d>=4&&M.setW(D,O[B*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return M})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,a=t.images[s];let l=this.textureLoader;if(a.uri){const d=i.manager.getHandler(a.uri);d!==null&&(l=d)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,i){const r=this,s=this.json,a=s.textures[e],l=s.images[t],d=(l.uri||l.bufferView)+":"+a.sampler;if(this.textureCache[d])return this.textureCache[d];const h=this.loadImageSource(t,i).then(function(m){m.flipY=!1,m.name=a.name||l.name||"",m.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(m.name=l.uri);const g=(s.samplers||{})[a.sampler]||{};return m.magFilter=MS[g.magFilter]||ln,m.minFilter=MS[g.minFilter]||Er,m.wrapS=ES[g.wrapS]||Vr,m.wrapT=ES[g.wrapT]||Vr,r.associations.set(m,{textures:e}),m}).catch(function(){return null});return this.textureCache[d]=h,h}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=r.images[e],l=self.URL||self.webkitURL;let d=a.uri||"",h=!1;if(a.bufferView!==void 0)d=i.getDependency("bufferView",a.bufferView).then(function(u){h=!0;const g=new Blob([u],{type:a.mimeType});return d=l.createObjectURL(g),d});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const m=Promise.resolve(d).then(function(u){return new Promise(function(g,v){let w=g;t.isImageBitmapLoader===!0&&(w=function(T){const M=new qn(T);M.needsUpdate=!0,g(M)}),t.load(Ho.resolveURL(u,s.path),w,void 0,v)})}).then(function(u){return h===!0&&l.revokeObjectURL(d),is(u,a),u.userData.mimeType=a.mimeType||t4(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",d),u});return this.sourceCache[e]=m,m}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(a){if(!a)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(a=a.clone(),a.channel=i.texCoord),s.extensions[It.KHR_TEXTURE_TRANSFORM]){const l=i.extensions!==void 0?i.extensions[It.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const d=s.associations.get(a);a=s.extensions[It.KHR_TEXTURE_TRANSFORM].extendTexture(a,l),s.associations.set(a,d)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+i.uuid;let d=this.cache.get(l);d||(d=new Ao,_i.prototype.copy.call(d,i),d.color.copy(i.color),d.map=i.map,d.sizeAttenuation=!1,this.cache.add(l,d)),i=d}else if(e.isLine){const l="LineBasicMaterial:"+i.uuid;let d=this.cache.get(l);d||(d=new Aa,_i.prototype.copy.call(d,i),d.color.copy(i.color),d.map=i.map,this.cache.add(l,d)),i=d}if(r||s||a){let l="ClonedMaterial:"+i.uuid+":";r&&(l+="derivative-tangents:"),s&&(l+="vertex-colors:"),a&&(l+="flat-shading:");let d=this.cache.get(l);d||(d=i.clone(),s&&(d.vertexColors=!0),a&&(d.flatShading=!0),r&&(d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(l,d),this.associations.set(d,this.associations.get(i))),i=d}e.material=i}getMaterialType(){return na}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let a;const l={},d=s.extensions||{},h=[];if(d[It.KHR_MATERIALS_UNLIT]){const u=r[It.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),h.push(u.extendParams(l,s,t))}else{const u=s.pbrMetallicRoughness||{};if(l.color=new Je(1,1,1),l.opacity=1,Array.isArray(u.baseColorFactor)){const g=u.baseColorFactor;l.color.setRGB(g[0],g[1],g[2],Sn),l.opacity=g[3]}u.baseColorTexture!==void 0&&h.push(t.assignTexture(l,"map",u.baseColorTexture,on)),l.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,l.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(l,"metalnessMap",u.metallicRoughnessTexture)),h.push(t.assignTexture(l,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(g){return g.getMaterialType&&g.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(g){return g.extendMaterialParams&&g.extendMaterialParams(e,l)})))}s.doubleSided===!0&&(l.side=Si);const m=s.alphaMode||Cp.OPAQUE;if(m===Cp.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,m===Cp.MASK&&(l.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==Or&&(h.push(t.assignTexture(l,"normalMap",s.normalTexture)),l.normalScale=new et(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;l.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&a!==Or&&(h.push(t.assignTexture(l,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==Or){const u=s.emissiveFactor;l.emissive=new Je().setRGB(u[0],u[1],u[2],Sn)}return s.emissiveTexture!==void 0&&a!==Or&&h.push(t.assignTexture(l,"emissiveMap",s.emissiveTexture,on)),Promise.all(h).then(function(){const u=new a(l);return s.name&&(u.name=s.name),is(u,s),t.associations.set(u,{materials:e}),s.extensions&&fa(r,u,s),u})}createUniqueName(e){const t=Yt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(l){return i[It.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(d){return TS(d,l,t)})}const a=[];for(let l=0,d=e.length;l<d;l++){const h=e[l],m=e4(h),u=r[m];if(u)a.push(u.promise);else{let g;h.extensions&&h.extensions[It.KHR_DRACO_MESH_COMPRESSION]?g=s(h):g=TS(new On,h,t),r[m]={primitive:h,promise:g},a.push(g)}}return Promise.all(a)}loadMesh(e){const t=this,i=this.json,r=this.extensions,s=i.meshes[e],a=s.primitives,l=[];for(let d=0,h=a.length;d<h;d++){const m=a[d].material===void 0?ZB(this.cache):this.getDependency("material",a[d].material);l.push(m)}return l.push(t.loadGeometries(a)),Promise.all(l).then(function(d){const h=d.slice(0,d.length-1),m=d[d.length-1],u=[];for(let v=0,w=m.length;v<w;v++){const T=m[v],M=a[v];let b;const A=h[v];if(M.mode===ir.TRIANGLES||M.mode===ir.TRIANGLE_STRIP||M.mode===ir.TRIANGLE_FAN||M.mode===void 0)b=s.isSkinnedMesh===!0?new NE(T,A):new wn(T,A),b.isSkinnedMesh===!0&&b.normalizeSkinWeights(),M.mode===ir.TRIANGLE_STRIP?b.geometry=wS(b.geometry,yE):M.mode===ir.TRIANGLE_FAN&&(b.geometry=wS(b.geometry,sg));else if(M.mode===ir.LINES)b=new bh(T,A);else if(M.mode===ir.LINE_STRIP)b=new Wh(T,A);else if(M.mode===ir.LINE_LOOP)b=new KO(T,A);else if(M.mode===ir.POINTS)b=new Ud(T,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+M.mode);Object.keys(b.geometry.morphAttributes).length>0&&JB(b,s),b.name=t.createUniqueName(s.name||"mesh_"+e),is(b,s),M.extensions&&fa(r,b,M),t.assignFinalMaterial(b),u.push(b)}for(let v=0,w=u.length;v<w;v++)t.associations.set(u[v],{meshes:e,primitives:v});if(u.length===1)return s.extensions&&fa(r,u[0],s),u[0];const g=new Nr;s.extensions&&fa(r,g,s),t.associations.set(g,{meshes:e});for(let v=0,w=u.length;v<w;v++)g.add(u[v]);return g})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new mi(bn.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new dl(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),is(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,s=t.joints.length;r<s;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){const s=r.pop(),a=r,l=[],d=[];for(let h=0,m=a.length;h<m;h++){const u=a[h];if(u){l.push(u);const g=new ot;s!==null&&g.fromArray(s.array,h*16),d.push(g)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new Vh(l,d)})}loadAnimation(e){const t=this.json,i=this,r=t.animations[e],s=r.name?r.name:"animation_"+e,a=[],l=[],d=[],h=[],m=[];for(let u=0,g=r.channels.length;u<g;u++){const v=r.channels[u],w=r.samplers[v.sampler],T=v.target,M=T.node,b=r.parameters!==void 0?r.parameters[w.input]:w.input,A=r.parameters!==void 0?r.parameters[w.output]:w.output;T.node!==void 0&&(a.push(this.getDependency("node",M)),l.push(this.getDependency("accessor",b)),d.push(this.getDependency("accessor",A)),h.push(w),m.push(T))}return Promise.all([Promise.all(a),Promise.all(l),Promise.all(d),Promise.all(h),Promise.all(m)]).then(function(u){const g=u[0],v=u[1],w=u[2],T=u[3],M=u[4],b=[];for(let A=0,E=g.length;A<E;A++){const P=g[A],G=v[A],O=w[A],B=T[A],F=M[A];if(P===void 0)continue;P.updateMatrix&&P.updateMatrix();const D=i._createAnimationTracks(P,G,O,B,F);if(D)for(let L=0;L<D.length;L++)b.push(D[L])}return new WE(s,void 0,b)})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(s){const a=i._getNodeRef(i.meshCache,r.mesh,s);return r.weights!==void 0&&a.traverse(function(l){if(l.isMesh)for(let d=0,h=r.weights.length;d<h;d++)l.morphTargetInfluences[d]=r.weights[d]}),a})}loadNode(e){const t=this.json,i=this,r=t.nodes[e],s=i._loadNodeShallow(e),a=[],l=r.children||[];for(let h=0,m=l.length;h<m;h++)a.push(i.getDependency("node",l[h]));const d=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([s,Promise.all(a),d]).then(function(h){const m=h[0],u=h[1],g=h[2];g!==null&&m.traverse(function(v){v.isSkinnedMesh&&v.bind(g,n4)});for(let v=0,w=u.length;v<w;v++)m.add(u[v]);return m})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],a=s.name?r.createUniqueName(s.name):"",l=[],d=r._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return d&&l.push(d),s.camera!==void 0&&l.push(r.getDependency("camera",s.camera).then(function(h){return r._getNodeRef(r.cameraCache,s.camera,h)})),r._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){l.push(h)}),this.nodeCache[e]=Promise.all(l).then(function(h){let m;if(s.isBone===!0?m=new _h:h.length>1?m=new Nr:h.length===1?m=h[0]:m=new sn,m!==h[0])for(let u=0,g=h.length;u<g;u++)m.add(h[u]);if(s.name&&(m.userData.name=s.name,m.name=a),is(m,s),s.extensions&&fa(i,m,s),s.matrix!==void 0){const u=new ot;u.fromArray(s.matrix),m.applyMatrix4(u)}else s.translation!==void 0&&m.position.fromArray(s.translation),s.rotation!==void 0&&m.quaternion.fromArray(s.rotation),s.scale!==void 0&&m.scale.fromArray(s.scale);return r.associations.has(m)||r.associations.set(m,{}),r.associations.get(m).nodes=e,m}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,s=new Nr;i.name&&(s.name=r.createUniqueName(i.name)),is(s,i),i.extensions&&fa(t,s,i);const a=i.nodes||[],l=[];for(let d=0,h=a.length;d<h;d++)l.push(r.getDependency("node",a[d]));return Promise.all(l).then(function(d){for(let m=0,u=d.length;m<u;m++)s.add(d[m]);const h=m=>{const u=new Map;for(const[g,v]of r.associations)(g instanceof _i||g instanceof qn)&&u.set(g,v);return m.traverse(g=>{const v=r.associations.get(g);v!=null&&u.set(g,v)}),u};return r.associations=h(s),s})}_createAnimationTracks(e,t,i,r,s){const a=[],l=e.name?e.name:e.uuid,d=[];Ps[s.path]===Ps.weights?e.traverse(function(g){g.morphTargetInfluences&&d.push(g.name?g.name:g.uuid)}):d.push(l);let h;switch(Ps[s.path]){case Ps.weights:h=Fa;break;case Ps.rotation:h=Qs;break;case Ps.position:case Ps.scale:h=Ua;break;default:switch(i.itemSize){case 1:h=Fa;break;case 2:case 3:default:h=Ua;break}break}const m=r.interpolation!==void 0?KB[r.interpolation]:Ic,u=this._getArrayFromAccessor(i);for(let g=0,v=d.length;g<v;g++){const w=new h(d[g]+"."+Ps[s.path],t.array,u,m);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(w),a.push(w)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=gg(t.constructor),r=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)r[s]=t[s]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const r=this instanceof Qs?qB:oT;return new r(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function r4(n,e,t){const i=e.attributes,r=new Pr;if(i.POSITION!==void 0){const l=t.json.accessors[i.POSITION],d=l.min,h=l.max;if(d!==void 0&&h!==void 0){if(r.set(new j(d[0],d[1],d[2]),new j(h[0],h[1],h[2])),l.normalized){const m=gg(Go[l.componentType]);r.min.multiplyScalar(m),r.max.multiplyScalar(m)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const l=new j,d=new j;for(let h=0,m=s.length;h<m;h++){const u=s[h];if(u.POSITION!==void 0){const g=t.json.accessors[u.POSITION],v=g.min,w=g.max;if(v!==void 0&&w!==void 0){if(d.setX(Math.max(Math.abs(v[0]),Math.abs(w[0]))),d.setY(Math.max(Math.abs(v[1]),Math.abs(w[1]))),d.setZ(Math.max(Math.abs(v[2]),Math.abs(w[2]))),g.normalized){const T=gg(Go[g.componentType]);d.multiplyScalar(T)}l.max(d)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(l)}n.boundingBox=r;const a=new Wr;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=a}function TS(n,e,t){const i=e.attributes,r=[];function s(a,l){return t.getDependency("accessor",a).then(function(d){n.setAttribute(l,d)})}for(const a in i){const l=mg[a]||a.toLowerCase();l in n.attributes||r.push(s(i[a],l))}if(e.indices!==void 0&&!n.index){const a=t.getDependency("accessor",e.indices).then(function(l){n.setIndex(l)});r.push(a)}return Kt.workingColorSpace!==Sn&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Kt.workingColorSpace}" not supported.`),is(n,e),r4(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?QB(n,e.targets,t):n})}const Pp=new WeakMap;class z_ extends Hi{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,i,r){const s=new _s(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,a=>{this.parse(a,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,on,i).catch(i)}decodeDracoFile(e,t,i,r,s=Sn,a=()=>{}){const l={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:s};return this.decodeGeometry(e,l).then(t).catch(a)}decodeGeometry(e,t){const i=JSON.stringify(t);if(Pp.has(e)){const d=Pp.get(e);if(d.key===i)return d.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,a=e.byteLength,l=this._getWorker(s,a).then(d=>(r=d,new Promise((h,m)=>{r._callbacks[s]={resolve:h,reject:m},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(d=>this._createGeometry(d.geometry));return l.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),Pp.set(e,{key:i,promise:l}),l}_createGeometry(e){const t=new On;e.index&&t.setIndex(new _n(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const r=e.attributes[i],s=r.name,a=r.array,l=r.itemSize,d=new _n(a,l);s==="color"&&(this._assignVertexColorSpace(d,r.vertexColorSpace),d.normalized=!(a instanceof Float32Array)),t.setAttribute(s,d)}return t}_assignVertexColorSpace(e,t){if(t!==on)return;const i=new Je;for(let r=0,s=e.count;r<s;r++)i.fromBufferAttribute(e,r).convertSRGBToLinear(),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){const i=new _s(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,s)=>{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",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(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=s4.toString(),a=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){const a=s.data;switch(a.type){case"decode":r._callbacks[a.id].resolve(a);break;case"error":r._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_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 s4(){let n,e;onmessage=function(a){const l=a.data;switch(l.type){case"init":n=l.decoderConfig,e=new Promise(function(m){n.onModuleLoaded=function(u){m({draco:u})},DracoDecoderModule(n)});break;case"decode":const d=l.buffer,h=l.taskConfig;e.then(m=>{const u=m.draco,g=new u.Decoder;try{const v=t(u,g,new Int8Array(d),h),w=v.attributes.map(T=>T.array.buffer);v.index&&w.push(v.index.array.buffer),self.postMessage({type:"decode",id:l.id,geometry:v},w)}catch(v){console.error(v),self.postMessage({type:"error",id:l.id,error:v.message})}finally{u.destroy(g)}});break}};function t(a,l,d,h){const m=h.attributeIDs,u=h.attributeTypes;let g,v;const w=l.GetEncodedGeometryType(d);if(w===a.TRIANGULAR_MESH)g=new a.Mesh,v=l.DecodeArrayToMesh(d,d.byteLength,g);else if(w===a.POINT_CLOUD)g=new a.PointCloud,v=l.DecodeArrayToPointCloud(d,d.byteLength,g);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!v.ok()||g.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());const T={index:null,attributes:[]};for(const M in m){const b=self[u[M]];let A,E;if(h.useUniqueIDs)E=m[M],A=l.GetAttributeByUniqueId(g,E);else{if(E=l.GetAttributeId(g,a[m[M]]),E===-1)continue;A=l.GetAttribute(g,E)}const P=r(a,l,g,M,b,A);M==="color"&&(P.vertexColorSpace=h.vertexColorSpace),T.attributes.push(P)}return w===a.TRIANGULAR_MESH&&(T.index=i(a,l,g)),a.destroy(g),T}function i(a,l,d){const m=d.num_faces()*3,u=m*4,g=a._malloc(u);l.GetTrianglesUInt32Array(d,u,g);const v=new Uint32Array(a.HEAPF32.buffer,g,m).slice();return a._free(g),{array:v,itemSize:1}}function r(a,l,d,h,m,u){const g=u.num_components(),w=d.num_points()*g,T=w*m.BYTES_PER_ELEMENT,M=s(a,m),b=a._malloc(T);l.GetAttributeDataArrayForAllPoints(d,u,M,T,b);const A=new m(a.HEAPF32.buffer,b,w).slice();return a._free(b),{name:h,array:A,itemSize:g}}function s(a,l){switch(l){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}var H_=function(){var n="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",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",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var r=WebAssembly.validate(t)?e:n,s,a=WebAssembly.instantiate(l(r),{}).then(function(b){s=b.instance,s.exports.__wasm_call_ctors()});function l(b){for(var A=new Uint8Array(b.length),E=0;E<b.length;++E){var P=b.charCodeAt(E);A[E]=P>96?P-97:P>64?P-39:P+4}for(var G=0,E=0;E<b.length;++E)A[G++]=A[E]<60?i[A[E]]:(A[E]-60)*64+A[++E];return A.buffer.slice(0,G)}function d(b,A,E,P,G,O){var B=s.exports.sbrk,F=E+3&-4,D=B(F*P),L=B(G.length),V=new Uint8Array(s.exports.memory.buffer);V.set(G,L);var ie=b(D,E,P,L,G.length);if(ie==0&&O&&O(D,F,P),A.set(V.subarray(D,D+E*P)),B(D-B(0)),ie!=0)throw new Error("Malformed buffer data: "+ie)}var h={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},m={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],g=0;function v(b){var A={object:new Worker(b),pending:0,requests:{}};return A.object.onmessage=function(E){var P=E.data;A.pending-=P.count,A.requests[P.id][P.action](P.value),delete A.requests[P.id]},A}function w(b){for(var A="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(l(r))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+d.toString()+M.toString(),E=new Blob([A],{type:"text/javascript"}),P=URL.createObjectURL(E),G=0;G<b;++G)u[G]=v(P);URL.revokeObjectURL(P)}function T(b,A,E,P,G){for(var O=u[0],B=1;B<u.length;++B)u[B].pending<O.pending&&(O=u[B]);return new Promise(function(F,D){var L=new Uint8Array(E),V=g++;O.pending+=b,O.requests[V]={resolve:F,reject:D},O.object.postMessage({id:V,count:b,size:A,source:L,mode:P,filter:G},[L.buffer])})}function M(b){a.then(function(){var A=b.data;try{var E=new Uint8Array(A.count*A.size);d(s.exports[A.mode],E,A.count,A.size,A.source,s.exports[A.filter]),self.postMessage({id:A.id,count:A.count,action:"resolve",value:E},[E.buffer])}catch(P){self.postMessage({id:A.id,count:A.count,action:"reject",value:P})}})}return{ready:a,supported:!0,useWorkers:function(b){w(b)},decodeVertexBuffer:function(b,A,E,P,G){d(s.exports.meshopt_decodeVertexBuffer,b,A,E,P,s.exports[h[G]])},decodeIndexBuffer:function(b,A,E,P){d(s.exports.meshopt_decodeIndexBuffer,b,A,E,P)},decodeIndexSequence:function(b,A,E,P){d(s.exports.meshopt_decodeIndexSequence,b,A,E,P)},decodeGltfBuffer:function(b,A,E,P,G,O){d(s.exports[m[G]],b,A,E,P,s.exports[h[O]])},decodeGltfBufferAsync:function(b,A,E,P,G){return u.length>0?T(b,A,E,m[P],h[G]):a.then(function(){var O=new Uint8Array(b*A);return d(s.exports[m[P]],O,b,A,E,s.exports[h[G]]),O})}}}();class a4 extends D_{constructor(e){super(e),this.type=gi}parse(e){const a=function(F,D){switch(F){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(D||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(D||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(D||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(D||""))}},m=`
`,u=function(F,D,L){D=D||1024;let ie=F.pos,re=-1,de=0,me="",$=String.fromCharCode.apply(null,new Uint16Array(F.subarray(ie,ie+128)));for(;0>(re=$.indexOf(m))&&de<D&&ie<F.byteLength;)me+=$,de+=$.length,ie+=128,$+=String.fromCharCode.apply(null,new Uint16Array(F.subarray(ie,ie+128)));return-1<re?(F.pos+=de+re+1,me+$.slice(0,re)):!1},g=function(F){const D=/^#\?(\S+)/,L=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,V=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,ie=/^\s*FORMAT=(\S+)\s*$/,re=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,de={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let me,$;for((F.pos>=F.byteLength||!(me=u(F)))&&a(1,"no header found"),($=me.match(D))||a(3,"bad initial token"),de.valid|=1,de.programtype=$[1],de.string+=me+`
`;me=u(F),me!==!1;){if(de.string+=me+`
`,me.charAt(0)==="#"){de.comments+=me+`
`;continue}if(($=me.match(L))&&(de.gamma=parseFloat($[1])),($=me.match(V))&&(de.exposure=parseFloat($[1])),($=me.match(ie))&&(de.valid|=2,de.format=$[1]),($=me.match(re))&&(de.valid|=4,de.height=parseInt($[1],10),de.width=parseInt($[2],10)),de.valid&2&&de.valid&4)break}return de.valid&2||a(3,"missing format specifier"),de.valid&4||a(3,"missing image size specifier"),de},v=function(F,D,L){const V=D;if(V<8||V>32767||F[0]!==2||F[1]!==2||F[2]&128)return new Uint8Array(F);V!==(F[2]<<8|F[3])&&a(3,"wrong scanline width");const ie=new Uint8Array(4*D*L);ie.length||a(4,"unable to allocate buffer space");let re=0,de=0;const me=4*V,$=new Uint8Array(4),ue=new Uint8Array(me);let Y=L;for(;Y>0&&de<F.byteLength;){de+4>F.byteLength&&a(1),$[0]=F[de++],$[1]=F[de++],$[2]=F[de++],$[3]=F[de++],($[0]!=2||$[1]!=2||($[2]<<8|$[3])!=V)&&a(3,"bad rgbe scanline format");let pe=0,_e;for(;pe<me&&de<F.byteLength;){_e=F[de++];const Pe=_e>128;if(Pe&&(_e-=128),(_e===0||pe+_e>me)&&a(3,"bad scanline data"),Pe){const Ue=F[de++];for(let ae=0;ae<_e;ae++)ue[pe++]=Ue}else ue.set(F.subarray(de,de+_e),pe),pe+=_e,de+=_e}const Ae=V;for(let Pe=0;Pe<Ae;Pe++){let Ue=0;ie[re]=ue[Pe+Ue],Ue+=V,ie[re+1]=ue[Pe+Ue],Ue+=V,ie[re+2]=ue[Pe+Ue],Ue+=V,ie[re+3]=ue[Pe+Ue],re+=4}Y--}return ie},w=function(F,D,L,V){const ie=F[D+3],re=Math.pow(2,ie-128)/255;L[V+0]=F[D+0]*re,L[V+1]=F[D+1]*re,L[V+2]=F[D+2]*re,L[V+3]=1},T=function(F,D,L,V){const ie=F[D+3],re=Math.pow(2,ie-128)/255;L[V+0]=Eo.toHalfFloat(Math.min(F[D+0]*re,65504)),L[V+1]=Eo.toHalfFloat(Math.min(F[D+1]*re,65504)),L[V+2]=Eo.toHalfFloat(Math.min(F[D+2]*re,65504)),L[V+3]=Eo.toHalfFloat(1)},M=new Uint8Array(e);M.pos=0;const b=g(M),A=b.width,E=b.height,P=v(M.subarray(M.pos),A,E);let G,O,B;switch(this.type){case Un:B=P.length/4;const F=new Float32Array(B*4);for(let L=0;L<B;L++)w(P,L*4,F,L*4);G=F,O=Un;break;case gi:B=P.length/4;const D=new Uint16Array(B*4);for(let L=0;L<B;L++)T(P,L*4,D,L*4);G=D,O=gi;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:A,height:E,data:G,header:b.string,gamma:b.gamma,exposure:b.exposure,type:O}}setDataType(e){return this.type=e,this}load(e,t,i,r){function s(a,l){switch(a.type){case Un:case gi:a.colorSpace=Sn,a.minFilter=ln,a.magFilter=ln,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,l)}return super.load(e,s,i,r)}}class G_{_removeEvent(e,t,i){return t>-1&&(e.splice(t,1),e.length===0&&delete this._events[i]),this}clear(){return this._events={},this}has(e){return!!this._events[e]}on(e,t,i,r=!1){let s=this._events[e];if(s==null&&(s=this._events[e]=[]),s.findIndex(l=>l.callback===t&&(!i||l.target===i))>-1){console.warn(`event: ${e} duplicate registered`);return}return s.push({name:e,callback:t,target:i,once:r}),this}off(e,t,i){let r=this._events[e];if(r){let s=r.findIndex(a=>a.callback===t&&(!i||a.target===i));this._removeEvent(r,s,e)}return this}onof(e,t,i){return i._listeners===void 0&&(i._listeners=[]),i._listeners.push({name:e,callback:t}),this.on(e,t),this}offof(e){for(let t of e._listeners)this.off(t.name,t.callback);return this}targetOff(e){for(let t in this._events){let i=this._events[t];for(let r=i.length;r--;)i[r].target===e&&this._removeEvent(i,r,t)}return this}emit(e,...t){let i=this._events[e];if(i)for(let r=i.length;r--;){let s=i[r];s&&(s.once&&this._removeEvent(i,r,e),s.target?s.callback.apply(s.target,t):s.callback(...t))}return this}constructor(){this._events={}}}console.log.bind(console);console.info.bind(console);console.warn.bind(console);console.error.bind(console);function lT(n,e=[]){return typeof n=="function"?new n(...e):n}const Br=Object.freeze({Linear:Object.freeze({None(n){return n},In(n){return n},Out(n){return n},InOut(n){return n}}),Quadratic:Object.freeze({In(n){return n*n},Out(n){return n*(2-n)},InOut(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}}),Cubic:Object.freeze({In(n){return n*n*n},Out(n){return--n*n*n+1},InOut(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}}),Quartic:Object.freeze({In(n){return n*n*n*n},Out(n){return 1- --n*n*n*n},InOut(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}}),Quintic:Object.freeze({In(n){return n*n*n*n*n},Out(n){return--n*n*n*n*n+1},InOut(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}}),Sinusoidal:Object.freeze({In(n){return 1-Math.sin((1-n)*Math.PI/2)},Out(n){return Math.sin(n*Math.PI/2)},InOut(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}}),Exponential:Object.freeze({In(n){return n===0?0:Math.pow(1024,n-1)},Out(n){return n===1?1:1-Math.pow(2,-10*n)},InOut(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}}),Circular:Object.freeze({In(n){return 1-Math.sqrt(1-n*n)},Out(n){return Math.sqrt(1- --n*n)},InOut(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}}),Elastic:Object.freeze({In(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In(n){return n===1?1:n*n*((1.70158+1)*n-1.70158)},Out(n){return n===0?0:--n*n*((1.70158+1)*n+1.70158)+1},InOut(n){const e=2.5949095;return(n*=2)<1?.5*(n*n*((e+1)*n-e)):.5*((n-=2)*n*((e+1)*n+e)+2)}}),Bounce:Object.freeze({In(n){return 1-Br.Bounce.Out(1-n)},Out(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut(n){return n<.5?Br.Bounce.In(n*2)*.5:Br.Bounce.Out(n*2-1)*.5+.5}}),generatePow(n=4){return n=n<Number.EPSILON?Number.EPSILON:n,n=n>1e4?1e4:n,{In(e){return e**n},Out(e){return 1-(1-e)**n},InOut(e){return e<.5?(e*2)**n/2:(1-(2-e*2)**n)/2+.5}}}}),Po={Linear:function(n,e){const t=n.length-1,i=t*e,r=Math.floor(i),s=Po.Utils.Linear;return e<0?s(n[0],n[1],i):e>1?s(n[t],n[t-1],t-i):s(n[r],n[r+1>t?t:r+1],i-r)},Bezier:function(n,e){let t=0;const i=n.length-1,r=Math.pow,s=Po.Utils.Bernstein;for(let a=0;a<=i;a++)t+=r(1-e,i-a)*r(e,a)*n[a]*s(i,a);return t},CatmullRom:function(n,e){const t=n.length-1;let i=t*e,r=Math.floor(i);const s=Po.Utils.CatmullRom;return n[0]===n[t]?(e<0&&(r=Math.floor(i=t*(1+e))),s(n[(r-1+t)%t],n[r],n[(r+1)%t],n[(r+2)%t],i-r)):e<0?n[0]-(s(n[0],n[0],n[1],n[1],-i)-n[0]):e>1?n[t]-(s(n[t],n[t],n[t-1],n[t-1],i-t)-n[t]):s(n[r?r-1:0],n[r],n[t<r+1?t:r+1],n[t<r+2?t:r+2],i-r)},Utils:{Linear:function(n,e,t){return(e-n)*t+n},Bernstein:function(n,e){const t=Po.Utils.Factorial;return t(n)/t(e)/t(n-e)},Factorial:function(){const n=[1];return function(e){let t=1;if(n[e])return n[e];for(let i=e;i>1;i--)t*=i;return n[e]=t,t}}(),CatmullRom:function(n,e,t,i,r){const s=(t-n)*.5,a=(i-e)*.5,l=r*r,d=r*l;return(2*e-2*t+s+a)*d+(-3*e+3*t-2*s-a)*l+s*r+e}}},Ql=()=>performance.now()*.001;class cT{getAll(){return Object.keys(this._tweens).map(e=>this._tweens[e])}removeAll(){this._tweens={}}add(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e}remove(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]}update(e=Ql(),t=!1){let i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(let r=0;r<i.length;r++){const s=this._tweens[i[r]],a=!t;s&&s.update(e,a)===!1&&!t&&delete this._tweens[i[r]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0}constructor(){this._tweens={},this._tweensAddedDuringUpdate={}}}const AS=new cT;class $h{static nextId(){return $h._nextId++}}$h._nextId=0;class Lp{getId(){return this._id}isPlaying(){return this._isPlaying}isPaused(){return this._isPaused}getDuration(){return this._duration}from(e){return this._valuesStart=Object.create(e),this}to(e,t=1){if(this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this}duration(e=1){return this._duration=e<0?0:e,this}dynamic(e=!1){return this._isDynamic=e,this}start(e=Ql(),t=!1){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(const i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){const i={};for(const r in this._valuesEnd)i[r]=this._valuesEnd[r];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this}startFromCurrentValues(e){return this.start(e,!0)}_setupProperties(e,t,i,r,s){for(const a in i){const l=e[a],d=Array.isArray(l),h=d?"array":typeof l;let m=!d&&Array.isArray(i[a]);if(!(h==="undefined"||h==="function")){if(m){const u=i[a];if(u.length===0)continue;const g=[l];for(let v=0,w=u.length;v<w;v+=1){const T=this._handleRelativeValue(l,u[v]);if(isNaN(T)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(T)}m&&(i[a]=g)}if((h==="object"||d)&&l&&!m){t[a]=d?[]:{};const u=l;for(const v in u)t[a][v]=u[v];r[a]=d?[]:{};let g=i[a];if(!this._isDynamic){const v={};for(const w in g)v[w]=g[w];i[a]=g=v}this._setupProperties(u,t[a],g,r[a],s)}else(typeof t[a]>"u"||s)&&(t[a]=l),d||(t[a]*=1),m?r[a]=i[a].slice().reverse():r[a]=t[a]||0}}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this}end(){return this._goToEnd=!0,this.update(1/0),this}pause(e=Ql()){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)}resume(e=Ql()){return!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)}stopChainedTweens(){for(let e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this}group(e=AS){return this._group=e,this}call(e){return this._onFinishCallback=e,this}delay(e=0){return this._delayTime=e,this}union(e,t){return this._headTween=e,this._tailTween=t.chain(this),this}repeat(e=0){return this._initialRepeat=e,this._repeat=e,this}repeatDelay(e){return this._repeatDelayTime=e,this}yoyo(e=!1){return this._yoyo=e,this}easing(e=Br.Linear.None){return this._easingFunction=e,this}interpolation(e=Po.Linear){return this._interpolationFunction=e,this}chain(...e){return this._chainedTweens=e,this}unchain(...e){return e.forEach(t=>{let i=this._chainedTweens.findIndex(r=>r===t);i>-1&&this._chainedTweens.splice(i,1)}),this}onStart(e){return this._onStartCallback=e,this}onEveryStart(e){return this._onEveryStartCallback=e,this}onUpdate(e){return this._onUpdateCallback=e,this}onRepeat(e){return this._onRepeatCallback=e,this}onComplete(e){return this._onCompleteCallback=e,this}onStop(e){return this._onStopCallback=e,this}update(e=Ql(),t=!0){if(this._isPaused)return!0;const i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);const r=e-this._startTime;var s;const a=this._duration+((s=this._repeatDelayTime)!=null?s:this._delayTime),l=this._duration+this._repeat*a,d=this._calculateElapsedPortion(r,a,l),h=this._easingFunction(d);if(d===1&&(this._onFinishCallback&&this._onFinishCallback(this._object),this._headTween&&this._headTweenStartFired===!1))return this._headTweenStartFired=!0,this._headTween.start(this._startTime+this._duration),this._isPlaying=!1,!1;const m=this._calculateCompletionStatus(r,a);if(m==="repeat"&&this._processRepetition(r,a),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,h),m==="about-to-repeat"&&this._processRepetition(r,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),m==="repeat"||m==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._headTween&&(this._headTweenStartFired=!1,this._initialRepeat=this._repeat),this._onEveryStartCallbackFired=!1;else if(m==="completed"){this._isPlaying=!1,this._tailTween&&this._tailTween.unchain(this),this._onCompleteCallback&&this._onCompleteCallback(this._object);for(let u=0,g=this._chainedTweens.length;u<g;u++)this._chainedTweens[u].start(this._startTime+this._duration,!1)}return m!=="completed"}_calculateElapsedPortion(e,t,i){if(this._duration===0||e>i)return 1;const r=e%t,s=Math.min(r/this._duration,1);return s===0&&e!==0&&e%this._duration===0?1:s}_calculateCompletionStatus(e,t){return this._duration!==0&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"}_processRepetition(e,t){const i=Math.min(t>0?Math.trunc((e-this._duration)/t)+1:1,this._repeat);isFinite(this._repeat)&&(this._repeat-=i);for(const r in this._valuesStartRepeat){const s=this._valuesEnd[r];!this._yoyo&&typeof s=="string"&&(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(s)),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=t*i}_updateProperties(e,t,i,r){for(const s in i){if(t[s]===void 0)continue;const a=t[s]||0;let l=i[s];const d=Array.isArray(e[s]),h=Array.isArray(l);if(!d&&h)e[s]=this._interpolationFunction(l,r);else if(typeof l=="object"&&l){this._updateProperties(e[s],a,l,r);let u=Object.getOwnPropertyDescriptor(e,s);u&&u.set&&(e[s]=e[s])}else l=this._handleRelativeValue(a,l),typeof l=="number"&&(e[s]=a+(l-a)*r)}}_handleRelativeValue(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)}_swapEndStartRepeatValues(e){const t=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t}constructor(e,t=AS){this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=0,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Br.Linear.None,this._interpolationFunction=Po.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=$h.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._headTween=null,this._tailTween=null,this._headTweenStartFired=!1,this._goToEnd=!1}}class o4{start(){return this._tween.start(),this}stop(){return this._tween.stop(),this}repeat(e){return this._chainedTween.repeat(e),this}union(){return this._chainedTween=this._tween=new Lp(this._object,this._group).union(this._tween,this._chainedTween),this}call(e){return this._chainTween().call(e),this}delay(e){return this._chainTween().delay(e),this}to(e,t,i){let r=this._chainTween().to(e,t);return i&&(i.from&&r.from(i.from),i.easing&&r.easing(i.easing),i.onStart&&r.onStart(i.onStart),i.onStop&&r.onStop(i.onStop),i.onComplete&&r.onComplete(i.onComplete),i.onUpdate&&r.onUpdate(i.onUpdate),i.onRepeat&&r.onRepeat(i.onRepeat)),this}_chainTween(){let e=this._tween;return this._chainedTween&&(e=new Lp(this._object,this._group),this._chainedTween.chain(e)),this._chainedTween=e,e}constructor(e,t){this._object=e,this._group=t,this._tween=new Lp(e,t)}}class l4{destroy(){this._group.removeAll()}update(e){this._group.update(e)}timeline(e){return new o4(e,this._group)}killTweensOf(e){this._group.getAll().forEach(t=>t._object===e&&this._group.remove(t))}constructor(){this._group=new cT}}class Nn{static _setUserData(e){const t=Nn._texKeys,i=[],r={},s={},a=[e];for(;a.length!==0;){let l=a.shift();if(l.isMesh){i.push(l);const d=l.material;Array.isArray(d)?d.forEach(h=>s[h.uuid]=h):s[d.uuid]=d}a.push(...l.children)}return Object.values(s).forEach(l=>{t.forEach(d=>{let h=l[d];h&&(r[h.uuid]=h)})}),Object.assign(e.userData,{meshes:i,materials:s,textures:r}),e}constructor(e){this.manager=e}}Nn._texKeys=["map","alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","metalnessMap","normalMap","roughnessMap","specularMap","alphaMap"];class c4 extends Nn{load({url:e,path:t,resourcePath:i,manager:r,texSettings:s,onLoad:a,onProgress:l,onError:d}){let h=this._loader;h===void 0&&(h=this._loader=new eT),h.manager=r,h.setPath(t),h.setResourcePath(i),h.load(e,m=>a(Object.assign(m,s)),l,d)}constructor(...e){super(...e),this.extension=["exr"]}}class u4 extends Nn{load({url:e,buffer:t,path:i,resourcePath:r,manager:s,onLoad:a,onProgress:l,onError:d}){let h=this._loader;h===void 0&&(h=this._loader=new fB),h.manager=s,h.setPath(i),h.setResourcePath(r);const m=u=>{a(Nn._setUserData(u))};t?m(h.parse(t,r)):h.load(e,m,l,d)}constructor(...e){super(...e),this.extension=["fbx"]}}class d4 extends Nn{load({url:e,buffer:t,path:i,resourcePath:r,dracoPath:s,manager:a,onLoad:l,onProgress:d,onError:h}){let m=this._dracoLoader;m===void 0&&(m=this._dracoLoader=new z_),m.manager=a,m.setDecoderPath(s);let u=this._loader;u===void 0&&(u=this._loader=new B_,u.setDRACOLoader(m),u.setMeshoptDecoder(H_)),u.manager=a,u.setPath(i),u.setResourcePath(r);const g=v=>{const w=v.scene;w.animations.push(...v.animations),l(Nn._setUserData(w))};t?u.parse(t,r,g,h):u.load(e,g,d,h)}constructor(...e){super(...e),this.extension=["gltf","glb"]}}class h4 extends Nn{load({url:e,path:t,resourcePath:i,manager:r,texSettings:s,onLoad:a,onProgress:l,onError:d}){let h=this._loader;h===void 0&&(h=this._loader=new a4),h.manager=r,h.setPath(t),h.setResourcePath(i);const m=Object.assign({mapping:el},s);h.load(e,u=>a(Object.assign(u,m)),l,d)}constructor(...e){super(...e),this.extension=["hdr"]}}class f4 extends Nn{load({url:e,path:t,resourcePath:i,manager:r,onLoad:s,onProgress:a,onError:l}){let d=this._loader;d===void 0&&(d=this._loader=new _s),d.manager=r,d.setPath(t),d.setResourcePath(i),d.load(e,h=>s(JSON.parse(h)),a,l)}constructor(...e){super(...e),this.extension=["json"]}}class p4 extends Nn{load({url:e,path:t,resourcePath:i,manager:r,texSettings:s,onLoad:a,onProgress:l,onError:d}){let h=this._loader;h===void 0&&(h=this._loader=new Xh),h.manager=r,h.setPath(t),h.setResourcePath(i);const m=u=>{u.colorSpace=on,a(Object.assign(u,s))};h.load(e,m,l,d)}constructor(...e){super(...e),this.extension=["png","jpg","webp","avif"]}}function Et(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var l=n.length-1;l>=0;l--)(a=n[l])&&(s=(r<3?a(s):r>3?a(e,t,s):a(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s}class m4{property(e,t={}){return this._properties[e]=t,this}applyProperties(e){return Object.assign(e,this._properties),e}constructor(e){this.clsName=e,this._properties=Object.create(null)}}class Ii{static _hasProperties(e){return Ii._propertyMap.has(e)}static _getProperties(e,t=!0){let i=Ii._propertyMap.get(e);return i===void 0&&t&&(i=Object.create(null),Ii._propertyMap.set(e,i)),i}static _getMergedProperties(e){let t=null;for(;e!==Object.constructor.prototype;){let i=Ii._getProperties(e,!1);i&&(t===null&&(t=Object.create(null)),Object.assign(t,i)),e=Object.getPrototypeOf(e)}return t}static _getClassProperties(e,t=!0){let i=Ii._classMap.get(e);return i===void 0&&t&&(i=new m4(e),Ii._classMap.set(e,i)),i}static _applyClassProperties(e,t){let i=Ii._getClassProperties(e,!1);return i?i.applyProperties(Ii._getProperties(t)):Ii._getProperties(t,!1)}}Ii._classMap=new Map;Ii._propertyMap=new Map;function rt(n,e){let t=null;function i(r,s){Ii._getProperties(r.constructor)[s]=t}if(n===void 0)return rt({});if(typeof e>"u")return t=n,i;t={},i(n,e)}const uT={Linear:Br.Linear.None,QuadraticIn:Br.Quadratic.In,QuadraticOut:Br.Quadratic.Out,QuadraticInOut:Br.Quadratic.InOut};class V_{constructor(){this.style=uT.QuadraticInOut,this.time=4}}Et([rt({value:uT})],V_.prototype,"style",void 0);Et([rt],V_.prototype,"time",void 0);class Zc{constructor(){this.instanceId=Zc._instanceCount++,this.uuid=bn.generateUUID(),this.name="",this.type="ObjectInstance"}}Zc._instanceCount=0;class sl extends Zc{get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this.manager.componentScheduler.enableComponent(this,e))}_onPreDestroy(){this.unscheduleAll(),this.manager.removeComponent(this.node,this),this._enabled&&this.manager.componentScheduler.enableComponent(this,!1),this.onDestroy&&this.flags.OnLoadCalled&&this.onDestroy()}schedule(e,t,i=-1){this.manager.scheduler.schedule(this,e,t,i)}unshedule(e){this.manager.scheduler.unshedule(this,e)}unscheduleAll(){this.manager.scheduler.unscheduleAll(this)}destroy(){return this.flags.Destroyed?!1:(this.destroyImmediate(),!0)}destroyImmediate(){this._onPreDestroy&&this._onPreDestroy(),this.flags.Destroyed=!0}constructor(...e){super(...e),this._enabled=!0,this.type="Component",this.flags={}}}const{clamp:g4,lerp:_4}=bn;class dT extends sl{get vcam(){return this._vcam}get vcams(){return this._vcams}lastUpdate(e){let t=this.getActiveCamera();if(t!=null)if(this._vcams.forEach(i=>{i.locked||(i.enabled=i===t)}),this._lerpTime<this.brainBlend.time){this._lerpTime+=e;let i=g4(this._lerpTime/this.brainBlend.time,0,1);this._lerpToMainCamera(t,this.brainBlend.style(i))}else this._lerpToMainCamera(t,1)}activeCamera(e,t=4){this._vcamSolo!==e&&(this._vcamSolo=e,this._lerpTime=0,this.brainBlend.time=t)}addCamera(e){this._vcams.indexOf(e)===-1&&this._vcams.push(e)}removeCamera(e){let t=this._vcams.indexOf(e);t!==-1&&this._vcams.splice(t,1)}getActiveCamera(){return this._vcamSolo||this._vcams.filter(e=>e.enabled||e.locked).sort((e,t)=>t.priority-e.priority)[0]}_lerpToMainCamera(e,t){const i=this.node,r=e,{lens:s,finalPosition:a,finalRotation:l}=r,d=i.fov!=s.fov||i.near!=s.near||i.far!=s.far;i.position.lerp(a,t),i.quaternion.slerp(l,t),i.fov=_4(i.fov,s.fov,t),i.near=s.near,i.far=s.far,d&&i.updateProjectionMatrix()}constructor(...e){super(...e),this._vcam=null,this._vcamSolo=null,this._vcams=[],this._lerpTime=4,this.brainBlend=new V_}}Et([rt],dT.prototype,"brainBlend",void 0);class qh{constructor(){this.fov=45,this.near=.1,this.far=1e3}}Et([rt],qh.prototype,"fov",void 0);Et([rt],qh.prototype,"near",void 0);Et([rt],qh.prototype,"far",void 0);class W_ extends sl{get finalPosition(){return this._finalPosition.copy(this.node.position).add(this.correctPosition)}get finalRotation(){return this._finalRotation.copy(this.node.quaternion).multiply(this.correctRotation)}onLoad(){const e=this.viewer.camera;this.node.isCamera=!0,this.lens.fov=e.fov,this.lens.near=e.near,this.lens.far=e.far,this.brain=this.viewer.getComponent(e,dT,!0),this.brain.addCamera(this)}onDestroy(){this.brain.removeCamera(this)}constructor(...e){super(...e),this._finalPosition=new j,this._finalRotation=new Gn,this.locked=!1,this.priority=10,this.lens=new qh,this.correctPosition=new j,this.correctRotation=new Gn}}Et([rt],W_.prototype,"lens",void 0);const Ls={NONE:1,SELECTED:2,IN:4};class v4{connect(e){let t=this._connectors.find(i=>i.target===e);t===void 0&&(t={target:e,state:Ls.NONE},this._connectors.push(t))}disconnect(e){let t=this._connectors.findIndex(i=>i.target===e);t!==-1&&this._connectors.splice(t,1)}pointerDown(e,t){if(this._connectors.length!==0){this._raycaster.setFromCamera(e,t);for(let i of this._connectors)if(i.target.has("click")||i.target.has("pointerdown")){let r=this._raycaster.intersectObject(i.target.node,!0);r.length&&(i.state|=Ls.SELECTED,i.target.emit("pointerdown",{intersects:r}))}}}pointerUp(e,t){if(this._connectors.length!==0){this._raycaster.setFromCamera(e,t);for(let i of this._connectors)if(i.target.has("click")||i.target.has("pointerup")){let r=this._raycaster.intersectObject(i.target.node,!0);r.length&&(i.state&Ls.SELECTED&&(i.state&=~Ls.SELECTED,i.target.emit("click",{intersects:r})),i.target.emit("pointerup",{intersects:r}))}}}pointerMove(e,t){if(this._connectors.length!==0){this._raycaster.setFromCamera(e,t);for(let i of this._connectors)if(i.target.has("pointerover")||i.target.has("pointerout")){let r=this._raycaster.intersectObject(i.target.node,!0);r.length?i.state&Ls.IN||(i.state|=Ls.IN,i.target.emit("pointerover",{intersects:r})):i.state&Ls.IN&&(i.state&=~Ls.IN,i.target.emit("pointerout",{intersects:r}))}}}constructor(){this._raycaster=new GN,this._connectors=[]}}class mt{get pointerButton(){return this._pointerButton}get pointer(){return this._pointer}get pointerPosition(){return this._pointerPosition}get mouseWheel(){return this._mouseWheel}get touchCount(){return this._touchCount}get touches(){return this._touches}get keys(){return this._keys}addEventListeners(){const e=this.viewer.canvas;e.style.touchAction="none",this._addEventListener(e,"contextmenu",t=>t.preventDefault()),this._addEventListener(e,"pointerdown",t=>this._onPointerDown(t),{passive:!1}),this._addEventListener(e,"pointerup",t=>this._onPointerUp(t),{passive:!1}),this._addEventListener(e,"pointercancel",t=>this._onPointerUp(t),{passive:!1}),this._addEventListener(e,"pointerout",t=>this._onPointerUp(t),{passive:!1}),this._addEventListener(e,"pointermove",t=>this._onPointerMove(t),{passive:!0}),this._addEventListener(e,"wheel",t=>this._onMouseWheel(t),{passive:!1}),this._addEventListener(e,"touchstart",t=>this._onTouchStart(t),{passive:!0}),this._addEventListener(e,"touchend",t=>this._onTouchEnd(t),{passive:!0}),this._addEventListener(e,"touchmove",t=>this._onTouchMove(t),{passive:!0}),this._addEventListener(window,"keydown",t=>this._onKeyDown(t),{passive:!1}),this._addEventListener(window,"keypress",t=>this._onKeyPress(t),{passive:!1}),this._addEventListener(window,"keyup",t=>this._onKeyUp(t),{passive:!1})}removeAllListeners(){for(let{target:e,type:t,callback:i}of this._listeners)e.removeEventListener?e.removeEventListener(t,i):e.off&&e.off(t,i,e);this._listeners=[]}connect(e,t){switch(t){case mt.CLICK:case mt.POINTER_DOWN:case mt.POINTER_UP:case mt.POINTER_OVER:case mt.POINTER_OUT:this._pressability.connect(e);break}}disconnect(e){this._pressability.disconnect(e)}_addEventListener(e,t,i,r){e.addEventListener?e.addEventListener(t,i,r):e.on&&e.on(t,i,e),this._listeners.push({target:e,type:t,callback:i})}_remapPointer(e){const t=this.viewer.width;return this.viewer.rootRotated?{button:e.button,buttons:e.buttons,clientX:e.clientY,clientY:t-e.clientX,offsetX:e.offsetY,offsetY:t-e.offsetX,pageX:e.pageY,pageY:t-e.pageX,screenX:e.screenY,screenY:t-e.screenX,movementX:e.movementY,movementY:e.movementX}:e}_remapTouch(e){const t=this.viewer.width;return this.viewer.rootRotated?{touches:Array.from(e.touches).map(i=>({identifier:i.identifier,clientX:i.clientY,clientY:t-i.clientX,pageX:i.pageY,pageY:t-i.pageX,screenX:i.screenY,screenY:t-i.screenX}))}:e}_computePointer(e){this._pointer.x=e.offsetX/this.viewer.width*2-1,this._pointer.y=1-e.offsetY/this.viewer.height*2,this._pointerPosition.set(e.offsetX,e.offsetY)}_onPointerDown(e){e.preventDefault(),e=this._remapPointer(e),this._pointerButton=e.button,this._computePointer(e),this._pressability.pointerDown(this._pointer,this.viewer.camera),this.viewer.emit(mt.POINTER_DOWN,e)}_onPointerUp(e){e.preventDefault(),e=this._remapPointer(e),this._pointerButton=-1,this._computePointer(e),this._pressability.pointerUp(this._pointer,this.viewer.camera),this.viewer.emit(mt.POINTER_UP,e)}_onPointerMove(e){e=this._remapPointer(e),this._computePointer(e),this._pressability.pointerMove(this._pointer,this.viewer.camera),this.viewer.emit(mt.POINTER_MOVE,e)}_onMouseWheel(e){e.preventDefault(),this._mouseWheel=e.deltaY||e.wheelDelta,this.viewer.emit(mt.MOUSE_WHEEL,e)}_onTouchStart(e){e=this._remapTouch(e),this.viewer.emit(mt.TOUCH_START,e)}_onTouchEnd(e){e=this._remapTouch(e),this.viewer.emit(mt.TOUCH_END,e)}_onTouchMove(e){e=this._remapTouch(e);let t=e.touches,i=this._touches;for(let r=t.length;r--;){i[r]==null&&(i[r]={id:-1,position:new et});const s=t[r];i[r].id=s.identifier,i[r].position.set(s.pageX,s.pageY)}this._touchCount=t.length,this.viewer.emit(mt.TOUCH_MOVE,e)}_onKeyDown(e){this._keys[e.key]=!0,this.viewer.emit(mt.KEYDOWN,e)}_onKeyPress(e){this._keys[e.key]=!0,this.viewer.emit(mt.KEYPRESS,e)}_onKeyUp(e){this._keys[e.key]=!1,this.viewer.emit(mt.KEYUP,e)}constructor(e){this.viewer=e,this._listeners=[],this._mouseWheel=0,this._touches=[],this._touchCount=0,this._pointerButton=-1,this._pointerPosition=new et,this._pointer=new et,this._keys={},this._pressability=new v4}}mt.CLICK="click";mt.MOUSE_WHEEL="mousewheel";mt.TOUCH_START="touchstart";mt.TOUCH_END="touchend";mt.TOUCH_MOVE="touchmove";mt.POINTER_DOWN="pointerdown";mt.POINTER_UP="pointerup";mt.POINTER_MOVE="pointermove";mt.POINTER_OVER="pointerover";mt.POINTER_OUT="pointerout";mt.KEYDOWN="keydown";mt.KEYPRESS="keypress";mt.KEYUP="keyup";mt.RESIZE="resize";const CS=typeof window>"u";class y4{match(e,t){const i=this.userAgent.match(t);return i&&i.length>1&&i[e]||""}get isMobile(){return!this.isTablet&&(/[^-]mobi/i.test(this.userAgent)||this.iOSDevice==="iphone"||this.iOSDevice==="ipod"||this.isAndroidDevice||/nexus\s*[0-6]\s*/i.test(this.userAgent))}get isTablet(){return/tablet/i.test(this.userAgent)&&!/tablet pc/i.test(this.userAgent)||this.iOSDevice==="ipad"||this.isAndroidDevice&&!/[^-]mobi/i.test(this.userAgent)||!/nexus\s*[0-6]\s*/i.test(this.userAgent)&&/nexus\s*[0-9]+/i.test(this.userAgent)}get isDesktop(){return!this.isMobile&&!this.isTablet}get isMacOS(){return/macintosh/i.test(this.userAgent)&&{version:this.match(1,/mac os x (\d+(\.?_?\d+)+)/i).replace(/[_\s]/g,".").split(".").map(e=>e)[1]}}get isWindows(){return/windows /i.test(this.userAgent)&&{version:this.match(1,/Windows ((NT|XP)( \d\d?.\d)?)/i)}}get isiOS(){return!!this.iOSDevice&&{version:this.match(1,/os (\d+([_\s]\d+)*) like mac os x/i).replace(/[_\s]/g,".")||this.match(1,/version\/(\d+(\.\d+)?)/i)}}get isAndroid(){return this.isAndroidDevice&&{version:this.match(1,/android[ \/-](\d+(\.\d+)*)/i)}}get browser(){const e=this.match(1,/version\/(\d+(\.\d+)?)/i);return/opera/i.test(this.userAgent)?{name:"Opera",version:e||this.match(1,/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(this.userAgent)?{name:"Opera",version:this.match(1,/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||e}:/SamsungBrowser/i.test(this.userAgent)?{name:"Samsung Internet for Android",version:e||this.match(1,/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(this.userAgent)?{name:"Yandex Browser",version:e||this.match(1,/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(this.userAgent)?{name:"UC Browser",version:this.match(1,/(?:ucbrowser)[\s\/](\d+(\.\d+)?)/i)}:/msie|trident/i.test(this.userAgent)?{name:"Internet Explorer",version:this.match(1,/(?:msie |rv:)(\d+(\.\d+)?)/i)}:/(edge|edgios|edga|edg)/i.test(this.userAgent)?{name:"Microsoft Edge",version:this.match(2,/(edge|edgios|edga|edg)\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(this.userAgent)?{name:"Firefox",version:this.match(1,/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)}:/chromium/i.test(this.userAgent)?{name:"Chromium",version:this.match(1,/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||e}:/chrome|crios|crmo/i.test(this.userAgent)?{name:"Chrome",version:this.match(1,/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/safari|applewebkit/i.test(this.userAgent)?{name:"Safari",version:e}:{name:this.match(1,/^(.*)\/(.*) /),version:this.match(2,/^(.*)\/(.*) /)}}constructor(e){this.userAgent=e||(!CS&&window.navigator?window.navigator.userAgent:""),this.isAndroidDevice=!/like android/i.test(this.userAgent)&&/android/i.test(this.userAgent),this.iOSDevice=this.match(1,/(iphone|ipod|ipad)/i).toLowerCase(),!CS&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>2&&!window.MSStream&&(this.iOSDevice="ipad")}}const ur=new y4,j_=(navigator.userAgent||navigator.vendor).toLowerCase(),ml=typeof ur.browser=="boolean"?"":ur.browser.name,b4=document.createElement("audio");class Mt{}Mt.isTablet=ur.isTablet;Mt.isMobile=ur.isMobile||ur.isTablet;Mt.isDesktop=ur.isDesktop;Mt.device=Mt.isMobile?"mobile":"desktop";Mt.isAndroid=!!ur.isAndroid;Mt.isIOS=!!ur.isiOS;Mt.isMacOS=!!ur.isMacOS;Mt.isWindows=typeof ur.isWindows=="boolean"?ur.isWindows:ur.isWindows.version!==null;Mt.isLinux=j_.indexOf("linux")!=-1;Mt.ua=j_;Mt.isEdge=ml==="Microsoft Edge";Mt.isIE=ml==="Internet Explorer";Mt.isFirefox=ml==="Firefox";Mt.isChrome=ml==="Chrome";Mt.isOpera=ml==="Opera";Mt.isSafari=ml==="Safari";Mt.isSupportMSAA=!j_.match("version/15.4 ");Mt.isSupportOgg=!!b4.canPlayType("audio/ogg");Mt.isRetina=window.devicePixelRatio&&window.devicePixelRatio>=1.5;Mt.devicePixelRatio=window.devicePixelRatio||1;Mt.cpuCoreCount=navigator.hardwareConcurrency||1;Mt.baseUrl=document.location.origin;Mt.isIFrame=window.self!==window.top;Object.freeze(new j(1,0,0));Object.freeze(new j(0,1,0));Object.freeze(new j(0,0,1));Object.freeze(new j(1,0,0));Object.freeze(new j(0,1,0));Object.freeze(new j(0,0,0));Object.freeze(new j(1,1,1));Object.freeze(new j(-1,-1,-1));const{clamp:hT}=bn,{max:u8,abs:x4,acos:d8}=Math,fT=1e-6,w4=new j;function pT(n,e,t,i,r=n){if(i<=0)return r.copy(e);let s=w4.copy(e).sub(n);return s.lengthSq()<fT?r.copy(e):r.copy(n).add(s.multiplyScalar(hT(t*i,0,1)))}function ud(n,e,t,i){if(i<=0)return e;let r=e-n;return x4(r)<fT?e:n+r*hT(i*t,0,1)}const{clamp:Ip,degToRad:S4}=bn,{abs:M4,tan:E4,PI:T4}=Math,dd=T4*2,Dp=.001;class Ft extends W_{get lookAt(){return this._lookAt}set lookAt(e){this._lookAt.copy(e),this._targetLookAt.copy(e)}get springLength(){return this._spherical.radius}set springLength(e){this._spherical.radius=this._targetSpringLength=e}get theta(){return this._spherical.theta}set theta(e){this._spherical.theta=this._targetTheta=e}get phi(){return this._spherical.phi}set phi(e){this._spherical.phi=this._targetPhi=e}get fov(){return this.lens.fov}set fov(e){this.lens.fov=this._targetFov=e}onEnable(){this.viewer.on(mt.POINTER_DOWN,this._onPointerDown,this),this.viewer.on(mt.POINTER_UP,this._onPointerUp,this),this.viewer.on(mt.POINTER_MOVE,this._onPointerMove,this),this.viewer.on(mt.MOUSE_WHEEL,this._onMouseWheel,this),this.viewer.on(mt.TOUCH_START,this._onTouchStart,this),this.viewer.on(mt.TOUCH_MOVE,this._onTouchMove,this),this.reset()}onDisable(){this.viewer.off(mt.POINTER_DOWN,this._onPointerDown,this),this.viewer.off(mt.POINTER_UP,this._onPointerUp,this),this.viewer.off(mt.POINTER_MOVE,this._onPointerMove,this),this.viewer.off(mt.MOUSE_WHEEL,this._onMouseWheel,this),this.viewer.off(mt.TOUCH_START,this._onTouchStart,this),this.viewer.off(mt.TOUCH_MOVE,this._onTouchMove,this)}reset(){this._button=-1,this._touchID=-1,this._targetTheta=this.theta,this._targetPhi=this.phi,this._targetSpringLength=this.springLength,this._targetLookAt.copy(this._lookAt),this._targetFov=this.lens.fov}_onPointerDown(e){Mt.isMobile||(this._button=e.button,this._preLoc0.set(e.pageX,e.pageY))}_onPointerUp(e){Mt.isMobile||(this._button=-1)}_onPointerMove(e){if(Mt.isMobile)return;const{__loc0:t,__panDelta:i,__rotateDelta:r}=Ft;switch(t.set(e.pageX,e.pageY),this._button){case 0:this._calculateRotatelDelta(r,this._preLoc0,t),this._calculateTargetSpringArm(r);break;case 1:case 2:this._calculatePanDelta(i,this._preLoc0,t),this._calculateTargetLookAt(i);break}this._preLoc0.copy(t)}_onMouseWheel(e){e.deltaY>0?this._targetSpringLength*=this._calculateDistanceScale(1/.85):e.deltaY<0&&(this._targetSpringLength*=this._calculateDistanceScale(.85)),this._calculateTargetSpringArm()}_onTouchStart(e){if(!Mt.isMobile)return;let t=e.touches;t.length>1?(this._preLoc0.set(t[0].pageX,t[0].pageY),this._preLoc1.set(t[1].pageX,t[1].pageY)):t.length>0&&(this._touchID=t[0].identifier,this._preLoc0.set(t[0].pageX,t[0].pageY))}_onTouchMove(e){if(!Mt.isMobile)return;const{__loc0:t,__loc1:i,__panDelta:r,__rotateDelta:s,__preCenter:a,__center:l}=Ft;let d=e.touches;d.length>1?(t.set(d[0].pageX,d[0].pageY),i.set(d[1].pageX,d[1].pageY),this.lookAt&&(this._targetSpringLength*=this._calculateDistanceScale(this._preLoc0.distanceTo(this._preLoc1)/t.distanceTo(i))),a.copy(this._preLoc0).add(this._preLoc1).multiplyScalar(.5),l.copy(t).add(i).multiplyScalar(.5),this._calculatePanDelta(r,a,l),this._calculateTargetLookAt(r),this._calculateTargetSpringArm(),this._preLoc0.copy(t),this._preLoc1.copy(i)):d.length>0&&this._touchID===d[0].identifier&&(t.set(d[0].pageX,d[0].pageY),this._calculateRotatelDelta(s,this._preLoc0,t),this._calculateTargetSpringArm(s),this._preLoc0.copy(t))}_calculateDistanceScale(e){return this._tempRotateSmoothing=this.rotateSmoothing,this.forbidZ&&(e=1),e}_calculateRotatelDelta(e,t,i){this._tempRotateSmoothing=this.rotateSmoothing;const r=this.viewer.canvas;return e.copy(i).sub(t).multiplyScalar(this.rotateSpeed*2*Math.PI/r.clientHeight),e.y=-e.y,this.forbidX&&(e.x=0),this.forbidY&&(e.y=0),e}_calculatePanDelta(e,t,i){this._tempRotateSmoothing=this.rotateSmoothing;const r=this.viewer.canvas;return e.copy(i).sub(t).multiplyScalar(this.panSpeed/r.clientHeight),this.forbidPanX&&(e.x=0),this.forbidPanY&&(e.y=0),e}_calculateTargetLookAt(e){const{__xAxis:t,__yAxis:i,__posDelta:r}=Ft;t.setFromMatrixColumn(this.node.matrix,0),i.setFromMatrixColumn(this.node.matrix,1),this.forbitPanOffsetY&&(i.y=0,i.normalize()),r.copy(this.node.position).sub(this.lookAt);const s=r.length()*2*E4(S4(this.fov*.5));this._targetLookAt.sub(t.multiplyScalar(e.x*s)).add(i.multiplyScalar(e.y*s))}_calculateTargetSpringArm(e,t){e&&(this._targetTheta-=e.x,this._targetPhi+=e.y),t&&(this._targetSpringLength=t),this._targetTheta=Ip(this._targetTheta,this.thetaMin,this.thetaMax),this._targetPhi=Ip(this._targetPhi,this.phiMin,this.phiMax),this._targetSpringLength=Ip(this._targetSpringLength,this.distanceMin,this.distanceMax)}gotoPOI({duration:e=-1,easing:t=Br.Cubic.InOut,springLength:i=this._targetSpringLength,theta:r=this._targetTheta,phi:s=this._targetPhi,lookAt:a=this._lookAt,fov:l=this.lens.fov,smoothing:d=this.smoothing,rotateSmoothing:h=d}){this._targetFov=l,this._tempSmoothing=d,this._tempRotateSmoothing=h,this._targetLookAt.copy(a);const m=r%dd,u=this._spherical.theta=this._spherical.theta%dd,g=[m,m-dd,m+dd],v=g.map(T=>M4(u-T)),w=Math.min(...v);this._targetTheta=g[v.findIndex(T=>T===w)],this._targetSpringLength=i,this._targetPhi=s,this._calculateTargetSpringArm(),e>0&&(this.locked=!0,this.enabled=!1,this.viewer.killTweensOf(this),this.viewer.timeline(this).to({springLength:i,theta:r,phi:s,lookAt:a,fov:l},e,{easing:t,onUpdate:()=>{this.node.position.setFromSpherical(this._spherical).add(this._lookAt),this.node.lookAt(this._lookAt)}}).call(()=>{this.locked=!1,this.enabled=!0}).start())}update(e){const t=this._tempSmoothing,i=this._tempRotateSmoothing;this._spherical.theta=ud(this._spherical.theta,this._targetTheta,e,i),this._spherical.phi=ud(this._spherical.phi,this._targetPhi,e,i),this._spherical.radius=ud(this._spherical.radius,this._targetSpringLength,e,t),this.lens.fov=ud(this.lens.fov,this._targetFov,e,t),pT(this._lookAt,this._targetLookAt,e,t),this.node.position.setFromSpherical(this._spherical).add(this._lookAt),this.node.lookAt(this._lookAt)}constructor(...e){super(...e),this._button=-1,this._touchID=-1,this._preLoc0=new et,this._preLoc1=new et,this._spherical=new N_(4,Math.PI/2),this._lookAt=new j,this._tempSmoothing=6,this._tempRotateSmoothing=8,this._targetTheta=0,this._targetPhi=0,this._targetSpringLength=4,this._targetFov=this.fov,this._targetLookAt=new j,this.forbidX=!1,this.forbidY=!1,this.forbidZ=!1,this.forbidPanX=!1,this.forbidPanY=!1,this.forbitPanOffsetY=!1,this.panSpeed=1,this.rotateSpeed=1,this.smoothing=5,this.rotateSmoothing=8,this.phiMin=Dp,this.phiMax=Math.PI-Dp,this.thetaMin=-1/0,this.thetaMax=1/0,this.distanceMin=Dp,this.distanceMax=1/0}}Ft.__loc0=new et;Ft.__loc1=new et;Ft.__center=new et;Ft.__preCenter=new et;Ft.__panDelta=new et;Ft.__panTarget=new et;Ft.__rotateDelta=new et;Ft.__posDelta=new j;Ft.__xAxis=new j;Ft.__yAxis=new j;Ft.__quat=new Gn;Et([rt({dir:"set"})],Ft.prototype,"forbidX",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbidY",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbidZ",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbidPanX",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbidPanY",void 0);Et([rt({dir:"set"})],Ft.prototype,"forbitPanOffsetY",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"panSpeed",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"rotateSpeed",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"smoothing",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"rotateSmoothing",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"phiMin",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"phiMax",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"thetaMin",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"thetaMax",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"distanceMin",void 0);Et([rt({dir:"set",step:.01})],Ft.prototype,"distanceMax",void 0);Et([rt({step:.01})],Ft.prototype,"lookAt",null);Et([rt({step:.01})],Ft.prototype,"springLength",null);Et([rt({step:.01})],Ft.prototype,"theta",null);Et([rt({step:.01})],Ft.prototype,"phi",null);Et([rt],Ft.prototype,"fov",null);class RS extends wn{constructor(...e){super(new Yc(...e))}}const A4=`
varying vec2 vUv;
void main() {
vUv = position.xy * 0.5 + 0.5;
gl_Position = vec4(position.xy, 1.0, 1.0);
}
`,C4=`
uniform mat4 textureMatrix;
varying vec4 vUv4;
varying vec2 vUv;
varying vec3 vPositionWS;
#ifdef USE_UV1
varying vec2 vUv1;
#endif
#ifdef USE_UV2
varying vec2 vUv2;
#endif
#ifdef USE_UV3
varying vec2 vUv3;
#endif
varying vec3 vViewPosition;
#include <common>
#include <normal_pars_vertex>
#include <logdepthbuf_pars_vertex>
void main() {
#include <beginnormal_vertex>
#include <defaultnormal_vertex>
vec4 transformed = vec4(position, 1.);
#ifdef USE_INSTANCING
transformed = instanceMatrix * transformed;
#endif
vUv = uv;
#ifdef USE_UV1
vUv1 = uv1;
#endif
#ifdef USE_UV2
vUv2 = uv2;
#endif
#ifdef USE_UV3
vUv3 = uv2;
#endif
vec4 positionWS = modelMatrix * transformed;
vec4 mvPosition = viewMatrix * positionWS;
vUv4 = textureMatrix * positionWS;
vPositionWS = positionWS.xyz;
vViewPosition = -mvPosition.xyz;
vNormal = normalize(transformedNormal);
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
}
`,R4=`
uniform vec3 color;
uniform float alpha;
uniform float roughness;
uniform float metalness;
uniform sampler2D map;
uniform sampler2D normalMap;
uniform sampler2D roughnessMap;
uniform sampler2D aoMap;
uniform float aoMapIntensity;
uniform sampler2D lightMap;
uniform float lightMapIntensity;
uniform sampler2D reflectMap;
uniform float reflectIntensity;
varying vec3 vPositionWS;
varying vec2 vUv;
#ifdef USE_UV1
varying vec2 vUv1;
#endif
#ifdef USE_UV2
varying vec2 vUv2;
#endif
#ifdef USE_UV3
varying vec2 vUv3;
#endif
varying vec4 vUv4;
varying vec3 vViewPosition;
varying vec3 vNormal;
#include <common>
#include <lights_physical_pars_fragment>
#include <logdepthbuf_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
vec3 coord = vUv4.xyz / vUv4.w;
vec2 reflectUv = coord.xy;
#ifdef USE_NORMALMAP
vec4 texelNormal = texture2D(normalMap, UV_NORMAL);
vec3 normal = normalize(vec3(texelNormal.r * 2.0 - 1.0, texelNormal.b, texelNormal.g * 2.0 - 1.0));
reflectUv += coord.z * normal.xz * 0.05;
#endif
vec3 geometryNormal = normalize(vNormal);
vec3 geometryViewDir = normalize(vViewPosition);
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
float metalnessFactor = metalness;
vec4 diffuseColor = vec4(color, alpha);
#ifdef USE_MAP
diffuseColor *= texture2D(map, vUv);
#endif
diffuseColor.rgb = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
float specularF90 = 1.0;
float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
roughnessFactor *= texture2D(roughnessMap, UV_ROUGHNESS).g * roughness;
#endif
computeMultiscattering( geometryNormal, geometryViewDir, specularColor, specularF90, roughnessFactor, singleScattering, multiScattering );
vec3 totalScattering = singleScattering + multiScattering;
vec3 diffuse = diffuseColor.rgb * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
vec3 irradiance = vec3(0.);
#ifdef USE_LIGHTMAP
irradiance += texture2D(lightMap, UV_LIGHTMAP).rgb * lightMapIntensity;
#endif
float lod = roughnessFactor * (1.7 - 0.7 * roughnessFactor) * 6.;
vec4 reflectColor = textureLod(reflectMap, reflectUv, lod) * reflectIntensity;
vec3 f_specular = vec3(0.);
vec3 f_diffuse = vec3(0.);
f_specular += reflectColor.rgb * (1.0 - roughnessFactor * roughnessFactor) + multiScattering * irradiance;
f_diffuse += diffuse * irradiance;
#ifdef USE_AOMAP
float ambientOcclusion = mix(1., texture2D(aoMap, UV_AO).r, aoMapIntensity);
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
f_specular *= computeSpecularOcclusion(dotNV, ambientOcclusion, roughnessFactor);
f_diffuse *= ambientOcclusion;
#endif
gl_FragColor = vec4(f_specular + f_diffuse, diffuseColor.a);
#include <tonemapping_fragment>
#include <colorspace_fragment>
}
`;class Kh extends zi{onBeforeCompile(e){const t=[];this.aoMap&&this.aoMap.channel&&t.push(["UV_AO",this.aoMap.channel]),this.lightMap&&this.lightMap.channel&&t.push(["UV_LIGHTMAP",this.lightMap.channel]),this.roughnessMap&&this.roughnessMap.channel&&t.push(["UV_ROUGHNESS",this.roughnessMap.channel]),this.normalMap&&this.normalMap.channel&&t.push(["UV_NORMAL",this.normalMap.channel]),t.forEach(([i,r])=>{e.defines[i]="vUv"+r})}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=e}get alpha(){return this.uniforms.alpha.value}set alpha(e){this.uniforms.alpha.value=e}get metalness(){return this.uniforms.metalness.value}set metalness(e){this.uniforms.metalness.value=e}get roughness(){return this.uniforms.roughness.value}set roughness(e){this.uniforms.roughness.value=e}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}get roughnessMap(){return this.uniforms.roughnessMap.value}set roughnessMap(e){this.uniforms.roughnessMap.value=e}get normalMap(){return this.uniforms.normalMap.value}set normalMap(e){this.uniforms.normalMap.value=e}get aoMap(){return this.uniforms.aoMap.value}set aoMap(e){this.uniforms.aoMap.value=e}get lightMap(){return this.uniforms.lightMap.value}set lightMap(e){this.uniforms.lightMap.value=e}get lightMapIntensity(){return this.uniforms.lightMapIntensity.value}set lightMapIntensity(e){this.uniforms.lightMapIntensity.value=e}get reflectIntensity(){return this.uniforms.reflectIntensity.value}set reflectIntensity(e){this.uniforms.reflectIntensity.value=e}constructor(...e){super(...e),this.vertexShader=C4,this.fragmentShader=R4,this.defines={UV_AO:"vUv",UV_LIGHTMAP:"vUv",UV_ROUGHNESS:"vUv",UV_NORMAL:"vUv"},this.uniforms={color:{value:new Je},alpha:{value:1},map:{value:null},reflectMap:{value:null},reflectIntensity:{value:1},textureMatrix:{value:new ot},metalness:{value:0},roughness:{value:1},roughnessMap:{value:null},normalMap:{value:null},aoMap:{value:null},aoMapIntensity:{value:1},lightMap:{value:null},lightMapIntensity:{value:1}}}}Et([rt],Kh.prototype,"color",null);Et([rt({min:0,max:1,step:.01})],Kh.prototype,"alpha",null);Et([rt({min:0,max:1,step:.01})],Kh.prototype,"metalness",null);Et([rt({min:0,max:1,step:.01})],Kh.prototype,"roughness",null);class X_ extends Zc{constructor(...e){super(...e),this.type="Plugin"}}class Nc extends X_{static Instance(e){return e.getPlugin(Nc,!0)}add(e){return this.scene.add(e),e}remove(e){return this.scene.remove(e),e}onRender(e){const{renderer:t,camera:i}=this.viewer,r=t.autoClear;t.autoClear=!1,t.render(this.scene,i),t.autoClear=r}constructor(...e){super(...e),this.scene=new kc}}const xh=4,_g=new dl,va=(1+Math.sqrt(5))/2,uo=1/va,PS=[new j(1,1,1),new j(-1,1,1),new j(1,1,-1),new j(-1,1,-1),new j(0,va,uo),new j(0,va,-uo),new j(uo,0,va),new j(-uo,0,va),new j(va,uo,0),new j(-va,uo,0)],us={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3};function Vo(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function Y_(){return`
precision mediump float;
precision mediump int;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function P4(){return new zi({name:"Clear",uniforms:{map:{value:null},intensity:{value:1}},vertexShader:A4,fragmentShader:`
uniform sampler2D map;
uniform float intensity;
varying vec2 vUv;
void main() {
vec4 col = texture2D(map, vUv);
gl_FragColor = vec4(col.rgb * intensity, col.a);
}
`,blending:Gr,depthWrite:!1,depthTest:!1})}function L4(){return new zi({name:"CubeMapToCubeUV",uniforms:{envMap:{value:null},lod:{value:0},exposure:{value:1}},vertexShader:Y_(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
uniform float lod;
uniform float exposure;
void main() {
gl_FragColor = textureCubeLodEXT(envMap, vOutputDirection, lod);
gl_FragColor.rgb *= exposure;
}
`,blending:ch,depthWrite:!1,depthTest:!1})}function I4(n,e,t){return new zi({name:"MipBlurToCubeUV",defines:{CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{cubeUVMap:{value:null},lod:{value:0}},vertexShader:Y_(),fragmentShader:`
precision mediump float;
precision mediump int;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
varying vec3 vOutputDirection;
uniform sampler2D cubeUVMap;
uniform float lod;
void main() {
vec3 col = bilinearCubeUV(cubeUVMap, vOutputDirection, CUBEUV_MAX_MIP - lod);
gl_FragColor = vec4(col, 1.);
}
`,blending:ch,depthWrite:!1,depthTest:!1})}function D4(n,e,t){return new zi({name:"MipBlurToCubeUV",defines:{CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},cubeUVMap:{value:null},weight:{value:1},lod:{value:0},exposure:{value:1}},vertexShader:Y_(),fragmentShader:`
precision mediump float;
precision mediump int;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
varying vec3 vOutputDirection;
uniform sampler2D cubeUVMap;
uniform samplerCube envMap;
uniform float weight;
uniform float lod;
uniform float exposure;
void main() {
vec3 col0 = bilinearCubeUV(cubeUVMap, vOutputDirection, CUBEUV_MAX_MIP - (lod + 1.));
vec3 col1 = textureCubeLodEXT(envMap, vOutputDirection, lod).rgb * exposure;
gl_FragColor = vec4(mix(col0, col1, weight), 1.);
}
`,blending:Gr,depthWrite:!1,depthTest:!1})}class k4{get pause(){return this._pause}set pause(e){this._pause=e}get target(){return this._target}get callback(){return this._callback}get lived(){return this._repeat>0||this._repeatForever}update(e){this._pause||(this._repeat>0||this._repeatForever)&&(this._elapsed+=e,this._elapsed>=this._interval&&(this.trigger(this._elapsed-this._lastTime),this._elapsed-=this._interval,this._lastTime=this._elapsed,this._repeat--))}trigger(e){this._target&&this._callback&&this._callback.call(this._target,e,this._elapsed)}constructor(e,t,i,r){this._target=null,this._callback=null,this._interval=0,this._repeat=0,this._elapsed=0,this._lastTime=0,this._repeatForever=!1,this._pause=!1,this._target=e,this._callback=t,this._interval=i,this._repeat=r,this._repeatForever=r===-1}}class F4{get target(){return this._target}get callers(){return this._callers}constructor(e,t){this._target=e,this._callers=t}}class U4{pause(e){let t=this._callers[e.uuid];t&&t.forEach(i=>i.pause=!0)}resume(e){let t=this._callers[e.uuid];t&&t.forEach(i=>i.pause=!1)}schedule(e,t,i,r){let s=this._callers[e.uuid];s===void 0&&(s=this._callers[e.uuid]=[],this._callersArray.push(new F4(e,s))),s.push(new k4(e,t,i,r))}unshedule(e,t){let i=this._callers[e.uuid];if(i){let r=i.findIndex(s=>s.callback===t);r!==-1&&i.splice(r,1)}}unscheduleAll(e){delete this._callers[e.uuid];let t=this._callersArray.findIndex(i=>i.target===e);t!==-1&&this._callersArray.splice(t,1)}update(e){let t,i=this._callersArray;for(let r=i.length;r--;){t=i[r].callers;for(let s=t.length;s--;)t[s].lived?t[s].update(e):t.splice(s,1)}}constructor(){this._callers={},this._callersArray=[]}}class vg{add(e){this._targets.push(e)}remove(e){let t=this._targets.indexOf(e);t!==-1&&this._targets.splice(t,1)}invoke(e){let t=this._callback;for(let i of this._targets)t(i,e)}constructor(e){this._targets=[],this._callback=e}}class O4 extends vg{invoke(e){if(this._targets.length>0){let t=this._callback;for(let i of this._targets)t(i,e);this._targets.length=0}}}class N4{start(){this.startInvoker.invoke(0)}update(e){this.updateInvoker.invoke(e)}lastUpdate(e){this.lastUpdateInvoker.invoke(e)}enableComponent(e,t){t?e.flags.OnEnableCalled||(e.flags.OnEnableCalled=!0,e.onEnable&&e.onEnable(),typeof e.start=="function"&&!e.flags.IsStartCalled&&(e.flags.IsStartCalled=!0,this.startInvoker.add(e)),typeof e.update=="function"&&this.updateInvoker.add(e),typeof e.lastUpdate=="function"&&this.lastUpdateInvoker.add(e)):e.flags.OnEnableCalled&&(e.flags.OnEnableCalled=!1,e.onDisable&&e.onDisable(),typeof e.start=="function"&&!e.flags.IsStartCalled&&this.startInvoker.remove(e),typeof e.update=="function"&&this.updateInvoker.remove(e),typeof e.lastUpdate=="function"&&this.lastUpdateInvoker.remove(e))}constructor(){this.startInvoker=new O4(e=>e.start()),this.updateInvoker=new vg((e,t)=>e.update(t)),this.lastUpdateInvoker=new vg((e,t)=>e.lastUpdate(t))}}var LS;(function(n){n[n.CheckOnly=0]="CheckOnly",n[n.AutoAdd=1]="AutoAdd"})(LS||(LS={}));class Zh{get viewer(){return this._viewer}get scheduler(){return this._scheduler}get componentScheduler(){return this._componentScheduler}destroy(){this._componentsMap.forEach(e=>e.forEach(t=>t.destroy())),this._componentsMap.clear()}update(e){this._scheduler.update(e),this._componentScheduler.start(),this._componentScheduler.update(e),this._componentScheduler.lastUpdate(e)}destroyComponents(e){let t=this._componentsMap.get(e);t&&(t.forEach(i=>i.destroy()),this._componentsMap.delete(e));for(let i of e.children)this.destroyComponents(i)}activeComponents(e){let t=this._componentsMap.get(e);t&&t.forEach(i=>this._activeComponent(i,e.visible));for(let i of e.children)this.activeComponents(i)}addComponent(e,t){let i=e instanceof sl?e.node:e,r=typeof t=="function",s=this._findComponent(i,r?t:t.constructor);if(s===void 0){s=r?new t:t,s.node=i,s.manager=this,s.viewer=this._viewer,this._addDendencies(i,s.constructor),s.flags.OnLoadCalled||(s.flags.OnLoadCalled=!0,s.onLoad&&s.onLoad());let a=this._componentsMap.get(i);a===void 0?this._componentsMap.set(i,[s]):a.push(s),this._activeComponent(s,s.enabled)}return s}removeComponent(e,t){let i=this._componentsMap.get(e);return i&&i.splice(i.indexOf(t),1),this}getComponent(e,t,i=!1){let r=this._findComponent(e,t);return r===void 0&&i&&(r=this.addComponent(e,t)),r}getComponentsInChidren(e,t,i=[]){let r=this._componentsMap.get(e);if(r){for(let s=r.length;s--;)r[s]instanceof t&&i.push(r[s]);for(let s of e.children)this.getComponentsInChidren(s,t,i)}return i}traverseComponents(e){this._componentsMap.forEach(t=>t.forEach(e))}_addDendencies(e,t){for(;t!==sl;){let i=Zh._dependenciesMap.get(t);if(i){const{components:r,mode:s}=i;for(const a of r)if(!this.getComponent(e,a))if(s===1)this.addComponent(e,a);else throw`Should add ${a.name} before adding ${t.name}`}t=Object.getPrototypeOf(t)}}_findComponent(e,t){let i=this._componentsMap.get(e);if(i)for(let r=i.length;r--;){let s=i[r];if(s instanceof t)return s}}_activeComponent(e,t){this._componentScheduler.enableComponent(e,t)}constructor(e){this._scheduler=new U4,this._componentScheduler=new N4,this._componentsMap=new Map,this._viewer=e}}Zh._dependenciesMap=new Map;class B4 extends G_{get percent(){return this._percent}destroy(){this._tasks.length=0,this._taskIndex=0,this._percent=0}add(e){this._tasks.push(e)}update(){let e=this._tasks[this._taskIndex];if(e){try{e.excute()}catch(t){console.error(t),this.onError&&this.onError(e)}this._percent=++this._taskIndex/this._tasks.length,this.onProgress&&this.onProgress(e,this._taskIndex,this._tasks.length),this._taskIndex===this._tasks.length&&(this._percent=1,this.onComplete&&this.onComplete())}}constructor(e,t,i){super(),this.onComplete=e,this.onProgress=t,this.onError=i,this._tasks=[],this._taskIndex=0,this._percent=0}}function z4(n,e){if(!((Mt.isChrome||Mt.isSafari||Mt.isEdge||Mt.isFirefox||Mt.isOpera)&&!Mt.isIE)||!(n instanceof HTMLCanvasElement))return null;let i=Object.assign({alpha:!1,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1},e);if(window.WebGL2RenderingContext)try{return{gl:n.getContext("webgl2",i),RENDER_TARGET_FLOAT_TYPE:gi,DATA_FLOAT_TYPE:Un}}catch{return null}else if(window.WebGLRenderingContext){const r=n.getContext("webgl",i)||n.getContext("webgl2",i)||n.getContext("experimental-webgl",i);return(r.getExtension("OES_texture_float")||r.getExtension("OES_texture_half_float"))&&r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?{gl:r,RENDER_TARGET_FLOAT_TYPE:Mt.isIOS||r.getExtension("OES_texture_half_float")?gi:Un,DATA_FLOAT_TYPE:Un}:this._floatPacking?{gl:r,RENDER_TARGET_FLOAT_TYPE:Bi,DATA_FLOAT_TYPE:Bi}:null}return null}var Lo;(function(n){n[n.AUTO=0]="AUTO",n[n.LANDSCAPE=1]="LANDSCAPE",n[n.PORTRAIT=2]="PORTRAIT"})(Lo||(Lo={}));class Wo{static extension(e){let t=e.split(".");return t.length>1?t.pop().toLowerCase():""}static dirname(e){let t=e.lastIndexOf("/");return t!==-1?e.substring(0,t):""}static basename(e,t){let i=e.split("/").pop();return t?i.replace("."+t,""):i}static _splitTextureSettings(e){let t={};for(let i of Wo._texSettingKeys)e[i]!==void 0&&(i==="dataType"?t.type=e[i]:t[i]=e[i]);return t}destroy(){this._loaders.clear()}getLoader(e){return this._loaders.get(e)}addLoader(e){let t=new e(this);for(let i of t.extension)this._loaders.set(i,t)}loadAsset({url:e,buffer:t,ext:i,path:r,resourcePath:s,dracoPath:a,manager:l,onProgress:d,...h}){return new Promise((m,u)=>{const g=i||e&&Wo.extension(e)||"",v=Wo._splitTextureSettings(h);this._loaders.has(g)?this._loaders.get(g).load({url:e,buffer:t,texSettings:v,path:r,resourcePath:s,dracoPath:a,manager:l,onProgress:d,onLoad:m,onError:w=>{console.error(`${e} not exist`,w),u(w)}}):u("ResourceManager.loadAsset: missing loader for "+g)})}constructor(){this._loaders=new Map}}Wo._texSettingKeys=["flipY","mapping","wrapS","wrapT","dataType","magFilter","minFilter","format","anisotropy","repeat","colorSpace","channel"];function hd(n,e){for(let t in e){let i=e[t];if(i!==void 0&&n[t]!==void 0){let r=Object.getOwnPropertyDescriptor(n,t);if(!r||r.writable||r.set)n[t]=i;else{let s=n[t];s&&s.copy&&s.copy(i)}}}return n}class H4{get viewer(){return this._viewer}destroy(){this._plugins.forEach(e=>e.uninstall&&e.uninstall()),this._plugins.length=0,this._pluginsMap.clear()}update(e){this._plugins.forEach(t=>t.onUpdate&&t.onUpdate(e))}render(e){this._plugins.forEach(t=>t.onRender&&t.onRender(e))}traversePlugins(e){this._plugins.forEach(e)}getPlugin(e,t=!1){let i=this._pluginsMap.get(e);return i===void 0&&t&&(i=this.addPlugin(e)),i}addPlugin(e){const t=lT(e);return this._pluginsMap.has(t.constructor)||(t.viewer=this._viewer,t.install&&t.install(),this._plugins.push(t),this._pluginsMap.set(t.constructor,t),Ii._applyClassProperties(t.type,t.constructor)),t}removePlugin(e){const t=typeof e=="function"?e:e.constructor,i=this._pluginsMap.get(t);i&&(i.uninstall&&i.uninstall(),this._plugins.splice(this._plugins.indexOf(i),1),this._pluginsMap.delete(t))}constructor(e){this._plugins=[],this._pluginsMap=new Map,this._viewer=e}}class kt extends G_{static _setDirectLightShadow(e,t){const i=e.camera;for(let r=0;r<t.length&&r<6;r++)i[kt._shadowCameraKeys[r]]=t[r];return t.length>6&&(e.bias=t[6]),t.length>8&&e.mapSize.set(t[7],t[8]),e}static compileMaterial(e,t,i,r){kt.fullscreenMesh.material=r,e.compile(kt.fullscreenMesh,i,t)}static compileObject3D(e,t,i,r){e.compile(r,i,t)}static compileTexture(e,t){if(Array.isArray(t))for(let i of t)e.initTexture(i);else e.initTexture(t)}static Blit(e,t,i,r,s){kt.fullscreenMesh.material=i;const a=e.getRenderTarget();e.setRenderTarget(t,s,r),e.render(kt.fullscreenMesh,kt.fullscreenCamera),e.setRenderTarget(a)}static createFullscreenTriangle(){let e=new On;return e.setAttribute("position",new nn([-1,3,0,-1,-1,0,3,-1,0],3)),e.setAttribute("uv",new nn([0,2,0,0,2,0],2)),e}static findChild(e,t){let i=null,r=t.split("/"),s=e.children;for(let a of r)if(i=s.find(l=>l.name===a),i)s=i.children;else return null;return i}static getChildByName(e,t){return kt.getObject(e,i=>i.name===t&&i)}static getObject(e,t,i=!1){const r=[e],s=[];for(;r.length!==0;){let a=r.shift();if(t(a)&&(s.push(a),!i))break;a.children.forEach(d=>r.push(d))}return i?s:s[0]}static _getObjectValue(e,t,i=!1){return t?i?Object.values(e||kt.__emtpyObject).filter(r=>r.name===t):Object.values(e||kt.__emtpyObject).find(r=>r.name===t):Object.values(e)}static getMaterial(e,t,i=!1){return kt._getObjectValue(e.userData.materials,t,i)}static getTexture(e,t,i=!1){return kt._getObjectValue(e.userData.textures,t,i)}static getMesh(e,t,i=!1){return kt._getObjectValue(e.userData.meshes,t,i)}get root(){return this._root}get time(){return this._time}get scene(){return this._scene}get camera(){return this._camera}get renderer(){return this._renderer}get canvas(){return this._canvas}get gl(){return this._gl}get RENDER_TARGET_FLOAT_TYPE(){return this._RENDER_TARGET_FLOAT_TYPE}get DATA_FLOAT_TYPE(){return this._DATA_FLOAT_TYPE}get dpr(){return this._dpr}get width(){return this._width}get height(){return this._height}get viewport(){return this._viewport}get rootRotated(){return this._rootRotated}get input(){return this._input}get targetFrameRate(){return this._targetFrameRate}set targetFrameRate(e){this._targetFrameRate=Math.max(.001,e)}get instanceId(){return this._instanceId}get loadingManager(){return this._loadingManager}get resourceManager(){return this._resourceManager}get taskManager(){return this._taskManager}destroy(){this.stop(),this._renderer.dispose(),this._taskManager.destroy(),this._resourceManager.destroy(),this._componentManager.destroy(),this._pluginManager.destroy(),this._tweenManager.destroy(),this._input.removeAllListeners()}_addDefaultLoaders(){this.addLoader(d4),this.addLoader(h4),this.addLoader(p4),this.addLoader(f4)}_frame(e){if(this._time=e,this._targetFrameRate>-1){const t=1/this._targetFrameRate,i=this._time-this._lastFrameTime;i>=t&&(this.loop(this._fixedFrameTime?t:this._time-this._lastTime),this._lastTime=this._time,this._lastFrameTime=this._time-i%t)}else this.loop(this._time-this._lastTime),this._lastTime=this._time}loop(e){this._autoResize&&this.resize(),e=Math.min(e,.067),this.update(e),this.render(e)}update(e){this._taskManager.update(),this._tweenManager.update(this._time),this._componentManager.update(e),this._pluginManager.update(e)}render(e){this._renderer.info.reset(),this._onRender(e),this._pluginManager.render(e)}_onRender(e){this._renderer.render(this._scene,this._camera)}_onResize(e,t){this._renderer.setSize(e,t)}start(){if(this._running==!1){this._running=!0;const e=t=>{this._running&&this._frame(t*.001)};this._renderer.setAnimationLoop(e)}return this}stop(){return this._running=!1,this._time=this._lastTime=0,this}resize(e=window.innerWidth,t=window.innerHeight){if(this._rootRotated=this._orientation===Lo.LANDSCAPE?e<t:this._orientation===Lo.PORTRAIT?e>t:!1,this._rootRotated){let i=e;e=t,t=i}if(this._width!==e||this._height!==t){this._width=e,this._height=t;let i=this._root;this._rootRotated?(i.style["-webkit-transform"]="rotate(90deg)",i.style.transform="rotate(90deg)",i.style["-webkit-transform-origin"]="0px 0px 0px",i.style.transformOrigin="0px 0px 0px",i.style.margin=`0 0 0 ${t}px`,i.style.width=`${e}px`,i.style.height=`${t}px`):(i.style["-webkit-transform"]="rotate(0deg)",i.style.transform="rotate(0deg)",i.style.margin="0px auto",i.style.width=`${e}px`,i.style.height=`${t}px`);let r=this._camera;if(r.isOrthographicCamera)this._viewport={width:e/r.zoom,height:t/r.zoom,factor:1};else if(r.isPerspectiveCamera){r.manual||(r.aspect=e/t,r.updateProjectionMatrix());let s=r.getWorldPosition(kt.__worldPos).distanceTo(kt.__target),a=2*Math.tan(bn.degToRad(r.fov*.5))*s,l=a*e/t;this._viewport={width:l,height:a,factor:e/l}}this._onResize(e,t),this.emit(mt.RESIZE,e,t)}}loadAsset(e){return this._resourceManager.loadAsset(Object.assign(Object.assign({},this._defaultProps),e))}getLoader(e){return this._resourceManager.getLoader(e)}addLoader(e){this._resourceManager.addLoader(e)}timeline(e){return this._tweenManager.timeline(e)}killTweensOf(e){this._tweenManager.killTweensOf(e)}traverseMaterials(e){kt.getObject(this._scene,t=>{t.material&&(Array.isArray(t.material)?t.material.forEach(e):e(t.material))},!0)}traversePlugins(e){return this._pluginManager.traversePlugins(e)}getPlugin(e,t){return this._pluginManager.getPlugin(e,t)}addPlugin(e,t){const i=this._pluginManager.addPlugin(e);return hd(i,t),i}removePlugin(e){this._pluginManager.removePlugin(e)}getComponent(e,t,i){return this._componentManager.getComponent(e,t,i)}traverseComponents(e){return this._componentManager.traverseComponents(e)}addComponent(e,t){return this._componentManager.addComponent(e,t)}removeComponent(e,t){return this._componentManager.removeComponent(e,t)}addTask(e){this._taskManager.add(e)}addNode(e,{args:t,debug:i,scale:r,position:s,rotation:a,layer:l,shadowArgs:d,makeDefault:h,component:m,parent:u=this._scene,...g}={}){let v=null,w=lT(e,t);if(w.isObject3D)v=w,u.add(w);else if(w instanceof sl)v=w.node||new sn,u.add(v),this._componentManager.addComponent(v,w);else throw Error("Viewer.addNode: unsuport object");if(m){const T=Array.isArray(m)?m:[m];for(let M of T)this._componentManager.addComponent(v,M)}return l&&(v.layers.mask=l),(r||s||a)&&hd(v,{scale:r,position:s,rotation:a}),g&&hd(w,g),w.isCamera&&h&&(w.manual=w.aspect!==this._camera.aspect,this._camera=w),d&&v.isDirectionalLight&&kt._setDirectLightShadow(v.shadow,d),w}removeNode(e){this._componentManager.destroyComponents(e),e.removeFromParent()}activeNode(e,t){return this._componentManager.activeComponents(e),e.visible=t,e}createRenderTarget(e,t,i=!1,r=!1,s=0,a=!1,l=!1){return new Zs(e,t,{wrapS:ti,wrapT:ti,magFilter:i?Fn:ln,minFilter:i?Fn:a?nw:ln,type:typeof r=="boolean"?r?this.DATA_FLOAT_TYPE:Bi:r,anisotropy:0,colorSpace:Sn,depthBuffer:l,stencilBuffer:!1,samples:Mt.isSupportMSAA?s:0,generateMipmaps:a})}createCubeRenderTarget(e,t=!1,i=!1,r=0,s=!1,a=!1){return new LE(e,{wrapS:ti,wrapT:ti,magFilter:t?Fn:ln,minFilter:t?Fn:s?nw:ln,type:typeof i=="boolean"?i?this.DATA_FLOAT_TYPE:Bi:i,anisotropy:0,colorSpace:Sn,depthBuffer:a,stencilBuffer:!1,samples:Mt.isSupportMSAA?r:0,generateMipmaps:s})}createDataTexture(e,t,i,r=!1,s=!0){return new $c(e,t,i,Vn,r?Un:Bi,__,ti,ti,s?Fn:ln,s?Fn:ln,0)}portal(e){const t=this._scene,i=this._camera;this._scene=new kc;const r=e();return this._scene=t,this._camera=i,r}blit(e,t,i,r){kt.Blit(this._renderer,e,t,i,r)}compile(e){if(Array.isArray(e))if(e.every(t=>t.isMaterial))kt.compileMaterial(this._renderer,this._scene,this._camera,e);else throw Error("Viewer.compile: unsuport material");else typeof e=="object"?e.isMaterial?kt.compileMaterial(this._renderer,this._scene,this._camera,e):e.isObject3D?(e.meshData.materials&&kt.compileMaterial(this._renderer,this._scene,this._camera,Object.values(e.meshData.materials)),e.meshData.textures&&kt.compileTexture(this._renderer,Object.values(e.meshData.textures)),e.meshData.meshes||kt.compileObject3D(this._renderer,this._scene,this._camera,e)):e.isTexture&&kt.compileTexture(this._renderer,e):kt.compileObject3D(this._renderer,this._scene,this._camera,this._scene)}constructor({root:e,canvas:t,autoStart:i=!0,autoResize:r=!0,shadows:s=!1,camera:a={fov:45,near:.1,far:1e3,position:new j(0,0,4)},targetFrameRate:l=-1,fixedFrameTime:d=!1,colorSpace:h=on,toneMapping:m=lE,toneMappingExposure:u=1,maxDPR:g=1.5,path:v="",resourcePath:w="",dracoPath:T="https://www.gstatic.com/draco/v1/decoders/",orientation:M=Lo.AUTO,loader:b={},tasker:A={},...E}={}){super(),this._instanceId=kt._instanceCount++,this._dpr=1,this._width=1,this._height=1,this._viewport={width:1,height:1,factor:1},this._orientation=Lo.AUTO,this._defaultProps={},this._running=!1,this._rootRotated=!1,this._time=0,this._lastTime=0,this._lastFrameTime=0,this._targetFrameRate=-1,this._fixedFrameTime=!1,this._autoResize=!0;const P=t||document.getElementById("canvas"),G=z4(P,E);if(!G)throw Error("Unsupport WebGL in current platform");this._root=e||P,this._canvas=P,this._gl=G.gl,this._RENDER_TARGET_FLOAT_TYPE=G.RENDER_TARGET_FLOAT_TYPE,this._DATA_FLOAT_TYPE=G.DATA_FLOAT_TYPE,this._dpr=Math.min(g,window.devicePixelRatio),this._orientation=M,this._scene=new kc,this._camera=hd(new mi,a),this._renderer=new WO({canvas:P,context:G.gl}),this._renderer.setPixelRatio(this._dpr),this._renderer.outputColorSpace=h,this._renderer.toneMapping=m,this._renderer.toneMappingExposure=u,this._renderer.shadowMap.enabled=!!s,this._renderer.shadowMap.type=typeof s=="boolean"?oE:s,this._renderer.info.autoReset=!1,this._resourceManager=new Wo,this._loadingManager=new jE(b.onLoad,b.onProgress,b.onError),this._taskManager=new B4(A.onComplete,A.onProgress,A.onError),this._componentManager=new Zh(this),this._pluginManager=new H4(this),this._tweenManager=new l4,this._defaultProps={path:v,resourcePath:w,dracoPath:T,manager:this._loadingManager},this._autoResize=r,this._targetFrameRate=l,this._input=new mt(this),this._input.addEventListeners(),this._addDefaultLoaders(),i&&this.start(),this.resize()}}kt.__target=new j;kt.__worldPos=new j;kt._shadowCameraKeys=["top","bottom","left","right","near","far"];kt.__emtpyObject={};kt.fullscreenMesh=new wn(kt.createFullscreenTriangle());kt.fullscreenCamera=new dl(-1,1,1,-1,0,1);kt._instanceCount=0;class G4{get envMapTarget(){return this._envMapTarget}dispose(){this._sourceTarget.dispose(),this._envMapTarget.dispose(),this._pmremGenerator.dispose()}mergeReflect(e){this._pmremGenerator._copyTexture(this._envMapTarget,this._sourceTarget.texture,e.envMapIntensity),this._pmremGenerator._mergeReflect(this._envMapTarget,this._reflectMap,e.quality),e.envMapTarget=this._envMapTarget,e.lodMax=this._pmremGenerator._lodMeshes.length-1}_getPMREMExtension(e){const t=new gh(e);return t._fromTextureExtension=function(i,r){const s=r?this._fromTexture(r):this._fromCubeTexture(i);return this._cubeMapMaterial=L4(),this._copyTexMaterial=P4(),this._copyMesh=new wn(kt.fullscreenMesh.geometry,this._copyTexMaterial),this._lodMeshes=this._lodPlanes.map(a=>new wn(a,this._cubeMapMaterial)),this._sourceInit=!1,s},t._fromCubeTexture=function(i){return this._setSize(i.image.length===0?16:i.image[0].width||i.image[0].image.width),this._allocateTargets()},t._copyTexture=function(i,r,s=1){const a=this._copyTexMaterial.uniforms;a.map.value=r,a.intensity.value=s,i.scissorTest=!1,Vo(i,0,0,i.width,i.height);const l=this._renderer;l.autoClear=!0,l.setRenderTarget(i),l.render(this._copyMesh,_g),l.setRenderTarget(null)},t._clearTexture=function(i,r){this._copyTexture(i,this._sourceTarget.texture,r)},t._mergeReflect=function(i,r,s){const a=this._renderer,l=a.autoClear,d=this._cubeMapMaterial,h=this._cubeMapMaterial.uniforms;if(h.envMap.value=r,a.autoClear=!1,s===us.HIGH)for(let m=0;m<this._lodMeshes.length-1;m++)h.lod.value=m<5?0:m,this._blit(i,m,d);else if(s===us.MEDIUM)for(let m=0;m<this._lodMeshes.length;m++)m<4?(h.lod.value=0,this._blit(i,m,d)):this._pmremblur(i,m-1,m);else if(s===us.ULTRA){h.lod.value=0,this._blit(i,0,d);for(let m=1;m<this._lodMeshes.length;m++)this._pmremblur(i,m-1,m)}i.scissorTest=!1,Vo(i,0,0,i.width,i.height),a.autoClear=l},t._pmremblur=function(i,r,s){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[r]*this._sigmas[r]),l=PS[r%PS.length];this._blur(i,r,s,a,l)},t._blit=function(i,r,s){const a=this._renderer,l=this._lodMax,d=this._sizeLods[r],h=3*d*(r>l-xh?r-l+xh:0),m=4*(this._cubeSize-d);Vo(i,h,m,3*d,2*d);const u=this._lodMeshes[r];u.material=s,a.autoClear=!1,a.setRenderTarget(i),a.render(u,_g)},t}constructor({envMap:e,reflectMap:t,viewer:i}){this._reflectMap=t,this._pmremGenerator=this._getPMREMExtension(i.renderer),this._envMapTarget=this._pmremGenerator._fromTextureExtension(t,e),this._sourceTarget=this._envMapTarget.clone(),this._pmremGenerator._copyTexture(this._sourceTarget,this._envMapTarget.texture),i.scene.environment=this._envMapTarget.texture}}function IS(n,e){let t=n*n,i=2*Math.PI*t,r=Math.pow(16,e)*1.386294361,s=i*(Math.pow(4,e)+i);return bn.clamp(r/s,0,1)}const DS=10;class V4{get envMapTarget(){return this._envMapTarget}dispose(){this._envMapTarget.dispose(),this._pmremGenerator.dispose()}mergeMipBlur(e){this._setBlurIntensity(e.blurIntensity);const t=this._pmremGenerator._applyMipBlur(this._envMapTarget,this._reflectMap,this._blurMinLod,this._blurMaxLod,this._sigma,e.exposure);this._pmremGenerator._mipCopy(e.envMapTarget,t,e.lodMax,this._blurMinLod)}_setBlurIntensity(e){if(this._blurIntensity!==e){this._blurIntensity=e,this._sigma=bn.lerp(1,40,this._blurIntensity/10);for(let t=0;t<=DS;t++){let i=IS(this._sigma,t);if(i<.002&&(this._blurMinLod=t),i>=1){this._blurMaxLod=t;break}}}}_getPMREMExtension(e){const t=new gh(e);return t._fromTextureExtension=function(i){this._setSize(i.image.length===0?16:i.image[0].width||i.image[0].image.width);const r=this._allocateTargets();return this._mipBlurMaterial=D4(this._lodMax,r.width,r.height),this._mipCopyMaterial=I4(this._lodMax,r.width,r.height),this._lodMeshes=this._lodPlanes.map(s=>new wn(s,this._mipBlurMaterial)),r},t._applyMipBlur=function(i,r,s,a,l,d=1){const h=this._pingPongRenderTarget,m=this._mipBlurMaterial.uniforms;m.envMap.value=r,m.exposure.value=d;let u=a,g=i,v=h;this._mipBlur(i,h,u,1);for(let w=0;u-- >s;w++)g=w&1?i:h,v=(w&1)===1?h:i,this._mipBlur(g,v,u,IS(l,u));return i.scissorTest=!1,Vo(i,0,0,i.width,i.height),g},t._mipBlur=function(i,r,s,a){const l=this._mipBlurMaterial.uniforms;l.cubeUVMap.value=r.texture,l.weight.value=a,l.lod.value=s,this._blit(i,s,this._mipBlurMaterial)},t._mipCopy=function(i,r,s,a=s){const l=this._mipCopyMaterial.uniforms;l.cubeUVMap.value=r.texture,l.lod.value=a,this._blit(i,s,this._mipCopyMaterial),i.scissorTest=!1,Vo(i,0,0,i.width,i.height)},t._blit=function(i,r,s){const a=this._renderer,l=this._lodMax,d=this._sizeLods[r],h=3*d*(r>l-xh?r-l+xh:0),m=4*(this._cubeSize-d);Vo(i,h,m,3*d,2*d);const u=this._lodMeshes[r];u.material=s,a.autoClear=!1,a.setRenderTarget(i),a.render(u,_g)},t}constructor({viewer:e,reflectMap:t}){this._sigma=2,this._blurMinLod=0,this._blurMaxLod=DS,this._blurIntensity=-1,this._reflectMap=t,this._pmremGenerator=this._getPMREMExtension(e.renderer),this._envMapTarget=this._pmremGenerator._fromTextureExtension(t)}}class ia extends X_{get debug(){return this._debug}set debug(e){if(this._debug!==e){if(this._debug=e,e&&this._debugNode===null){const t=this.viewer,i=Nc.Instance(t).scene;this._debugNode=t.addNode(sn,{parent:i}),t.addNode(RS,{parent:this._debugNode,material:new Or({map:this._reflectPass.envMapTarget.texture}),position:new j(1.1,3,0)}),this._mipBlurPass&&t.addNode(RS,{parent:this._debugNode,material:new Or({map:this._mipBlurPass.envMapTarget.texture}),position:new j(0,3,0)})}this._debugNode&&(this._debugNode.visible=e)}}onRender(e){this.manual||((this._elapsed>=this.interval||this._elapsed===0)&&(this._elapsed=0,this._renderFrame()),this._elapsed+=e)}manualFrame(){this.manual&&this._renderFrame()}_renderFrame(){const{renderer:e}=this.viewer,t=e.autoClear,i=e.getRenderTarget(),r=e.getActiveCubeFace(),s=e.getActiveMipmapLevel();e.autoClear=!0,this._mergeInfo.quality=this.quality,this._mergeInfo.exposure=this.reflectExposure,this._mergeInfo.envMapIntensity=this.envMapIntensity,this._mergeInfo.blurIntensity=this.reflectBlurIntensity,this.quality!==us.LOW&&this._cubeCamera.update(e,this._scene),this._reflectPass.mergeReflect(this._mergeInfo),this.quality===us.HIGH&&(this._mipBlurPass===void 0&&(this._mipBlurPass=new V4({viewer:this.viewer,reflectMap:this._cubeCamera.renderTarget.texture})),this._mipBlurPass.mergeMipBlur(this._mergeInfo)),e.autoClear=t,e.setRenderTarget(i,r,s)}constructor({envMap:e,scene:t,near:i,far:r,layer:s=0,resolution:a=256,floatType:l=gi,position:d=new j(0,1,0)}={}){super(),this._mergeInfo={quality:us.HIGH,envMapTarget:null,envMapIntensity:1,blurIntensity:1,lodMax:0,exposure:1},this._debug=!1,this._debugNode=null,this._elapsed=0,this.quality=us.HIGH,this.envMapIntensity=1,this.reflectExposure=1,this.reflectBlurIntensity=5,this.interval=0,this.manual=!1,this.install=()=>{const h=this.viewer;this._scene=t||h.scene;const m=h.createCubeRenderTarget(a,!1,l,0,!0,!0);this._cubeCamera=new RE(i||h.camera.near,r||h.camera.far,m),this._cubeCamera.position.copy(d),this._cubeCamera.layers.mask=s;const u=m.texture;this._reflectPass=new G4({viewer:h,reflectMap:u,envMap:e})},this.uninstall=()=>{this._reflectPass.dispose(),this._mipBlurPass&&this._mipBlurPass.dispose()}}}ia.Quality=us;Et([rt],ia.prototype,"debug",null);Et([rt({value:us})],ia.prototype,"quality",void 0);Et([rt({min:0,max:1,step:.01})],ia.prototype,"envMapIntensity",void 0);Et([rt({min:0,max:10,step:.01})],ia.prototype,"reflectExposure",void 0);Et([rt({min:0,max:10,step:.1})],ia.prototype,"reflectBlurIntensity",void 0);Et([rt],ia.prototype,"interval",void 0);Et([rt],ia.prototype,"manual",void 0);class Qh extends X_{get debug(){return this._debug}set debug(e){this._debug!==e&&(this._debug=e,e&&this._helper===null&&(this._helper=new VN(new Pr(this._boxMin,this._boxMax)),Nc.Instance(this.viewer).add(this._helper)),this._helper&&(this._helper.visible=e))}get center(){return this._center}set center(e){this._center.copy(e)}get boxMin(){return this._boxMin}set boxMin(e){this._boxMin.copy(e)}get boxMax(){return this._boxMax}set boxMax(e){this._boxMax.copy(e)}onUpdate(e){this._debug&&this._helper.updateMatrixWorld()}useBoxProjection(e){e.defines.USE_BOX_PROJECTION=!0,e.uniforms.probePos={value:this._center},e.uniforms.probeBoxMin={value:this._boxMin},e.uniforms.probeBoxMax={value:this._boxMax}}constructor(){super(),this._center=new $t(0,.5,0,1),this._boxMin=new j(0,0,0),this._boxMax=new j(1,1,1),this._helper=null,this._debug=!1,this.install=()=>{ki.physical.vertexShader=ki.physical.vertexShader.replace(/#ifdef USE_TRANSMISSION/g,`
#if defined(USE_TRANSMISSION) || defined(USE_BOX_PROJECTION)
`),ki.physical.fragmentShader=ki.physical.fragmentShader.replace("varying vec3 vViewPosition;",`
varying vec3 vViewPosition;
#if defined(USE_BOX_PROJECTION)
varying vec3 vWorldPosition;
#endif
`),xt.worldpos_vertex=xt.worldpos_vertex.replace("#if defined( USE_ENVMAP )","#if defined( USE_ENVMAP ) || defined( USE_BOX_PROJECTION )"),xt.envmap_physical_pars_fragment=xt.envmap_physical_pars_fragment.replace("#ifdef USE_ENVMAP",`
#ifdef USE_ENVMAP
#if defined(USE_BOX_PROJECTION)
uniform vec4 probePos;
uniform vec3 probeBoxMin;
uniform vec3 probeBoxMax;
vec3 boxProjection(vec3 nrdir, vec3 worldPos, vec3 probePos, vec3 boxMin, vec3 boxMax) {
vec3 tbot = boxMin - worldPos;
vec3 ttop = boxMax - worldPos;
vec3 tmax = mix(tbot, ttop, step(vec3(0), nrdir));
tmax /= nrdir;
float t = min(min(tmax.x, tmax.y), tmax.z);
return worldPos + nrdir * t - probePos;
}
#endif
`).replace("reflectVec = inverseTransformDirection( reflectVec, viewMatrix );",`
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
#if defined(USE_BOX_PROJECTION)
if (probePos.w > 0.001) {
reflectVec = boxProjection(reflectVec, vWorldPosition, probePos.xyz, probeBoxMin.xyz, probeBoxMax.xyz);
}
#endif
`).replace("vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );",`
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#if defined(USE_BOX_PROJECTION)
if (probePos.w > 0.001) {
worldNormal = boxProjection(worldNormal, vWorldPosition, probePos.xyz, probeBoxMin.xyz, probeBoxMax.xyz);
}
#endif
`)},this.uninstall=()=>{Nc.Instance(this.viewer).remove(this._helper)}}}Et([rt],Qh.prototype,"debug",null);Et([rt],Qh.prototype,"center",null);Et([rt],Qh.prototype,"boxMin",null);Et([rt],Qh.prototype,"boxMax",null);class W4 extends Nn{constructor(){super(...arguments);Ve(this,"extension",["bin"]);Ve(this,"_loader");Ve(this,"_dracoLoader")}load({url:t,buffer:i,path:r,resourcePath:s,dracoPath:a,manager:l,onLoad:d,onProgress:h,onError:m}){let u=this._dracoLoader;u===void 0&&(u=this._dracoLoader=new z_),u.manager=l,u.setDecoderPath(a);let g=this._loader;g===void 0&&(g=this._loader=new $4,g.setDRACOLoader(u),g.setMeshoptDecoder(H_)),g.manager=l,g.setPath(r),g.setResourcePath(s);const v=w=>{const T=w.scene;T.animations.push(...w.animations),d(Nn._setUserData(T))};i?g.parse(i,s,v,m):g.load(t,v,h,m)}}const j4=255,X4="glTF",fd=12;function kS(n,e){for(let t=0,i=n.length;t<i;t++)n[t]^=e;return n}function Y4(n,e=j4){kS(new Uint8Array(n,0,4),e);const t=new DataView(n,0,fd),r={magic:new TextDecoder().decode(new Uint8Array(n.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)};if(r.magic!==X4)throw new Error("Unsupported glTF-Binary header.");if(r.version<2)throw new Error("Legacy binary file detected.");const s=r.length-fd,a=new DataView(n,fd);let l=0;for(;l<s;){const d=a.getUint32(l,!0);l+=4,kS(new Uint8Array(n,fd+l,d+4),e),l+=4,l+=d}return n}class $4 extends B_{parse(e,t,i,r){super.parse(Y4(e),t,i,r)}}class q4 extends EventTarget{constructor(){super();Ve(this,"api_base");this.api_base=location.host}apiURL(t){return this.api_base+t}}const K4=new q4,xa=class xa{static loadAsset(e,t,i=t.url){const r=t.url;if(!r)return Promise.resolve("");if(t.ext==="mtl"){t.ext="mtl";const s=r.substring(0,Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\")))+"/",d=r.split(".").join(".").replace(/^.*[\\\/]/,"")+".mtl";t.path=K4.apiURL("/viewfile?"+new URLSearchParams({filepath:s})),t.url=d}else/\.obj/.test(t.url)?t.ext="obj":/\.glb/.test(t.url)?(t.ext="glb",t.dracoPath="https://unpkg.com/three@latest/examples/jsm/libs/draco/gltf/"):/\.jpg/.test(t.url)?t.ext="jpg":/\.stl/.test(t.url)?t.ext="stl":/\.fbx/.test(t.url)?t.ext="fbx":/\.usdz/.test(t.url)?t.ext="usdz":/\.png/.test(t.url)&&(t.ext="png");return e.loadAsset(t).then(s=>(xa.resource.set(i,s),s))}static getRes(e){const t=e.split("?")[0];return xa.resource.get(t)}static clear(){xa.resource.clear()}static setRes(e,t){xa.resource.set(e,t)}};Ve(xa,"resource",new Map);let wh=xa;const Z4=wh.clear,ho=wh.loadAsset;class Q4{constructor(e){Ve(this,"flags",{});this.viewer=e}}var J4=Object.defineProperty,ez=Object.getOwnPropertyDescriptor,Mn=(n,e,t,i)=>{for(var r=i>1?void 0:i?ez(e,t):e,s=n.length-1,a;s>=0;s--)(a=n[s])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&J4(e,t,r),r};const{clamp:hc,degToRad:tz}=bn,{abs:nz,tan:iz,PI:rz}=Math,pd=rz*2,kp=.001;function Vl(n,e,t,i,r=.001){if(i<=0)return e;let s=e-n;if(s>0){const a=(s+r)*hc(i*t,0,1);return a>s?e:n+a}else if(s<0){const a=(s-r)*hc(i*t,0,1);return a<s?e:n+a}else return e}var Hn;const vn=(Hn=class extends W_{constructor(){super();Ve(this,"_button",-1);Ve(this,"_touchID",-1);Ve(this,"_preLoc0",new et);Ve(this,"_preLoc1",new et);Ve(this,"_spherical",new N_(4,Math.PI/2));Ve(this,"_lookAt",new j);Ve(this,"_autoRotate",0);Ve(this,"_tempSmoothing",6);Ve(this,"_tempRotateSmoothing",8);Ve(this,"_targetTheta",0);Ve(this,"_targetPhi",0);Ve(this,"_targetSpringLength",4);Ve(this,"_handlerId",0);Ve(this,"_targetFov",this.fov);Ve(this,"_targetLookAt",new j);Ve(this,"forbidX",!1);Ve(this,"forbidY",!1);Ve(this,"forbidZ",!1);Ve(this,"forbidPanX",!1);Ve(this,"forbidPanY",!1);Ve(this,"forbitPanOffsetY",!1);Ve(this,"panSpeed",1);Ve(this,"rotateSpeed",1);Ve(this,"scaleSpeed",1);Ve(this,"smoothing",5);Ve(this,"rotateSmoothing",5);Ve(this,"phiMin",kp);Ve(this,"phiMax",Math.PI-kp);Ve(this,"thetaMin",-1/0);Ve(this,"thetaMax",1/0);Ve(this,"distanceMin",kp);Ve(this,"distanceMax",1/0);Ve(this,"dom",null)}get autoRotate(){return this._autoRotate}set autoRotate(t){this._autoRotate=t,cancelAnimationFrame(this._handlerId),t&&this._calculateAutoRotate()}get lookAt(){return this._lookAt}set lookAt(t){this._lookAt.copy(t),this._targetLookAt.copy(t)}get springLength(){return this._spherical.radius}set springLength(t){this._spherical.radius=this._targetSpringLength=t}get theta(){return this._spherical.theta}set theta(t){this._spherical.theta=this._targetTheta=t}get phi(){return this._spherical.phi}set phi(t){this._spherical.phi=this._targetPhi=t}get fov(){return this.lens.fov}set fov(t){this.lens.fov=this._targetFov=t}onEnable(){this.viewer.on(mt.POINTER_DOWN,this._onPointerDown,this),this.viewer.on(mt.MOUSE_WHEEL,this._onMouseWheel,this),this.viewer.on(mt.TOUCH_START,this._onTouchStart,this),this.viewer.on(mt.TOUCH_MOVE,this._onTouchMove,this),window.addEventListener(mt.POINTER_MOVE,this._onPointerMove.bind(this),{passive:!1}),window.addEventListener(mt.POINTER_UP,this._onPointerUp.bind(this),{passive:!1}),this.reset()}onDisable(){this.viewer.off(mt.POINTER_DOWN,this._onPointerDown,this),this.viewer.off(mt.MOUSE_WHEEL,this._onMouseWheel,this),this.viewer.off(mt.TOUCH_START,this._onTouchStart,this),this.viewer.off(mt.TOUCH_MOVE,this._onTouchMove,this),window.removeEventListener(mt.POINTER_MOVE,this._onPointerMove.bind(this)),window.removeEventListener(mt.POINTER_UP,this._onPointerUp.bind(this))}reset(){this._button=-1,this._touchID=-1,this._targetTheta=this.theta,this._targetPhi=this.phi,this._targetSpringLength=this.springLength,this._targetLookAt.copy(this._lookAt),this._targetFov=this.lens.fov}_onPointerDown(t){Mt.isMobile||(this._button=t.button,this._preLoc0.set(t.pageX,t.pageY))}_onPointerUp(t){Mt.isMobile||(this._button=-1)}_onPointerMove(t){if(Mt.isMobile||!this._preLoc0)return;const{__loc0:i,__panDelta:r,__rotateDelta:s}=Hn;switch(i.set(t.pageX,t.pageY),this._button){case 0:this._calculateRotatelDelta(s,this._preLoc0,i),this._calculateTargetSpringArm(s);break;case 1:case 2:this._calculatePanDelta(r,this._preLoc0,i),this._calculateTargetLookAt(r);break}this._preLoc0.copy(i)}_onMouseWheel(t){t.preventDefault(),this._handleMouseWheel(this._customWheelEvent(t)),this._calculateTargetSpringArm()}_getZoomScale(t){const i=Math.abs(t*.01);return Math.pow(.95,this.scaleSpeed*i)}_dollyOut(t){this._targetSpringLength*=this._calculateDistanceScale(1/t)}_dollyIn(t){this._targetSpringLength*=this._calculateDistanceScale(t)}_handleMouseWheel(t){t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY))}_customWheelEvent(t){const i=t.deltaMode,r={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(i){case 1:r.deltaY*=16;break;case 2:r.deltaY*=100;break}return t.ctrlKey&&(r.deltaY*=10),r}_onTouchStart(t){if(!Mt.isMobile)return;let i=t.touches;i.length>1?(this._preLoc0.set(i[0].pageX,i[0].pageY),this._preLoc1.set(i[1].pageX,i[1].pageY)):i.length>0&&(this._touchID=i[0].identifier,this._preLoc0.set(i[0].pageX,i[0].pageY))}_onTouchMove(t){if(!Mt.isMobile)return;const{__loc0:i,__loc1:r,__panDelta:s,__rotateDelta:a,__preCenter:l,__center:d}=Hn;let h=t.touches;h.length>1?(i.set(h[0].pageX,h[0].pageY),r.set(h[1].pageX,h[1].pageY),this.lookAt&&(this._targetSpringLength*=this._calculateDistanceScale(this._preLoc0.distanceTo(this._preLoc1)/i.distanceTo(r))),l.copy(this._preLoc0).add(this._preLoc1).multiplyScalar(.5),d.copy(i).add(r).multiplyScalar(.5),this._calculatePanDelta(s,l,d),this._calculateTargetLookAt(s),this._calculateTargetSpringArm(),this._preLoc0.copy(i),this._preLoc1.copy(r)):h.length>0&&this._touchID===h[0].identifier&&(i.set(h[0].pageX,h[0].pageY),this._calculateRotatelDelta(a,this._preLoc0,i),this._calculateTargetSpringArm(a),this._preLoc0.copy(i))}_calculateDistanceScale(t){return this._tempRotateSmoothing=this.rotateSmoothing,this.forbidZ&&(t=1),t}_calculateAutoRotate(){const{__rotateDelta:t}=Hn;t.y=0,t.x=this._autoRotate,this._calculateTargetSpringArm(t),this._handlerId=requestAnimationFrame(this._calculateAutoRotate.bind(this))}_calculateRotatelDelta(t,i,r){this._tempRotateSmoothing=this.rotateSmoothing;const s=this.viewer.canvas;return t.copy(r).sub(i).multiplyScalar(this.rotateSpeed*2*Math.PI/s.clientHeight),t.y=-t.y,this.forbidX&&(t.x=0),this.forbidY&&(t.y=0),t}_calculatePanDelta(t,i,r){this._tempRotateSmoothing=this.rotateSmoothing;const s=this.viewer.canvas;return t.copy(r).sub(i).multiplyScalar(this.panSpeed/s.clientHeight),this.forbidPanX&&(t.x=0),this.forbidPanY&&(t.y=0),t}_calculateTargetLookAt(t){const{__xAxis:i,__yAxis:r,__posDelta:s}=Hn;i.setFromMatrixColumn(this.node.matrix,0),r.setFromMatrixColumn(this.node.matrix,1),this.forbitPanOffsetY&&(r.y=0,r.normalize()),s.copy(this.node.position).sub(this.lookAt);const a=s.length()*2*iz(tz(this.fov*.5));this._targetLookAt.sub(i.multiplyScalar(t.x*a)).add(r.multiplyScalar(t.y*a))}_calculateTargetSpringArm(t,i){t&&(this._targetTheta-=t.x,this._targetPhi+=t.y),i&&(this._targetSpringLength=i),this._targetTheta=hc(this._targetTheta,this.thetaMin,this.thetaMax),this._targetPhi=hc(this._targetPhi,this.phiMin,this.phiMax),this._targetSpringLength=hc(this._targetSpringLength,this.distanceMin,this.distanceMax)}gotoPOI({springLength:t=this._targetSpringLength,theta:i=this._targetTheta,phi:r=this._targetPhi,lookAt:s=this._lookAt,fov:a=this.lens.fov,smoothing:l=this.smoothing,rotateSmoothing:d=l}){this._targetFov=a,this._tempSmoothing=l,this._tempRotateSmoothing=d,this._targetLookAt.copy(s);const h=i%pd,m=this._spherical.theta=this._spherical.theta%pd,u=[h,h-pd,h+pd],g=u.map(w=>nz(m-w)),v=Math.min(...g);this._targetTheta=u[g.findIndex(w=>w===v)],this._targetSpringLength=t,this._targetPhi=r,this._calculateTargetSpringArm()}update(t){const i=this._tempSmoothing,r=this._tempRotateSmoothing;if(this._autoRotate&&this._spherical.theta===this._targetTheta){this._targetTheta-=this._autoRotate,this._targetTheta<-Math.PI?this._targetTheta+=2*Math.PI:this._targetTheta>Math.PI&&(this._targetTheta-=2*Math.PI),this._spherical.theta=Vl(this._spherical.theta,this._targetTheta,t,0),this.node.position.setFromSpherical(this._spherical).add(this._lookAt);return}this._spherical.theta=Vl(this._spherical.theta,this._targetTheta,t,r),this._spherical.phi=Vl(this._spherical.phi,this._targetPhi,t,r),this._spherical.radius=Vl(this._spherical.radius,this._targetSpringLength,t,i,.01),this.lens.fov=Vl(this.lens.fov,this._targetFov,t,i),pT(this._lookAt,this._targetLookAt,t,i),this.node.position.setFromSpherical(this._spherical).add(this._lookAt),this.node.lookAt(this._lookAt)}},Ve(Hn,"__loc0",new et),Ve(Hn,"__loc1",new et),Ve(Hn,"__center",new et),Ve(Hn,"__preCenter",new et),Ve(Hn,"__panDelta",new et),Ve(Hn,"__panTarget",new et),Ve(Hn,"__rotateDelta",new et),Ve(Hn,"__posDelta",new j),Ve(Hn,"__xAxis",new j),Ve(Hn,"__yAxis",new j),Ve(Hn,"__quat",new Gn),Hn);Mn([rt()],vn.prototype,"autoRotate",1);Mn([rt({dir:"set"})],vn.prototype,"forbidX",2);Mn([rt({dir:"set"})],vn.prototype,"forbidY",2);Mn([rt({dir:"set"})],vn.prototype,"forbidZ",2);Mn([rt({dir:"set"})],vn.prototype,"forbidPanX",2);Mn([rt({dir:"set"})],vn.prototype,"forbidPanY",2);Mn([rt({dir:"set"})],vn.prototype,"forbitPanOffsetY",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"panSpeed",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"rotateSpeed",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"scaleSpeed",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"smoothing",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"rotateSmoothing",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"phiMin",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"phiMax",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"thetaMin",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"thetaMax",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"distanceMin",2);Mn([rt({dir:"set",step:.01})],vn.prototype,"distanceMax",2);Mn([rt({dir:"set"})],vn.prototype,"dom",2);Mn([rt({step:.01})],vn.prototype,"lookAt",1);Mn([rt({step:.01})],vn.prototype,"springLength",1);Mn([rt({step:.01})],vn.prototype,"theta",1);Mn([rt({step:.01})],vn.prototype,"phi",1);Mn([rt],vn.prototype,"fov",1);let sz=vn;function mT(n,e){n.uniforms.uEdge=e,n.vertexShader=n.vertexShader.replace("void main() {",`
attribute vec3 center;
attribute vec2 edgeUv;
varying vec2 vEdgeUv;
void main() {
vEdgeUv = edgeUv;
`),n.fragmentShader=n.fragmentShader.replace("void main() {",`
uniform float uEdge;
varying vec3 vCenter;
varying vec2 vEdgeUv;
float smoothedge(float v) {
float th = 0.03;
float w = fwidth(v) * 0.5;
return (1. - smoothstep(th - w, th + w, v)) + smoothstep(1. - th - w, 1. - th + w, v);
}
void main() {
`).replace("#include <opaque_fragment>",`
float edge = smoothedge(vEdgeUv.x) + smoothedge(vEdgeUv.y);
outgoingLight = mix(outgoingLight, outgoingLight * vec3(0.3), edge * uEdge);
#include <opaque_fragment>
`)}function FS(n,e){xt.normal_fragment_begin.indexOf("USE_FLAT")===-1&&(xt.normal_fragment_begin=xt.normal_fragment_begin.replace("vec3 normal = normalize( vNormal );",`
#ifdef USE_FLAT
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 flatNormal = normalize( cross( fdx, fdy ) );
vec3 normal = mix(normalize( vNormal ), flatNormal, uFlat);
#else
vec3 normal = normalize( vNormal );
#endif
`)),n.uniforms.uFlat=e,n.fragmentShader=n.fragmentShader.replace("void main() {",`
#define USE_FLAT
uniform float uFlat;
void main() {
`)}const Fp={renderMode:"Geometry",loaded:!1,ModelAssets:{model:"",texture_diffuse:"",texture_normal:"",texture_pbr:"",shaded:""}};class az{constructor(){Ve(this,"_changed",0);Ve(this,"_events",new G_);Ve(this,"states",new Proxy(Fp,{get:(e,t)=>e[t],set:(e,t,i)=>(e[t]!==i&&(e[t]=i,this._changed++,this._events.emit("CHANGED",this._changed,t,i)),!0)}))}onChanged(e){this._events.on("CHANGED",(t,i,r)=>{e(i,r)})}addModel(e){this._events.emit("addModel",e)}onAddModel(e){this._events.on("addModel",e)}offAddModel(e){this._events.off("addModel",e)}syncCameraPosition(e){this._events.emit("syncCameraPosition",e)}onSyncCameraPosition(e){this._events.on("syncCameraPosition",e)}offSyncCameraPosition(e){this._events.off("syncCameraPosition",e)}tracerToWebGLCameraPosition(e){this._events.emit("tracerToWebGLCameraPosition",e)}onTracerToWebGLCameraPosition(e){this._events.on("tracerToWebGLCameraPosition",e)}offTracerToWebGLCameraPosition(e){this._events.off("tracerToWebGLCameraPosition",e)}loading(e){this._events.emit("loading",e)}onLoading(e){this._events.on("loading",e)}offLoading(e){this._events.off("loading",e)}init(){this._changed++;for(let e in Fp)this._events.emit("CHANGED",this._changed,e,Fp[e])}destroy(){this._events.clear()}}const oz=function(){const[n,e]=Xn.useState(0);return Xn.useEffect(()=>(Nd._events.on("CHANGED",e),()=>{Nd._events.off("CHANGED",e)}),[]),Nd},Nd=new az,rr=[Nd],lz=[oz];class cz{constructor(e,t={}){this.enabled=!0;const i=t.defaultThickness!==void 0?t.defaultThickness:.003,r=new Je().fromArray(t.defaultColor!==void 0?t.defaultColor:[0,0,0]),s=t.defaultAlpha!==void 0?t.defaultAlpha:1,a=t.defaultKeepAlive!==void 0?t.defaultKeepAlive:!1,l={},d=60,h={},m={},u={outlineThickness:{value:i},outlineColor:{value:r},outlineAlpha:{value:s}},g=["#include <common>","#include <uv_pars_vertex>","#include <displacementmap_pars_vertex>","#include <fog_pars_vertex>","#include <morphtarget_pars_vertex>","#include <skinning_pars_vertex>","#include <logdepthbuf_pars_vertex>","#include <clipping_planes_pars_vertex>","uniform float outlineThickness;","vec4 calculateOutline( vec4 pos, vec3 normal, vec4 skinned ) {"," float thickness = outlineThickness;"," const float ratio = 1.0;"," vec4 pos2 = projectionMatrix * modelViewMatrix * vec4( skinned.xyz + normal, 1.0 );"," vec4 norm = normalize( pos - pos2 );"," return pos + norm * thickness * pos.w * ratio;","}","void main() {"," #include <uv_vertex>"," #include <beginnormal_vertex>"," #include <morphnormal_vertex>"," #include <skinbase_vertex>"," #include <skinnormal_vertex>"," #include <begin_vertex>"," #include <morphtarget_vertex>"," #include <skinning_vertex>"," #include <displacementmap_vertex>"," #include <project_vertex>"," vec3 outlineNormal = - objectNormal;"," gl_Position = calculateOutline( gl_Position, outlineNormal, vec4( transformed, 1.0 ) );"," #include <logdepthbuf_vertex>"," #include <clipping_planes_vertex>"," #include <fog_vertex>","}"].join(`
`),v=["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","#include <clipping_planes_pars_fragment>","uniform vec3 outlineColor;","uniform float outlineAlpha;","void main() {"," #include <clipping_planes_fragment>"," #include <logdepthbuf_fragment>"," gl_FragColor = vec4( outlineColor, outlineAlpha );"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>"," #include <premultiplied_alpha_fragment>","}"].join(`
`);function w(){return new zi({type:"OutlineEffect",uniforms:AE.merge([Ze.fog,Ze.displacementmap,u]),vertexShader:g,fragmentShader:v,side:Ei})}function T(F){let D=l[F.uuid];return D===void 0&&(D={material:w(),used:!0,keepAlive:a,count:0},l[F.uuid]=D),D.used=!0,D.material}function M(F){const D=T(F);return h[D.uuid]=F,O(D,F),D}function b(F){const D=F.geometry,L=D!==void 0&&D.attributes.normal!==void 0;return F.isMesh===!0&&F.material!==void 0&&L===!0}function A(F){if(b(F)!==!1){if(Array.isArray(F.material))for(let D=0,L=F.material.length;D<L;D++)F.material[D]=M(F.material[D]);else F.material=M(F.material);m[F.uuid]=F.onBeforeRender,F.onBeforeRender=P}}function E(F){if(b(F)!==!1){if(Array.isArray(F.material))for(let D=0,L=F.material.length;D<L;D++)F.material[D]=h[F.material[D].uuid];else F.material=h[F.material.uuid];F.onBeforeRender=m[F.uuid]}}function P(F,D,L,V,ie){const re=h[ie.uuid];re!==void 0&&G(ie,re)}function G(F,D){const L=D.userData.outlineParameters;F.uniforms.outlineAlpha.value=D.opacity,L!==void 0&&(L.thickness!==void 0&&(F.uniforms.outlineThickness.value=L.thickness),L.color!==void 0&&F.uniforms.outlineColor.value.fromArray(L.color),L.alpha!==void 0&&(F.uniforms.outlineAlpha.value=L.alpha)),D.displacementMap&&(F.uniforms.displacementMap.value=D.displacementMap,F.uniforms.displacementScale.value=D.displacementScale,F.uniforms.displacementBias.value=D.displacementBias)}function O(F,D){if(F.name==="invisible")return;const L=D.userData.outlineParameters;F.fog=D.fog,F.toneMapped=D.toneMapped,F.premultipliedAlpha=D.premultipliedAlpha,F.displacementMap=D.displacementMap,L!==void 0?(D.visible===!1?F.visible=!1:F.visible=L.visible!==void 0?L.visible:!0,F.transparent=L.alpha!==void 0&&L.alpha<1?!0:D.transparent,L.keepAlive!==void 0&&(l[D.uuid].keepAlive=L.keepAlive)):(F.transparent=D.transparent,F.visible=D.visible),(D.wireframe===!0||D.depthTest===!1)&&(F.visible=!1),D.clippingPlanes&&(F.clipping=!0,F.clippingPlanes=D.clippingPlanes,F.clipIntersection=D.clipIntersection,F.clipShadows=D.clipShadows),F.version=D.version}function B(){let F;F=Object.keys(h);for(let D=0,L=F.length;D<L;D++)h[F[D]]=void 0;F=Object.keys(m);for(let D=0,L=F.length;D<L;D++)m[F[D]]=void 0;F=Object.keys(l);for(let D=0,L=F.length;D<L;D++){const V=F[D];l[V].used===!1?(l[V].count++,l[V].keepAlive===!1&&l[V].count>d&&delete l[V]):(l[V].used=!1,l[V].count=0)}}this.render=function(F,D){if(this.enabled===!1){e.render(F,D);return}const L=e.autoClear;e.autoClear=this.autoClear,e.render(F,D),e.autoClear=L,this.renderOutline(F,D)},this.renderOutline=function(F,D){const L=e.autoClear,V=F.matrixWorldAutoUpdate,ie=F.background,re=e.shadowMap.enabled;F.matrixWorldAutoUpdate=!1,F.background=null,e.autoClear=!1,e.shadowMap.enabled=!1,F.traverse(A),e.render(F,D),F.traverse(E),B(),F.matrixWorldAutoUpdate=V,F.background=ie,e.autoClear=L,e.shadowMap.enabled=re},this.autoClear=e.autoClear,this.domElement=e.domElement,this.shadowMap=e.shadowMap,this.clear=function(F,D,L){e.clear(F,D,L)},this.getPixelRatio=function(){return e.getPixelRatio()},this.setPixelRatio=function(F){e.setPixelRatio(F)},this.getSize=function(F){return e.getSize(F)},this.setSize=function(F,D,L){e.setSize(F,D,L)},this.setViewport=function(F,D,L,V){e.setViewport(F,D,L,V)},this.setScissor=function(F,D,L,V){e.setScissor(F,D,L,V)},this.setScissorTest=function(F){e.setScissorTest(F)},this.setRenderTarget=function(F){e.setRenderTarget(F)}}}class uz extends D_{constructor(e){super(e)}parse(e){function t($){switch($.image_type){case g:case T:if($.colormap_length>256||$.colormap_size!==24||$.colormap_type!==1)throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case v:case w:case M:case b:if($.colormap_type)throw new Error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case u:throw new Error("THREE.TGALoader: No data.");default:throw new Error("THREE.TGALoader: Invalid type "+$.image_type)}if($.width<=0||$.height<=0)throw new Error("THREE.TGALoader: Invalid image size.");if($.pixel_size!==8&&$.pixel_size!==16&&$.pixel_size!==24&&$.pixel_size!==32)throw new Error("THREE.TGALoader: Invalid pixel size "+$.pixel_size)}function i($,ue,Y,pe,_e){let Ae,Pe;const Ue=Y.pixel_size>>3,ae=Y.width*Y.height*Ue;if(ue&&(Pe=_e.subarray(pe,pe+=Y.colormap_length*(Y.colormap_size>>3))),$){Ae=new Uint8Array(ae);let ge,ce,Me,Ye=0;const ht=new Uint8Array(Ue);for(;Ye<ae;)if(ge=_e[pe++],ce=(ge&127)+1,ge&128){for(Me=0;Me<Ue;++Me)ht[Me]=_e[pe++];for(Me=0;Me<ce;++Me)Ae.set(ht,Ye+Me*Ue);Ye+=Ue*ce}else{for(ce*=Ue,Me=0;Me<ce;++Me)Ae[Ye+Me]=_e[pe++];Ye+=ce}}else Ae=_e.subarray(pe,pe+=ue?Y.width*Y.height:ae);return{pixel_data:Ae,palettes:Pe}}function r($,ue,Y,pe,_e,Ae,Pe,Ue,ae){const ge=ae;let ce,Me=0,Ye,ht;const ft=L.width;for(ht=ue;ht!==pe;ht+=Y)for(Ye=_e;Ye!==Pe;Ye+=Ae,Me++)ce=Ue[Me],$[(Ye+ft*ht)*4+3]=255,$[(Ye+ft*ht)*4+2]=ge[ce*3+0],$[(Ye+ft*ht)*4+1]=ge[ce*3+1],$[(Ye+ft*ht)*4+0]=ge[ce*3+2];return $}function s($,ue,Y,pe,_e,Ae,Pe,Ue){let ae,ge=0,ce,Me;const Ye=L.width;for(Me=ue;Me!==pe;Me+=Y)for(ce=_e;ce!==Pe;ce+=Ae,ge+=2)ae=Ue[ge+0]+(Ue[ge+1]<<8),$[(ce+Ye*Me)*4+0]=(ae&31744)>>7,$[(ce+Ye*Me)*4+1]=(ae&992)>>2,$[(ce+Ye*Me)*4+2]=(ae&31)<<3,$[(ce+Ye*Me)*4+3]=ae&32768?0:255;return $}function a($,ue,Y,pe,_e,Ae,Pe,Ue){let ae=0,ge,ce;const Me=L.width;for(ce=ue;ce!==pe;ce+=Y)for(ge=_e;ge!==Pe;ge+=Ae,ae+=3)$[(ge+Me*ce)*4+3]=255,$[(ge+Me*ce)*4+2]=Ue[ae+0],$[(ge+Me*ce)*4+1]=Ue[ae+1],$[(ge+Me*ce)*4+0]=Ue[ae+2];return $}function l($,ue,Y,pe,_e,Ae,Pe,Ue){let ae=0,ge,ce;const Me=L.width;for(ce=ue;ce!==pe;ce+=Y)for(ge=_e;ge!==Pe;ge+=Ae,ae+=4)$[(ge+Me*ce)*4+2]=Ue[ae+0],$[(ge+Me*ce)*4+1]=Ue[ae+1],$[(ge+Me*ce)*4+0]=Ue[ae+2],$[(ge+Me*ce)*4+3]=Ue[ae+3];return $}function d($,ue,Y,pe,_e,Ae,Pe,Ue){let ae,ge=0,ce,Me;const Ye=L.width;for(Me=ue;Me!==pe;Me+=Y)for(ce=_e;ce!==Pe;ce+=Ae,ge++)ae=Ue[ge],$[(ce+Ye*Me)*4+0]=ae,$[(ce+Ye*Me)*4+1]=ae,$[(ce+Ye*Me)*4+2]=ae,$[(ce+Ye*Me)*4+3]=255;return $}function h($,ue,Y,pe,_e,Ae,Pe,Ue){let ae=0,ge,ce;const Me=L.width;for(ce=ue;ce!==pe;ce+=Y)for(ge=_e;ge!==Pe;ge+=Ae,ae+=2)$[(ge+Me*ce)*4+0]=Ue[ae+0],$[(ge+Me*ce)*4+1]=Ue[ae+0],$[(ge+Me*ce)*4+2]=Ue[ae+0],$[(ge+Me*ce)*4+3]=Ue[ae+1];return $}function m($,ue,Y,pe,_e){let Ae,Pe,Ue,ae,ge,ce;switch((L.flags&A)>>E){default:case O:Ae=0,Ue=1,ge=ue,Pe=0,ae=1,ce=Y;break;case P:Ae=0,Ue=1,ge=ue,Pe=Y-1,ae=-1,ce=-1;break;case B:Ae=ue-1,Ue=-1,ge=-1,Pe=0,ae=1,ce=Y;break;case G:Ae=ue-1,Ue=-1,ge=-1,Pe=Y-1,ae=-1,ce=-1;break}if(re)switch(L.pixel_size){case 8:d($,Pe,ae,ce,Ae,Ue,ge,pe);break;case 16:h($,Pe,ae,ce,Ae,Ue,ge,pe);break;default:throw new Error("THREE.TGALoader: Format not supported.")}else switch(L.pixel_size){case 8:r($,Pe,ae,ce,Ae,Ue,ge,pe,_e);break;case 16:s($,Pe,ae,ce,Ae,Ue,ge,pe);break;case 24:a($,Pe,ae,ce,Ae,Ue,ge,pe);break;case 32:l($,Pe,ae,ce,Ae,Ue,ge,pe);break;default:throw new Error("THREE.TGALoader: Format not supported.")}return $}const u=0,g=1,v=2,w=3,T=9,M=10,b=11,A=48,E=4,P=0,G=1,O=2,B=3;if(e.length<19)throw new Error("THREE.TGALoader: Not enough data to contain header.");let F=0;const D=new Uint8Array(e),L={id_length:D[F++],colormap_type:D[F++],image_type:D[F++],colormap_index:D[F++]|D[F++]<<8,colormap_length:D[F++]|D[F++]<<8,colormap_size:D[F++],origin:[D[F++]|D[F++]<<8,D[F++]|D[F++]<<8],width:D[F++]|D[F++]<<8,height:D[F++]|D[F++]<<8,pixel_size:D[F++],flags:D[F++]};if(t(L),L.id_length+F>e.length)throw new Error("THREE.TGALoader: No data.");F+=L.id_length;let V=!1,ie=!1,re=!1;switch(L.image_type){case T:V=!0,ie=!0;break;case g:ie=!0;break;case M:V=!0;break;case v:break;case b:V=!0,re=!0;break;case w:re=!0;break}const de=new Uint8Array(L.width*L.height*4),me=i(V,ie,L,F,D);return m(de,L.width,L.height,me.pixel_data,me.palettes),{data:de,width:L.width,height:L.height,flipY:!0,generateMipmaps:!0,minFilter:Er}}}const dz=/^[og]\s*(.+)?/,hz=/^mtllib /,fz=/^usemtl /,pz=/^usemap /,US=/\s+/,OS=new j,Up=new j,NS=new j,BS=new j,nr=new j,md=new Je;function mz(){const n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const i=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(r,s){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const l={index:this.materials.length,name:r||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(d){const h={index:typeof d=="number"?d:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return h.clone=this.clone.bind(h),h}};return this.materials.push(l),l},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(r){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),r&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return r&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},i&&i.name&&typeof i.clone=="function"){const r=i.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const i=parseInt(e,10);return(i>=0?i-1:i+t/3)*3},parseNormalIndex:function(e,t){const i=parseInt(e,10);return(i>=0?i-1:i+t/3)*3},parseUVIndex:function(e,t){const i=parseInt(e,10);return(i>=0?i-1:i+t/2)*2},addVertex:function(e,t,i){const r=this.vertices,s=this.object.geometry.vertices;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[i+0],r[i+1],r[i+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,i){const r=this.normals,s=this.object.geometry.normals;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[i+0],r[i+1],r[i+2])},addFaceNormal:function(e,t,i){const r=this.vertices,s=this.object.geometry.normals;OS.fromArray(r,e),Up.fromArray(r,t),NS.fromArray(r,i),nr.subVectors(NS,Up),BS.subVectors(OS,Up),nr.cross(BS),nr.normalize(),s.push(nr.x,nr.y,nr.z),s.push(nr.x,nr.y,nr.z),s.push(nr.x,nr.y,nr.z)},addColor:function(e,t,i){const r=this.colors,s=this.object.geometry.colors;r[e]!==void 0&&s.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&s.push(r[t+0],r[t+1],r[t+2]),r[i]!==void 0&&s.push(r[i+0],r[i+1],r[i+2])},addUV:function(e,t,i){const r=this.uvs,s=this.object.geometry.uvs;s.push(r[e+0],r[e+1]),s.push(r[t+0],r[t+1]),s.push(r[i+0],r[i+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,i,r,s,a,l,d,h){const m=this.vertices.length;let u=this.parseVertexIndex(e,m),g=this.parseVertexIndex(t,m),v=this.parseVertexIndex(i,m);if(this.addVertex(u,g,v),this.addColor(u,g,v),l!==void 0&&l!==""){const w=this.normals.length;u=this.parseNormalIndex(l,w),g=this.parseNormalIndex(d,w),v=this.parseNormalIndex(h,w),this.addNormal(u,g,v)}else this.addFaceNormal(u,g,v);if(r!==void 0&&r!==""){const w=this.uvs.length;u=this.parseUVIndex(r,w),g=this.parseUVIndex(s,w),v=this.parseUVIndex(a,w),this.addUV(u,g,v),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let i=0,r=e.length;i<r;i++){const s=this.parseVertexIndex(e[i],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const i=this.vertices.length,r=this.uvs.length;for(let s=0,a=e.length;s<a;s++)this.addVertexLine(this.parseVertexIndex(e[s],i));for(let s=0,a=t.length;s<a;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return n.startObject("",!1),n}class gz extends Hi{constructor(e){super(e),this.materials=null}load(e,t,i,r){const s=this,a=new _s(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{t(s.parse(l))}catch(d){r?r(d):console.error(d),s.manager.itemError(e)}},i,r)}setMaterials(e){return this.materials=e,this}parse(e){const t=new mz;e.indexOf(`\r
`)!==-1&&(e=e.replace(/\r\n/g,`
`)),e.indexOf(`\\
`)!==-1&&(e=e.replace(/\\\n/g,""));const i=e.split(`
`);let r=[];for(let l=0,d=i.length;l<d;l++){const h=i[l].trimStart();if(h.length===0)continue;const m=h.charAt(0);if(m!=="#")if(m==="v"){const u=h.split(US);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),u.length>=7?(md.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(md.r,md.g,md.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]));break}}else if(m==="f"){const g=h.slice(1).trim().split(US),v=[];for(let T=0,M=g.length;T<M;T++){const b=g[T];if(b.length>0){const A=b.split("/");v.push(A)}}const w=v[0];for(let T=1,M=v.length-1;T<M;T++){const b=v[T],A=v[T+1];t.addFace(w[0],b[0],A[0],w[1],b[1],A[1],w[2],b[2],A[2])}}else if(m==="l"){const u=h.substring(1).trim().split(" ");let g=[];const v=[];if(h.indexOf("/")===-1)g=u;else for(let w=0,T=u.length;w<T;w++){const M=u[w].split("/");M[0]!==""&&g.push(M[0]),M[1]!==""&&v.push(M[1])}t.addLineGeometry(g,v)}else if(m==="p"){const g=h.slice(1).trim().split(" ");t.addPointGeometry(g)}else if((r=dz.exec(h))!==null){const u=(" "+r[0].slice(1).trim()).slice(1);t.startObject(u)}else if(fz.test(h))t.object.startMaterial(h.substring(7).trim(),t.materialLibraries);else if(hz.test(h))t.materialLibraries.push(h.substring(7).trim());else if(pz.test(h))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(m==="s"){if(r=h.split(" "),r.length>1){const g=r[1].trim().toLowerCase();t.object.smooth=g!=="0"&&g!=="off"}else t.object.smooth=!0;const u=t.object.currentMaterial();u&&(u.smooth=t.object.smooth)}else{if(h==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+h+'"')}}t.finalize();const s=new Nr;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let l=0,d=t.objects.length;l<d;l++){const h=t.objects[l],m=h.geometry,u=h.materials,g=m.type==="Line",v=m.type==="Points";let w=!1;if(m.vertices.length===0)continue;const T=new On;T.setAttribute("position",new nn(m.vertices,3)),m.normals.length>0&&T.setAttribute("normal",new nn(m.normals,3)),m.colors.length>0&&(w=!0,T.setAttribute("color",new nn(m.colors,3))),m.hasUVIndices===!0&&T.setAttribute("uv",new nn(m.uvs,2));const M=[];for(let A=0,E=u.length;A<E;A++){const P=u[A],G=P.name+"_"+P.smooth+"_"+w;let O=t.materials[G];if(this.materials!==null){if(O=this.materials.create(P.name),g&&O&&!(O instanceof Aa)){const B=new Aa;_i.prototype.copy.call(B,O),B.color.copy(O.color),O=B}else if(v&&O&&!(O instanceof Ao)){const B=new Ao({size:10,sizeAttenuation:!1});_i.prototype.copy.call(B,O),B.color.copy(O.color),B.map=O.map,O=B}}O===void 0&&(g?O=new Aa:v?O=new Ao({size:1,sizeAttenuation:!1}):O=new Od,O.name=P.name,O.flatShading=!P.smooth,O.vertexColors=w,t.materials[G]=O),M.push(O)}let b;if(M.length>1){for(let A=0,E=u.length;A<E;A++){const P=u[A];T.addGroup(P.groupStart,P.groupCount,A)}g?b=new bh(T,M):v?b=new Ud(T,M):b=new wn(T,M)}else g?b=new bh(T,M[0]):v?b=new Ud(T,M[0]):b=new wn(T,M[0]);b.name=h.name,s.add(b)}else if(t.vertices.length>0){const l=new Ao({size:1,sizeAttenuation:!1}),d=new On;d.setAttribute("position",new nn(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(d.setAttribute("color",new nn(t.colors,3)),l.vertexColors=!0);const h=new Ud(d,l);s.add(h)}return s}}class _z extends Hi{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new _s(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{t(s.parse(l))}catch(d){r?r(d):console.error(d),s.manager.itemError(e)}},i,r)}parse(e){function t(h){const m=new DataView(h),u=32/8*3+32/8*3*3+16/8,g=m.getUint32(80,!0);if(80+32/8+g*u===m.byteLength)return!0;const w=[115,111,108,105,100];for(let T=0;T<5;T++)if(i(w,m,T))return!1;return!0}function i(h,m,u){for(let g=0,v=h.length;g<v;g++)if(h[g]!==m.getUint8(u+g))return!1;return!0}function r(h){const m=new DataView(h),u=m.getUint32(80,!0);let g,v,w,T=!1,M,b,A,E,P;for(let V=0;V<70;V++)m.getUint32(V,!1)==1129270351&&m.getUint8(V+4)==82&&m.getUint8(V+5)==61&&(T=!0,M=new Float32Array(u*3*3),b=m.getUint8(V+6)/255,A=m.getUint8(V+7)/255,E=m.getUint8(V+8)/255,P=m.getUint8(V+9)/255);const G=84,O=12*4+2,B=new On,F=new Float32Array(u*3*3),D=new Float32Array(u*3*3),L=new Je;for(let V=0;V<u;V++){const ie=G+V*O,re=m.getFloat32(ie,!0),de=m.getFloat32(ie+4,!0),me=m.getFloat32(ie+8,!0);if(T){const $=m.getUint16(ie+48,!0);$&32768?(g=b,v=A,w=E):(g=($&31)/31,v=($>>5&31)/31,w=($>>10&31)/31)}for(let $=1;$<=3;$++){const ue=ie+$*12,Y=V*3*3+($-1)*3;F[Y]=m.getFloat32(ue,!0),F[Y+1]=m.getFloat32(ue+4,!0),F[Y+2]=m.getFloat32(ue+8,!0),D[Y]=re,D[Y+1]=de,D[Y+2]=me,T&&(L.set(g,v,w).convertSRGBToLinear(),M[Y]=L.r,M[Y+1]=L.g,M[Y+2]=L.b)}}return B.setAttribute("position",new _n(F,3)),B.setAttribute("normal",new _n(D,3)),T&&(B.setAttribute("color",new _n(M,3)),B.hasColors=!0,B.alpha=P),B}function s(h){const m=new On,u=/solid([\s\S]*?)endsolid/g,g=/facet([\s\S]*?)endfacet/g,v=/solid\s(.+)/;let w=0;const T=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,M=new RegExp("vertex"+T+T+T,"g"),b=new RegExp("normal"+T+T+T,"g"),A=[],E=[],P=[],G=new j;let O,B=0,F=0,D=0;for(;(O=u.exec(h))!==null;){F=D;const L=O[0],V=(O=v.exec(L))!==null?O[1]:"";for(P.push(V);(O=g.exec(L))!==null;){let de=0,me=0;const $=O[0];for(;(O=b.exec($))!==null;)G.x=parseFloat(O[1]),G.y=parseFloat(O[2]),G.z=parseFloat(O[3]),me++;for(;(O=M.exec($))!==null;)A.push(parseFloat(O[1]),parseFloat(O[2]),parseFloat(O[3])),E.push(G.x,G.y,G.z),de++,D++;me!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+w),de!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+w),w++}const ie=F,re=D-F;m.userData.groupNames=P,m.addGroup(ie,re,B),B++}return m.setAttribute("position",new nn(A,3)),m.setAttribute("normal",new nn(E,3)),m}function a(h){return typeof h!="string"?new TextDecoder().decode(h):h}function l(h){if(typeof h=="string"){const m=new Uint8Array(h.length);for(let u=0;u<h.length;u++)m[u]=h.charCodeAt(u)&255;return m.buffer||m}else return h}const d=l(e);return t(d)?r(d):s(a(e))}}class vz extends Q4{constructor(t,i){super(t);Ve(this,"_index");Ve(this,"originNormals");Ve(this,"flatNormals");Ve(this,"_uEdge",{value:0});Ve(this,"_uFlat",{value:0});Ve(this,"_model");Ve(this,"_freelookCamera");Ve(this,"_directionalLight");Ve(this,"_ambientLight");Ve(this,"_matcap");Ve(this,"_standard");Ve(this,"_texture");Ve(this,"_environment");Ve(this,"_onChanged",(t,i)=>{const r=this.viewer;t==="ModelAssets"&&(rr[this._index].loading(!0),Promise.allSettled([ho(r,{url:i.model}),ho(r,{url:i.texture_diffuse}),ho(r,{url:i.texture_normal,colorSpace:""}),ho(r,{url:i.texture_pbr,colorSpace:""}),ho(r,{url:i.shaded})]).then(s=>{rr[this._index].loading(!1);const[a,l,d,h,m]=s.map(u=>u.status==="fulfilled"?u.value:"");(a||this._model)&&(this._texture={diffuse:l,normal:d,pbr:h,shaded:m},this.viewer.scene.background=new Je().fromArray([.12941176470588237,.2,.2823529411764706].map(u=>u+.1)),this._addModel(a))}).catch(s=>{console.error(s)})),t==="renderMode"&&this._onRenderMode(i)});this._index=i}onExit(){this.originNormals=null,this.flatNormals=null,this._environment=null,this.viewer.scene.environment=null}onPre(){const t=this.viewer;return Promise.all([ho(t,{url:"/extensions/ComfyUI-Rodin/threeVisualizer/environments/interior.exr",mapping:el,flipY:!0})]).then(([i])=>{this._environment=i,t.scene.environment=i})}onInit(){const t=this.viewer;t.scene.environmentIntensity=2,this._freelookCamera=t.addNode(sz,{rotateSpeed:.8,scaleSpeed:.8}),this._directionalLight=t.addNode(F_,{position:new j(0,1,1),intensity:3}),this._ambientLight=t.addNode(YE,{color:new Je(16777215),intensity:.5});let i=this._directionalLight;i.castShadow=!0,i.shadow.mapSize.width=4096,i.shadow.mapSize.height=4096,i.shadow.camera.near=-1,i.shadow.camera.far=10,i.shadow.bias=-.005,i.shadow.normalBias=.01,t.renderer.shadowMap.enabled=!0,t.renderer.shadowMap.type=2,this._addMaterials(),this._addOutline(),rr[this._index].onTracerToWebGLCameraPosition(this._onSyncCameraPosition.bind(this)),rr[this._index].onChanged(this._onChanged),rr[this._index].init()}_onSyncCameraPosition(t){const i=this._freelookCamera,r=new N_().setFromVector3(t);i.gotoPOI({theta:r.theta,phi:r.phi,springLength:r.radius,smoothing:0})}_addMaterials(){const t=this._matcap=new _N;t.side=Si,t.onBeforeCompile=r=>{FS(r,this._uFlat)};const i=this._standard=new na;i.side=Si,i.onBeforeCompile=r=>{FS(r,this._uFlat)}}_addOutline(){const t=this.viewer;let i=new cz(t.renderer),r=!1;t.scene.onAfterRender=()=>{rr[this._index].states.renderMode==="Toon"&&(r||(r=!0,i.renderOutline(t.scene,t.camera),r=!1))}}_addModel(t){const i=t.userData.meshes,r=i.map(T=>gT(T.material,this._standard)),s=r.map(T=>Array.isArray(T)?T.map(M=>GS(M,this._texture)):GS(T,this._texture)),a=r.map(T=>Array.isArray(T)?T.map(M=>zS(M,this._texture)):zS(T,this._texture)),l=r.map(T=>Array.isArray(T)?T.map(M=>WS(M)):WS(T));t.userData.pbrMaterials=s,t.userData.unlitMaterials=a,t.userData.toonMaterials=l;const d=r.map(T=>Array.isArray(T)?T.map(()=>HS()):HS()),h=r.map(T=>Array.isArray(T)?T.map(()=>VS()):VS());t.userData.geometryMaterials=d,t.userData.wireframeMaterials=h;const u=new Pr().setFromObject(t).getSize(new j),g=Math.max(Math.max(u.x,u.y),u.z);i.forEach(T=>{T.geometry=this.setGeometryBaryCenter(T.geometry)});const v=this._freelookCamera;v.lens.near=g*.1,v.lens.far=g*8,v.distanceMin=g*1.2,v.distanceMax=g*4,v.forbidPanX=!0,v.forbidPanY=!0,v.gotoPOI({springLength:g*2,theta:0,phi:1.37,smoothing:0}),Object.values(t.userData.materials).forEach(T=>{T.onBeforeCompile=M=>{mT(M,this._uEdge)}});const w=this.viewer;t.traverse(T=>{T.isObject3D&&(T.castShadow=!0,T.receiveShadow=!0)}),this._model&&w.removeNode(this._model),this._model=w.addNode(t),this._onRenderMode(rr[this._index].states.renderMode),rr[this._index].states.renderMode==="Tracer"&&w.stop()}_onRenderMode(t){t==="Tracer"&&rr[this._index].syncCameraPosition(this._freelookCamera.node.position);let i=this._model;if(i){const r=this._matcap,s=this.viewer;i.userData.meshes.forEach((a,l)=>{t==="Preview"?(a.material=r,this._uFlat.value=1):t==="Wireframe"?(a.geometry.attributes.normal=this.flatNormals,a.material=i.userData.wireframeMaterials[l]):t==="Geometry"&&(a.geometry.attributes.normal=this.originNormals,a.material=i.userData.geometryMaterials[l]),["PBR","Tracer"].includes(t)&&(a.geometry.attributes.normal=this.originNormals,a.material=i.userData.pbrMaterials[l]),t==="Shaded"&&(a.geometry.attributes.normal=this.originNormals,a.material=i.userData.unlitMaterials[l]),t==="Toon"?(a.geometry.attributes.normal=this.originNormals,a.material=i.userData.toonMaterials[l],s.scene.environment=null):s.scene.environment||(s.scene.environment=this._environment),this._directionalLight.visible=this._ambientLight.visible=t==="Toon"})}}onUpdate(t){}setGeometryBaryCenter(t){t.index&&(t.copy(t.toNonIndexed()),t.setIndex(null));const i=[new et(0,0),new et(1,0),new j(1,1),new et(0,0),new j(1,1),new j(0,1)],r=t.attributes.position,s=new Float32Array(r.count*2);for(let a=0,l=r.count;a<l;a++)i[a%i.length].toArray(s,a*2);return t.setAttribute("edgeUv",new _n(s,2)),this.computeVertexNormals(t),t}computeVertexNormals(t){const i=t.index,r=t.getAttribute("position");if(r!==void 0){let s=t.getAttribute("normal");if(this.originNormals=new _n(new Float32Array(s.array),3),s===void 0)s=new _n(new Float32Array(r.count*3),3),t.setAttribute("normal",s);else for(let O=0,B=s.count;O<B;O++)s.setXYZ(O,0,0,0);const a=new j,l=new j,d=new j,h=new j,m=new j,u=new j,g=new j,v=new j,w=new j,T=new j,M=new j,b=new j,A=new j,E=new j,P=new j,G=new j;if(i)for(let O=0,B=i.count;O<B;O+=6){const F=i.getX(O+0),D=i.getX(O+1),L=i.getX(O+2),V=i.getX(O+3),ie=i.getX(O+4),re=i.getX(O+5);a.fromBufferAttribute(r,F),l.fromBufferAttribute(r,D),d.fromBufferAttribute(r,L),w.fromBufferAttribute(r,V),T.fromBufferAttribute(r,ie),M.fromBufferAttribute(r,re),g.subVectors(d,l),v.subVectors(a,l),g.cross(v),P.subVectors(M,w),G.subVectors(w,T),P.cross(G),g.add(P),h.fromBufferAttribute(s,F),m.fromBufferAttribute(s,D),u.fromBufferAttribute(s,L),b.fromBufferAttribute(s,V),A.fromBufferAttribute(s,ie),E.fromBufferAttribute(s,re),h.add(g),m.add(g),u.add(g),b.add(g),A.add(g),E.add(g),s.setXYZ(F,h.x,h.y,h.z),s.setXYZ(D,m.x,m.y,m.z),s.setXYZ(L,u.x,u.y,u.z),s.setXYZ(V,b.x,b.y,b.z),s.setXYZ(ie,A.x,A.y,A.z),s.setXYZ(re,E.x,E.y,E.z)}else for(let O=0,B=r.count;O<B;O+=6)a.fromBufferAttribute(r,O+0),l.fromBufferAttribute(r,O+1),d.fromBufferAttribute(r,O+2),w.fromBufferAttribute(r,O+3),T.fromBufferAttribute(r,O+4),M.fromBufferAttribute(r,O+5),g.subVectors(d,l),v.subVectors(a,l),g.cross(v),P.subVectors(M,w),G.subVectors(w,T),P.cross(G),g.add(P),s.setXYZ(O+0,g.x,g.y,g.z),s.setXYZ(O+1,g.x,g.y,g.z),s.setXYZ(O+2,g.x,g.y,g.z),s.setXYZ(O+3,g.x,g.y,g.z),s.setXYZ(O+4,g.x,g.y,g.z),s.setXYZ(O+5,g.x,g.y,g.z);this.flatNormals=new _n(new Float32Array(s.array),3),t.normalizeNormals(),s.needsUpdate=!0}}}function gT(n,e){if(n){if(Array.isArray(n))return n.map(t=>gT(t,e));if(n.name===Hi.DEFAULT_MATERIAL_NAME)return e}else return e;return n}function zS(n,e){const t=new Or;return t.map=n.map||e.shaded||e.diffuse||n.emissiveMap,t.toneMapped=!1,t}function HS(){const n=new na({});return n.map=null,n.metalness=.8,n.roughness=.5,n.metalnessMap=null,n.roughnessMap=null,n.toneMapped=!1,n}function GS(n,e){const t=new na({});return e.pbr?(t.metalnessMap=e.pbr,t.roughnessMap=e.pbr):(t.metalness=0,t.roughness=.5),e.normal&&(t.normalMap=e.normal),t.map=n.map||e.diffuse||e.shaded||n.emissiveMap,t}function VS(){const n=new na({});return n.onBeforeCompile=e=>{mT(e,{value:1})},n.map=null,n.metalness=.8,n.roughness=.5,n.metalnessMap=null,n.roughnessMap=null,n.toneMapped=!1,n}const yz=bz();function WS(n){const e=new mN;return e.map=n.map,e.gradientMap=yz,e.toneMapped=!1,e.shadowSide=2,e}function bz(n=4){const e=new Uint8Array(n);for(let i=0;i<=e.length;i++)e[i]=i/e.length*256;const t=new $c(e,e.length,1,Wc);return t.needsUpdate=!0,t}class xz{constructor(){Ve(this,"_scenesMap",new Map);Ve(this,"_activeScene",null);Ve(this,"_activeSceneName","")}get activeSceneName(){return this._activeSceneName}clear(){var e;(e=this._activeScene)==null||e.onExit(),this._scenesMap.clear(),this._activeScene=null}getScene(e){return this._scenesMap.get(e)}registerScene(e,t){return this._scenesMap.set(e,t),t}prepareScene(e){const t=e||this._scenesMap.keys(),i=[];for(let r of t){let s=this._scenesMap.get(r);s&&!s.flags.OnPreCalled&&(s.flags.OnPreCalled=!0,s.onPre&&i.push(s.onPre()))}return Promise.all(i)}runScene(e,t={}){let i=this._scenesMap.get(e);if(i){let r=this._activeScene;r&&r.onExit&&r.onExit(t),i.onInit&&i.onInit(),i.onEnter&&i.onEnter(t),this._activeScene=i,this._activeSceneName=e}}updateScene(e){this._activeScene&&this._activeScene.onUpdate&&this._activeScene.onUpdate(e)}}class wz extends Nn{constructor(){super(...arguments);Ve(this,"extension",["gltf","glb"]);Ve(this,"_loader");Ve(this,"_dracoLoader")}load({url:t,buffer:i,path:r,resourcePath:s,dracoPath:a,manager:l,onLoad:d,onProgress:h,onError:m}){let u=this._dracoLoader;u===void 0&&(u=this._dracoLoader=new z_),u.manager=l,u.setDecoderPath(a);let g=this._loader;g===void 0&&(g=this._loader=new B_,g.setDRACOLoader(u),g.setMeshoptDecoder(H_)),g.manager=l,g.setPath(r),g.setResourcePath(s);const v=w=>{const T=w.scene;T.animations.push(...w.animations),T.userData=Object.assign(w.userData,T.userData),d(Nn._setUserData(T))};i?g.parse(i,s,v,m):g.load(t,v,h,m)}}class Sz extends Nn{constructor(){super(...arguments);Ve(this,"extension",["obj"]);Ve(this,"_loader")}load({url:t,buffer:i,path:r,resourcePath:s,manager:a,onLoad:l,onProgress:d,onError:h}){let m=this._loader;m===void 0&&(m=this._loader=new gz),m.manager=a,m.setPath(r),m.setResourcePath(s);const u=g=>{const v=new kc;v.add(g),v.animations.push(...g.animations),v.userData=Object.assign(g.userData,v.userData),l(Nn._setUserData(v))};i?m.parse(i):m.load(t,u,d,h)}}class Mz extends Nn{constructor(){super(...arguments);Ve(this,"extension",["stl"]);Ve(this,"_loader")}load({url:t,buffer:i,path:r,resourcePath:s,manager:a,onLoad:l,onProgress:d,onError:h}){let m=this._loader;m===void 0&&(m=this._loader=new _z),m.manager=a,m.setPath(r),m.setResourcePath(s);const u=g=>{const v=g.getAttribute("position");if(v)for(let M=0,b=v.count;M<b;M++){const A=v.getY(M),E=v.getZ(M);v.setY(M,E),v.setZ(M,-A)}const w=new na,T=new wn(g,w);l(Nn._setUserData(T))};i?m.parse(i):m.load(t,u,d,h)}}const Ez="modulepreload",Tz=function(n){return"/extensions/ComfyUI-Rodin/threeVisualizer/"+n},jS={},Wl=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=Promise.allSettled(t.map(d=>{if(d=Tz(d),d in jS)return;jS[d]=!0;const h=d.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const u=document.createElement("link");if(u.rel=h?"stylesheet":Ez,h||(u.as="script"),u.crossOrigin="",u.href=d,l&&u.setAttribute("nonce",l),document.head.appendChild(u),h)return new Promise((g,v)=>{u.addEventListener("load",g),u.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return r.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};var yg=(n=>{var e=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(e=e||__filename),function(t={locateFile:(i,r)=>(!r&&e&&(r=e.substr(0,e.lastIndexOf("/")+1)),r+i),...n}){function i(){return ue.buffer!=Pe.buffer&&ft(),Pe}function r(){return ue.buffer!=Pe.buffer&&ft(),Ue}function s(){return ue.buffer!=Pe.buffer&&ft(),ae}function a(){return ue.buffer!=Pe.buffer&&ft(),ge}function l(){return ue.buffer!=Pe.buffer&&ft(),ce}function d(){return ue.buffer!=Pe.buffer&&ft(),Me}function h(){return ue.buffer!=Pe.buffer&&ft(),Ye}function m(){return ue.buffer!=Pe.buffer&&ft(),ht}var u=t,g,v;if(u.ready=new Promise((o,c)=>{g=o,v=c}),u.expectedDataFileDownloads||(u.expectedDataFileDownloads=0),u.expectedDataFileDownloads++,function(){if(!(u.ENVIRONMENT_IS_PTHREAD||u.$ww)){var o=function(c){typeof window=="object"?window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/"):typeof process>"u"&&typeof location<"u"&&encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/");var f="emHdBindings.data",p="emHdBindings.data";typeof u.locateFilePackage=="function"&&!u.locateFile&&(u.locateFile=u.locateFilePackage,me("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var _=u.locateFile?u.locateFile(p,""):p,y=c.remote_package_size;function x(se,he,ye,ze){if(typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"){require("fs").readFile(se,function(at,dt){at?ze(at):ye(dt.buffer)});return}var Ke=new XMLHttpRequest;Ke.open("GET",se,!0),Ke.responseType="arraybuffer",Ke.onprogress=function(at){var dt=se,Re=he;if(at.total&&(Re=at.total),at.loaded){Ke.addedTotal?u.dataFileDownloads[dt].loaded=at.loaded:(Ke.addedTotal=!0,u.dataFileDownloads||(u.dataFileDownloads={}),u.dataFileDownloads[dt]={loaded:at.loaded,total:Re});var je=0,dn=0,zt=0;for(var ci in u.dataFileDownloads){var hn=u.dataFileDownloads[ci];je+=hn.total,dn+=hn.loaded,zt++}je=Math.ceil(je*u.expectedDataFileDownloads/zt),u.setStatus&&u.setStatus(`Downloading data... (${dn}/${je})`)}else u.dataFileDownloads||u.setStatus&&u.setStatus("Downloading data...")},Ke.onerror=function(at){throw new Error("NetworkError for: "+se)},Ke.onload=function(at){if(Ke.status==200||Ke.status==304||Ke.status==206||Ke.status==0&&Ke.response){var dt=Ke.response;ye(dt)}else throw new Error(Ke.statusText+" : "+Ke.responseURL)},Ke.send(null)}function C(se){console.error("package error:",se)}var U=null,H=u.getPreloadedPackage?u.getPreloadedPackage(_,y):null;H||x(_,y,function(se){U?(U(se),U=null):H=se},C);function K(){function se(at,dt){if(!at)throw dt+new Error().stack}u.FS_createPath("/","usd",!0,!0),u.FS_createPath("/usd","ar",!0,!0),u.FS_createPath("/usd/ar","resources",!0,!0),u.FS_createPath("/usd","hd",!0,!0),u.FS_createPath("/usd/hd","resources",!0,!0),u.FS_createPath("/usd/hd/resources","codegenTemplates",!0,!0),u.FS_createPath("/usd","httpResolver",!0,!0),u.FS_createPath("/usd/httpResolver","resources",!0,!0),u.FS_createPath("/usd","ndr",!0,!0),u.FS_createPath("/usd/ndr","resources",!0,!0),u.FS_createPath("/usd","sdf",!0,!0),u.FS_createPath("/usd/sdf","resources",!0,!0),u.FS_createPath("/usd","usd",!0,!0),u.FS_createPath("/usd/usd","resources",!0,!0),u.FS_createPath("/usd/usd/resources","codegenTemplates",!0,!0),u.FS_createPath("/usd/usd/resources","usd",!0,!0),u.FS_createPath("/usd","usdGeom",!0,!0),u.FS_createPath("/usd/usdGeom","resources",!0,!0),u.FS_createPath("/usd/usdGeom/resources","usdGeom",!0,!0),u.FS_createPath("/usd","usdHydra",!0,!0),u.FS_createPath("/usd/usdHydra","resources",!0,!0),u.FS_createPath("/usd/usdHydra/resources","shaders",!0,!0),u.FS_createPath("/usd/usdHydra/resources","usdHydra",!0,!0),u.FS_createPath("/usd","usdImaging",!0,!0),u.FS_createPath("/usd/usdImaging","resources",!0,!0),u.FS_createPath("/usd","usdLux",!0,!0),u.FS_createPath("/usd/usdLux","resources",!0,!0),u.FS_createPath("/usd/usdLux/resources","usdLux",!0,!0),u.FS_createPath("/usd","usdRender",!0,!0),u.FS_createPath("/usd/usdRender","resources",!0,!0),u.FS_createPath("/usd/usdRender/resources","usdRender",!0,!0),u.FS_createPath("/usd","usdShade",!0,!0),u.FS_createPath("/usd/usdShade","resources",!0,!0),u.FS_createPath("/usd/usdShade/resources","usdShade",!0,!0),u.FS_createPath("/usd","usdShaders",!0,!0),u.FS_createPath("/usd/usdShaders","resources",!0,!0),u.FS_createPath("/usd/usdShaders/resources","shaders",!0,!0),u.FS_createPath("/usd","usdSkel",!0,!0),u.FS_createPath("/usd/usdSkel","resources",!0,!0),u.FS_createPath("/usd/usdSkel/resources","usdSkel",!0,!0),u.FS_createPath("/usd","usdVol",!0,!0),u.FS_createPath("/usd/usdVol","resources",!0,!0),u.FS_createPath("/usd/usdVol/resources","usdVol",!0,!0);function he(at,dt,Re){this.start=at,this.end=dt,this.audio=Re}he.prototype={requests:{},open:function(at,dt){this.name=dt,this.requests[dt]=this,u.addRunDependency(`fp ${this.name}`)},send:function(){},onload:function(){var at=this.byteArray.subarray(this.start,this.end);this.finish(at)},finish:function(at){var dt=this;u.FS_createDataFile(this.name,null,at,!0,!0,!0),u.removeRunDependency(`fp ${dt.name}`),this.requests[this.name]=null}};for(var ye=c.files,ze=0;ze<ye.length;++ze)new he(ye[ze].start,ye[ze].end,ye[ze].audio||0).open("GET",ye[ze].filename);function Ke(at){se(at,"Loading data file failed."),se(at.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var dt=new Uint8Array(at);he.prototype.byteArray=dt;for(var Re=c.files,je=0;je<Re.length;++je)he.prototype.requests[Re[je].filename].onload();u.removeRunDependency("datafile_emHdBindings.data")}u.addRunDependency("datafile_emHdBindings.data"),u.preloadResults||(u.preloadResults={}),u.preloadResults[f]={fromCache:!1},H?(Ke(H),H=null):U=Ke}u.calledRun?K():(u.preRun||(u.preRun=[]),u.preRun.push(K))};o({files:[{filename:"/usd/ar/resources/plugInfo.json",start:0,end:589},{filename:"/usd/hd/resources/codegenTemplates/schemaClass.cpp",start:589,end:9620},{filename:"/usd/hd/resources/codegenTemplates/schemaClass.h",start:9620,end:20258},{filename:"/usd/hd/resources/plugInfo.json",start:20258,end:20483},{filename:"/usd/httpResolver/resources/plugInfo.json",start:20483,end:20823},{filename:"/usd/ndr/resources/plugInfo.json",start:20823,end:21397},{filename:"/usd/plugInfo.json",start:21397,end:21448},{filename:"/usd/sdf/resources/plugInfo.json",start:21448,end:22544},{filename:"/usd/usd/resources/codegenTemplates/api.h",start:22544,end:24646},{filename:"/usd/usd/resources/codegenTemplates/plugInfo.json",start:24646,end:25003},{filename:"/usd/usd/resources/codegenTemplates/schemaClass.cpp",start:25003,end:37342},{filename:"/usd/usd/resources/codegenTemplates/schemaClass.h",start:37342,end:54229},{filename:"/usd/usd/resources/codegenTemplates/tokens.cpp",start:54229,end:55817},{filename:"/usd/usd/resources/codegenTemplates/tokens.h",start:55817,end:59072},{filename:"/usd/usd/resources/codegenTemplates/wrapSchemaClass.cpp",start:59072,end:68578},{filename:"/usd/usd/resources/codegenTemplates/wrapTokens.cpp",start:68578,end:71099},{filename:"/usd/usd/resources/generatedSchema.usda",start:71099,end:86803},{filename:"/usd/usd/resources/plugInfo.json",start:86803,end:92530},{filename:"/usd/usd/resources/usd/schema.usda",start:92530,end:110774},{filename:"/usd/usdGeom/resources/generatedSchema.usda",start:110774,end:355640},{filename:"/usd/usdGeom/resources/plugInfo.json",start:355640,end:371761},{filename:"/usd/usdGeom/resources/usdGeom/schema.usda",start:371761,end:500520},{filename:"/usd/usdHydra/resources/generatedSchema.usda",start:500520,end:501538},{filename:"/usd/usdHydra/resources/plugInfo.json",start:501538,end:502826},{filename:"/usd/usdHydra/resources/shaders/empty.glslfx",start:502826,end:504049},{filename:"/usd/usdHydra/resources/shaders/shaderDefs.usda",start:504049,end:510806},{filename:"/usd/usdHydra/resources/usdHydra/schema.usda",start:510806,end:518107},{filename:"/usd/usdImaging/resources/plugInfo.json",start:518107,end:531776},{filename:"/usd/usdLux/resources/generatedSchema.usda",start:531776,end:610666},{filename:"/usd/usdLux/resources/plugInfo.json",start:610666,end:620463},{filename:"/usd/usdLux/resources/usdLux/schema.usda",start:620463,end:662394},{filename:"/usd/usdRender/resources/generatedSchema.usda",start:662394,end:685685},{filename:"/usd/usdRender/resources/plugInfo.json",start:685685,end:688784},{filename:"/usd/usdRender/resources/usdRender/schema.usda",start:688784,end:705492},{filename:"/usd/usdShade/resources/generatedSchema.usda",start:705492,end:721492},{filename:"/usd/usdShade/resources/plugInfo.json",start:721492,end:727378},{filename:"/usd/usdShade/resources/usdShade/schema.usda",start:727378,end:754223},{filename:"/usd/usdShaders/resources/plugInfo.json",start:754223,end:754902},{filename:"/usd/usdShaders/resources/shaders/previewSurface.glslfx",start:754902,end:768823},{filename:"/usd/usdShaders/resources/shaders/primvarReader.glslfx",start:768823,end:770046},{filename:"/usd/usdShaders/resources/shaders/shaderDefs.usda",start:770046,end:784976},{filename:"/usd/usdShaders/resources/shaders/transform2d.glslfx",start:784976,end:786199},{filename:"/usd/usdShaders/resources/shaders/uvTexture.glslfx",start:786199,end:787422},{filename:"/usd/usdSkel/resources/generatedSchema.usda",start:787422,end:802913},{filename:"/usd/usdSkel/resources/plugInfo.json",start:802913,end:805907},{filename:"/usd/usdSkel/resources/usdSkel/schema.usda",start:805907,end:816312},{filename:"/usd/usdVol/resources/generatedSchema.usda",start:816312,end:840757},{filename:"/usd/usdVol/resources/plugInfo.json",start:840757,end:843193},{filename:"/usd/usdVol/resources/usdVol/schema.usda",start:843193,end:849069}],remote_package_size:849069})}}(),!u.ENVIRONMENT_IS_PTHREAD){let o=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)};var s8=o;const c=1024*1024*1024,f=4*1024*1024*1024,p=o()?c:f;u.wasmMemory=new WebAssembly.Memory({initial:16777216/65536,maximum:p/65536,shared:!0})}var w=Object.assign({},u),T="./this.program",M=(o,c)=>{throw c},b=typeof window=="object",A=typeof importScripts=="function",E=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",P=u.ENVIRONMENT_IS_PTHREAD||!1,G="";function O(o){return u.locateFile?u.locateFile(o,G):G+o}var B,F,D;if(E){var L=require("fs"),V=require("path");A?G=V.dirname(G)+"/":G=__dirname+"/",B=(c,f)=>(c=vt(c)?new URL(c):V.normalize(c),L.readFileSync(c,f?void 0:"utf8")),D=c=>{var f=B(c,!0);return f.buffer||(f=new Uint8Array(f)),f},F=(c,f,p,_=!0)=>{c=vt(c)?new URL(c):V.normalize(c),L.readFile(c,_?void 0:"utf8",(y,x)=>{y?p(y):f(_?x.buffer:x)})},!u.thisProgram&&process.argv.length>1&&(T=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),M=(c,f)=>{throw process.exitCode=c,f},u.inspect=()=>"[Emscripten Module object]";let o;try{o=require("worker_threads")}catch(c){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),c}global.Worker=o.Worker}else(b||A)&&(A?G=self.location.href:typeof document<"u"&&document.currentScript&&(G=document.currentScript.src),e&&(G=e),G.indexOf("blob:")!==0?G=G.substr(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1):G="",E||(B=o=>{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.send(null),c.responseText},A&&(D=o=>{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.responseType="arraybuffer",c.send(null),new Uint8Array(c.response)}),F=(o,c,f)=>{var p=new XMLHttpRequest;p.open("GET",o,!0),p.responseType="arraybuffer",p.onload=()=>{if(p.status==200||p.status==0&&p.response){c(p.response);return}f()},p.onerror=f,p.send(null)}));E&&typeof performance>"u"&&(global.performance=require("perf_hooks").performance);var ie=console.log.bind(console),re=console.error.bind(console);E&&(ie=(...o)=>L.writeSync(1,o.join(" ")+`
`),re=(...o)=>L.writeSync(2,o.join(" ")+`
`));var de=u.print||ie,me=u.printErr||re;Object.assign(u,w),w=null,u.arguments&&u.arguments,u.thisProgram&&(T=u.thisProgram),u.quit&&(M=u.quit);var $;u.wasmBinary&&($=u.wasmBinary),typeof WebAssembly!="object"&&lt("no native wasm support detected");var ue,Y,pe=!1,_e;function Ae(o,c){o||lt(c)}var Pe,Ue,ae,ge,ce,Me,Ye,ht;function ft(){var o=ue.buffer;u.HEAP8=Pe=new Int8Array(o),u.HEAP16=ae=new Int16Array(o),u.HEAPU8=Ue=new Uint8Array(o),u.HEAPU16=ge=new Uint16Array(o),u.HEAP32=ce=new Int32Array(o),u.HEAPU32=Me=new Uint32Array(o),u.HEAPF32=Ye=new Float32Array(o),u.HEAPF64=ht=new Float64Array(o)}var Wt=u.INITIAL_MEMORY||16777216;if(Ae(Wt>=5242880,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+Wt+"! (STACK_SIZE=5242880)"),P)ue=u.wasmMemory;else if(u.wasmMemory)ue=u.wasmMemory;else if(ue=new WebAssembly.Memory({initial:Wt/65536,maximum:4294967296/65536,shared:!0}),!(ue.buffer instanceof SharedArrayBuffer))throw me("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),E&&me("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");ft(),Wt=ue.buffer.byteLength;var Z=[],Jt=[],Ut=[];function jt(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)yt(u.preRun.shift());Te(Z)}function ut(){P||(!u.noFSInit&&!R.init.initialized&&R.init(),R.ignorePermissions=!1,Te(Jt))}function yn(){if(!P){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)X(u.postRun.shift());Te(Ut)}}function yt(o){Z.unshift(o)}function wt(o){Jt.unshift(o)}function X(o){Ut.unshift(o)}var N=0,ve=null;function De(o){return o}function ke(o){N++,u.monitorRunDependencies&&u.monitorRunDependencies(N)}function Le(o){if(N--,u.monitorRunDependencies&&u.monitorRunDependencies(N),N==0&&ve){var c=ve;ve=null,c()}}function lt(o){u.onAbort&&u.onAbort(o),o="Aborted("+o+")",me(o),_e=1,o+=". Build with -sASSERTIONS for more info.";var c=new WebAssembly.RuntimeError(o);throw v(c),c}var Qe="data:application/octet-stream;base64,",tt=o=>o.startsWith(Qe),vt=o=>o.startsWith("file://"),Ne;Ne="emHdBindings.wasm",tt(Ne)||(Ne=O(Ne));function nt(o){if(o==Ne&&$)return new Uint8Array($);if(D)return D(o);throw"both async and sync fetching of the wasm failed"}function Rt(o){if(!$&&(b||A)){if(typeof fetch=="function"&&!vt(o))return fetch(o,{credentials:"same-origin"}).then(c=>{if(!c.ok)throw"failed to load wasm binary file at '"+o+"'";return c.arrayBuffer()}).catch(()=>nt(o));if(F)return new Promise((c,f)=>{F(o,p=>c(new Uint8Array(p)),f)})}return Promise.resolve().then(()=>nt(o))}function ct(o,c,f){return Rt(o).then(p=>WebAssembly.instantiate(p,c)).then(p=>p).then(f,p=>{me(`failed to asynchronously prepare wasm: ${p}`),lt(p)})}function $e(o,c,f,p){return!o&&typeof WebAssembly.instantiateStreaming=="function"&&!tt(c)&&!vt(c)&&!E&&typeof fetch=="function"?fetch(c,{credentials:"same-origin"}).then(_=>{var y=WebAssembly.instantiateStreaming(_,f);return y.then(p,function(x){return me(`wasm streaming compile failed: ${x}`),me("falling back to ArrayBuffer instantiation"),ct(c,f,p)})}):ct(c,f,p)}function bt(){var o={a:vC};function c(p,_){return ne=p.exports,ne=_t.instrumentWasmExports(ne),ne=qP(ne),en(ne.Hd),ne.Dd,wt(ne.Bd),Y=_,Le(),ne}ke();function f(p){c(p.instance,p.module)}if(u.instantiateWasm)try{return u.instantiateWasm(o,c)}catch(p){me(`Module.instantiateWasm callback failed with error: ${p}`),v(p)}return $e($,Ne,o,f).catch(v),{}}var Ie,it;function ee(o,c){return _t.handleAsync(async()=>{const f=fe(o),p=new URL(f);try{const _=await fetch(p);if(!_.ok)throw new Error("Fetch failed: "+_.statusText);const y=await _.arrayBuffer(),x=y.byteLength,C=Ml(x);r().set(new Uint8Array(y),C>>>0),u.HEAP32[c>>2]=C,u.HEAP32[(c>>2)+1]=x}catch(_){console.error("Error in fetch_asset: ",_),u.HEAP32[c>>2]=0,u.HEAP32[(c>>2)+1]=0}})}function He(o){typeof self<"u"?typeof self.loadedFiles>"u"&&(self.loadedFiles=[]):console.log("Neither window nor self is defined"),self.loadedFiles.push(fe(o))}function oe(o,c){const f=fe(o),p=fe(c);let _=document.createElement("a");_.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(f)),_.setAttribute("download",p),_.style.display="none",document.body.appendChild(_),_.click(),document.body.removeChild(_)}function Ce(o){this.name="ExitStatus",this.message=`Program terminated with exit(${o})`,this.status=o}var Ge=o=>{o.terminate(),o.onmessage=c=>{}},gt=o=>{var c=Ee.pthreads[o];delete Ee.pthreads[o],Ge(c),gf(o),Ee.runningWorkers.splice(Ee.runningWorkers.indexOf(c),1),c.pthread_ptr=0},Pt=o=>{var c=Ee.pthreads[o];c.postMessage({cmd:"cancel"})},un=o=>{var c=Ee.pthreads[o];Ae(c),Ee.returnWorkerToPool(c)},Ln=(o,c)=>(r().fill(0,o,o+c),o),Ot=o=>{var c=Ee.getNewWorker();if(!c)return 6;Ee.runningWorkers.push(c),Ee.pthreads[o.pthread_ptr]=c,c.pthread_ptr=o.pthread_ptr;var f={cmd:"run",start_routine:o.startRoutine,arg:o.arg,pthread_ptr:o.pthread_ptr};return E&&c.unref(),c.postMessage(f,o.transferList),0},oi=0,ii=()=>Ht||oi>0,Nt={isAbs:o=>o.charAt(0)==="/",splitPath:o=>{var c=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return c.exec(o).slice(1)},normalizeArray:(o,c)=>{for(var f=0,p=o.length-1;p>=0;p--){var _=o[p];_==="."?o.splice(p,1):_===".."?(o.splice(p,1),f++):f&&(o.splice(p,1),f--)}if(c)for(;f;f--)o.unshift("..");return o},normalize:o=>{var c=Nt.isAbs(o),f=o.substr(-1)==="/";return o=Nt.normalizeArray(o.split("/").filter(p=>!!p),!c).join("/"),!o&&!c&&(o="."),o&&f&&(o+="/"),(c?"/":"")+o},dirname:o=>{var c=Nt.splitPath(o),f=c[0],p=c[1];return!f&&!p?".":(p&&(p=p.substr(0,p.length-1)),f+p)},basename:o=>{if(o==="/")return"/";o=Nt.normalize(o),o=o.replace(/\/$/,"");var c=o.lastIndexOf("/");return c===-1?o:o.substr(c+1)},join:function(){var o=Array.prototype.slice.call(arguments);return Nt.normalize(o.join("/"))},join2:(o,c)=>Nt.normalize(o+"/"+c)},fr=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return p=>(p.set(crypto.getRandomValues(new Uint8Array(p.byteLength))),p);if(E)try{var o=require("crypto"),c=o.randomFillSync;if(c)return p=>o.randomFillSync(p);var f=o.randomBytes;return p=>(p.set(f(p.byteLength)),p)}catch{}lt("initRandomDevice")},ys=o=>(ys=fr())(o),Ci={resolve:function(){for(var o="",c=!1,f=arguments.length-1;f>=-1&&!c;f--){var p=f>=0?arguments[f]:R.cwd();if(typeof p!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!p)return"";o=p+"/"+o,c=Nt.isAbs(p)}return o=Nt.normalizeArray(o.split("/").filter(_=>!!_),!c).join("/"),(c?"/":"")+o||"."},relative:(o,c)=>{o=Ci.resolve(o).substr(1),c=Ci.resolve(c).substr(1);function f(H){for(var K=0;K<H.length&&H[K]==="";K++);for(var se=H.length-1;se>=0&&H[se]==="";se--);return K>se?[]:H.slice(K,se-K+1)}for(var p=f(o.split("/")),_=f(c.split("/")),y=Math.min(p.length,_.length),x=y,C=0;C<y;C++)if(p[C]!==_[C]){x=C;break}for(var U=[],C=x;C<p.length;C++)U.push("..");return U=U.concat(_.slice(x)),U.join("/")}},ra=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Ri=(o,c,f)=>{c>>>=0;for(var p=c+f,_=c;o[_]&&!(_>=p);)++_;if(_-c>16&&o.buffer&&ra)return ra.decode(o.slice(c,_));for(var y="";c<_;){var x=o[c++];if(!(x&128)){y+=String.fromCharCode(x);continue}var C=o[c++]&63;if((x&224)==192){y+=String.fromCharCode((x&31)<<6|C);continue}var U=o[c++]&63;if((x&240)==224?x=(x&15)<<12|C<<6|U:x=(x&7)<<18|C<<12|U<<6|o[c++]&63,x<65536)y+=String.fromCharCode(x);else{var H=x-65536;y+=String.fromCharCode(55296|H>>10,56320|H&1023)}}return y},bs=[],Qi=o=>{for(var c=0,f=0;f<o.length;++f){var p=o.charCodeAt(f);p<=127?c++:p<=2047?c+=2:p>=55296&&p<=57343?(c+=4,++f):c+=3}return c},xs=(o,c,f,p)=>{if(f>>>=0,!(p>0))return 0;for(var _=f,y=f+p-1,x=0;x<o.length;++x){var C=o.charCodeAt(x);if(C>=55296&&C<=57343){var U=o.charCodeAt(++x);C=65536+((C&1023)<<10)|U&1023}if(C<=127){if(f>=y)break;c[f++>>>0]=C}else if(C<=2047){if(f+1>=y)break;c[f++>>>0]=192|C>>6,c[f++>>>0]=128|C&63}else if(C<=65535){if(f+2>=y)break;c[f++>>>0]=224|C>>12,c[f++>>>0]=128|C>>6&63,c[f++>>>0]=128|C&63}else{if(f+3>=y)break;c[f++>>>0]=240|C>>18,c[f++>>>0]=128|C>>12&63,c[f++>>>0]=128|C>>6&63,c[f++>>>0]=128|C&63}}return c[f>>>0]=0,f-_};function Xr(o,c,f){var p=Qi(o)+1,_=new Array(p),y=xs(o,_,0,_.length);return c&&(_.length=y),_}var Ba=()=>{if(!bs.length){var o=null;if(E){var c=256,f=Buffer.alloc(c),p=0,_=process.stdin.fd;try{p=L.readSync(_,f)}catch(y){if(y.toString().includes("EOF"))p=0;else throw y}p>0?o=f.slice(0,p).toString("utf-8"):o=null}else typeof window<"u"&&typeof window.prompt=="function"?(o=window.prompt("Input: "),o!==null&&(o+=`
`)):typeof readline=="function"&&(o=readline(),o!==null&&(o+=`
`));if(!o)return null;bs=Xr(o,!0)}return bs.shift()},Ji={ttys:[],init(){},shutdown(){},register(o,c){Ji.ttys[o]={input:[],output:[],ops:c},R.registerDevice(o,Ji.stream_ops)},stream_ops:{open(o){var c=Ji.ttys[o.node.rdev];if(!c)throw new R.ErrnoError(43);o.tty=c,o.seekable=!1},close(o){o.tty.ops.fsync(o.tty)},fsync(o){o.tty.ops.fsync(o.tty)},read(o,c,f,p,_){if(!o.tty||!o.tty.ops.get_char)throw new R.ErrnoError(60);for(var y=0,x=0;x<p;x++){var C;try{C=o.tty.ops.get_char(o.tty)}catch{throw new R.ErrnoError(29)}if(C===void 0&&y===0)throw new R.ErrnoError(6);if(C==null)break;y++,c[f+x]=C}return y&&(o.node.timestamp=Date.now()),y},write(o,c,f,p,_){if(!o.tty||!o.tty.ops.put_char)throw new R.ErrnoError(60);try{for(var y=0;y<p;y++)o.tty.ops.put_char(o.tty,c[f+y])}catch{throw new R.ErrnoError(29)}return p&&(o.node.timestamp=Date.now()),y}},default_tty_ops:{get_char(o){return Ba()},put_char(o,c){c===null||c===10?(de(Ri(o.output,0)),o.output=[]):c!=0&&o.output.push(c)},fsync(o){o.output&&o.output.length>0&&(de(Ri(o.output,0)),o.output=[])},ioctl_tcgets(o){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(o,c,f){return 0},ioctl_tiocgwinsz(o){return[24,80]}},default_tty1_ops:{put_char(o,c){c===null||c===10?(me(Ri(o.output,0)),o.output=[]):c!=0&&o.output.push(c)},fsync(o){o.output&&o.output.length>0&&(me(Ri(o.output,0)),o.output=[])}}},gl=(o,c)=>Math.ceil(o/c)*c,z=o=>{o=gl(o,65536);var c=Qv(65536,o);return c?Ln(c,o):0},q={ops_table:null,mount(o){return q.createNode(null,"/",16895,0)},createNode(o,c,f,p){if(R.isBlkdev(f)||R.isFIFO(f))throw new R.ErrnoError(63);q.ops_table||(q.ops_table={dir:{node:{getattr:q.node_ops.getattr,setattr:q.node_ops.setattr,lookup:q.node_ops.lookup,mknod:q.node_ops.mknod,rename:q.node_ops.rename,unlink:q.node_ops.unlink,rmdir:q.node_ops.rmdir,readdir:q.node_ops.readdir,symlink:q.node_ops.symlink},stream:{llseek:q.stream_ops.llseek}},file:{node:{getattr:q.node_ops.getattr,setattr:q.node_ops.setattr},stream:{llseek:q.stream_ops.llseek,read:q.stream_ops.read,write:q.stream_ops.write,allocate:q.stream_ops.allocate,mmap:q.stream_ops.mmap,msync:q.stream_ops.msync}},link:{node:{getattr:q.node_ops.getattr,setattr:q.node_ops.setattr,readlink:q.node_ops.readlink},stream:{}},chrdev:{node:{getattr:q.node_ops.getattr,setattr:q.node_ops.setattr},stream:R.chrdev_stream_ops}});var _=R.createNode(o,c,f,p);return R.isDir(_.mode)?(_.node_ops=q.ops_table.dir.node,_.stream_ops=q.ops_table.dir.stream,_.contents={}):R.isFile(_.mode)?(_.node_ops=q.ops_table.file.node,_.stream_ops=q.ops_table.file.stream,_.usedBytes=0,_.contents=null):R.isLink(_.mode)?(_.node_ops=q.ops_table.link.node,_.stream_ops=q.ops_table.link.stream):R.isChrdev(_.mode)&&(_.node_ops=q.ops_table.chrdev.node,_.stream_ops=q.ops_table.chrdev.stream),_.timestamp=Date.now(),o&&(o.contents[c]=_,o.timestamp=_.timestamp),_},getFileDataAsTypedArray(o){return o.contents?o.contents.subarray?o.contents.subarray(0,o.usedBytes):new Uint8Array(o.contents):new Uint8Array(0)},expandFileStorage(o,c){var f=o.contents?o.contents.length:0;if(!(f>=c)){var p=1024*1024;c=Math.max(c,f*(f<p?2:1.125)>>>0),f!=0&&(c=Math.max(c,256));var _=o.contents;o.contents=new Uint8Array(c),o.usedBytes>0&&o.contents.set(_.subarray(0,o.usedBytes),0)}},resizeFileStorage(o,c){if(o.usedBytes!=c)if(c==0)o.contents=null,o.usedBytes=0;else{var f=o.contents;o.contents=new Uint8Array(c),f&&o.contents.set(f.subarray(0,Math.min(c,o.usedBytes))),o.usedBytes=c}},node_ops:{getattr(o){var c={};return c.dev=R.isChrdev(o.mode)?o.id:1,c.ino=o.id,c.mode=o.mode,c.nlink=1,c.uid=0,c.gid=0,c.rdev=o.rdev,R.isDir(o.mode)?c.size=4096:R.isFile(o.mode)?c.size=o.usedBytes:R.isLink(o.mode)?c.size=o.link.length:c.size=0,c.atime=new Date(o.timestamp),c.mtime=new Date(o.timestamp),c.ctime=new Date(o.timestamp),c.blksize=4096,c.blocks=Math.ceil(c.size/c.blksize),c},setattr(o,c){c.mode!==void 0&&(o.mode=c.mode),c.timestamp!==void 0&&(o.timestamp=c.timestamp),c.size!==void 0&&q.resizeFileStorage(o,c.size)},lookup(o,c){throw R.genericErrors[44]},mknod(o,c,f,p){return q.createNode(o,c,f,p)},rename(o,c,f){if(R.isDir(o.mode)){var p;try{p=R.lookupNode(c,f)}catch{}if(p)for(var _ in p.contents)throw new R.ErrnoError(55)}delete o.parent.contents[o.name],o.parent.timestamp=Date.now(),o.name=f,c.contents[f]=o,c.timestamp=o.parent.timestamp,o.parent=c},unlink(o,c){delete o.contents[c],o.timestamp=Date.now()},rmdir(o,c){var f=R.lookupNode(o,c);for(var p in f.contents)throw new R.ErrnoError(55);delete o.contents[c],o.timestamp=Date.now()},readdir(o){var c=[".",".."];for(var f in o.contents)o.contents.hasOwnProperty(f)&&c.push(f);return c},symlink(o,c,f){var p=q.createNode(o,c,41471,0);return p.link=f,p},readlink(o){if(!R.isLink(o.mode))throw new R.ErrnoError(28);return o.link}},stream_ops:{read(o,c,f,p,_){var y=o.node.contents;if(_>=o.node.usedBytes)return 0;var x=Math.min(o.node.usedBytes-_,p);if(x>8&&y.subarray)c.set(y.subarray(_,_+x),f);else for(var C=0;C<x;C++)c[f+C]=y[_+C];return x},write(o,c,f,p,_,y){if(c.buffer===i().buffer&&(y=!1),!p)return 0;var x=o.node;if(x.timestamp=Date.now(),c.subarray&&(!x.contents||x.contents.subarray)){if(y)return x.contents=c.subarray(f,f+p),x.usedBytes=p,p;if(x.usedBytes===0&&_===0)return x.contents=c.slice(f,f+p),x.usedBytes=p,p;if(_+p<=x.usedBytes)return x.contents.set(c.subarray(f,f+p),_),p}if(q.expandFileStorage(x,_+p),x.contents.subarray&&c.subarray)x.contents.set(c.subarray(f,f+p),_);else for(var C=0;C<p;C++)x.contents[_+C]=c[f+C];return x.usedBytes=Math.max(x.usedBytes,_+p),p},llseek(o,c,f){var p=c;if(f===1?p+=o.position:f===2&&R.isFile(o.node.mode)&&(p+=o.node.usedBytes),p<0)throw new R.ErrnoError(28);return p},allocate(o,c,f){q.expandFileStorage(o.node,c+f),o.node.usedBytes=Math.max(o.node.usedBytes,c+f)},mmap(o,c,f,p,_){if(!R.isFile(o.node.mode))throw new R.ErrnoError(43);var y,x,C=o.node.contents;if(!(_&2)&&C.buffer===i().buffer)x=!1,y=C.byteOffset;else{if((f>0||f+c<C.length)&&(C.subarray?C=C.subarray(f,f+c):C=Array.prototype.slice.call(C,f,f+c)),x=!0,y=z(c),!y)throw new R.ErrnoError(48);i().set(C,y>>>0)}return{ptr:y,allocated:x}},msync(o,c,f,p,_){return q.stream_ops.write(o,c,0,p,f,!1),0}}},S=(o,c,f,p)=>{var _=`al ${o}`;F(o,y=>{Ae(y,`Loading data file "${o}" failed (no arrayBuffer).`),c(new Uint8Array(y)),_&&Le()},y=>{if(f)f();else throw`Loading data file "${o}" failed.`}),_&&ke()},I=(o,c,f,p,_,y)=>R.createDataFile(o,c,f,p,_,y),k=u.preloadPlugins||[],W=(o,c,f,p)=>{typeof Browser<"u"&&Browser.init();var _=!1;return k.forEach(y=>{_||y.canHandle(c)&&(y.handle(o,c,f,p),_=!0)}),_},te=(o,c,f,p,_,y,x,C,U,H)=>{var K=c?Ci.resolve(Nt.join2(o,c)):o;function se(he){function ye(ze){H&&H(),C||I(o,c,ze,p,_,U),y&&y(),Le()}W(he,K,ye,()=>{x&&x(),Le()})||ye(he)}ke(),typeof f=="string"?S(f,he=>se(he),x):se(f)},Q=o=>{var c={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},f=c[o];if(typeof f>"u")throw new Error(`Unknown file open mode: ${o}`);return f},le=(o,c)=>{var f=0;return o&&(f|=365),c&&(f|=146),f},R={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(o,c={}){if(o=Ci.resolve(o),!o)return{path:"",node:null};var f={follow_mount:!0,recurse_count:0};if(c=Object.assign(f,c),c.recurse_count>8)throw new R.ErrnoError(32);for(var p=o.split("/").filter(se=>!!se),_=R.root,y="/",x=0;x<p.length;x++){var C=x===p.length-1;if(C&&c.parent)break;if(_=R.lookupNode(_,p[x]),y=Nt.join2(y,p[x]),R.isMountpoint(_)&&(!C||C&&c.follow_mount)&&(_=_.mounted.root),!C||c.follow)for(var U=0;R.isLink(_.mode);){var H=R.readlink(y);y=Ci.resolve(Nt.dirname(y),H);var K=R.lookupPath(y,{recurse_count:c.recurse_count+1});if(_=K.node,U++>40)throw new R.ErrnoError(32)}}return{path:y,node:_}},getPath(o){for(var c;;){if(R.isRoot(o)){var f=o.mount.mountpoint;return c?f[f.length-1]!=="/"?`${f}/${c}`:f+c:f}c=c?`${o.name}/${c}`:o.name,o=o.parent}},hashName(o,c){for(var f=0,p=0;p<c.length;p++)f=(f<<5)-f+c.charCodeAt(p)|0;return(o+f>>>0)%R.nameTable.length},hashAddNode(o){var c=R.hashName(o.parent.id,o.name);o.name_next=R.nameTable[c],R.nameTable[c]=o},hashRemoveNode(o){var c=R.hashName(o.parent.id,o.name);if(R.nameTable[c]===o)R.nameTable[c]=o.name_next;else for(var f=R.nameTable[c];f;){if(f.name_next===o){f.name_next=o.name_next;break}f=f.name_next}},lookupNode(o,c){var f=R.mayLookup(o);if(f)throw new R.ErrnoError(f,o);for(var p=R.hashName(o.id,c),_=R.nameTable[p];_;_=_.name_next){var y=_.name;if(_.parent.id===o.id&&y===c)return _}return R.lookup(o,c)},createNode(o,c,f,p){var _=new R.FSNode(o,c,f,p);return R.hashAddNode(_),_},destroyNode(o){R.hashRemoveNode(o)},isRoot(o){return o===o.parent},isMountpoint(o){return!!o.mounted},isFile(o){return(o&61440)===32768},isDir(o){return(o&61440)===16384},isLink(o){return(o&61440)===40960},isChrdev(o){return(o&61440)===8192},isBlkdev(o){return(o&61440)===24576},isFIFO(o){return(o&61440)===4096},isSocket(o){return(o&49152)===49152},flagsToPermissionString(o){var c=["r","w","rw"][o&3];return o&512&&(c+="w"),c},nodePermissions(o,c){return R.ignorePermissions?0:c.includes("r")&&!(o.mode&292)||c.includes("w")&&!(o.mode&146)||c.includes("x")&&!(o.mode&73)?2:0},mayLookup(o){var c=R.nodePermissions(o,"x");return c||(o.node_ops.lookup?0:2)},mayCreate(o,c){try{var f=R.lookupNode(o,c);return 20}catch{}return R.nodePermissions(o,"wx")},mayDelete(o,c,f){var p;try{p=R.lookupNode(o,c)}catch(y){return y.errno}var _=R.nodePermissions(o,"wx");if(_)return _;if(f){if(!R.isDir(p.mode))return 54;if(R.isRoot(p)||R.getPath(p)===R.cwd())return 10}else if(R.isDir(p.mode))return 31;return 0},mayOpen(o,c){return o?R.isLink(o.mode)?32:R.isDir(o.mode)&&(R.flagsToPermissionString(c)!=="r"||c&512)?31:R.nodePermissions(o,R.flagsToPermissionString(c)):44},MAX_OPEN_FDS:4096,nextfd(){for(var o=0;o<=R.MAX_OPEN_FDS;o++)if(!R.streams[o])return o;throw new R.ErrnoError(33)},getStreamChecked(o){var c=R.getStream(o);if(!c)throw new R.ErrnoError(8);return c},getStream:o=>R.streams[o],createStream(o,c=-1){return R.FSStream||(R.FSStream=function(){this.shared={}},R.FSStream.prototype={},Object.defineProperties(R.FSStream.prototype,{object:{get(){return this.node},set(f){this.node=f}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(f){this.shared.flags=f}},position:{get(){return this.shared.position},set(f){this.shared.position=f}}})),o=Object.assign(new R.FSStream,o),c==-1&&(c=R.nextfd()),o.fd=c,R.streams[c]=o,o},closeStream(o){R.streams[o]=null},chrdev_stream_ops:{open(o){var c=R.getDevice(o.node.rdev);o.stream_ops=c.stream_ops,o.stream_ops.open&&o.stream_ops.open(o)},llseek(){throw new R.ErrnoError(70)}},major:o=>o>>8,minor:o=>o&255,makedev:(o,c)=>o<<8|c,registerDevice(o,c){R.devices[o]={stream_ops:c}},getDevice:o=>R.devices[o],getMounts(o){for(var c=[],f=[o];f.length;){var p=f.pop();c.push(p),f.push.apply(f,p.mounts)}return c},syncfs(o,c){typeof o=="function"&&(c=o,o=!1),R.syncFSRequests++,R.syncFSRequests>1&&me(`warning: ${R.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var f=R.getMounts(R.root.mount),p=0;function _(x){return R.syncFSRequests--,c(x)}function y(x){if(x)return y.errored?void 0:(y.errored=!0,_(x));++p>=f.length&&_(null)}f.forEach(x=>{if(!x.type.syncfs)return y(null);x.type.syncfs(x,o,y)})},mount(o,c,f){var p=f==="/",_=!f,y;if(p&&R.root)throw new R.ErrnoError(10);if(!p&&!_){var x=R.lookupPath(f,{follow_mount:!1});if(f=x.path,y=x.node,R.isMountpoint(y))throw new R.ErrnoError(10);if(!R.isDir(y.mode))throw new R.ErrnoError(54)}var C={type:o,opts:c,mountpoint:f,mounts:[]},U=o.mount(C);return U.mount=C,C.root=U,p?R.root=U:y&&(y.mounted=C,y.mount&&y.mount.mounts.push(C)),U},unmount(o){var c=R.lookupPath(o,{follow_mount:!1});if(!R.isMountpoint(c.node))throw new R.ErrnoError(28);var f=c.node,p=f.mounted,_=R.getMounts(p);Object.keys(R.nameTable).forEach(x=>{for(var C=R.nameTable[x];C;){var U=C.name_next;_.includes(C.mount)&&R.destroyNode(C),C=U}}),f.mounted=null;var y=f.mount.mounts.indexOf(p);f.mount.mounts.splice(y,1)},lookup(o,c){return o.node_ops.lookup(o,c)},mknod(o,c,f){var p=R.lookupPath(o,{parent:!0}),_=p.node,y=Nt.basename(o);if(!y||y==="."||y==="..")throw new R.ErrnoError(28);var x=R.mayCreate(_,y);if(x)throw new R.ErrnoError(x);if(!_.node_ops.mknod)throw new R.ErrnoError(63);return _.node_ops.mknod(_,y,c,f)},create(o,c){return c=c!==void 0?c:438,c&=4095,c|=32768,R.mknod(o,c,0)},mkdir(o,c){return c=c!==void 0?c:511,c&=1023,c|=16384,R.mknod(o,c,0)},mkdirTree(o,c){for(var f=o.split("/"),p="",_=0;_<f.length;++_)if(f[_]){p+="/"+f[_];try{R.mkdir(p,c)}catch(y){if(y.errno!=20)throw y}}},mkdev(o,c,f){return typeof f>"u"&&(f=c,c=438),c|=8192,R.mknod(o,c,f)},symlink(o,c){if(!Ci.resolve(o))throw new R.ErrnoError(44);var f=R.lookupPath(c,{parent:!0}),p=f.node;if(!p)throw new R.ErrnoError(44);var _=Nt.basename(c),y=R.mayCreate(p,_);if(y)throw new R.ErrnoError(y);if(!p.node_ops.symlink)throw new R.ErrnoError(63);return p.node_ops.symlink(p,_,o)},rename(o,c){var f=Nt.dirname(o),p=Nt.dirname(c),_=Nt.basename(o),y=Nt.basename(c),x,C,U;if(x=R.lookupPath(o,{parent:!0}),C=x.node,x=R.lookupPath(c,{parent:!0}),U=x.node,!C||!U)throw new R.ErrnoError(44);if(C.mount!==U.mount)throw new R.ErrnoError(75);var H=R.lookupNode(C,_),K=Ci.relative(o,p);if(K.charAt(0)!==".")throw new R.ErrnoError(28);if(K=Ci.relative(c,f),K.charAt(0)!==".")throw new R.ErrnoError(55);var se;try{se=R.lookupNode(U,y)}catch{}if(H!==se){var he=R.isDir(H.mode),ye=R.mayDelete(C,_,he);if(ye)throw new R.ErrnoError(ye);if(ye=se?R.mayDelete(U,y,he):R.mayCreate(U,y),ye)throw new R.ErrnoError(ye);if(!C.node_ops.rename)throw new R.ErrnoError(63);if(R.isMountpoint(H)||se&&R.isMountpoint(se))throw new R.ErrnoError(10);if(U!==C&&(ye=R.nodePermissions(C,"w"),ye))throw new R.ErrnoError(ye);R.hashRemoveNode(H);try{C.node_ops.rename(H,U,y)}catch(ze){throw ze}finally{R.hashAddNode(H)}}},rmdir(o){var c=R.lookupPath(o,{parent:!0}),f=c.node,p=Nt.basename(o),_=R.lookupNode(f,p),y=R.mayDelete(f,p,!0);if(y)throw new R.ErrnoError(y);if(!f.node_ops.rmdir)throw new R.ErrnoError(63);if(R.isMountpoint(_))throw new R.ErrnoError(10);f.node_ops.rmdir(f,p),R.destroyNode(_)},readdir(o){var c=R.lookupPath(o,{follow:!0}),f=c.node;if(!f.node_ops.readdir)throw new R.ErrnoError(54);return f.node_ops.readdir(f)},unlink(o){var c=R.lookupPath(o,{parent:!0}),f=c.node;if(!f)throw new R.ErrnoError(44);var p=Nt.basename(o),_=R.lookupNode(f,p),y=R.mayDelete(f,p,!1);if(y)throw new R.ErrnoError(y);if(!f.node_ops.unlink)throw new R.ErrnoError(63);if(R.isMountpoint(_))throw new R.ErrnoError(10);f.node_ops.unlink(f,p),R.destroyNode(_)},readlink(o){var c=R.lookupPath(o),f=c.node;if(!f)throw new R.ErrnoError(44);if(!f.node_ops.readlink)throw new R.ErrnoError(28);return Ci.resolve(R.getPath(f.parent),f.node_ops.readlink(f))},stat(o,c){var f=R.lookupPath(o,{follow:!c}),p=f.node;if(!p)throw new R.ErrnoError(44);if(!p.node_ops.getattr)throw new R.ErrnoError(63);return p.node_ops.getattr(p)},lstat(o){return R.stat(o,!0)},chmod(o,c,f){var p;if(typeof o=="string"){var _=R.lookupPath(o,{follow:!f});p=_.node}else p=o;if(!p.node_ops.setattr)throw new R.ErrnoError(63);p.node_ops.setattr(p,{mode:c&4095|p.mode&-4096,timestamp:Date.now()})},lchmod(o,c){R.chmod(o,c,!0)},fchmod(o,c){var f=R.getStreamChecked(o);R.chmod(f.node,c)},chown(o,c,f,p){var _;if(typeof o=="string"){var y=R.lookupPath(o,{follow:!p});_=y.node}else _=o;if(!_.node_ops.setattr)throw new R.ErrnoError(63);_.node_ops.setattr(_,{timestamp:Date.now()})},lchown(o,c,f){R.chown(o,c,f,!0)},fchown(o,c,f){var p=R.getStreamChecked(o);R.chown(p.node,c,f)},truncate(o,c){if(c<0)throw new R.ErrnoError(28);var f;if(typeof o=="string"){var p=R.lookupPath(o,{follow:!0});f=p.node}else f=o;if(!f.node_ops.setattr)throw new R.ErrnoError(63);if(R.isDir(f.mode))throw new R.ErrnoError(31);if(!R.isFile(f.mode))throw new R.ErrnoError(28);var _=R.nodePermissions(f,"w");if(_)throw new R.ErrnoError(_);f.node_ops.setattr(f,{size:c,timestamp:Date.now()})},ftruncate(o,c){var f=R.getStreamChecked(o);if(!(f.flags&2097155))throw new R.ErrnoError(28);R.truncate(f.node,c)},utime(o,c,f){var p=R.lookupPath(o,{follow:!0}),_=p.node;_.node_ops.setattr(_,{timestamp:Math.max(c,f)})},open(o,c,f){if(o==="")throw new R.ErrnoError(44);c=typeof c=="string"?Q(c):c,f=typeof f>"u"?438:f,c&64?f=f&4095|32768:f=0;var p;if(typeof o=="object")p=o;else{o=Nt.normalize(o);try{var _=R.lookupPath(o,{follow:!(c&131072)});p=_.node}catch{}}var y=!1;if(c&64)if(p){if(c&128)throw new R.ErrnoError(20)}else p=R.mknod(o,f,0),y=!0;if(!p)throw new R.ErrnoError(44);if(R.isChrdev(p.mode)&&(c&=-513),c&65536&&!R.isDir(p.mode))throw new R.ErrnoError(54);if(!y){var x=R.mayOpen(p,c);if(x)throw new R.ErrnoError(x)}c&512&&!y&&R.truncate(p,0),c&=-131713;var C=R.createStream({node:p,path:R.getPath(p),flags:c,seekable:!0,position:0,stream_ops:p.stream_ops,ungotten:[],error:!1});return C.stream_ops.open&&C.stream_ops.open(C),u.logReadFiles&&!(c&1)&&(R.readFiles||(R.readFiles={}),o in R.readFiles||(R.readFiles[o]=1)),C},close(o){if(R.isClosed(o))throw new R.ErrnoError(8);o.getdents&&(o.getdents=null);try{o.stream_ops.close&&o.stream_ops.close(o)}catch(c){throw c}finally{R.closeStream(o.fd)}o.fd=null},isClosed(o){return o.fd===null},llseek(o,c,f){if(R.isClosed(o))throw new R.ErrnoError(8);if(!o.seekable||!o.stream_ops.llseek)throw new R.ErrnoError(70);if(f!=0&&f!=1&&f!=2)throw new R.ErrnoError(28);return o.position=o.stream_ops.llseek(o,c,f),o.ungotten=[],o.position},read(o,c,f,p,_){if(p<0||_<0)throw new R.ErrnoError(28);if(R.isClosed(o))throw new R.ErrnoError(8);if((o.flags&2097155)===1)throw new R.ErrnoError(8);if(R.isDir(o.node.mode))throw new R.ErrnoError(31);if(!o.stream_ops.read)throw new R.ErrnoError(28);var y=typeof _<"u";if(!y)_=o.position;else if(!o.seekable)throw new R.ErrnoError(70);var x=o.stream_ops.read(o,c,f,p,_);return y||(o.position+=x),x},write(o,c,f,p,_,y){if(p<0||_<0)throw new R.ErrnoError(28);if(R.isClosed(o))throw new R.ErrnoError(8);if(!(o.flags&2097155))throw new R.ErrnoError(8);if(R.isDir(o.node.mode))throw new R.ErrnoError(31);if(!o.stream_ops.write)throw new R.ErrnoError(28);o.seekable&&o.flags&1024&&R.llseek(o,0,2);var x=typeof _<"u";if(!x)_=o.position;else if(!o.seekable)throw new R.ErrnoError(70);var C=o.stream_ops.write(o,c,f,p,_,y);return x||(o.position+=C),C},allocate(o,c,f){if(R.isClosed(o))throw new R.ErrnoError(8);if(c<0||f<=0)throw new R.ErrnoError(28);if(!(o.flags&2097155))throw new R.ErrnoError(8);if(!R.isFile(o.node.mode)&&!R.isDir(o.node.mode))throw new R.ErrnoError(43);if(!o.stream_ops.allocate)throw new R.ErrnoError(138);o.stream_ops.allocate(o,c,f)},mmap(o,c,f,p,_){if(p&2&&!(_&2)&&(o.flags&2097155)!==2)throw new R.ErrnoError(2);if((o.flags&2097155)===1)throw new R.ErrnoError(2);if(!o.stream_ops.mmap)throw new R.ErrnoError(43);return o.stream_ops.mmap(o,c,f,p,_)},msync(o,c,f,p,_){return o.stream_ops.msync?o.stream_ops.msync(o,c,f,p,_):0},munmap:o=>0,ioctl(o,c,f){if(!o.stream_ops.ioctl)throw new R.ErrnoError(59);return o.stream_ops.ioctl(o,c,f)},readFile(o,c={}){if(c.flags=c.flags||0,c.encoding=c.encoding||"binary",c.encoding!=="utf8"&&c.encoding!=="binary")throw new Error(`Invalid encoding type "${c.encoding}"`);var f,p=R.open(o,c.flags),_=R.stat(o),y=_.size,x=new Uint8Array(y);return R.read(p,x,0,y,0),c.encoding==="utf8"?f=Ri(x,0):c.encoding==="binary"&&(f=x),R.close(p),f},writeFile(o,c,f={}){f.flags=f.flags||577;var p=R.open(o,f.flags,f.mode);if(typeof c=="string"){var _=new Uint8Array(Qi(c)+1),y=xs(c,_,0,_.length);R.write(p,_,0,y,void 0,f.canOwn)}else if(ArrayBuffer.isView(c))R.write(p,c,0,c.byteLength,void 0,f.canOwn);else throw new Error("Unsupported data type");R.close(p)},cwd:()=>R.currentPath,chdir(o){var c=R.lookupPath(o,{follow:!0});if(c.node===null)throw new R.ErrnoError(44);if(!R.isDir(c.node.mode))throw new R.ErrnoError(54);var f=R.nodePermissions(c.node,"x");if(f)throw new R.ErrnoError(f);R.currentPath=c.path},createDefaultDirectories(){R.mkdir("/tmp"),R.mkdir("/home"),R.mkdir("/home/web_user")},createDefaultDevices(){R.mkdir("/dev"),R.registerDevice(R.makedev(1,3),{read:()=>0,write:(p,_,y,x,C)=>x}),R.mkdev("/dev/null",R.makedev(1,3)),Ji.register(R.makedev(5,0),Ji.default_tty_ops),Ji.register(R.makedev(6,0),Ji.default_tty1_ops),R.mkdev("/dev/tty",R.makedev(5,0)),R.mkdev("/dev/tty1",R.makedev(6,0));var o=new Uint8Array(1024),c=0,f=()=>(c===0&&(c=ys(o).byteLength),o[--c]);R.createDevice("/dev","random",f),R.createDevice("/dev","urandom",f),R.mkdir("/dev/shm"),R.mkdir("/dev/shm/tmp")},createSpecialDirectories(){R.mkdir("/proc");var o=R.mkdir("/proc/self");R.mkdir("/proc/self/fd"),R.mount({mount(){var c=R.createNode(o,"fd",16895,73);return c.node_ops={lookup(f,p){var _=+p,y=R.getStreamChecked(_),x={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>y.path}};return x.parent=x,x}},c}},{},"/proc/self/fd")},createStandardStreams(){u.stdin?R.createDevice("/dev","stdin",u.stdin):R.symlink("/dev/tty","/dev/stdin"),u.stdout?R.createDevice("/dev","stdout",null,u.stdout):R.symlink("/dev/tty","/dev/stdout"),u.stderr?R.createDevice("/dev","stderr",null,u.stderr):R.symlink("/dev/tty1","/dev/stderr"),R.open("/dev/stdin",0),R.open("/dev/stdout",1),R.open("/dev/stderr",1)},ensureErrnoError(){R.ErrnoError||(R.ErrnoError=function(c,f){this.name="ErrnoError",this.node=f,this.setErrno=function(p){this.errno=p},this.setErrno(c),this.message="FS error"},R.ErrnoError.prototype=new Error,R.ErrnoError.prototype.constructor=R.ErrnoError,[44].forEach(o=>{R.genericErrors[o]=new R.ErrnoError(o),R.genericErrors[o].stack="<generic error, no stack>"}))},staticInit(){R.ensureErrnoError(),R.nameTable=new Array(4096),R.mount(q,{},"/"),R.createDefaultDirectories(),R.createDefaultDevices(),R.createSpecialDirectories(),R.filesystems={MEMFS:q}},init(o,c,f){R.init.initialized=!0,R.ensureErrnoError(),u.stdin=o||u.stdin,u.stdout=c||u.stdout,u.stderr=f||u.stderr,R.createStandardStreams()},quit(){R.init.initialized=!1;for(var o=0;o<R.streams.length;o++){var c=R.streams[o];c&&R.close(c)}},findObject(o,c){var f=R.analyzePath(o,c);return f.exists?f.object:null},analyzePath(o,c){try{var f=R.lookupPath(o,{follow:!c});o=f.path}catch{}var p={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var f=R.lookupPath(o,{parent:!0});p.parentExists=!0,p.parentPath=f.path,p.parentObject=f.node,p.name=Nt.basename(o),f=R.lookupPath(o,{follow:!c}),p.exists=!0,p.path=f.path,p.object=f.node,p.name=f.node.name,p.isRoot=f.path==="/"}catch(_){p.error=_.errno}return p},createPath(o,c,f,p){o=typeof o=="string"?o:R.getPath(o);for(var _=c.split("/").reverse();_.length;){var y=_.pop();if(y){var x=Nt.join2(o,y);try{R.mkdir(x)}catch{}o=x}}return x},createFile(o,c,f,p,_){var y=Nt.join2(typeof o=="string"?o:R.getPath(o),c),x=le(p,_);return R.create(y,x)},createDataFile(o,c,f,p,_,y){var x=c;o&&(o=typeof o=="string"?o:R.getPath(o),x=c?Nt.join2(o,c):o);var C=le(p,_),U=R.create(x,C);if(f){if(typeof f=="string"){for(var H=new Array(f.length),K=0,se=f.length;K<se;++K)H[K]=f.charCodeAt(K);f=H}R.chmod(U,C|146);var he=R.open(U,577);R.write(he,f,0,f.length,0,y),R.close(he),R.chmod(U,C)}return U},createDevice(o,c,f,p){var _=Nt.join2(typeof o=="string"?o:R.getPath(o),c),y=le(!!f,!!p);R.createDevice.major||(R.createDevice.major=64);var x=R.makedev(R.createDevice.major++,0);return R.registerDevice(x,{open(C){C.seekable=!1},close(C){p&&p.buffer&&p.buffer.length&&p(10)},read(C,U,H,K,se){for(var he=0,ye=0;ye<K;ye++){var ze;try{ze=f()}catch{throw new R.ErrnoError(29)}if(ze===void 0&&he===0)throw new R.ErrnoError(6);if(ze==null)break;he++,U[H+ye]=ze}return he&&(C.node.timestamp=Date.now()),he},write(C,U,H,K,se){for(var he=0;he<K;he++)try{p(U[H+he])}catch{throw new R.ErrnoError(29)}return K&&(C.node.timestamp=Date.now()),he}}),R.mkdev(_,y,x)},forceLoadFile(o){if(o.isDevice||o.isFolder||o.link||o.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(B)try{o.contents=Xr(B(o.url),!0),o.usedBytes=o.contents.length}catch{throw new R.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(o,c,f,p,_){function y(){this.lengthKnown=!1,this.chunks=[]}if(y.prototype.get=function(ye){if(!(ye>this.length-1||ye<0)){var ze=ye%this.chunkSize,Ke=ye/this.chunkSize|0;return this.getter(Ke)[ze]}},y.prototype.setDataGetter=function(ye){this.getter=ye},y.prototype.cacheLength=function(){var ye=new XMLHttpRequest;if(ye.open("HEAD",f,!1),ye.send(null),!(ye.status>=200&&ye.status<300||ye.status===304))throw new Error("Couldn't load "+f+". Status: "+ye.status);var ze=Number(ye.getResponseHeader("Content-length")),Ke,at=(Ke=ye.getResponseHeader("Accept-Ranges"))&&Ke==="bytes",dt=(Ke=ye.getResponseHeader("Content-Encoding"))&&Ke==="gzip",Re=1024*1024;at||(Re=ze);var je=(zt,ci)=>{if(zt>ci)throw new Error("invalid range ("+zt+", "+ci+") or no bytes requested!");if(ci>ze-1)throw new Error("only "+ze+" bytes available! programmer error!");var hn=new XMLHttpRequest;if(hn.open("GET",f,!1),ze!==Re&&hn.setRequestHeader("Range","bytes="+zt+"-"+ci),hn.responseType="arraybuffer",hn.overrideMimeType&&hn.overrideMimeType("text/plain; charset=x-user-defined"),hn.send(null),!(hn.status>=200&&hn.status<300||hn.status===304))throw new Error("Couldn't load "+f+". Status: "+hn.status);return hn.response!==void 0?new Uint8Array(hn.response||[]):Xr(hn.responseText||"",!0)},dn=this;dn.setDataGetter(zt=>{var ci=zt*Re,hn=(zt+1)*Re-1;if(hn=Math.min(hn,ze-1),typeof dn.chunks[zt]>"u"&&(dn.chunks[zt]=je(ci,hn)),typeof dn.chunks[zt]>"u")throw new Error("doXHR failed!");return dn.chunks[zt]}),(dt||!ze)&&(Re=ze=1,ze=this.getter(0).length,Re=ze,de("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=ze,this._chunkSize=Re,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){if(!A)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var x=new y;Object.defineProperties(x,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var C={isDevice:!1,contents:x}}else var C={isDevice:!1,url:f};var U=R.createFile(o,c,C,p,_);C.contents?U.contents=C.contents:C.url&&(U.contents=null,U.url=C.url),Object.defineProperties(U,{usedBytes:{get:function(){return this.contents.length}}});var H={},K=Object.keys(U.stream_ops);K.forEach(he=>{var ye=U.stream_ops[he];H[he]=function(){return R.forceLoadFile(U),ye.apply(null,arguments)}});function se(he,ye,ze,Ke,at){var dt=he.node.contents;if(at>=dt.length)return 0;var Re=Math.min(dt.length-at,Ke);if(dt.slice)for(var je=0;je<Re;je++)ye[ze+je]=dt[at+je];else for(var je=0;je<Re;je++)ye[ze+je]=dt.get(at+je);return Re}return H.read=(he,ye,ze,Ke,at)=>(R.forceLoadFile(U),se(he,ye,ze,Ke,at)),H.mmap=(he,ye,ze,Ke,at)=>{R.forceLoadFile(U);var dt=z(ye);if(!dt)throw new R.ErrnoError(48);return se(he,i(),dt,ye,ze),{ptr:dt,allocated:!0}},U.stream_ops=H,U}},fe=(o,c)=>(o>>>=0,o?Ri(r(),o,c):""),J={DEFAULT_POLLMASK:5,calculateAt(o,c,f){if(Nt.isAbs(c))return c;var p;if(o===-100)p=R.cwd();else{var _=J.getStreamFromFD(o);p=_.path}if(c.length==0){if(!f)throw new R.ErrnoError(44);return p}return Nt.join2(p,c)},doStat(o,c,f){try{var p=o(c)}catch(C){if(C&&C.node&&Nt.normalize(c)!==Nt.normalize(R.getPath(C.node)))return-54;throw C}l()[f>>>2>>>0]=p.dev,l()[f+4>>>2>>>0]=p.mode,d()[f+8>>>2>>>0]=p.nlink,l()[f+12>>>2>>>0]=p.uid,l()[f+16>>>2>>>0]=p.gid,l()[f+20>>>2>>>0]=p.rdev,it=[p.size>>>0,(Ie=p.size,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+24>>>2>>>0]=it[0],l()[f+28>>>2>>>0]=it[1],l()[f+32>>>2>>>0]=4096,l()[f+36>>>2>>>0]=p.blocks;var _=p.atime.getTime(),y=p.mtime.getTime(),x=p.ctime.getTime();return it=[Math.floor(_/1e3)>>>0,(Ie=Math.floor(_/1e3),+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+40>>>2>>>0]=it[0],l()[f+44>>>2>>>0]=it[1],d()[f+48>>>2>>>0]=_%1e3*1e3,it=[Math.floor(y/1e3)>>>0,(Ie=Math.floor(y/1e3),+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+56>>>2>>>0]=it[0],l()[f+60>>>2>>>0]=it[1],d()[f+64>>>2>>>0]=y%1e3*1e3,it=[Math.floor(x/1e3)>>>0,(Ie=Math.floor(x/1e3),+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+72>>>2>>>0]=it[0],l()[f+76>>>2>>>0]=it[1],d()[f+80>>>2>>>0]=x%1e3*1e3,it=[p.ino>>>0,(Ie=p.ino,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[f+88>>>2>>>0]=it[0],l()[f+92>>>2>>>0]=it[1],0},doMsync(o,c,f,p,_){if(!R.isFile(c.node.mode))throw new R.ErrnoError(43);if(p&2)return 0;var y=r().slice(o,o+f);R.msync(c,y,_,f,p)},varargs:void 0,get(){var o=l()[+J.varargs>>>2>>>0];return J.varargs+=4,o},getp(){return J.get()},getStr(o){var c=fe(o);return c},getStreamFromFD(o){var c=R.getStreamChecked(o);return c}};function be(o){if(P)return Vt(0,1,o);_e=o,ii()||(Ee.terminateAllThreads(),u.onExit&&u.onExit(o),pe=!0),M(o,new Ce(o))}var Fe=(o,c)=>{if(_e=o,P)throw qe(o),"unwind";be(o)},Oe=Fe,We=o=>{if(o instanceof Ce||o=="unwind")return _e;M(1,o)},Ee={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){P?Ee.initWorker():Ee.initMainThread()},initMainThread(){for(var o=10;o--;)Ee.allocateUnusedWorker();yt(()=>{ke(),Ee.loadWasmModuleToAllWorkers(()=>Le())})},initWorker(){Ht=!1},setExitStatus:o=>{_e=o},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var o of Ee.runningWorkers)Ge(o);for(var o of Ee.unusedWorkers)Ge(o);Ee.unusedWorkers=[],Ee.runningWorkers=[],Ee.pthreads=[]},returnWorkerToPool:o=>{var c=o.pthread_ptr;delete Ee.pthreads[c],Ee.unusedWorkers.push(o),Ee.runningWorkers.splice(Ee.runningWorkers.indexOf(o),1),o.pthread_ptr=0,gf(c)},receiveObjectTransfer(o){},threadInitTLS(){Ee.tlsInitFunctions.forEach(o=>o())},loadWasmModuleToWorker:o=>new Promise(c=>{o.onmessage=y=>{var x=y.data,C=x.cmd;if(x.targetThread&&x.targetThread!=pu()){var U=Ee.pthreads[x.targetThread];U?U.postMessage(x,x.transferList):me(`Internal error! Worker sent a message "${C}" to target pthread ${x.targetThread}, but that thread no longer exists!`);return}C==="checkMailbox"?uu():C==="spawnThread"?Ot(x):C==="cleanupThread"?un(x.thread):C==="killThread"?gt(x.thread):C==="cancelThread"?Pt(x.thread):C==="loaded"?(o.loaded=!0,E&&!o.pthread_ptr&&o.unref(),c(o)):C==="alert"?alert(`Thread ${x.threadId}: ${x.text}`):x.target==="setimmediate"?o.postMessage(x):C==="callHandler"?u[x.handler](...x.args):C&&me(`worker sent an unknown command ${C}`)},o.onerror=y=>{var x="worker sent an error!";throw me(`${x} ${y.filename}:${y.lineno}: ${y.message}`),y},E&&(o.on("message",y=>o.onmessage({data:y})),o.on("error",y=>o.onerror(y)));var f=[],p=["onExit","onAbort","print","printErr"];for(var _ of p)u.hasOwnProperty(_)&&f.push(_);o.postMessage({cmd:"load",handlers:f,urlOrBlob:u.mainScriptUrlOrBlob||e,wasmMemory:ue,wasmModule:Y})}),loadWasmModuleToAllWorkers(o){if(P)return o();Promise.all(Ee.unusedWorkers.map(Ee.loadWasmModuleToWorker)).then(o)},allocateUnusedWorker(){var o,c=O("emHdBindings.worker.js");o=new Worker(c),Ee.unusedWorkers.push(o)},getNewWorker(){return Ee.unusedWorkers.length==0&&(Ee.allocateUnusedWorker(),Ee.loadWasmModuleToWorker(Ee.unusedWorkers[0])),Ee.unusedWorkers.pop()}};u.PThread=Ee;var Te=o=>{for(;o.length>0;)o.shift()(u)},Xe=()=>{var o=pu(),c=d()[o+52>>>2>>>0],f=d()[o+56>>>2>>>0],p=c-f;r0(c,p),xe(c)};u.establishStackSpace=Xe;function qe(o){if(P)return Vt(1,0,o);Oe(o)}var Tt=(o,c)=>{var f=(_=>yf.apply(null,[o,_]))(c);function p(_){ii()?Ee.setExitStatus(_):_f(_)}p(f)};u.invokeEntryPoint=Tt;var Ht=u.noExitRuntime||!0,en=o=>{Ee.tlsInitFunctions.push(o)},Bt=(o,c)=>c+2097152>>>0<4194305-!!o?(o>>>0)+c*4294967296:NaN,pt=function(o,c){return o>>>=0,(f=>vf.apply(null,[o,f]))(c)},Gt=[],In=0;function Xt(o){o>>>=0;var c=new Qn(o);return c.get_caught()||(c.set_caught(!0),In--),c.set_rethrown(!1),Gt.push(c),o0(c.excPtr),c.get_exception_ptr()}var St=0,Zt=()=>{we(0,0);var o=Gt.pop();a0(o.excPtr),St=0};function Qn(o){this.excPtr=o,this.ptr=o-24,this.set_type=function(c){d()[this.ptr+4>>>2>>>0]=c},this.get_type=function(){return d()[this.ptr+4>>>2>>>0]},this.set_destructor=function(c){d()[this.ptr+8>>>2>>>0]=c},this.get_destructor=function(){return d()[this.ptr+8>>>2>>>0]},this.set_caught=function(c){c=c?1:0,i()[this.ptr+12>>>0>>>0]=c},this.get_caught=function(){return i()[this.ptr+12>>>0>>>0]!=0},this.set_rethrown=function(c){c=c?1:0,i()[this.ptr+13>>>0>>>0]=c},this.get_rethrown=function(){return i()[this.ptr+13>>>0>>>0]!=0},this.init=function(c,f){this.set_adjusted_ptr(0),this.set_type(c),this.set_destructor(f)},this.set_adjusted_ptr=function(c){d()[this.ptr+16>>>2>>>0]=c},this.get_adjusted_ptr=function(){return d()[this.ptr+16>>>2>>>0]},this.get_exception_ptr=function(){var c=c0(this.get_type());if(c)return d()[this.excPtr>>>2>>>0];var f=this.get_adjusted_ptr();return f!==0?f:this.excPtr}}function sa(o){throw o>>>=0,St||(St=o),St}var Pi=o=>{var c=St;if(!c)return El(0),0;var f=new Qn(c);f.set_adjusted_ptr(c);var p=f.get_type();if(!p)return El(0),c;for(var _ in o){var y=o[_];if(y===0||y===p)break;var x=f.ptr+16;if(l0(y,p,x))return El(y),c}return El(p),c};function za(){return Pi([])}function vT(o){return o>>>=0,Pi([o])}function yT(o,c){return o>>>=0,c>>>=0,Pi([o,c])}function bT(o){o>>>=0;var c=new Qn(o).get_exception_ptr();return c}var $_=()=>{var o=Gt.pop();o||lt("no exception to throw");var c=o.excPtr;throw o.get_rethrown()||(Gt.push(o),o.set_rethrown(!0),o.set_caught(!1),In++),St=c,St};function xT(o){if(o>>>=0,!!o){var c=new Qn(o);Gt.push(c),c.set_rethrown(!0),$_()}}function wT(o,c,f){o>>>=0,c>>>=0,f>>>=0;var p=new Qn(o);throw p.init(c,f),St=o,In++,St}var ST=()=>In;function MT(o){o>>>=0,e0(o,!A,1,!b,2097152,!1),Ee.threadInitTLS()}function ET(o){o>>>=0,P?postMessage({cmd:"cleanupThread",thread:o}):un(o)}function q_(o,c,f,p){return P?Vt(2,1,o,c,f,p):K_(o,c,f,p)}function K_(o,c,f,p){if(o>>>=0,c>>>=0,f>>>=0,p>>>=0,typeof SharedArrayBuffer>"u")return me("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var _=[],y=0;if(P&&(_.length===0||y))return q_(o,c,f,p);var x={startRoutine:f,pthread_ptr:o,arg:p,transferList:_};return P?(x.cmd="spawnThread",postMessage(x,_),0):Ot(x)}function Z_(o,c){if(P)return Vt(3,1,o,c);o>>>=0;try{return o=J.getStr(o),R.chmod(o,c),0}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function Q_(o,c,f,p){if(P)return Vt(4,1,o,c,f,p);c>>>=0;try{if(c=J.getStr(c),c=J.calculateAt(o,c),f&-8)return-28;var _=R.lookupPath(c,{follow:!0}),y=_.node;if(!y)return-44;var x="";return f&4&&(x+="r"),f&2&&(x+="w"),f&1&&(x+="x"),x&&R.nodePermissions(y,x)?-2:0}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return-C.errno}}function J_(o,c,f,p){return P?Vt(5,0,o,c,f,p):0}function ev(o,c){if(P)return Vt(6,1,o,c);try{return R.fchmod(o,c),0}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var TT=o=>(l()[Zv()>>>2>>>0]=o,o);function tv(o,c,f){if(P)return Vt(7,1,o,c,f);f>>>=0,J.varargs=f;try{var p=J.getStreamFromFD(o);switch(c){case 0:{var _=J.get();if(_<0)return-28;for(;R.streams[_];)_++;var y;return y=R.createStream(p,_),y.fd}case 1:case 2:return 0;case 3:return p.flags;case 4:{var _=J.get();return p.flags|=_,0}case 5:{var _=J.getp(),x=0;return s()[_+x>>>1>>>0]=2,0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:return TT(28),-1;default:return-28}}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return-C.errno}}function nv(o,c){if(P)return Vt(8,1,o,c);c>>>=0;try{var f=J.getStreamFromFD(o);return J.doStat(R.stat,f.path,c)}catch(p){if(typeof R>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}var Qc=(o,c,f)=>xs(o,r(),c,f);function iv(o,c){if(P)return Vt(9,1,o,c);o>>>=0,c>>>=0;try{if(c===0)return-28;var f=R.cwd(),p=Qi(f)+1;return c<p?-68:(Qc(f,o,c),p)}catch(_){if(typeof R>"u"||_.name!=="ErrnoError")throw _;return-_.errno}}function rv(o,c,f){if(P)return Vt(10,1,o,c,f);c>>>=0,f>>>=0;try{var p=J.getStreamFromFD(o);p.getdents||(p.getdents=R.readdir(p.path));for(var _=280,y=0,x=R.llseek(p,0,1),C=Math.floor(x/_);C<p.getdents.length&&y+_<=f;){var U,H,K=p.getdents[C];if(K===".")U=p.node.id,H=4;else if(K===".."){var se=R.lookupPath(p.path,{parent:!0});U=se.node.id,H=4}else{var he=R.lookupNode(p.node,K);U=he.id,H=R.isChrdev(he.mode)?2:R.isDir(he.mode)?4:R.isLink(he.mode)?10:8}it=[U>>>0,(Ie=U,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[c+y>>>2>>>0]=it[0],l()[c+y+4>>>2>>>0]=it[1],it=[(C+1)*_>>>0,(Ie=(C+1)*_,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[c+y+8>>>2>>>0]=it[0],l()[c+y+12>>>2>>>0]=it[1],s()[c+y+16>>>1>>>0]=280,i()[c+y+18>>>0>>>0]=H,Qc(K,c+y+19,256),y+=_,C+=1}return R.llseek(p,C*_,0),y}catch(ye){if(typeof R>"u"||ye.name!=="ErrnoError")throw ye;return-ye.errno}}function sv(o,c,f){if(P)return Vt(11,1,o,c,f);f>>>=0,J.varargs=f;try{var p=J.getStreamFromFD(o);switch(c){case 21509:return p.tty?0:-59;case 21505:{if(!p.tty)return-59;if(p.tty.ops.ioctl_tcgets){var _=p.tty.ops.ioctl_tcgets(p),y=J.getp();l()[y>>>2>>>0]=_.c_iflag||0,l()[y+4>>>2>>>0]=_.c_oflag||0,l()[y+8>>>2>>>0]=_.c_cflag||0,l()[y+12>>>2>>>0]=_.c_lflag||0;for(var x=0;x<32;x++)i()[y+x+17>>>0>>>0]=_.c_cc[x]||0;return 0}return 0}case 21510:case 21511:case 21512:return p.tty?0:-59;case 21506:case 21507:case 21508:{if(!p.tty)return-59;if(p.tty.ops.ioctl_tcsets){for(var y=J.getp(),C=l()[y>>>2>>>0],U=l()[y+4>>>2>>>0],H=l()[y+8>>>2>>>0],K=l()[y+12>>>2>>>0],se=[],x=0;x<32;x++)se.push(i()[y+x+17>>>0>>>0]);return p.tty.ops.ioctl_tcsets(p.tty,c,{c_iflag:C,c_oflag:U,c_cflag:H,c_lflag:K,c_cc:se})}return 0}case 21519:{if(!p.tty)return-59;var y=J.getp();return l()[y>>>2>>>0]=0,0}case 21520:return p.tty?-28:-59;case 21531:{var y=J.getp();return R.ioctl(p,c,y)}case 21523:{if(!p.tty)return-59;if(p.tty.ops.ioctl_tiocgwinsz){var he=p.tty.ops.ioctl_tiocgwinsz(p.tty),y=J.getp();s()[y>>>1>>>0]=he[0],s()[y+2>>>1>>>0]=he[1]}return 0}case 21524:return p.tty?0:-59;case 21515:return p.tty?0:-59;default:return-28}}catch(ye){if(typeof R>"u"||ye.name!=="ErrnoError")throw ye;return-ye.errno}}function av(o,c){if(P)return Vt(12,1,o,c);o>>>=0,c>>>=0;try{return o=J.getStr(o),J.doStat(R.lstat,o,c)}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function ov(o,c,f){if(P)return Vt(13,1,o,c,f);c>>>=0;try{return c=J.getStr(c),c=J.calculateAt(o,c),c=Nt.normalize(c),c[c.length-1]==="/"&&(c=c.substr(0,c.length-1)),R.mkdir(c,f,0),0}catch(p){if(typeof R>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}function lv(o,c,f,p){if(P)return Vt(14,1,o,c,f,p);c>>>=0,f>>>=0;try{c=J.getStr(c);var _=p&256,y=p&4096;return p=p&-6401,c=J.calculateAt(o,c,y),J.doStat(_?R.lstat:R.stat,c,f)}catch(x){if(typeof R>"u"||x.name!=="ErrnoError")throw x;return-x.errno}}function cv(o,c,f,p){if(P)return Vt(15,1,o,c,f,p);c>>>=0,p>>>=0,J.varargs=p;try{c=J.getStr(c),c=J.calculateAt(o,c);var _=p?J.get():0;return R.open(c,f,_).fd}catch(y){if(typeof R>"u"||y.name!=="ErrnoError")throw y;return-y.errno}}function uv(o,c,f,p){if(P)return Vt(16,1,o,c,f,p);c>>>=0,f>>>=0,p>>>=0;try{if(c=J.getStr(c),c=J.calculateAt(o,c),p<=0)return-28;var _=R.readlink(c),y=Math.min(p,Qi(_)),x=i()[f+y>>>0];return Qc(_,f,p+1),i()[f+y>>>0]=x,y}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return-C.errno}}function dv(o,c,f,p){if(P)return Vt(17,1,o,c,f,p);c>>>=0,p>>>=0;try{return c=J.getStr(c),p=J.getStr(p),c=J.calculateAt(o,c),p=J.calculateAt(f,p),R.rename(c,p),0}catch(_){if(typeof R>"u"||_.name!=="ErrnoError")throw _;return-_.errno}}function hv(o,c){if(P)return Vt(18,1,o,c);o>>>=0,c>>>=0;try{return o=J.getStr(o),J.doStat(R.stat,o,c)}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function fv(o,c,f){if(P)return Vt(19,1,o,c,f);c>>>=0;try{return c=J.getStr(c),c=J.calculateAt(o,c),f===0?R.unlink(c):f===512?R.rmdir(c):lt("Invalid flags passed to unlinkat"),0}catch(p){if(typeof R>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}function AT(o,c,f,p,_){}var CT=()=>{for(var o=new Array(256),c=0;c<256;++c)o[c]=String.fromCharCode(c);pv=o},pv,Bn=o=>{for(var c="",f=o;r()[f>>>0];)c+=pv[r()[f++>>>0]];return c},Ha={},aa={},Jc={},Ga,Lt=o=>{throw new Ga(o)},mv,eu=o=>{throw new mv(o)},Gi=(o,c,f)=>{o.forEach(function(C){Jc[C]=c});function p(C){var U=f(C);U.length!==o.length&&eu("Mismatched type converter count");for(var H=0;H<o.length;++H)Lr(o[H],U[H])}var _=new Array(c.length),y=[],x=0;c.forEach((C,U)=>{aa.hasOwnProperty(C)?_[U]=aa[C]:(y.push(C),Ha.hasOwnProperty(C)||(Ha[C]=[]),Ha[C].push(()=>{_[U]=aa[C],++x,x===y.length&&p(_)}))}),y.length===0&&p(_)};function RT(o,c,f={}){var p=c.name;if(o||Lt(`type "${p}" must have a positive integer typeid pointer`),aa.hasOwnProperty(o)){if(f.ignoreDuplicateRegistrations)return;Lt(`Cannot register type '${p}' twice`)}if(aa[o]=c,delete Jc[o],Ha.hasOwnProperty(o)){var _=Ha[o];delete Ha[o],_.forEach(y=>y())}}function Lr(o,c,f={}){if(!("argPackAdvance"in c))throw new TypeError("registerType registeredInstance requires argPackAdvance");return RT(o,c,f)}var Yr=8;function PT(o,c,f,p){o>>>=0,c>>>=0,c=Bn(c),Lr(o,{name:c,fromWireType:function(_){return!!_},toWireType:function(_,y){return y?f:p},argPackAdvance:Yr,readValueFromPointer:function(_){return this.fromWireType(r()[_>>>0])},destructorFunction:null})}var LT=o=>({count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}),Jh=o=>{function c(f){return f.$$.ptrType.registeredClass.name}Lt(c(o)+" instance already deleted")},ef=!1,gv=o=>{},IT=o=>{o.smartPtr?o.smartPtrType.rawDestructor(o.smartPtr):o.ptrType.registeredClass.rawDestructor(o.ptr)},_v=o=>{o.count.value-=1;var c=o.count.value===0;c&&IT(o)},vv=(o,c,f)=>{if(c===f)return o;if(f.baseClass===void 0)return null;var p=vv(o,c,f.baseClass);return p===null?null:f.downcast(p)},yv={},DT=()=>Object.keys(yl).length,kT=()=>{var o=[];for(var c in yl)yl.hasOwnProperty(c)&&o.push(yl[c]);return o},_l=[],tf=()=>{for(;_l.length;){var o=_l.pop();o.$$.deleteScheduled=!1,o.delete()}},vl,FT=o=>{vl=o,_l.length&&vl&&vl(tf)},UT=()=>{u.getInheritedInstanceCount=DT,u.getLiveInheritedInstances=kT,u.flushPendingDeletes=tf,u.setDelayFunction=FT},yl={},OT=(o,c)=>{for(c===void 0&&Lt("ptr should not be undefined");o.baseClass;)c=o.upcast(c),o=o.baseClass;return c},NT=(o,c)=>(c=OT(o,c),yl[c]),tu=(o,c)=>{(!c.ptrType||!c.ptr)&&eu("makeClassHandle requires ptr and ptrType");var f=!!c.smartPtrType,p=!!c.smartPtr;return f!==p&&eu("Both smartPtrType and smartPtr must be specified"),c.count={value:1},bl(Object.create(o,{$$:{value:c}}))};function BT(o){var c=this.getPointee(o);if(!c)return this.destructor(o),null;var f=NT(this.registeredClass,c);if(f!==void 0){if(f.$$.count.value===0)return f.$$.ptr=c,f.$$.smartPtr=o,f.clone();var p=f.clone();return this.destructor(o),p}function _(){return this.isSmartPointer?tu(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:c,smartPtrType:this,smartPtr:o}):tu(this.registeredClass.instancePrototype,{ptrType:this,ptr:o})}var y=this.registeredClass.getActualType(c),x=yv[y];if(!x)return _.call(this);var C;this.isConst?C=x.constPointerType:C=x.pointerType;var U=vv(c,this.registeredClass,C.registeredClass);return U===null?_.call(this):this.isSmartPointer?tu(C.registeredClass.instancePrototype,{ptrType:C,ptr:U,smartPtrType:this,smartPtr:o}):tu(C.registeredClass.instancePrototype,{ptrType:C,ptr:U})}var bl=o=>typeof FinalizationRegistry>"u"?(bl=c=>c,o):(ef=new FinalizationRegistry(c=>{_v(c.$$)}),bl=c=>{var f=c.$$,p=!!f.smartPtr;if(p){var _={$$:f};ef.register(c,_,c)}return c},gv=c=>ef.unregister(c),bl(o)),zT=()=>{Object.assign(nu.prototype,{isAliasOf(o){if(!(this instanceof nu)||!(o instanceof nu))return!1;var c=this.$$.ptrType.registeredClass,f=this.$$.ptr;o.$$=o.$$;for(var p=o.$$.ptrType.registeredClass,_=o.$$.ptr;c.baseClass;)f=c.upcast(f),c=c.baseClass;for(;p.baseClass;)_=p.upcast(_),p=p.baseClass;return c===p&&f===_},clone(){if(this.$$.ptr||Jh(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var o=bl(Object.create(Object.getPrototypeOf(this),{$$:{value:LT(this.$$)}}));return o.$$.count.value+=1,o.$$.deleteScheduled=!1,o},delete(){this.$$.ptr||Jh(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Lt("Object already scheduled for deletion"),gv(this),_v(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Jh(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Lt("Object already scheduled for deletion"),_l.push(this),_l.length===1&&vl&&vl(tf),this.$$.deleteScheduled=!0,this}})};function nu(){}var HT=48,GT=57,iu=o=>{if(o===void 0)return"_unknown";o=o.replace(/[^a-zA-Z0-9_]/g,"$");var c=o.charCodeAt(0);return c>=HT&&c<=GT?`_${o}`:o};function ru(o,c){return o=iu(o),{[o]:function(){return c.apply(this,arguments)}}[o]}var nf=(o,c,f)=>{if(o[c].overloadTable===void 0){var p=o[c];o[c]=function(){return o[c].overloadTable.hasOwnProperty(arguments.length)||Lt(`Function '${f}' called with an invalid number of arguments (${arguments.length}) - expects one of (${o[c].overloadTable})!`),o[c].overloadTable[arguments.length].apply(this,arguments)},o[c].overloadTable=[],o[c].overloadTable[p.argCount]=p}},rf=(o,c,f)=>{u.hasOwnProperty(o)?((f===void 0||u[o].overloadTable!==void 0&&u[o].overloadTable[f]!==void 0)&&Lt(`Cannot register public name '${o}' twice`),nf(u,o,o),u.hasOwnProperty(f)&&Lt(`Cannot register multiple overloads of a function with the same number of arguments (${f})!`),u[o].overloadTable[f]=c):(u[o]=c,f!==void 0&&(u[o].numArguments=f))};function VT(o,c,f,p,_,y,x,C){this.name=o,this.constructor=c,this.instancePrototype=f,this.rawDestructor=p,this.baseClass=_,this.getActualType=y,this.upcast=x,this.downcast=C,this.pureVirtualFunctions=[]}var su=(o,c,f)=>{for(;c!==f;)c.upcast||Lt(`Expected null or instance of ${f.name}, got an instance of ${c.name}`),o=c.upcast(o),c=c.baseClass;return o};function WT(o,c){if(c===null)return this.isReference&&Lt(`null is not a valid ${this.name}`),0;c.$$||Lt(`Cannot pass "${lf(c)}" as a ${this.name}`),c.$$.ptr||Lt(`Cannot pass deleted object as a pointer of type ${this.name}`);var f=c.$$.ptrType.registeredClass,p=su(c.$$.ptr,f,this.registeredClass);return p}function jT(o,c){var f;if(c===null)return this.isReference&&Lt(`null is not a valid ${this.name}`),this.isSmartPointer?(f=this.rawConstructor(),o!==null&&o.push(this.rawDestructor,f),f):0;c.$$||Lt(`Cannot pass "${lf(c)}" as a ${this.name}`),c.$$.ptr||Lt(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&c.$$.ptrType.isConst&&Lt(`Cannot convert argument of type ${c.$$.smartPtrType?c.$$.smartPtrType.name:c.$$.ptrType.name} to parameter type ${this.name}`);var p=c.$$.ptrType.registeredClass;if(f=su(c.$$.ptr,p,this.registeredClass),this.isSmartPointer)switch(c.$$.smartPtr===void 0&&Lt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:c.$$.smartPtrType===this?f=c.$$.smartPtr:Lt(`Cannot convert argument of type ${c.$$.smartPtrType?c.$$.smartPtrType.name:c.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:f=c.$$.smartPtr;break;case 2:if(c.$$.smartPtrType===this)f=c.$$.smartPtr;else{var _=c.clone();f=this.rawShare(f,Qt.toHandle(()=>_.delete())),o!==null&&o.push(this.rawDestructor,f)}break;default:Lt("Unsupporting sharing policy")}return f}function XT(o,c){if(c===null)return this.isReference&&Lt(`null is not a valid ${this.name}`),0;c.$$||Lt(`Cannot pass "${lf(c)}" as a ${this.name}`),c.$$.ptr||Lt(`Cannot pass deleted object as a pointer of type ${this.name}`),c.$$.ptrType.isConst&&Lt(`Cannot convert argument of type ${c.$$.ptrType.name} to parameter type ${this.name}`);var f=c.$$.ptrType.registeredClass,p=su(c.$$.ptr,f,this.registeredClass);return p}function bv(o){return this.fromWireType(d()[o>>>2>>>0])}var YT=()=>{Object.assign(xl.prototype,{getPointee(o){return this.rawGetPointee&&(o=this.rawGetPointee(o)),o},destructor(o){this.rawDestructor&&this.rawDestructor(o)},argPackAdvance:Yr,readValueFromPointer:bv,deleteObject(o){o!==null&&o.delete()},fromWireType:BT})};function xl(o,c,f,p,_,y,x,C,U,H,K){this.name=o,this.registeredClass=c,this.isReference=f,this.isConst=p,this.isSmartPointer=_,this.pointeeType=y,this.sharingPolicy=x,this.rawGetPointee=C,this.rawConstructor=U,this.rawShare=H,this.rawDestructor=K,!_&&c.baseClass===void 0?p?(this.toWireType=WT,this.destructorFunction=null):(this.toWireType=XT,this.destructorFunction=null):this.toWireType=jT}var xv=(o,c,f)=>{u.hasOwnProperty(o)||eu("Replacing nonexistant public symbol"),u[o].overloadTable!==void 0&&f!==void 0?u[o].overloadTable[f]=c:(u[o]=c,u[o].argCount=f)},$T=(o,c,f)=>{var p=u["dynCall_"+o];return f&&f.length?p.apply(null,[c].concat(f)):p.call(null,c)},qT=(o,c,f)=>{var p=$T(o,c,f);return p},KT=(o,c)=>{var f=[];return function(){return f.length=0,Object.assign(f,arguments),qT(o,c,f)}},li=(o,c)=>{o=Bn(o);function f(){return KT(o,c)}var p=f();return typeof p!="function"&&Lt(`unknown function pointer with signature ${o}: ${c}`),p},ZT=(o,c)=>{var f=ru(c,function(p){this.name=c,this.message=p;var _=new Error(p).stack;_!==void 0&&(this.stack=this.toString()+`
`+_.replace(/^Error(:[^\n]*)?\n/,""))});return f.prototype=Object.create(o.prototype),f.prototype.constructor=f,f.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},f},wv,Sv=o=>{var c=Jv(o),f=Bn(c);return Ir(c),f},$r=(o,c)=>{var f=[],p={};function _(y){if(!p[y]&&!aa[y]){if(Jc[y]){Jc[y].forEach(_);return}f.push(y),p[y]=!0}}throw c.forEach(_),new wv(`${o}: `+f.map(Sv).join([", "]))};function QT(o,c,f,p,_,y,x,C,U,H,K,se,he){o>>>=0,c>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0,C>>>=0,U>>>=0,H>>>=0,K>>>=0,se>>>=0,he>>>=0,K=Bn(K),y=li(_,y),C&&(C=li(x,C)),H&&(H=li(U,H)),he=li(se,he);var ye=iu(K);rf(ye,function(){$r(`Cannot construct ${K} due to unbound types`,[p])}),Gi([o,c,f],p?[p]:[],function(ze){ze=ze[0];var Ke,at;p?(Ke=ze.registeredClass,at=Ke.instancePrototype):at=nu.prototype;var dt=ru(ye,function(){if(Object.getPrototypeOf(this)!==Re)throw new Ga("Use 'new' to construct "+K);if(je.constructor_body===void 0)throw new Ga(K+" has no accessible constructor");var hn=je.constructor_body[arguments.length];if(hn===void 0)throw new Ga(`Tried to invoke ctor of ${K} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(je.constructor_body).toString()}) parameters instead!`);return hn.apply(this,arguments)}),Re=Object.create(at,{constructor:{value:dt}});dt.prototype=Re;var je=new VT(K,dt,Re,he,Ke,y,C,H);je.baseClass&&(je.baseClass.__derivedClasses===void 0&&(je.baseClass.__derivedClasses=[]),je.baseClass.__derivedClasses.push(je));var dn=new xl(K,je,!0,!1,!1),zt=new xl(K+"*",je,!1,!1,!1),ci=new xl(K+" const*",je,!1,!0,!1);return yv[o]={pointerType:zt,constPointerType:ci},xv(ye,dt),[dn,zt,ci]})}var au=o=>{for(;o.length;){var c=o.pop(),f=o.pop();f(c)}};function Mv(o,c){if(!(o instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof o} which is not a function`);var f=ru(o.name||"unknownFunctionName",function(){});f.prototype=o.prototype;var p=new f,_=o.apply(p,c);return _ instanceof Object?_:p}var ou=o=>{try{return o()}catch(c){lt(c)}},JT=()=>{if(!ii())try{P?_f(_e):Oe(_e)}catch(o){We(o)}},sf=o=>{if(!pe)try{o(),JT()}catch(c){We(c)}},Ev=()=>{oi+=1},eA=()=>{oi-=1},_t={instrumentWasmImports(o){var c=/^(invoke_.*|__asyncjs__.*)$/;for(var f in o)(function(p){var _=o[p];_.sig,typeof _=="function"&&(_.isAsync||c.test(p))})(f)},instrumentWasmExports(o){var c={};for(var f in o)(function(p){var _=o[p];typeof _=="function"?c[p]=function(){_t.exportCallStack.push(p);try{return _.apply(null,arguments)}finally{if(!pe){var y=_t.exportCallStack.pop();Ae(y===p),_t.maybeStopUnwind()}}}:c[p]=_})(f);return c},State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callStackNameToId:{},callStackIdToName:{},callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId(o){var c=_t.callStackNameToId[o];return c===void 0&&(c=_t.callStackId++,_t.callStackNameToId[o]=c,_t.callStackIdToName[c]=o),c},maybeStopUnwind(){_t.currData&&_t.state===_t.State.Unwinding&&_t.exportCallStack.length===0&&(_t.state=_t.State.Normal,Ev(),ou(Bb),typeof Fibers<"u"&&Fibers.trampoline())},whenDone(){return new Promise((o,c)=>{_t.asyncPromiseHandlers={resolve:o,reject:c}})},allocateData(){var o=Ml(12+_t.StackSize);return _t.setDataHeader(o,o+12,_t.StackSize),_t.setDataRewindFunc(o),o},setDataHeader(o,c,f){d()[o>>>2>>>0]=c,d()[o+4>>>2>>>0]=c+f},setDataRewindFunc(o){var c=_t.exportCallStack[0],f=_t.getCallStackId(c);l()[o+8>>>2>>>0]=f},getDataRewindFunc(o){var c=l()[o+8>>>2>>>0],f=_t.callStackIdToName[c],p=ne[f];return p},doRewind(o){var c=_t.getDataRewindFunc(o);return eA(),c()},handleSleep(o){if(!pe){if(_t.state===_t.State.Normal){var c=!1,f=!1;o((p=0)=>{if(!pe&&(_t.handleSleepReturnValue=p,c=!0,!!f)){_t.state=_t.State.Rewinding,ou(()=>zb(_t.currData)),typeof Browser<"u"&&Browser.mainLoop.func&&Browser.mainLoop.resume();var _,y=!1;try{_=_t.doRewind(_t.currData)}catch(U){_=U,y=!0}var x=!1;if(!_t.currData){var C=_t.asyncPromiseHandlers;C&&(_t.asyncPromiseHandlers=null,(y?C.reject:C.resolve)(_),x=!0)}if(y&&!x)throw _}}),f=!0,c||(_t.state=_t.State.Unwinding,_t.currData=_t.allocateData(),typeof Browser<"u"&&Browser.mainLoop.func&&Browser.mainLoop.pause(),ou(()=>Nb(_t.currData)))}else _t.state===_t.State.Rewinding?(_t.state=_t.State.Normal,ou(Hb),Ir(_t.currData),_t.currData=null,_t.sleepCallbacks.forEach(p=>sf(p))):lt(`invalid state: ${_t.state}`);return _t.handleSleepReturnValue}},handleAsync(o){return _t.handleSleep(c=>{o().then(c)})}};function lu(o,c,f,p,_,y){var x=c.length;x<2&&Lt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var C=c[1]!==null&&f!==null,U=!1,H=1;H<c.length;++H)if(c[H]!==null&&c[H].destructorFunction===void 0){U=!0;break}for(var K=c[0].name!=="void",se="",he="",H=0;H<x-2;++H)se+=(H!==0?", ":"")+"arg"+H,he+=(H!==0?", ":"")+"arg"+H+"Wired";var ye=`
return function ${iu(o)}(${se}) {
if (arguments.length !== ${x-2}) {
throwBindingError('function ${o} called with ' + arguments.length + ' arguments, expected ${x-2}');
}`;U&&(ye+=`var destructors = [];
`);var ze=U?"destructors":"null",Ke=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],at=[Lt,p,_,au,c[0],c[1]];C&&(ye+="var thisWired = classParam.toWireType("+ze+`, this);
`);for(var H=0;H<x-2;++H)ye+="var arg"+H+"Wired = argType"+H+".toWireType("+ze+", arg"+H+"); // "+c[H+2].name+`
`,Ke.push("argType"+H),at.push(c[H+2]);if(C&&(he="thisWired"+(he.length>0?", ":"")+he),ye+=(K||y?"var rv = ":"")+"invoker(fn"+(he.length>0?", ":"")+he+`);
`,Ke.push("Asyncify"),at.push(_t),ye+="function onDone("+(K?"rv":"")+`) {
`,U)ye+=`runDestructors(destructors);
`;else for(var H=C?1:2;H<c.length;++H){var dt=H===1?"thisWired":"arg"+(H-2)+"Wired";c[H].destructorFunction!==null&&(ye+=dt+"_dtor("+dt+"); // "+c[H].name+`
`,Ke.push(dt+"_dtor"),at.push(c[H].destructorFunction))}return K&&(ye+=`var ret = retType.fromWireType(rv);
return ret;
`),ye+=`}
`,ye+="return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone("+(K?"rv":"")+`);
`,ye+=`}
`,Ke.push(ye),Mv(Function,Ke).apply(null,at)}var cu=(o,c)=>{for(var f=[],p=0;p<o;p++)f.push(d()[c+p*4>>>2>>>0]);return f},af=o=>{o=o.trim();const c=o.indexOf("(");return c!==-1?(Ae(o[o.length-1]==")","Parentheses for argument names should match."),o.substr(0,c)):o};function tA(o,c,f,p,_,y,x,C){o>>>=0,c>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0;var U=cu(f,p);c=Bn(c),c=af(c),y=li(_,y),Gi([],[o],function(H){H=H[0];var K=`${H.name}.${c}`;function se(){$r(`Cannot call ${K} due to unbound types`,U)}c.startsWith("@@")&&(c=Symbol[c.substring(2)]);var he=H.registeredClass.constructor;return he[c]===void 0?(se.argCount=f-1,he[c]=se):(nf(he,c,K),he[c].overloadTable[f-1]=se),Gi([],U,function(ye){var ze=[ye[0],null].concat(ye.slice(1)),Ke=lu(K,ze,null,y,x,C);if(he[c].overloadTable===void 0?(Ke.argCount=f-1,he[c]=Ke):he[c].overloadTable[f-1]=Ke,H.registeredClass.__derivedClasses)for(const at of H.registeredClass.__derivedClasses)at.constructor.hasOwnProperty(c)||(at.constructor[c]=Ke);return[]}),[]})}var Tv=(o,c,f)=>(o instanceof Object||Lt(`${f} with invalid "this": ${o}`),o instanceof c.registeredClass.constructor||Lt(`${f} incompatible with "this" of type ${o.constructor.name}`),o.$$.ptr||Lt(`cannot call emscripten binding method ${f} on deleted object`),su(o.$$.ptr,o.$$.ptrType.registeredClass,c.registeredClass));function nA(o,c,f,p,_,y,x,C){o>>>=0,c>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0,C>>>=0,c=Bn(c),y=li(_,y),Gi([],[o],function(U){U=U[0];var H=`${U.name}.${c}`,K={get(){$r(`Cannot access ${H} due to unbound types`,[f])},enumerable:!0,configurable:!0};return C?K.set=()=>{$r(`Cannot access ${H} due to unbound types`,[f])}:K.set=se=>{Lt(`${H} is a read-only property`)},Object.defineProperty(U.registeredClass.constructor,c,K),Gi([],[f],function(se){se=se[0];var he={get(){return se.fromWireType(y(p))},enumerable:!0};return C&&(C=li(x,C),he.set=ye=>{var ze=[];C(p,se.toWireType(ze,ye)),au(ze)}),Object.defineProperty(U.registeredClass.constructor,c,he),[]}),[]})}function iA(o,c,f,p,_,y){o>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0;var x=cu(c,f);_=li(p,_),Gi([],[o],function(C){C=C[0];var U=`constructor ${C.name}`;if(C.registeredClass.constructor_body===void 0&&(C.registeredClass.constructor_body=[]),C.registeredClass.constructor_body[c-1]!==void 0)throw new Ga(`Cannot register multiple constructors with identical number of parameters (${c-1}) for class '${C.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return C.registeredClass.constructor_body[c-1]=()=>{$r(`Cannot construct ${C.name} due to unbound types`,x)},Gi([],x,H=>(H.splice(1,0,null),C.registeredClass.constructor_body[c-1]=lu(U,H,null,_,y),[])),[]})}function rA(o,c,f,p,_,y,x,C,U){o>>>=0,c>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0;var H=cu(f,p);c=Bn(c),c=af(c),y=li(_,y),Gi([],[o],function(K){K=K[0];var se=`${K.name}.${c}`;c.startsWith("@@")&&(c=Symbol[c.substring(2)]),C&&K.registeredClass.pureVirtualFunctions.push(c);function he(){$r(`Cannot call ${se} due to unbound types`,H)}var ye=K.registeredClass.instancePrototype,ze=ye[c];return ze===void 0||ze.overloadTable===void 0&&ze.className!==K.name&&ze.argCount===f-2?(he.argCount=f-2,he.className=K.name,ye[c]=he):(nf(ye,c,se),ye[c].overloadTable[f-2]=he),Gi([],H,function(Ke){var at=lu(se,Ke,K,y,x,U);return ye[c].overloadTable===void 0?(at.argCount=f-2,ye[c]=at):ye[c].overloadTable[f-2]=at,[]}),[]})}function sA(o,c,f,p,_,y,x,C,U,H){o>>>=0,c>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0,x>>>=0,C>>>=0,U>>>=0,H>>>=0,c=Bn(c),_=li(p,_),Gi([],[o],function(K){K=K[0];var se=`${K.name}.${c}`,he={get(){$r(`Cannot access ${se} due to unbound types`,[f,x])},enumerable:!0,configurable:!0};return U?he.set=()=>$r(`Cannot access ${se} due to unbound types`,[f,x]):he.set=ye=>Lt(se+" is a read-only property"),Object.defineProperty(K.registeredClass.instancePrototype,c,he),Gi([],U?[f,x]:[f],function(ye){var ze=ye[0],Ke={get(){var dt=Tv(this,K,se+" getter");return ze.fromWireType(_(y,dt))},enumerable:!0};if(U){U=li(C,U);var at=ye[1];Ke.set=function(dt){var Re=Tv(this,K,se+" setter"),je=[];U(H,Re,at.toWireType(je,dt)),au(je)}}return Object.defineProperty(K.registeredClass.instancePrototype,c,Ke),[]}),[]})}function aA(){Object.assign(Av.prototype,{get(o){return this.allocated[o]},has(o){return this.allocated[o]!==void 0},allocate(o){var c=this.freelist.pop()||this.allocated.length;return this.allocated[c]=o,c},free(o){this.allocated[o]=void 0,this.freelist.push(o)}})}function Av(){this.allocated=[void 0],this.freelist=[]}var er=new Av;function of(o){o>>>=0,o>=er.reserved&&--er.get(o).refcount===0&&er.free(o)}var oA=()=>{for(var o=0,c=er.reserved;c<er.allocated.length;++c)er.allocated[c]!==void 0&&++o;return o},lA=()=>{er.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),er.reserved=er.allocated.length,u.count_emval_handles=oA},Qt={toValue:o=>(o||Lt("Cannot use deleted val. handle = "+o),er.get(o).value),toHandle:o=>{switch(o){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return er.allocate({refcount:1,value:o})}}};function Cv(o){return this.fromWireType(l()[o>>>2>>>0])}var cA=function(o,c){o>>>=0,c>>>=0,c=Bn(c),Lr(o,{name:c,fromWireType:f=>{var p=Qt.toValue(f);return of(f),p},toWireType:(f,p)=>Qt.toHandle(p),argPackAdvance:Yr,readValueFromPointer:Cv,destructorFunction:null})},uA=(o,c,f)=>{switch(c){case 1:return f?function(p){return this.fromWireType(i()[p>>>0>>>0])}:function(p){return this.fromWireType(r()[p>>>0>>>0])};case 2:return f?function(p){return this.fromWireType(s()[p>>>1>>>0])}:function(p){return this.fromWireType(a()[p>>>1>>>0])};case 4:return f?function(p){return this.fromWireType(l()[p>>>2>>>0])}:function(p){return this.fromWireType(d()[p>>>2>>>0])};default:throw new TypeError(`invalid integer width (${c}): ${o}`)}};function dA(o,c,f,p){o>>>=0,c>>>=0,f>>>=0,c=Bn(c);function _(){}_.values={},Lr(o,{name:c,constructor:_,fromWireType:function(y){return this.constructor.values[y]},toWireType:(y,x)=>x.value,argPackAdvance:Yr,readValueFromPointer:uA(c,f,p),destructorFunction:null}),rf(c,_)}var Va=(o,c)=>{var f=aa[o];return f===void 0&&Lt(c+" has unknown type "+Sv(o)),f};function hA(o,c,f){o>>>=0,c>>>=0,f>>>=0;var p=Va(o,"enum");c=Bn(c);var _=p.constructor,y=Object.create(p.constructor.prototype,{value:{value:f},constructor:{value:ru(`${p.name}_${c}`,function(){})}});_.values[f]=y,_[c]=y}var lf=o=>{if(o===null)return"null";var c=typeof o;return c==="object"||c==="array"||c==="function"?o.toString():""+o},fA=(o,c)=>{switch(c){case 4:return function(f){return this.fromWireType(h()[f>>>2>>>0])};case 8:return function(f){return this.fromWireType(m()[f>>>3>>>0])};default:throw new TypeError(`invalid float width (${c}): ${o}`)}},pA=function(o,c,f){o>>>=0,c>>>=0,f>>>=0,c=Bn(c),Lr(o,{name:c,fromWireType:p=>p,toWireType:(p,_)=>_,argPackAdvance:Yr,readValueFromPointer:fA(c,f),destructorFunction:null})};function mA(o,c,f,p,_,y,x){o>>>=0,f>>>=0,p>>>=0,_>>>=0,y>>>=0;var C=cu(c,f);o=Bn(o),o=af(o),_=li(p,_),rf(o,function(){$r(`Cannot call ${o} due to unbound types`,C)},c-1),Gi([],C,function(U){var H=[U[0],null].concat(U.slice(1));return xv(o,lu(o,H,null,_,y,x),c-1),[]})}var gA=(o,c,f)=>{switch(c){case 1:return f?p=>i()[p>>>0>>>0]:p=>r()[p>>>0>>>0];case 2:return f?p=>s()[p>>>1>>>0]:p=>a()[p>>>1>>>0];case 4:return f?p=>l()[p>>>2>>>0]:p=>d()[p>>>2>>>0];default:throw new TypeError(`invalid integer width (${c}): ${o}`)}};function _A(o,c,f,p,_){o>>>=0,c>>>=0,f>>>=0,c=Bn(c);var y=K=>K;if(p===0){var x=32-8*f;y=K=>K<<x>>>x}var C=c.includes("unsigned"),U=(K,se)=>{},H;C?H=function(K,se){return U(se,this.name),se>>>0}:H=function(K,se){return U(se,this.name),se},Lr(o,{name:c,fromWireType:y,toWireType:H,argPackAdvance:Yr,readValueFromPointer:gA(c,f,p!==0),destructorFunction:null})}function vA(o,c,f){o>>>=0,f>>>=0;var p=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],_=p[c];function y(x){var C=d()[x>>>2>>>0],U=d()[x+4>>>2>>>0];return new _(i().buffer,U,C)}f=Bn(f),Lr(o,{name:f,fromWireType:y,argPackAdvance:Yr,readValueFromPointer:y},{ignoreDuplicateRegistrations:!0})}function yA(o,c,f,p,_,y,x,C,U,H,K,se){o>>>=0,c>>>=0,f>>>=0,_>>>=0,y>>>=0,x>>>=0,C>>>=0,U>>>=0,H>>>=0,K>>>=0,se>>>=0,f=Bn(f),y=li(_,y),C=li(x,C),H=li(U,H),se=li(K,se),Gi([o],[c],function(he){he=he[0];var ye=new xl(f,he.registeredClass,!1,!1,!0,he,p,y,C,H,se);return[ye]})}function bA(o,c){o>>>=0,c>>>=0,c=Bn(c);var f=c==="std::string";Lr(o,{name:c,fromWireType(p){var _=d()[p>>>2>>>0],y=p+4,x;if(f)for(var C=y,U=0;U<=_;++U){var H=y+U;if(U==_||r()[H>>>0]==0){var K=H-C,se=fe(C,K);x===void 0?x=se:(x+="\0",x+=se),C=H+1}}else{for(var he=new Array(_),U=0;U<_;++U)he[U]=String.fromCharCode(r()[y+U>>>0]);x=he.join("")}return Ir(p),x},toWireType(p,_){_ instanceof ArrayBuffer&&(_=new Uint8Array(_));var y,x=typeof _=="string";x||_ instanceof Uint8Array||_ instanceof Uint8ClampedArray||_ instanceof Int8Array||Lt("Cannot pass non-string to std::string"),f&&x?y=Qi(_):y=_.length;var C=Ml(4+y+1),U=C+4;if(d()[C>>>2>>>0]=y,f&&x)Qc(_,U,y+1);else if(x)for(var H=0;H<y;++H){var K=_.charCodeAt(H);K>255&&(Ir(U),Lt("String has UTF-16 code units that do not fit in 8 bits")),r()[U+H>>>0]=K}else for(var H=0;H<y;++H)r()[U+H>>>0]=_[H];return p!==null&&p.push(Ir,C),C},argPackAdvance:Yr,readValueFromPointer:bv,destructorFunction(p){Ir(p)}})}var Rv=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,xA=(o,c)=>{for(var f=o,p=f>>1,_=p+c/2;!(p>=_)&&a()[p>>>0];)++p;if(f=p<<1,f-o>32&&Rv)return Rv.decode(r().slice(o,f));for(var y="",x=0;!(x>=c/2);++x){var C=s()[o+x*2>>>1>>>0];if(C==0)break;y+=String.fromCharCode(C)}return y},wA=(o,c,f)=>{if(f===void 0&&(f=2147483647),f<2)return 0;f-=2;for(var p=c,_=f<o.length*2?f/2:o.length,y=0;y<_;++y){var x=o.charCodeAt(y);s()[c>>>1>>>0]=x,c+=2}return s()[c>>>1>>>0]=0,c-p},SA=o=>o.length*2,MA=(o,c)=>{for(var f=0,p="";!(f>=c/4);){var _=l()[o+f*4>>>2>>>0];if(_==0)break;if(++f,_>=65536){var y=_-65536;p+=String.fromCharCode(55296|y>>10,56320|y&1023)}else p+=String.fromCharCode(_)}return p},EA=(o,c,f)=>{if(c>>>=0,f===void 0&&(f=2147483647),f<4)return 0;for(var p=c,_=p+f-4,y=0;y<o.length;++y){var x=o.charCodeAt(y);if(x>=55296&&x<=57343){var C=o.charCodeAt(++y);x=65536+((x&1023)<<10)|C&1023}if(l()[c>>>2>>>0]=x,c+=4,c+4>_)break}return l()[c>>>2>>>0]=0,c-p},TA=o=>{for(var c=0,f=0;f<o.length;++f){var p=o.charCodeAt(f);p>=55296&&p<=57343&&++f,c+=4}return c},AA=function(o,c,f){o>>>=0,c>>>=0,f>>>=0,f=Bn(f);var p,_,y,x,C;c===2?(p=xA,_=wA,x=SA,y=()=>a(),C=1):c===4&&(p=MA,_=EA,x=TA,y=()=>d(),C=2),Lr(o,{name:f,fromWireType:U=>{for(var H=d()[U>>>2>>>0],K=y(),se,he=U+4,ye=0;ye<=H;++ye){var ze=U+4+ye*c;if(ye==H||K[ze>>>C]==0){var Ke=ze-he,at=p(he,Ke);se===void 0?se=at:(se+="\0",se+=at),he=ze+c}}return Ir(U),se},toWireType:(U,H)=>{typeof H!="string"&&Lt(`Cannot pass non-string to C++ string type ${f}`);var K=x(H),se=Ml(4+K+c);return d()[se>>>2]=K>>C,_(H,se+4,K+c),U!==null&&U.push(Ir,se),se},argPackAdvance:Yr,readValueFromPointer:Cv,destructorFunction(U){Ir(U)}})},CA=function(o,c){o>>>=0,c>>>=0,c=Bn(c),Lr(o,{isVoid:!0,name:c,argPackAdvance:0,fromWireType:()=>{},toWireType:(f,p)=>{}})},RA=!0,PA=()=>RA;function cf(o){if(o>>>=0,typeof Atomics.waitAsync=="function"){var c=Atomics.waitAsync(l(),o>>>2,o);c.value.then(uu);var f=o+128;Atomics.store(l(),f>>>2,1)}}u.__emscripten_thread_mailbox_await=cf;var uu=()=>{var o=pu();o&&(cf(o),sf(()=>i0()))};u.checkMailbox=uu;var LA=function(o,c,f){if(o>>>=0,c>>>=0,o==c)setTimeout(()=>uu());else if(P)postMessage({targetThread:o,cmd:"checkMailbox"});else{var p=Ee.pthreads[o];if(!p)return;p.postMessage({cmd:"checkMailbox"})}},IA=o=>{var c=Se(),f=o();return xe(c),f},Vt=function(o,c){var f=arguments.length-2,p=arguments;return IA(()=>{for(var _=f,y=s0(_*8),x=y>>>3,C=0;C<f;C++){var U=p[2+C];m()[x+C>>>0]=U}return t0(o,_,y,c)})},uf=[];function DA(o,c,f,p){c>>>=0,p>>>=0,uf.length=f;for(var _=p>>>3,y=0;y<f;y++)uf[y]=m()[_+y>>>0];var x=_C[o];Ee.currentProxiedOperationCallerThread=c;var C=x.apply(null,uf);return Ee.currentProxiedOperationCallerThread=0,C}function df(){if(P)return Vt(20,1);Ht=!1,oi=0}function kA(o){o>>>=0,E&&Ee.pthreads[o].ref()}function FA(o,c,f){o>>>=0,c>>>=0,f>>>=0,o=Qt.toValue(o),c=Va(c,"emval::as");var p=[],_=Qt.toHandle(p);return d()[f>>>2>>>0]=_,c.toWireType(p,o)}function UA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Va(c,"emval::as"),c.toWireType(null,o)}function OA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Va(c,"emval::as"),c.toWireType(null,o)}var Pv=(o,c)=>{for(var f=new Array(o),p=0;p<o;++p)f[p]=Va(d()[c+p*4>>>2>>>0],"parameter "+p);return f};function NA(o,c,f,p){o>>>=0,f>>>=0,p>>>=0,o=Qt.toValue(o);for(var _=Pv(c,f),y=new Array(c),x=0;x<c;++x){var C=_[x];y[x]=C.readValueFromPointer(p),p+=C.argPackAdvance}var U=o.apply(void 0,y);return Qt.toHandle(U)}var BA={},hf=o=>{var c=BA[o];return c===void 0?Bn(o):c},ff=[];function zA(o,c,f,p,_){o>>>=0,c>>>=0,f>>>=0,p>>>=0,_>>>=0,o=ff[o],c=Qt.toValue(c),f=hf(f);var y=[],x=o(c,f,y,_);return y.length&&(d()[p>>>2>>>0]=Qt.toHandle(y)),x}function HA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Qt.toValue(c),o==c}var Lv=()=>typeof globalThis=="object"?globalThis:function(){return Function}()("return this")();function GA(o){return o>>>=0,o===0?Qt.toHandle(Lv()):(o=hf(o),Qt.toHandle(Lv()[o]))}var VA=o=>{var c=ff.length;return ff.push(o),c};function WA(o,c){c>>>=0;var f=Pv(o,c),p=f.shift();o--;for(var _=["retType"],y=[p],x="",C=0;C<o;++C)x+=(C!==0?", ":"")+"arg"+C,_.push("argType"+C),y.push(f[C]);for(var U=p.name+"_$"+f.map(ye=>ye.name).join("_")+"$",H=iu("methodCaller_"+U),K="return function "+H+`(handle, name, destructors, args) {
`,se=0,C=0;C<o;++C)K+=" var arg"+C+" = argType"+C+".readValueFromPointer(args"+(se?"+"+se:"")+`);
`,se+=f[C].argPackAdvance;K+=" var rv = handle[name]("+x+`);
`;for(var C=0;C<o;++C)f[C].deleteObject&&(K+=" argType"+C+".deleteObject(arg"+C+`);
`);p.isVoid||(K+=` return retType.toWireType(destructors, rv);
`),K+=`};
`,_.push(K);var he=Mv(Function,_).apply(null,y);return VA(he)}function jA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Qt.toValue(c),Qt.toHandle(o[c])}function XA(o){o>>>=0,o>4&&(er.get(o).refcount+=1)}function YA(o,c){return o>>>=0,c>>>=0,o=Qt.toValue(o),c=Qt.toValue(c),o instanceof c}function $A(){return Qt.toHandle([])}function qA(o){return o>>>=0,Qt.toHandle(hf(o))}function KA(){return Qt.toHandle({})}function ZA(o){o>>>=0;var c=Qt.toValue(o);au(c),of(o)}function QA(o,c,f){o>>>=0,c>>>=0,f>>>=0,o=Qt.toValue(o),c=Qt.toValue(c),f=Qt.toValue(f),o[c]=f}function JA(o,c){o>>>=0,c>>>=0,o=Va(o,"_emval_take_value");var f=o.readValueFromPointer(c);return Qt.toHandle(f)}function eC(o){return o>>>=0,o=Qt.toValue(o),Qt.toHandle(typeof o)}function Iv(o,c,f,p,_,y,x,C){if(P)return Vt(21,1,o,c,f,p,_,y,x,C);o>>>=0;var U=Bt(_,y);x>>>=0,C>>>=0;try{if(isNaN(U))return 61;var H=J.getStreamFromFD(p),K=R.mmap(H,o,U,c,f),se=K.ptr;return l()[x>>>2>>>0]=K.allocated,d()[C>>>2>>>0]=se,0}catch(he){if(typeof R>"u"||he.name!=="ErrnoError")throw he;return-he.errno}}function Dv(o,c,f,p,_,y,x){if(P)return Vt(22,1,o,c,f,p,_,y,x);o>>>=0,c>>>=0;var C=Bt(y,x);try{if(isNaN(C))return 61;var U=J.getStreamFromFD(_);f&2&&J.doMsync(o,U,c,p,C),R.munmap(U)}catch(H){if(typeof R>"u"||H.name!=="ErrnoError")throw H;return-H.errno}}var wl={},pf;pf=()=>performance.timeOrigin+performance.now();function kv(o,c){if(P)return Vt(23,1,o,c);if(wl[o]&&(clearTimeout(wl[o].id),delete wl[o]),!c)return 0;var f=setTimeout(()=>{delete wl[o],sf(()=>n0(o,pf()))},c);return wl[o]={id:f,timeout_ms:c},0}var tC=()=>{lt("")},nC=()=>{},iC=()=>Date.now(),rC=()=>{throw Ev(),"unwind"};function Fv(o){if(P)return Vt(24,1,o);df(),Oe(o)}var Uv=()=>4294901760;function sC(){return Uv()}var aC=()=>E?require("os").cpus().length:navigator.hardwareConcurrency,oC=o=>{var c=ue.buffer,f=(o-c.byteLength+65535)/65536;try{return ue.grow(f),ft(),1}catch{}};function lC(o){o>>>=0;var c=r().length;if(o<=c)return!1;var f=Uv();if(o>f)return!1;for(var p=(U,H)=>U+(H-U%H)%H,_=1;_<=4;_*=2){var y=c*(1+.2/_);y=Math.min(y,o+100663296);var x=Math.min(f,p(Math.max(o,y),65536)),C=oC(x);if(C)return!0}return!1}var mf={},cC=()=>T||"./this.program",Sl=()=>{if(!Sl.strings){var o=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",c={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:o,_:cC()};for(var f in mf)mf[f]===void 0?delete c[f]:c[f]=mf[f];var p=[];for(var f in c)p.push(`${f}=${c[f]}`);Sl.strings=p}return Sl.strings},uC=(o,c)=>{for(var f=0;f<o.length;++f)i()[c++>>>0>>>0]=o.charCodeAt(f);i()[c>>>0>>>0]=0},Ov=function(o,c){if(P)return Vt(25,1,o,c);o>>>=0,c>>>=0;var f=0;return Sl().forEach((p,_)=>{var y=c+f;d()[o+_*4>>>2>>>0]=y,uC(p,y),f+=p.length+1}),0},Nv=function(o,c){if(P)return Vt(26,1,o,c);o>>>=0,c>>>=0;var f=Sl();d()[o>>>2>>>0]=f.length;var p=0;return f.forEach(_=>p+=_.length+1),d()[c>>>2>>>0]=p,0};function Bv(o){if(P)return Vt(27,1,o);try{var c=J.getStreamFromFD(o);return R.close(c),0}catch(f){if(typeof R>"u"||f.name!=="ErrnoError")throw f;return f.errno}}function zv(o,c){if(P)return Vt(28,1,o,c);c>>>=0;try{var f=0,p=0,_=0,y=J.getStreamFromFD(o),x=y.tty?2:R.isDir(y.mode)?3:R.isLink(y.mode)?7:4;return i()[c>>>0>>>0]=x,s()[c+2>>>1>>>0]=_,it=[f>>>0,(Ie=f,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[c+8>>>2>>>0]=it[0],l()[c+12>>>2>>>0]=it[1],it=[p>>>0,(Ie=p,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[c+16>>>2>>>0]=it[0],l()[c+20>>>2>>>0]=it[1],0}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return C.errno}}var Hv=(o,c,f,p)=>{for(var _=0,y=0;y<f;y++){var x=d()[c>>>2>>>0],C=d()[c+4>>>2>>>0];c+=8;var U=R.read(o,i(),x,C,p);if(U<0)return-1;if(_+=U,U<C)break;typeof p<"u"&&(p+=U)}return _};function Gv(o,c,f,p,_,y){if(P)return Vt(29,1,o,c,f,p,_,y);c>>>=0,f>>>=0;var x=Bt(p,_);y>>>=0;try{if(isNaN(x))return 61;var C=J.getStreamFromFD(o),U=Hv(C,c,f,x);return d()[y>>>2>>>0]=U,0}catch(H){if(typeof R>"u"||H.name!=="ErrnoError")throw H;return H.errno}}var Vv=(o,c,f,p)=>{for(var _=0,y=0;y<f;y++){var x=d()[c>>>2>>>0],C=d()[c+4>>>2>>>0];c+=8;var U=R.write(o,i(),x,C,p);if(U<0)return-1;_+=U,typeof p<"u"&&(p+=U)}return _};function Wv(o,c,f,p,_,y){if(P)return Vt(30,1,o,c,f,p,_,y);c>>>=0,f>>>=0;var x=Bt(p,_);y>>>=0;try{if(isNaN(x))return 61;var C=J.getStreamFromFD(o),U=Vv(C,c,f,x);return d()[y>>>2>>>0]=U,0}catch(H){if(typeof R>"u"||H.name!=="ErrnoError")throw H;return H.errno}}function jv(o,c,f,p){if(P)return Vt(31,1,o,c,f,p);c>>>=0,f>>>=0,p>>>=0;try{var _=J.getStreamFromFD(o),y=Hv(_,c,f);return d()[p>>>2>>>0]=y,0}catch(x){if(typeof R>"u"||x.name!=="ErrnoError")throw x;return x.errno}}function Xv(o,c,f,p,_){if(P)return Vt(32,1,o,c,f,p,_);var y=Bt(c,f);_>>>=0;try{if(isNaN(y))return 61;var x=J.getStreamFromFD(o);return R.llseek(x,y,p),it=[x.position>>>0,(Ie=x.position,+Math.abs(Ie)>=1?Ie>0?+Math.floor(Ie/4294967296)>>>0:~~+Math.ceil((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],l()[_>>>2>>>0]=it[0],l()[_+4>>>2>>>0]=it[1],x.getdents&&y===0&&p===0&&(x.getdents=null),0}catch(C){if(typeof R>"u"||C.name!=="ErrnoError")throw C;return C.errno}}function Yv(o,c,f,p){if(P)return Vt(33,1,o,c,f,p);c>>>=0,f>>>=0,p>>>=0;try{var _=J.getStreamFromFD(o),y=Vv(_,c,f);return d()[p>>>2>>>0]=y,0}catch(x){if(typeof R>"u"||x.name!=="ErrnoError")throw x;return x.errno}}function dC(o){return o>>>=0,o}var du=o=>o%4===0&&(o%100!==0||o%400===0),hC=(o,c)=>{for(var f=0,p=0;p<=c;f+=o[p++]);return f},$v=[31,29,31,30,31,30,31,31,30,31,30,31],qv=[31,28,31,30,31,30,31,31,30,31,30,31],fC=(o,c)=>{for(var f=new Date(o.getTime());c>0;){var p=du(f.getFullYear()),_=f.getMonth(),y=(p?$v:qv)[_];if(c>y-f.getDate())c-=y-f.getDate()+1,f.setDate(1),_<11?f.setMonth(_+1):(f.setMonth(0),f.setFullYear(f.getFullYear()+1));else return f.setDate(f.getDate()+c),f}return f},pC=(o,c)=>{i().set(o,c>>>0)};function mC(o,c,f,p){o>>>=0,c>>>=0,f>>>=0,p>>>=0;var _=d()[p+40>>>2>>>0],y={tm_sec:l()[p>>>2>>>0],tm_min:l()[p+4>>>2>>>0],tm_hour:l()[p+8>>>2>>>0],tm_mday:l()[p+12>>>2>>>0],tm_mon:l()[p+16>>>2>>>0],tm_year:l()[p+20>>>2>>>0],tm_wday:l()[p+24>>>2>>>0],tm_yday:l()[p+28>>>2>>>0],tm_isdst:l()[p+32>>>2>>>0],tm_gmtoff:l()[p+36>>>2>>>0],tm_zone:_?fe(_):""},x=fe(f),C={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var U in C)x=x.replace(new RegExp(U,"g"),C[U]);var H=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],K=["January","February","March","April","May","June","July","August","September","October","November","December"];function se(Re,je,dn){for(var zt=typeof Re=="number"?Re.toString():Re||"";zt.length<je;)zt=dn[0]+zt;return zt}function he(Re,je){return se(Re,je,"0")}function ye(Re,je){function dn(ci){return ci<0?-1:ci>0?1:0}var zt;return(zt=dn(Re.getFullYear()-je.getFullYear()))===0&&(zt=dn(Re.getMonth()-je.getMonth()))===0&&(zt=dn(Re.getDate()-je.getDate())),zt}function ze(Re){switch(Re.getDay()){case 0:return new Date(Re.getFullYear()-1,11,29);case 1:return Re;case 2:return new Date(Re.getFullYear(),0,3);case 3:return new Date(Re.getFullYear(),0,2);case 4:return new Date(Re.getFullYear(),0,1);case 5:return new Date(Re.getFullYear()-1,11,31);case 6:return new Date(Re.getFullYear()-1,11,30)}}function Ke(Re){var je=fC(new Date(Re.tm_year+1900,0,1),Re.tm_yday),dn=new Date(je.getFullYear(),0,4),zt=new Date(je.getFullYear()+1,0,4),ci=ze(dn),hn=ze(zt);return ye(ci,je)<=0?ye(hn,je)<=0?je.getFullYear()+1:je.getFullYear():je.getFullYear()-1}var at={"%a":Re=>H[Re.tm_wday].substring(0,3),"%A":Re=>H[Re.tm_wday],"%b":Re=>K[Re.tm_mon].substring(0,3),"%B":Re=>K[Re.tm_mon],"%C":Re=>{var je=Re.tm_year+1900;return he(je/100|0,2)},"%d":Re=>he(Re.tm_mday,2),"%e":Re=>se(Re.tm_mday,2," "),"%g":Re=>Ke(Re).toString().substring(2),"%G":Re=>Ke(Re),"%H":Re=>he(Re.tm_hour,2),"%I":Re=>{var je=Re.tm_hour;return je==0?je=12:je>12&&(je-=12),he(je,2)},"%j":Re=>he(Re.tm_mday+hC(du(Re.tm_year+1900)?$v:qv,Re.tm_mon-1),3),"%m":Re=>he(Re.tm_mon+1,2),"%M":Re=>he(Re.tm_min,2),"%n":()=>`
`,"%p":Re=>Re.tm_hour>=0&&Re.tm_hour<12?"AM":"PM","%S":Re=>he(Re.tm_sec,2),"%t":()=>" ","%u":Re=>Re.tm_wday||7,"%U":Re=>{var je=Re.tm_yday+7-Re.tm_wday;return he(Math.floor(je/7),2)},"%V":Re=>{var je=Math.floor((Re.tm_yday+7-(Re.tm_wday+6)%7)/7);if((Re.tm_wday+371-Re.tm_yday-2)%7<=2&&je++,je){if(je==53){var zt=(Re.tm_wday+371-Re.tm_yday)%7;zt!=4&&(zt!=3||!du(Re.tm_year))&&(je=1)}}else{je=52;var dn=(Re.tm_wday+7-Re.tm_yday-1)%7;(dn==4||dn==5&&du(Re.tm_year%400-1))&&je++}return he(je,2)},"%w":Re=>Re.tm_wday,"%W":Re=>{var je=Re.tm_yday+7-(Re.tm_wday+6)%7;return he(Math.floor(je/7),2)},"%y":Re=>(Re.tm_year+1900).toString().substring(2),"%Y":Re=>Re.tm_year+1900,"%z":Re=>{var je=Re.tm_gmtoff,dn=je>=0;return je=Math.abs(je)/60,je=je/60*100+je%60,(dn?"+":"-")+("0000"+je).slice(-4)},"%Z":Re=>Re.tm_zone,"%%":()=>"%"};x=x.replace(/%%/g,"\0\0");for(var U in at)x.includes(U)&&(x=x.replace(new RegExp(U,"g"),at[U](y)));x=x.replace(/\0\0/g,"%");var dt=Xr(x,!1);return dt.length>c?0:(pC(dt,o),dt.length-1)}function gC(o,c,f,p,_){return o>>>=0,c>>>=0,f>>>=0,p>>>=0,mC(o,c,f,p)}Ee.init();var Kv=function(o,c,f,p){o||(o=this),this.parent=o,this.mount=o.mount,this.mounted=null,this.id=R.nextInode++,this.name=c,this.mode=f,this.node_ops={},this.stream_ops={},this.rdev=p},hu=365,fu=146;Object.defineProperties(Kv.prototype,{read:{get:function(){return(this.mode&hu)===hu},set:function(o){o?this.mode|=hu:this.mode&=~hu}},write:{get:function(){return(this.mode&fu)===fu},set:function(o){o?this.mode|=fu:this.mode&=~fu}},isFolder:{get:function(){return R.isDir(this.mode)}},isDevice:{get:function(){return R.isChrdev(this.mode)}}}),R.FSNode=Kv,R.createPreloadedFile=te,R.staticInit(),u.FS_createPath=R.createPath,u.FS_createDataFile=R.createDataFile,u.FS_createPreloadedFile=R.createPreloadedFile,u.FS_unlink=R.unlink,u.FS_createLazyFile=R.createLazyFile,u.FS_createDevice=R.createDevice,CT(),Ga=u.BindingError=class extends Error{constructor(c){super(c),this.name="BindingError"}},mv=u.InternalError=class extends Error{constructor(c){super(c),this.name="InternalError"}},zT(),UT(),YT(),wv=u.UnboundTypeError=ZT(Error,"UnboundTypeError"),aA(),lA();var _C=[be,qe,q_,Z_,Q_,J_,ev,tv,nv,iv,rv,sv,av,ov,lv,cv,uv,dv,hv,fv,df,Iv,Dv,kv,Fv,Ov,Nv,Bv,zv,Gv,Wv,jv,Xv,Yv],vC={Qb:ee,Lc:pt,r:Xt,D:Zt,b:za,l:vT,Na:yT,nb:bT,Ua:$_,Bc:xT,y:wT,Cc:ST,Rc:MT,bb:ET,Nc:K_,f:sa,gb:Z_,$c:Q_,_b:J_,Xc:ev,hb:tv,Wc:nv,Sc:iv,Kc:rv,cd:sv,Tc:av,Pc:ov,Uc:lv,eb:cv,Jc:uv,Ic:dv,Vc:hv,Ec:fv,cc:AT,gd:PT,H:QT,da:tA,wa:nA,N:iA,z:rA,x:sA,fd:cA,sb:dA,Ea:hA,jb:pA,ld:mA,oa:_A,T:vA,qa:yA,ib:bA,Wa:AA,hd:CA,_c:PA,Fc:LA,Oc:DA,Mc:df,Qc:cf,Zc:kA,ra:FA,lc:UA,kc:OA,Ha:NA,la:zA,yd:of,kd:HA,od:GA,ka:WA,Ad:jA,$a:XA,pd:YA,Ub:$A,Rb:qA,Tb:KA,Vb:ZA,Sb:QA,F:JA,qd:eC,$b:Iv,ac:Dv,ab:kv,fa:tC,Pb:He,rd:oe,cb:nC,fb:iC,Yc:rC,tb:Fv,Gc:sC,ba:pf,Hc:aC,Dc:lC,dd:Ov,ed:Nv,xa:Oe,Ia:Bv,db:zv,Zb:Gv,Yb:Wv,bd:jv,bc:Xv,Va:Yv,ub:JR,jd:MP,s:GC,P:rP,nd:oP,pa:aR,Ta:WC,sa:iR,mc:BP,Aa:kR,Kb:bR,Gb:TR,mb:bP,Sa:JC,xd:YR,k:EC,Ab:WR,Bb:VR,La:GR,Ma:HR,zb:XR,Fa:jR,ob:gP,Ja:_P,Eb:RR,c:wC,Q:VC,J:cP,_a:NR,xb:qR,na:sR,aa:qC,vd:eP,Za:BR,M:$C,ta:tR,id:EP,e:yC,q:zC,sd:iP,ma:aP,td:nP,zd:zR,ca:UC,w:sP,vb:QR,wb:ZR,ya:yP,Ra:eR,h:bC,R:ZC,I:uP,wd:KR,ua:cR,md:mP,yb:$R,Hb:ER,m:AC,L:jC,Ca:dR,o:SC,Pa:xR,B:kC,rb:lP,C:IC,ud:tP,A:HC,va:QC,kb:wP,Da:XC,za:UR,Oa:OR,Cb:FR,Xb:YP,dc:XP,ec:jP,gc:VP,sc:DP,rc:kP,jc:zP,zc:TP,wc:RP,pc:UP,yc:AP,Wb:$P,xc:CP,p:PC,Z:YC,pb:pP,Fb:CR,j:xC,_:LC,Mb:vR,Jb:SR,Qa:mR,ea:dP,Ka:fP,qb:hP,U:wR,V:AR,d:MC,W:NC,Lb:yR,Nb:_R,ja:BC,Xa:SP,t:nR,g:CC,Y:KC,Ob:gR,O:OC,ha:hR,Ba:pR,Db:DR,i:RC,E:oR,ia:lR,Ya:vP,n:TC,S:fR,X:uR,v:DC,G:FC,Ib:MR,K:rR,$:IR,ga:LR,lb:xP,Ga:PR,ic:HP,fc:WP,hc:GP,vc:PP,nc:NP,qc:FP,uc:LP,tc:IP,oc:OP,u:dC,a:ue||u.wasmMemory,ad:be,Ac:gC},ne=bt(),pu=u._pthread_self=()=>(pu=u._pthread_self=ne.Cd)(),Ir=o=>(Ir=ne.Ed)(o),Ml=o=>(Ml=ne.Fd)(o),Zv=()=>(Zv=ne.Gd)();u.__emscripten_tls_init=()=>(u.__emscripten_tls_init=ne.Hd)();var Qv=(o,c)=>(Qv=ne.Id)(o,c),Jv=o=>(Jv=ne.Jd)(o);u.__embind_initialize_bindings=()=>(u.__embind_initialize_bindings=ne.Kd)();var e0=u.__emscripten_thread_init=(o,c,f,p,_,y)=>(e0=u.__emscripten_thread_init=ne.Ld)(o,c,f,p,_,y);u.__emscripten_thread_crashed=()=>(u.__emscripten_thread_crashed=ne.Md)();var t0=(o,c,f,p)=>(t0=ne.Nd)(o,c,f,p),gf=o=>(gf=ne.Od)(o),_f=u.__emscripten_thread_exit=o=>(_f=u.__emscripten_thread_exit=ne.Pd)(o),n0=(o,c)=>(n0=ne.Qd)(o,c),i0=u.__emscripten_check_mailbox=()=>(i0=u.__emscripten_check_mailbox=ne.Rd)(),we=(o,c)=>(we=ne.Sd)(o,c),El=o=>(El=ne.Td)(o),r0=(o,c)=>(r0=ne.Ud)(o,c),Se=()=>(Se=ne.Vd)(),xe=o=>(xe=ne.Wd)(o),s0=o=>(s0=ne.Xd)(o),a0=o=>(a0=ne.Yd)(o),o0=o=>(o0=ne.Zd)(o),l0=(o,c,f)=>(l0=ne._d)(o,c,f),c0=o=>(c0=ne.$d)(o),u0=u.dynCall_iii=(o,c,f)=>(u0=u.dynCall_iii=ne.ae)(o,c,f),d0=u.dynCall_iiii=(o,c,f,p)=>(d0=u.dynCall_iiii=ne.be)(o,c,f,p),vf=u.dynCall_vi=(o,c)=>(vf=u.dynCall_vi=ne.ce)(o,c),yf=u.dynCall_ii=(o,c)=>(yf=u.dynCall_ii=ne.de)(o,c),h0=u.dynCall_iiiiii=(o,c,f,p,_,y)=>(h0=u.dynCall_iiiiii=ne.ee)(o,c,f,p,_,y),f0=u.dynCall_vii=(o,c,f)=>(f0=u.dynCall_vii=ne.fe)(o,c,f),p0=u.dynCall_i=o=>(p0=u.dynCall_i=ne.ge)(o),m0=u.dynCall_viiiii=(o,c,f,p,_,y)=>(m0=u.dynCall_viiiii=ne.he)(o,c,f,p,_,y),g0=u.dynCall_v=o=>(g0=u.dynCall_v=ne.ie)(o),_0=u.dynCall_viii=(o,c,f,p)=>(_0=u.dynCall_viii=ne.je)(o,c,f,p),v0=u.dynCall_vid=(o,c,f)=>(v0=u.dynCall_vid=ne.ke)(o,c,f),y0=u.dynCall_di=(o,c)=>(y0=u.dynCall_di=ne.le)(o,c),b0=u.dynCall_iiiii=(o,c,f,p,_)=>(b0=u.dynCall_iiiii=ne.me)(o,c,f,p,_),x0=u.dynCall_viiii=(o,c,f,p,_)=>(x0=u.dynCall_viiii=ne.ne)(o,c,f,p,_),w0=u.dynCall_viid=(o,c,f,p)=>(w0=u.dynCall_viid=ne.oe)(o,c,f,p),S0=u.dynCall_dii=(o,c,f)=>(S0=u.dynCall_dii=ne.pe)(o,c,f),M0=u.dynCall_viiid=(o,c,f,p,_)=>(M0=u.dynCall_viiid=ne.qe)(o,c,f,p,_),E0=u.dynCall_iiiid=(o,c,f,p,_)=>(E0=u.dynCall_iiiid=ne.re)(o,c,f,p,_),T0=u.dynCall_iiiiiiii=(o,c,f,p,_,y,x,C)=>(T0=u.dynCall_iiiiiiii=ne.se)(o,c,f,p,_,y,x,C),A0=u.dynCall_viiiiii=(o,c,f,p,_,y,x)=>(A0=u.dynCall_viiiiii=ne.te)(o,c,f,p,_,y,x),C0=u.dynCall_iiiiiii=(o,c,f,p,_,y,x)=>(C0=u.dynCall_iiiiiii=ne.ue)(o,c,f,p,_,y,x),R0=u.dynCall_diii=(o,c,f,p)=>(R0=u.dynCall_diii=ne.ve)(o,c,f,p),P0=u.dynCall_j=o=>(P0=u.dynCall_j=ne.we)(o),L0=u.dynCall_iiid=(o,c,f,p)=>(L0=u.dynCall_iiid=ne.xe)(o,c,f,p),I0=u.dynCall_iiiiid=(o,c,f,p,_,y)=>(I0=u.dynCall_iiiiid=ne.ye)(o,c,f,p,_,y),D0=u.dynCall_vd=(o,c)=>(D0=u.dynCall_vd=ne.ze)(o,c),k0=u.dynCall_iiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se)=>(k0=u.dynCall_iiiiiiiiiiii=ne.Ae)(o,c,f,p,_,y,x,C,U,H,K,se),F0=u.dynCall_iid=(o,c,f)=>(F0=u.dynCall_iid=ne.Be)(o,c,f),U0=u.dynCall_viidi=(o,c,f,p,_)=>(U0=u.dynCall_viidi=ne.Ce)(o,c,f,p,_),O0=u.dynCall_iidiii=(o,c,f,p,_,y)=>(O0=u.dynCall_iidiii=ne.De)(o,c,f,p,_,y),N0=u.dynCall_iiiiiiiii=(o,c,f,p,_,y,x,C,U)=>(N0=u.dynCall_iiiiiiiii=ne.Ee)(o,c,f,p,_,y,x,C,U),B0=u.dynCall_iiiiiiiiii=(o,c,f,p,_,y,x,C,U,H)=>(B0=u.dynCall_iiiiiiiiii=ne.Fe)(o,c,f,p,_,y,x,C,U,H),z0=u.dynCall_iiidi=(o,c,f,p,_)=>(z0=u.dynCall_iiidi=ne.Ge)(o,c,f,p,_),H0=u.dynCall_fiii=(o,c,f,p)=>(H0=u.dynCall_fiii=ne.He)(o,c,f,p),G0=u.dynCall_iiifi=(o,c,f,p,_)=>(G0=u.dynCall_iiifi=ne.Ie)(o,c,f,p,_),V0=u.dynCall_viif=(o,c,f,p)=>(V0=u.dynCall_viif=ne.Je)(o,c,f,p),W0=u.dynCall_iiffi=(o,c,f,p,_)=>(W0=u.dynCall_iiffi=ne.Ke)(o,c,f,p,_),j0=u.dynCall_fif=(o,c,f)=>(j0=u.dynCall_fif=ne.Le)(o,c,f),X0=u.dynCall_iif=(o,c,f)=>(X0=u.dynCall_iif=ne.Me)(o,c,f),Y0=u.dynCall_dif=(o,c,f)=>(Y0=u.dynCall_dif=ne.Ne)(o,c,f),$0=u.dynCall_viiiiiii=(o,c,f,p,_,y,x,C)=>($0=u.dynCall_viiiiiii=ne.Oe)(o,c,f,p,_,y,x,C),q0=u.dynCall_viiiiiiii=(o,c,f,p,_,y,x,C,U)=>(q0=u.dynCall_viiiiiiii=ne.Pe)(o,c,f,p,_,y,x,C,U),K0=u.dynCall_iidii=(o,c,f,p,_)=>(K0=u.dynCall_iidii=ne.Qe)(o,c,f,p,_),Z0=u.dynCall_viiidiiiii=(o,c,f,p,_,y,x,C,U,H)=>(Z0=u.dynCall_viiidiiiii=ne.Re)(o,c,f,p,_,y,x,C,U,H),Q0=u.dynCall_viiiidi=(o,c,f,p,_,y,x)=>(Q0=u.dynCall_viiiidi=ne.Se)(o,c,f,p,_,y,x),J0=u.dynCall_viiidii=(o,c,f,p,_,y,x)=>(J0=u.dynCall_viiidii=ne.Te)(o,c,f,p,_,y,x),ey=u.dynCall_viiiid=(o,c,f,p,_,y)=>(ey=u.dynCall_viiiid=ne.Ue)(o,c,f,p,_,y),ty=u.dynCall_iiiidiii=(o,c,f,p,_,y,x,C)=>(ty=u.dynCall_iiiidiii=ne.Ve)(o,c,f,p,_,y,x,C),ny=u.dynCall_iiiiidiiii=(o,c,f,p,_,y,x,C,U,H)=>(ny=u.dynCall_iiiiidiiii=ne.We)(o,c,f,p,_,y,x,C,U,H),iy=u.dynCall_viiiiid=(o,c,f,p,_,y,x)=>(iy=u.dynCall_viiiiid=ne.Xe)(o,c,f,p,_,y,x),ry=u.dynCall_viiiiidi=(o,c,f,p,_,y,x,C)=>(ry=u.dynCall_viiiiidi=ne.Ye)(o,c,f,p,_,y,x,C),sy=u.dynCall_viiiddddi=(o,c,f,p,_,y,x,C,U)=>(sy=u.dynCall_viiiddddi=ne.Ze)(o,c,f,p,_,y,x,C,U),ay=u.dynCall_viiddi=(o,c,f,p,_,y)=>(ay=u.dynCall_viiddi=ne._e)(o,c,f,p,_,y),oy=u.dynCall_vidddi=(o,c,f,p,_,y)=>(oy=u.dynCall_vidddi=ne.$e)(o,c,f,p,_,y),ly=u.dynCall_viiddddi=(o,c,f,p,_,y,x,C)=>(ly=u.dynCall_viiddddi=ne.af)(o,c,f,p,_,y,x,C),cy=u.dynCall_fid=(o,c,f)=>(cy=u.dynCall_fid=ne.bf)(o,c,f),uy=u.dynCall_iiiiiid=(o,c,f,p,_,y,x)=>(uy=u.dynCall_iiiiiid=ne.cf)(o,c,f,p,_,y,x),dy=u.dynCall_vif=(o,c,f)=>(dy=u.dynCall_vif=ne.df)(o,c,f),hy=u.dynCall_viiidi=(o,c,f,p,_,y)=>(hy=u.dynCall_viiidi=ne.ef)(o,c,f,p,_,y),fy=u.dynCall_viddi=(o,c,f,p,_)=>(fy=u.dynCall_viddi=ne.ff)(o,c,f,p,_),py=u.dynCall_viiiiiiid=(o,c,f,p,_,y,x,C,U)=>(py=u.dynCall_viiiiiiid=ne.gf)(o,c,f,p,_,y,x,C,U),my=u.dynCall_jiij=(o,c,f,p,_)=>(my=u.dynCall_jiij=ne.hf)(o,c,f,p,_),gy=u.dynCall_ji=(o,c)=>(gy=u.dynCall_ji=ne.jf)(o,c),_y=u.dynCall_iiiifffffiiff=(o,c,f,p,_,y,x,C,U,H,K,se,he)=>(_y=u.dynCall_iiiifffffiiff=ne.kf)(o,c,f,p,_,y,x,C,U,H,K,se,he);u.dynCall_jif=(o,c,f)=>(u.dynCall_jif=ne.lf)(o,c,f);var vy=u.dynCall_vifii=(o,c,f,p,_)=>(vy=u.dynCall_vifii=ne.mf)(o,c,f,p,_),yy=u.dynCall_vfiiii=(o,c,f,p,_,y)=>(yy=u.dynCall_vfiiii=ne.nf)(o,c,f,p,_,y),by=u.dynCall_ifii=(o,c,f,p)=>(by=u.dynCall_ifii=ne.of)(o,c,f,p);u.dynCall_jiiijji=(o,c,f,p,_,y,x,C,U)=>(u.dynCall_jiiijji=ne.pf)(o,c,f,p,_,y,x,C,U);var xy=u.dynCall_viiif=(o,c,f,p,_)=>(xy=u.dynCall_viiif=ne.qf)(o,c,f,p,_),wy=u.dynCall_iiiiiiiiiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke,at,dt,Re,je)=>(wy=u.dynCall_iiiiiiiiiiiiiiiiiiii=ne.rf)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke,at,dt,Re,je),Sy=u.dynCall_viiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K)=>(Sy=u.dynCall_viiiiiiiiii=ne.sf)(o,c,f,p,_,y,x,C,U,H,K),My=u.dynCall_viiiiiiiii=(o,c,f,p,_,y,x,C,U,H)=>(My=u.dynCall_viiiiiiiii=ne.tf)(o,c,f,p,_,y,x,C,U,H),Ey=u.dynCall_iiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he)=>(Ey=u.dynCall_iiiiiiiiiiiii=ne.uf)(o,c,f,p,_,y,x,C,U,H,K,se,he);u.dynCall_ff=(o,c)=>(u.dynCall_ff=ne.vf)(o,c),u.dynCall_fff=(o,c,f)=>(u.dynCall_fff=ne.wf)(o,c,f),u.dynCall_iiijiii=(o,c,f,p,_,y,x,C)=>(u.dynCall_iiijiii=ne.xf)(o,c,f,p,_,y,x,C);var Ty=u.dynCall_jii=(o,c,f)=>(Ty=u.dynCall_jii=ne.yf)(o,c,f);u.dynCall_iiij=(o,c,f,p,_)=>(u.dynCall_iiij=ne.zf)(o,c,f,p,_),u.dynCall_iiiji=(o,c,f,p,_,y)=>(u.dynCall_iiiji=ne.Af)(o,c,f,p,_,y);var Ay=u.dynCall_iiiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye)=>(Ay=u.dynCall_iiiiiiiiiiiiii=ne.Bf)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye),Cy=u.dynCall_iiddddddiiii=(o,c,f,p,_,y,x,C,U,H,K,se)=>(Cy=u.dynCall_iiddddddiiii=ne.Cf)(o,c,f,p,_,y,x,C,U,H,K,se),Ry=u.dynCall_iidiiiii=(o,c,f,p,_,y,x,C)=>(Ry=u.dynCall_iidiiiii=ne.Df)(o,c,f,p,_,y,x,C),Py=u.dynCall_iddiii=(o,c,f,p,_,y)=>(Py=u.dynCall_iddiii=ne.Ef)(o,c,f,p,_,y),Ly=u.dynCall_iddii=(o,c,f,p,_)=>(Ly=u.dynCall_iddii=ne.Ff)(o,c,f,p,_),Iy=u.dynCall_idddiii=(o,c,f,p,_,y,x)=>(Iy=u.dynCall_idddiii=ne.Gf)(o,c,f,p,_,y,x),Dy=u.dynCall_idddii=(o,c,f,p,_,y)=>(Dy=u.dynCall_idddii=ne.Hf)(o,c,f,p,_,y),ky=u.dynCall_idii=(o,c,f,p)=>(ky=u.dynCall_idii=ne.If)(o,c,f,p),Fy=u.dynCall_idi=(o,c,f)=>(Fy=u.dynCall_idi=ne.Jf)(o,c,f),Uy=u.dynCall_fiiid=(o,c,f,p,_)=>(Uy=u.dynCall_fiiid=ne.Kf)(o,c,f,p,_),Oy=u.dynCall_iidi=(o,c,f,p)=>(Oy=u.dynCall_iidi=ne.Lf)(o,c,f,p),Ny=u.dynCall_iiiidii=(o,c,f,p,_,y,x)=>(Ny=u.dynCall_iiiidii=ne.Mf)(o,c,f,p,_,y,x),By=u.dynCall_iiiidiiiiii=(o,c,f,p,_,y,x,C,U,H,K)=>(By=u.dynCall_iiiidiiiiii=ne.Nf)(o,c,f,p,_,y,x,C,U,H,K),zy=u.dynCall_iiidiiiii=(o,c,f,p,_,y,x,C,U)=>(zy=u.dynCall_iiidiiiii=ne.Of)(o,c,f,p,_,y,x,C,U),Hy=u.dynCall_iiidiiidiiiidiif=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke)=>(Hy=u.dynCall_iiidiiidiiiidiif=ne.Pf)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke),Gy=u.dynCall_dddd=(o,c,f,p)=>(Gy=u.dynCall_dddd=ne.Qf)(o,c,f,p),Vy=u.dynCall_iidiiii=(o,c,f,p,_,y,x)=>(Vy=u.dynCall_iidiiii=ne.Rf)(o,c,f,p,_,y,x),Wy=u.dynCall_iiiddii=(o,c,f,p,_,y,x)=>(Wy=u.dynCall_iiiddii=ne.Sf)(o,c,f,p,_,y,x),jy=u.dynCall_iiiiiiiidi=(o,c,f,p,_,y,x,C,U,H)=>(jy=u.dynCall_iiiiiiiidi=ne.Tf)(o,c,f,p,_,y,x,C,U,H),Xy=u.dynCall_iiiddi=(o,c,f,p,_,y)=>(Xy=u.dynCall_iiiddi=ne.Uf)(o,c,f,p,_,y),Yy=u.dynCall_iiidd=(o,c,f,p,_)=>(Yy=u.dynCall_iiidd=ne.Vf)(o,c,f,p,_);u.dynCall_iiiif=(o,c,f,p,_)=>(u.dynCall_iiiif=ne.Wf)(o,c,f,p,_);var $y=u.dynCall_fi=(o,c)=>($y=u.dynCall_fi=ne.Xf)(o,c),qy=u.dynCall_did=(o,c,f)=>(qy=u.dynCall_did=ne.Yf)(o,c,f),Ky=u.dynCall_iiidii=(o,c,f,p,_,y)=>(Ky=u.dynCall_iiidii=ne.Zf)(o,c,f,p,_,y),Zy=u.dynCall_iiidddii=(o,c,f,p,_,y,x,C)=>(Zy=u.dynCall_iiidddii=ne._f)(o,c,f,p,_,y,x,C),Qy=u.dynCall_didii=(o,c,f,p,_)=>(Qy=u.dynCall_didii=ne.$f)(o,c,f,p,_),Jy=u.dynCall_iiiiiiidddi=(o,c,f,p,_,y,x,C,U,H,K)=>(Jy=u.dynCall_iiiiiiidddi=ne.ag)(o,c,f,p,_,y,x,C,U,H,K),eb=u.dynCall_iidd=(o,c,f,p)=>(eb=u.dynCall_iidd=ne.bg)(o,c,f,p),tb=u.dynCall_viij=(o,c,f,p,_)=>(tb=u.dynCall_viij=ne.cg)(o,c,f,p,_),nb=u.dynCall_viji=(o,c,f,p,_)=>(nb=u.dynCall_viji=ne.dg)(o,c,f,p,_),ib=u.dynCall_vijii=(o,c,f,p,_,y)=>(ib=u.dynCall_vijii=ne.eg)(o,c,f,p,_,y),rb=u.dynCall_iiijj=(o,c,f,p,_,y,x)=>(rb=u.dynCall_iiijj=ne.fg)(o,c,f,p,_,y,x),sb=u.dynCall_iiijji=(o,c,f,p,_,y,x,C)=>(sb=u.dynCall_iiijji=ne.gg)(o,c,f,p,_,y,x,C),ab=u.dynCall_vij=(o,c,f,p)=>(ab=u.dynCall_vij=ne.hg)(o,c,f,p),ob=u.dynCall_vijji=(o,c,f,p,_,y,x)=>(ob=u.dynCall_vijji=ne.ig)(o,c,f,p,_,y,x),lb=u.dynCall_viiji=(o,c,f,p,_,y)=>(lb=u.dynCall_viiji=ne.jg)(o,c,f,p,_,y),cb=u.dynCall_jiii=(o,c,f,p)=>(cb=u.dynCall_jiii=ne.kg)(o,c,f,p),ub=u.dynCall_iiiiddd=(o,c,f,p,_,y,x)=>(ub=u.dynCall_iiiiddd=ne.lg)(o,c,f,p,_,y,x),db=u.dynCall_vidii=(o,c,f,p,_)=>(db=u.dynCall_vidii=ne.mg)(o,c,f,p,_),hb=u.dynCall_vidiiii=(o,c,f,p,_,y,x)=>(hb=u.dynCall_vidiiii=ne.ng)(o,c,f,p,_,y,x),fb=u.dynCall_vidiii=(o,c,f,p,_,y)=>(fb=u.dynCall_vidiii=ne.og)(o,c,f,p,_,y),pb=u.dynCall_dj=(o,c,f)=>(pb=u.dynCall_dj=ne.pg)(o,c,f),mb=u.dynCall_vdiii=(o,c,f,p,_)=>(mb=u.dynCall_vdiii=ne.qg)(o,c,f,p,_),gb=u.dynCall_idiiiiii=(o,c,f,p,_,y,x,C)=>(gb=u.dynCall_idiiiiii=ne.rg)(o,c,f,p,_,y,x,C),_b=u.dynCall_idiiiiiii=(o,c,f,p,_,y,x,C,U)=>(_b=u.dynCall_idiiiiiii=ne.sg)(o,c,f,p,_,y,x,C,U),vb=u.dynCall_iiiidiiii=(o,c,f,p,_,y,x,C,U)=>(vb=u.dynCall_iiiidiiii=ne.tg)(o,c,f,p,_,y,x,C,U),yb=u.dynCall_viiiidiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se)=>(yb=u.dynCall_viiiidiiiiii=ne.ug)(o,c,f,p,_,y,x,C,U,H,K,se),bb=u.dynCall_iiiff=(o,c,f,p,_)=>(bb=u.dynCall_iiiff=ne.vg)(o,c,f,p,_);u.dynCall_viiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se)=>(u.dynCall_viiiiiiiiiii=ne.wg)(o,c,f,p,_,y,x,C,U,H,K,se);var xb=u.dynCall_iij=(o,c,f,p)=>(xb=u.dynCall_iij=ne.xg)(o,c,f,p),wb=u.dynCall_vidi=(o,c,f,p)=>(wb=u.dynCall_vidi=ne.yg)(o,c,f,p),Sb=u.dynCall_fii=(o,c,f)=>(Sb=u.dynCall_fii=ne.zg)(o,c,f),Mb=u.dynCall_viiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye)=>(Mb=u.dynCall_viiiiiiiiiiiii=ne.Ag)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye),Eb=u.dynCall_iiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K)=>(Eb=u.dynCall_iiiiiiiiiii=ne.Bg)(o,c,f,p,_,y,x,C,U,H,K),Tb=u.dynCall_viidii=(o,c,f,p,_,y)=>(Tb=u.dynCall_viidii=ne.Cg)(o,c,f,p,_,y),Ab=u.dynCall_viiiijii=(o,c,f,p,_,y,x,C,U)=>(Ab=u.dynCall_viiiijii=ne.Dg)(o,c,f,p,_,y,x,C,U),Cb=u.dynCall_viiijjii=(o,c,f,p,_,y,x,C,U,H)=>(Cb=u.dynCall_viiijjii=ne.Eg)(o,c,f,p,_,y,x,C,U,H),Rb=u.dynCall_iiiijjii=(o,c,f,p,_,y,x,C,U,H)=>(Rb=u.dynCall_iiiijjii=ne.Fg)(o,c,f,p,_,y,x,C,U,H),Pb=u.dynCall_viiijii=(o,c,f,p,_,y,x,C)=>(Pb=u.dynCall_viiijii=ne.Gg)(o,c,f,p,_,y,x,C),Lb=u.dynCall_iiiijii=(o,c,f,p,_,y,x,C)=>(Lb=u.dynCall_iiiijii=ne.Hg)(o,c,f,p,_,y,x,C),Ib=u.dynCall_ddiiiii=(o,c,f,p,_,y,x)=>(Ib=u.dynCall_ddiiiii=ne.Ig)(o,c,f,p,_,y,x),Db=u.dynCall_iifi=(o,c,f,p)=>(Db=u.dynCall_iifi=ne.Jg)(o,c,f,p),kb=u.dynCall_iiiij=(o,c,f,p,_,y)=>(kb=u.dynCall_iiiij=ne.Kg)(o,c,f,p,_,y);u.dynCall_jiji=(o,c,f,p,_)=>(u.dynCall_jiji=ne.Lg)(o,c,f,p,_);var Fb=u.dynCall_iiiiij=(o,c,f,p,_,y,x)=>(Fb=u.dynCall_iiiiij=ne.Mg)(o,c,f,p,_,y,x);u.dynCall_viijii=(o,c,f,p,_,y,x)=>(u.dynCall_viijii=ne.Ng)(o,c,f,p,_,y,x);var Ub=u.dynCall_jiiii=(o,c,f,p,_)=>(Ub=u.dynCall_jiiii=ne.Og)(o,c,f,p,_),Ob=u.dynCall_viiiiiiiiiiiiiii=(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke)=>(Ob=u.dynCall_viiiiiiiiiiiiiii=ne.Pg)(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke);u.dynCall_iiiiijj=(o,c,f,p,_,y,x,C,U)=>(u.dynCall_iiiiijj=ne.Qg)(o,c,f,p,_,y,x,C,U),u.dynCall_iiiiiijj=(o,c,f,p,_,y,x,C,U,H)=>(u.dynCall_iiiiiijj=ne.Rg)(o,c,f,p,_,y,x,C,U,H);var Nb=o=>(Nb=ne.Sg)(o),Bb=()=>(Bb=ne.Tg)(),zb=o=>(zb=ne.Ug)(o),Hb=()=>(Hb=ne.Vg)();u.___start_em_js=3895468,u.___stop_em_js=3896792;function yC(o,c,f){var p=Se();try{return u0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function bC(o,c,f,p){var _=Se();try{return d0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function xC(o,c){var f=Se();try{vf(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function wC(o,c){var f=Se();try{return yf(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function SC(o,c,f,p,_,y){var x=Se();try{return h0(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function MC(o,c,f){var p=Se();try{f0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function EC(o){var c=Se();try{return p0(o)}catch(f){if(xe(c),f!==f+0)throw f;we(1,0)}}function TC(o,c,f,p,_,y){var x=Se();try{m0(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function AC(o,c,f,p,_){var y=Se();try{return b0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function CC(o,c,f,p){var _=Se();try{_0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function RC(o,c,f,p,_){var y=Se();try{x0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function PC(o){var c=Se();try{g0(o)}catch(f){if(xe(c),f!==f+0)throw f;we(1,0)}}function LC(o,c,f){var p=Se();try{v0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function IC(o,c,f,p,_,y,x,C){var U=Se();try{return T0(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function DC(o,c,f,p,_,y,x){var C=Se();try{A0(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function kC(o,c,f,p,_,y,x){var C=Se();try{return C0(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function FC(o,c,f,p,_,y,x,C){var U=Se();try{$0(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function UC(o,c,f,p,_){var y=Se();try{return z0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function OC(o,c,f,p,_,y){var x=Se();try{hy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function NC(o,c,f,p){var _=Se();try{w0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function BC(o,c,f,p,_){var y=Se();try{U0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function zC(o,c,f,p){var _=Se();try{return L0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function HC(o,c,f,p,_,y,x,C,U){var H=Se();try{return N0(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function GC(o,c){var f=Se();try{return y0(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function VC(o,c,f){var p=Se();try{return F0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function WC(o,c,f){var p=Se();try{return S0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function jC(o,c,f,p,_,y){var x=Se();try{return I0(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function XC(o,c,f,p,_,y,x,C,U,H,K,se){var he=Se();try{return k0(o,c,f,p,_,y,x,C,U,H,K,se)}catch(ye){if(xe(he),ye!==ye+0)throw ye;we(1,0)}}function YC(o,c){var f=Se();try{D0(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function $C(o,c,f){var p=Se();try{return X0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function qC(o,c,f,p,_,y){var x=Se();try{return O0(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function KC(o,c,f,p,_){var y=Se();try{M0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function ZC(o,c,f,p,_){var y=Se();try{return E0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function QC(o,c,f,p,_,y,x,C,U,H){var K=Se();try{return B0(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function JC(o,c,f,p){var _=Se();try{return H0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function eR(o,c,f,p,_){var y=Se();try{return G0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function tR(o,c,f,p,_){var y=Se();try{return W0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function nR(o,c,f,p){var _=Se();try{V0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function iR(o,c,f,p){var _=Se();try{return R0(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function rR(o,c,f,p,_,y,x,C,U){var H=Se();try{q0(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function sR(o,c,f,p,_){var y=Se();try{return K0(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function aR(o,c,f){var p=Se();try{return Y0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function oR(o,c,f,p,_,y){var x=Se();try{ey(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function lR(o,c,f,p,_,y,x){var C=Se();try{Q0(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function cR(o,c,f,p,_,y,x,C){var U=Se();try{return ty(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function uR(o,c,f,p,_,y,x,C){var U=Se();try{ry(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function dR(o,c,f,p,_,y,x,C,U,H){var K=Se();try{return ny(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function hR(o,c,f,p,_,y,x){var C=Se();try{J0(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function fR(o,c,f,p,_,y,x){var C=Se();try{iy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function pR(o,c,f,p,_,y,x,C,U,H){var K=Se();try{Z0(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function mR(o,c,f,p){var _=Se();try{wb(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function gR(o,c,f,p,_,y,x,C,U){var H=Se();try{sy(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function _R(o,c,f,p,_,y){var x=Se();try{ay(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function vR(o,c,f,p,_,y){var x=Se();try{oy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function yR(o,c,f,p,_,y,x,C){var U=Se();try{ly(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function bR(o,c,f){var p=Se();try{return cy(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function xR(o,c,f,p,_,y,x){var C=Se();try{return uy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function wR(o,c,f){var p=Se();try{dy(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function SR(o,c,f,p,_){var y=Se();try{fy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function MR(o,c,f,p,_,y,x,C,U){var H=Se();try{py(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function ER(o,c,f,p,_,y,x,C,U,H,K,se,he){var ye=Se();try{return _y(o,c,f,p,_,y,x,C,U,H,K,se,he)}catch(ze){if(xe(ye),ze!==ze+0)throw ze;we(1,0)}}function TR(o,c,f){var p=Se();try{return j0(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function AR(o,c,f,p,_){var y=Se();try{vy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function CR(o,c,f,p,_,y){var x=Se();try{yy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function RR(o,c,f,p){var _=Se();try{return by(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function PR(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke){var at=Se();try{Ob(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke)}catch(dt){if(xe(at),dt!==dt+0)throw dt;we(1,0)}}function LR(o,c,f,p,_,y,x,C,U,H,K){var se=Se();try{Sy(o,c,f,p,_,y,x,C,U,H,K)}catch(he){if(xe(se),he!==he+0)throw he;we(1,0)}}function IR(o,c,f,p,_,y,x,C,U,H){var K=Se();try{My(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function DR(o,c,f,p,_){var y=Se();try{xy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function kR(o,c){var f=Se();try{return $y(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function FR(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke,at,dt,Re,je){var dn=Se();try{return wy(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke,at,dt,Re,je)}catch(zt){if(xe(dn),zt!==zt+0)throw zt;we(1,0)}}function UR(o,c,f,p,_,y,x,C,U,H,K,se,he){var ye=Se();try{return Ey(o,c,f,p,_,y,x,C,U,H,K,se,he)}catch(ze){if(xe(ye),ze!==ze+0)throw ze;we(1,0)}}function OR(o,c,f,p,_,y,x,C,U,H,K,se,he,ye){var ze=Se();try{return Ay(o,c,f,p,_,y,x,C,U,H,K,se,he,ye)}catch(Ke){if(xe(ze),Ke!==Ke+0)throw Ke;we(1,0)}}function NR(o,c,f,p,_,y,x,C,U,H,K,se){var he=Se();try{return Cy(o,c,f,p,_,y,x,C,U,H,K,se)}catch(ye){if(xe(he),ye!==ye+0)throw ye;we(1,0)}}function BR(o,c,f,p,_,y,x,C){var U=Se();try{return Ry(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function zR(o,c,f,p,_,y,x){var C=Se();try{return Wy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function HR(o,c,f,p,_,y){var x=Se();try{return Py(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function GR(o,c,f,p,_){var y=Se();try{return Ly(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function VR(o,c,f,p,_,y,x){var C=Se();try{return Iy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function WR(o,c,f,p,_,y){var x=Se();try{return Dy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function jR(o,c,f,p){var _=Se();try{return ky(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function XR(o,c,f){var p=Se();try{return Fy(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function YR(o,c,f,p,_){var y=Se();try{return Uy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function $R(o,c,f,p,_,y,x,C,U,H,K){var se=Se();try{return By(o,c,f,p,_,y,x,C,U,H,K)}catch(he){if(xe(se),he!==he+0)throw he;we(1,0)}}function qR(o,c,f,p){var _=Se();try{return Oy(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function KR(o,c,f,p,_,y,x){var C=Se();try{return Ny(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function ZR(o,c,f,p,_,y,x,C,U){var H=Se();try{return zy(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function QR(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke){var at=Se();try{return Hy(o,c,f,p,_,y,x,C,U,H,K,se,he,ye,ze,Ke)}catch(dt){if(xe(at),dt!==dt+0)throw dt;we(1,0)}}function JR(o,c,f,p){var _=Se();try{return Gy(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function eP(o,c,f,p,_,y,x){var C=Se();try{return Vy(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function tP(o,c,f,p,_,y,x,C,U,H){var K=Se();try{return jy(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function nP(o,c,f,p,_,y){var x=Se();try{return Xy(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function iP(o,c,f,p,_){var y=Se();try{return Yy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function rP(o,c,f){var p=Se();try{return qy(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function sP(o,c,f,p,_,y){var x=Se();try{return Ky(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function aP(o,c,f,p,_,y,x,C){var U=Se();try{return Zy(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function oP(o,c,f,p,_){var y=Se();try{return Qy(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function lP(o,c,f,p,_,y,x,C,U,H,K){var se=Se();try{return Jy(o,c,f,p,_,y,x,C,U,H,K)}catch(he){if(xe(se),he!==he+0)throw he;we(1,0)}}function cP(o,c,f,p){var _=Se();try{return eb(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function uP(o,c,f,p,_,y,x){var C=Se();try{return ub(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function dP(o,c,f,p,_){var y=Se();try{db(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function hP(o,c,f,p,_,y,x){var C=Se();try{hb(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function fP(o,c,f,p,_,y){var x=Se();try{fb(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function pP(o,c,f,p,_){var y=Se();try{mb(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function mP(o,c,f,p,_,y,x,C,U){var H=Se();try{return vb(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function gP(o,c,f,p,_,y,x,C){var U=Se();try{return gb(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function _P(o,c,f,p,_,y,x,C,U){var H=Se();try{return _b(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function vP(o,c,f,p,_,y,x,C,U,H,K,se){var he=Se();try{yb(o,c,f,p,_,y,x,C,U,H,K,se)}catch(ye){if(xe(he),ye!==ye+0)throw ye;we(1,0)}}function yP(o,c,f,p,_){var y=Se();try{return bb(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function bP(o,c,f){var p=Se();try{return Sb(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function xP(o,c,f,p,_,y,x,C,U,H,K,se,he,ye){var ze=Se();try{Mb(o,c,f,p,_,y,x,C,U,H,K,se,he,ye)}catch(Ke){if(xe(ze),Ke!==Ke+0)throw Ke;we(1,0)}}function wP(o,c,f,p,_,y,x,C,U,H,K){var se=Se();try{return Eb(o,c,f,p,_,y,x,C,U,H,K)}catch(he){if(xe(se),he!==he+0)throw he;we(1,0)}}function SP(o,c,f,p,_,y){var x=Se();try{Tb(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function MP(o,c,f,p,_,y,x){var C=Se();try{return Ib(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function EP(o,c,f,p){var _=Se();try{return Db(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function TP(o){var c=Se();try{return P0(o)}catch(f){if(xe(c),f!==f+0)throw f;we(1,0)}}function AP(o,c,f,p){var _=Se();try{return cb(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function CP(o,c,f,p,_){var y=Se();try{return my(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function RP(o,c){var f=Se();try{return gy(o,c)}catch(p){if(xe(f),p!==p+0)throw p;we(1,0)}}function PP(o,c,f,p,_){var y=Se();try{tb(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function LP(o,c,f,p,_){var y=Se();try{nb(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function IP(o,c,f,p,_,y){var x=Se();try{ib(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function DP(o,c,f,p,_,y,x){var C=Se();try{return rb(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function kP(o,c,f,p,_,y,x,C){var U=Se();try{return sb(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function FP(o,c,f,p){var _=Se();try{ab(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function UP(o,c,f){var p=Se();try{return Ty(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function OP(o,c,f,p,_,y,x){var C=Se();try{ob(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function NP(o,c,f,p,_,y){var x=Se();try{lb(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function BP(o,c,f){var p=Se();try{return pb(o,c,f)}catch(_){if(xe(p),_!==_+0)throw _;we(1,0)}}function zP(o,c,f,p){var _=Se();try{return xb(o,c,f,p)}catch(y){if(xe(_),y!==y+0)throw y;we(1,0)}}function HP(o,c,f,p,_,y,x,C,U){var H=Se();try{Ab(o,c,f,p,_,y,x,C,U)}catch(K){if(xe(H),K!==K+0)throw K;we(1,0)}}function GP(o,c,f,p,_,y,x,C,U,H){var K=Se();try{Cb(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function VP(o,c,f,p,_,y,x,C,U,H){var K=Se();try{return Rb(o,c,f,p,_,y,x,C,U,H)}catch(se){if(xe(K),se!==se+0)throw se;we(1,0)}}function WP(o,c,f,p,_,y,x,C){var U=Se();try{Pb(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function jP(o,c,f,p,_,y,x,C){var U=Se();try{return Lb(o,c,f,p,_,y,x,C)}catch(H){if(xe(U),H!==H+0)throw H;we(1,0)}}function XP(o,c,f,p,_,y){var x=Se();try{return kb(o,c,f,p,_,y)}catch(C){if(xe(x),C!==C+0)throw C;we(1,0)}}function YP(o,c,f,p,_,y,x){var C=Se();try{return Fb(o,c,f,p,_,y,x)}catch(U){if(xe(C),U!==U+0)throw U;we(1,0)}}function $P(o,c,f,p,_){var y=Se();try{return Ub(o,c,f,p,_)}catch(x){if(xe(y),x!==x+0)throw x;we(1,0)}}function qP(o){o=Object.assign({},o);var c=_=>()=>_()>>>0,f=_=>y=>_(y)>>>0,p=_=>(y,x)=>_(y,x)>>>0;return o.Cd=c(o.Cd),o.Fd=f(o.Fd),o.Gd=c(o.Gd),o.Id=p(o.Id),o.Jd=f(o.Jd),o.Vd=c(o.Vd),o.Xd=f(o.Xd),o}u.addRunDependency=ke,u.removeRunDependency=Le,u.FS_createPath=R.createPath,u.FS_createLazyFile=R.createLazyFile,u.FS_createDevice=R.createDevice,u.wasmMemory=ue,u.keepRuntimeAlive=ii,u.ExitStatus=Ce,u.FS_createPreloadedFile=R.createPreloadedFile,u.FS_createDataFile=R.createDataFile,u.FS_unlink=R.unlink,u.PThread=Ee,u.FS_readdir=R.readdir,u.FS_analyzePath=R.analyzePath;var mu;ve=function o(){mu||Gb(),mu||(ve=o)};function Gb(){if(N>0)return;if(P){g(u),ut(),startWorker(u);return}if(jt(),N>0)return;function o(){mu||(mu=!0,u.calledRun=!0,!pe&&(ut(),g(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),yn()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),o()},1)):o()}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();return Gb(),t.ready}})();typeof _T=="object"&&typeof xg=="object"?xg.exports=yg:typeof define=="function"&&define.amd&&define([],()=>yg);globalThis["NEEDLE:USD:GET"]=yg;let Op=null;async function Az(n){if(Op)return Op;const e=globalThis["NEEDLE:USD:GET"];if(!e)throw new Error('"NEEDLE:USD:GET" not found in globalThis - please modify "emHdBindings.js" and add: globalThis["NEEDLE:USD:GET"] = getUsdModule;');const t=await Promise.all([Wl(()=>import("./emHdBindings-B2pBhR1n.js"),[]),Wl(()=>import("./emHdBindings-A46AWXYl.js"),[]),Wl(()=>import("./emHdBindings.worker-t1x5VIsg.js"),[]),Wl(()=>import("./emHdBindings.worker-CyHENA1f.js"),[]),Wl(()=>import("./emHdBindings-qRmJXJBb.js"),[])]),[i,r,s,a,l]=t,d=s,h=await fetch(r.default).then(m=>m.arrayBuffer());return Op=e({mainScriptUrlOrBlob:i.default,setStatus:m=>{console.debug("🧊 USD STATUS",m)},...n,locateFile:m=>{var v;(n==null?void 0:n.debug)===!0&&console.warn("LOCATE FILE:",m);const u=(v=n==null?void 0:n.locateFile)==null?void 0:v.call(n,m);if(u)return u;let g=null;return m.includes("emHdBindings.data")?g=r.default:m.includes("emHdBindings.wasm")?g=l.default:m.includes("emHdBindings.worker.js")&&(g=d.default),g??m},getPreloadedPackage(m,u){var v;const g=(v=n==null?void 0:n.getPreloadedPackage)==null?void 0:v.call(n,m,u);if(g)return g;if(m.includes("emHdBindings.data")&&h.byteLength!==u)throw new Error(`emHdBindings.data size mismatch: expected ${u} but got ${h.byteLength}
${r.default}`);return null}})}const Cz=!1;class Rz{constructor(e,t){this.basename=e,this.config=t,this.allPaths=t.paths,this.textures=[],this.loader=new Xh,this.tgaLoader=new uz,this.exrLoader=new eT;let r=new URLSearchParams(window.location.search).get("file");if(r){let s=r.lastIndexOf("/");s>=0&&(r=r.substring(0,s)),this.baseUrl=r}}getTexture(e){if(this.textures[e])return this.textures[e];let t,i;if(this.textures[e]=new Promise((a,l)=>{t=a,i=l}),!e)return Promise.reject(new Error("Empty resource path for file: "+e+" at "+this.basename));let r,s=e.toLowerCase();return s.indexOf(".png")>=s.length-5?r="image/png":s.indexOf(".jpg")>=s.length-5||s.indexOf(".jpeg")>=s.length-5?r="image/jpeg":s.indexOf(".exr")>=s.length-4?(console.warn("EXR textures are not fully supported yet",e),r="image/x-exr"):s.indexOf(".tga")>=s.length-4?(console.warn("TGA textures are not fully supported yet",e),r="image/tga"):console.error("Error when loading texture: unknown filetype",e),this.config.driver().getFile(e,async a=>{let l=this.loader;r==="image/tga"?l=this.tgaLoader:r==="image/x-exr"&&(l=this.exrLoader);const d=this.baseUrl;function h(m){let u;if(m){let g=new Blob([m.slice(0)],{type:r});u=URL.createObjectURL(g)}else d?u=d+"/"+e:u=e;l.load(u,g=>{g.name=e,t(g)},void 0,g=>{i(g)})}if(!a)if(d)console.log("File not found in filesystem, trying to fetch",e);else{i(new Error("Unknown file: "+e));return}h(a)}),this.textures[e]}}class Pz{constructor(e,t){this._geometry=new On,this._id=e,this._interface=t,this._points=void 0,this._normals=void 0,this._colors=void 0,this._uvs=void 0,this._indices=void 0,this._materials=[];let i=new qi({side:Si,color:new Je(11842740)});this._materials.push(i),this._mesh=new wn(this._geometry,i),this._mesh.castShadow=!0,this._mesh.receiveShadow=!0;let r=e,s=r.lastIndexOf("/");s>=0&&(r=r.substring(s+1)),this._mesh.name=r,t.config.usdRoot.add(this._mesh)}updateOrder(e,t,i=3){if(e&&this._indices){let r=[];for(let s=0;s<this._indices.length;s++){let a=this._indices[s];for(let l=0;l<i;++l)r.push(e[i*a+l])}this._geometry.setAttribute(t,new nn(r,i))}}updateIndices(e){this._indices=[];for(let t=0;t<e.length;t++)this._indices.push(e[t]);this.updateOrder(this._points,"position"),this.updateOrder(this._normals,"normal"),this._colors&&this.updateOrder(this._colors,"color"),this._uvs&&(this.updateOrder(this._uvs,"uv",2),this._geometry.attributes.uv2=this._geometry.attributes.uv)}setTransform(e){this._mesh.matrix.set(...e),this._mesh.matrix.transpose(),this._mesh.matrixAutoUpdate=!1}updateNormals(e){this._geometry.hasAttribute("normal")||(this._normals=e.slice(0),this.updateOrder(this._normals,"normal"))}setNormals(e,t){t==="facevarying"?this._geometry.setAttribute("normal",new nn(e,3)):t==="vertex"&&(this._normals=e.slice(0),this.updateOrder(this._normals,"normal"))}setMaterial(e){this._interface.materials[e]?this._mesh.material=this._interface.materials[e]._material:console.error("Material not found",e,this._interface.materials)}setGeomSubsetMaterial(e){for(let t=0;t<e.length;t++){const i=e[t];this._interface.materials[i.materialId]&&(this._materials.push(this._interface.materials[i.materialId]._material),this._geometry.addGroup(i.start,i.length,t+1))}this._mesh=new wn(this._geometry,this._materials),this._interface.config.usdRoot.add(this._mesh)}setDisplayColor(e,t){let i=!1;this._mesh.material===Jl&&(this._mesh.material=this._mesh.material.clone(),i=!0),this._colors=null,t==="constant"?this._mesh.material.color=new Je().fromArray(e):t==="vertex"?(this._mesh.material.vertexColors=!0,i&&(this._mesh.material.color=new Je(16777215)),this._colors=e.slice(0),this.updateOrder(this._colors,"color")):Is.has(t)?Is.set(t,Is.get(t)+1):(Is.set(t,1),console.warn(`Unsupported displayColor interpolation type '${t}'.`))}setUV(e,t,i){this._uvs=null,i==="facevarying"?this._geometry.setAttribute("uv",new nn(e,t)):i==="vertex"&&(this._uvs=e.slice(0),this.updateOrder(this._uvs,"uv",2)),this._geometry.hasAttribute("uv")&&(this._geometry.attributes.uv2=this._geometry.attributes.uv)}updatePrimvar(e,t,i,r){if(e&&e!=="points")switch(e.startsWith("st")&&(e="uv"),e){case"displayColor":this.setDisplayColor(t,r);break;case"uv":case"UVMap":case"uvmap":case"uv0":case"UVW":case"uvw":case"map1":this.setUV(t,i,r);break;case"normals":this.setNormals(t,r);break;default:Is.has(e)?Is.set(e,Is.get(e)+1):(Is.set(e,1),console.warn("Unsupported primvar: ",e))}}updatePoints(e){this._points=e.slice(0),this.updateOrder(this._points,"position")}commit(){}}let Is=new Map,Jl;const Li=class Li{constructor(e,t){this._id=e,this._nodes={},this._interface=t,Jl||(Jl=new qi({side:Si,color:new Je(16722327),name:"DefaultMaterial"})),this._material=Jl}updateNode(e,t,i){this._nodes[t]=i}convertWrap(e){if(e===void 0)return Vr;const t={repeat:1e3,clamp:1001,mirror:1002};return t[e]?t[e]:Vr}assignTexture(e,t){return new Promise((i,r)=>{var a;const s=Li.usdPreviewToMeshPhysicalTextureMap[t];if(s===void 0){console.warn(`Unsupported material texture parameter '${t}'.`),i();return}if(e[t]&&e[t].nodeIn){const l=e[t].nodeIn;l.resolvedPath||console.warn("Texture node has no file!",l);const d=(a=l.resolvedPath)==null?void 0:a.replace("./",""),h=e[t].inputName;Object.keys(this._nodes).find(m=>this._nodes[m]===e),this._interface.registry.getTexture(d).then(m=>{var v,w,T,M;if(this._material||(console.error("Material not set when trying to assign texture, this is likely a bug"),i()),s==="alphaMap"){l.file===((w=(v=e.diffuseColor)==null?void 0:v.nodeIn)==null?void 0:w.file)&&h==="a"?this._material.map.format=Vn:console.warn("Separate alpha channel is currently not supported.",l.file,(M=(T=e.diffuseColor)==null?void 0:T.nodeIn)==null?void 0:M.file,h),this._material.alphaClip||(this._material.transparent=!0),this._material.needsUpdate=!0,i();return}else if(s==="metalnessMap")this._material.metalness=1;else if(s==="roughnessMap")this._material.roughness=1;else if(s==="emissiveMap")this._material.emissive=new Je(16777215);else if(!Li.channelMap[h]){console.warn(`Unsupported texture channel '${h}'!`),i();return}const u=m.clone();let g="rgba";if(s=="roughnessMap"&&h!="g"&&(g="0"+h+"11"),s=="metalnessMap"&&h!="b"&&(g="01"+h+"1"),s=="occlusionMap"&&h!="r"&&(g=h+"111"),s=="opacityMap"&&h!="a"&&(g=h+h+h+h),u.colorSpace=Li.usdPreviewToColorSpaceMap[t]||Sn,g!="rgba"&&(u.image=Li._swizzleImageChannels(u.image,g)),u.format=Li.channelMap[h],u.needsUpdate=!0,l.st&&l.st.nodeIn){const b=l.st.nodeIn,A=b.rotation?b.rotation/180*Math.PI:0,E=b.translation?new et(b.translation[0],b.translation[1]):new et(0,0),P=b.scale?new et(b.scale[0],b.scale[1]):new et(1,1),G=Math.sin(A),O=Math.cos(A);E.y=E.y-(1-O)*P.y,E.x=E.x-G*P.x,u.repeat.set(P.x,P.y),u.offset.set(E.x,E.y),u.rotation=A}u.wrapS=this.convertWrap(l.wrapS),u.wrapT=this.convertWrap(l.wrapT),this._material[s]=u,this._material.needsUpdate=!0,i()}).catch(m=>{console.warn("Error when loading texture",m),i()})}else{this._material[s]=void 0,i();return}})}static SRGBToLinear(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}static LinearToSRGB(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}static _swizzleImageChannels(e,t){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=e.width,i.height=e.height;const r=i.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),a=s.data,l={r:0,g:1,b:2,a:3,x:0,y:1,z:2,w:3,0:4,1:5,"-":-1},d=[4,4,4,4];for(let m=0;m<t.length;m++)d[m]=l[t[m]];const h=a.slice(0);for(let m=0;m<a.length;m+=4){h[0]=a[m],h[1]=a[m+1],h[2]=a[m+2],h[3]=a[m+3],h[4]=0,h[5]=1;const u=d[0],g=d[1],v=d[2],w=d[3];u!==-1&&(a[m]=h[u]),g!==-1&&(a[m+1]=h[g]),v!==-1&&(a[m+2]=h[v]),w!==-1&&(a[m+3]=h[w])}return r.putImageData(s,0,0),i}else if(e.data){const i=e.data.slice(0);for(let r=0;r<i.length;r++)i instanceof Uint8Array||i instanceof Uint8ClampedArray?i[r]=Math.floor(this.SRGBToLinear(i[r]/255)*255):i[r]=this.SRGBToLinear(i[r]);return{data:i,width:e.width,height:e.height}}else return console.warn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}assignProperty(e,t){const i=Li.usdPreviewToMeshPhysicalMap[t];if(i===void 0){console.warn(`Unsupported material parameter '${t}'.`);return}e[t]!==void 0&&!e[t].nodeIn&&(Array.isArray(e[t])?this._material[i]=new Je().fromArray(e[t]):(this._material[i]=e[t],i==="opacity"&&e[t]<1&&(this._material.transparent=!0),t=="opacityThreshold"&&e[t]>0&&(this._material.transparent=!1,this._material.alphaClip=!0)))}async updateFinished(e,t){for(let d of t)d.nodeIn=this._nodes[d.inputId],d.nodeOut=this._nodes[d.outputId],d.nodeIn[d.inputName]=d,d.nodeOut[d.outputName]=d;let i;for(let d of Object.values(this._nodes))if(d.diffuseColor){i=d;break}if(!i||Cz){this._material=Jl;return}this._material=new qi({}),this._material.side=Si;let r=this._id,s=r.lastIndexOf("/");s>=0&&(r=r.substring(s+1)),this._material.name=r;const a=!!(i.roughness&&i.roughness.nodeIn),l=!!(i.metallic&&i.metallic.nodeIn);i.occlusion&&i.occlusion.nodeIn;{const d=[];for(let h in Li.usdPreviewToMeshPhysicalTextureMap)d.push(this.assignTexture(i,h));await Promise.all(d),a&&!l?(this._material.metalnessMap=this._material.roughnessMap,this._material.metalnessMap?this._material.metalnessMap.needsUpdate=!0:console.error("Something went wrong with the texture promise; haveRoughnessMap is true but no roughnessMap was loaded.")):l&&!a?(this._material.roughnessMap=this._material.metalnessMap,this._material.roughnessMap?this._material.roughnessMap.needsUpdate=!0:console.error("Something went wrong with the texture promise; haveMetalnessMap is true but no metalnessMap was loaded.")):l&&a&&console.warn("TODO: [Three USD] separate metalness and roughness textures need to be merged")}for(let d in Li.usdPreviewToMeshPhysicalMap)this.assignProperty(i,d)}};Ve(Li,"usdPreviewToMeshPhysicalTextureMap",{diffuseColor:"map",clearcoat:"clearcoatMap",clearcoatRoughness:"clearcoatRoughnessMap",emissiveColor:"emissiveMap",occlusion:"aoMap",roughness:"roughnessMap",metallic:"metalnessMap",normal:"normalMap",opacity:"alphaMap"}),Ve(Li,"usdPreviewToColorSpaceMap",{diffuseColor:on,emissiveColor:on,opacity:on}),Ve(Li,"channelMap",{r:Vn,g:Vn,b:Vn,rgb:Vn,rgba:Vn}),Ve(Li,"usdPreviewToMeshPhysicalMap",{clearcoat:"clearcoat",clearcoatRoughness:"clearcoatRoughness",diffuseColor:"color",emissiveColor:"emissive",ior:"ior",metallic:"metalness",opacity:"opacity",roughness:"roughness",opacityThreshold:"alphaTest"});let bg=Li;class Lz{constructor(e,t){this.config=t,this.registry=new Rz(e,t),this.materials={},this.meshes={}}createRPrim(e,t,i){let r=new Pz(t,this);return this.meshes[t]=r,r}createBPrim(e,t){}createSPrim(e,t){if(e==="material"){let i=new bg(t,this);return this.materials[t]=i,i}else return}CommitResources(){for(const e in this.meshes)this.meshes[e].commit()}}function Iz(n){const e=new Uint8Array(n,0,16);return e[0]==80&&e[1]==75&&e[2]==3&&e[3]==4?"usdz":e[0]==80&&e[1]==88&&e[2]==82&&e[3]==45&&e[4]==85&&e[5]==83&&e[6]==68&&e[7]==67?"usd":"unknown"}async function Dz(n){if(typeof n.filepath!="string")throw new Error("Filepath must be a string");let e=n.filepath,t=n.buffer;t||(t=await(await fetch(e)).arrayBuffer()),e=e.replaceAll(/\\/g,"/").replaceAll("/","_");const i=Iz(t),r=e.split(".").pop();return r!=="usdz"&&r!=="usd"&&r!=="usda"?i==="usdz"||i==="usd"||i==="usda"?e+="."+i:(console.warn("Unknown file format - assuming .usdz"),e+=".usdz"):i!==r&&console.warn("File extension does not match file format",{ext:r,format:i}),n.USD.FS_createDataFile("",e,new Uint8Array(t),!0,!0,!0),e}async function kz(n){const e=n.debug||!1;n.USD.debug=e,e&&console.log("USD",n.USD),await n.USD.ready.catch(console.error);const{usdz:t,buffer:i,USD:r}=n,s=await Dz({USD:r,filepath:t,buffer:i});let a=null;const l={usdRoot:n.scene,paths:new Array,driver:()=>a},d=new Lz(s,l);a=new n.USD.HdWebSyncDriver(d,s),a instanceof Promise&&(a=await a);const h=a;e&&console.log("DRIVER",h);let m=h.GetStage();h.Draw();let u=0;return e&&console.log("STAGE",m),{driver:a,update:g=>{if(h.isDeleted()){e&&(n["debug:delete"]===void 0&&console.error("Called update for three hydra after it was deleted!"),n["debug:delete"]=!0);return}u+=g;let v=u*m.GetTimeCodesPerSecond();v=v%(m.GetEndTimeCode()-m.GetStartTimeCode()),h.SetTime(v),h.Draw()},dispose:()=>{e&&console.warn("Disposing Three Hydra"),a=null,n.USD.FS_unlink(s),h.delete(),e&&console.warn("Disposed Three Hydra")}}}class Fz extends Nn{constructor(){super(...arguments);Ve(this,"extension",["usdz"])}load({url:t,onLoad:i}){Az({mainScriptUrlOrBlob:"/extensions/ComfyUI-Rodin/threeVisualizer/external/emHdBindings.js"}).then(async r=>{const s=t,a=new kc;await kz({USD:r,usdz:s,scene:a}).catch(l=>{console.error("unsupport usd",l)}),setTimeout(()=>{var d;const l=(d=a.children)==null?void 0:d[0];l.updateMatrix(),i(Nn._setUserData(l))},1e3)})}}class Uz extends sl{constructor(t){super();Ve(this,"_sceneManager",new xz);Ve(this,"_index");this._index=t}async start(){try{await this._init(),await this._prepareScene(),await this._enterScene()}catch(t){console.error(t)}}async _init(){const t=this.viewer;t.addLoader(u4),t.addLoader(W4),t.addLoader(c4),t.addLoader(wz),t.addLoader(Sz),t.addLoader(Mz),t.addLoader(Fz)}async _prepareScene(){const t=this.viewer;this._sceneManager.registerScene("HomeScene",new vz(t,this._index)),await this._sceneManager.prepareScene()}async _enterScene(){this._sceneManager.runScene("HomeScene")}update(t){this._sceneManager.updateScene(t)}onDestroy(){this._sceneManager.clear()}}const Oz="_categorySelection_xm8rv_1",Nz="_dragging_xm8rv_1",Bz="_categoryContent_xm8rv_21",zz="_categoryItem_xm8rv_26",Hz="_bottomSDFPreview_xm8rv_40",Gz="_active_xm8rv_51",Vz="_container_xm8rv_61",Wz={categorySelection:Oz,dragging:Nz,categoryContent:Bz,categoryItem:zz,bottomSDFPreview:Hz,active:Gz,container:Vz},jz="_loadingContainer_ebap8_42",Xz="_rodinBg_ebap8_50",Yz="_loadingBox_ebap8_55",$z="_loading_ebap8_42",qz="_white_ebap8_75",Kz="_loadingText_ebap8_93",yr={loadingContainer:jz,rodinBg:Xz,loadingBox:Yz,loading:$z,"rotate-loading":"_rotate-loading_ebap8_1",white:qz,loadingText:Kz,"loading-text-opacity":"_loading-text-opacity_ebap8_1"},Zz=({color:n,type:e="defalut"})=>({defalut:an.jsx("div",{className:`${yr.loadingContainer} ${n?yr.white:""}`,children:an.jsxs("div",{className:yr.loadingBox,children:[an.jsx("div",{className:yr.loading}),an.jsx("div",{className:yr.loadingText,children:"Deemos"})]})}),rodin:an.jsx("div",{className:`${yr.loadingContainer} ${yr.rodinBg} ${n?yr.white:""}`,children:an.jsxs("div",{className:yr.loadingBox,children:[an.jsx("div",{className:yr.loading}),an.jsx("div",{className:yr.loadingText,children:"Deemos"})]})})})[e];function Qz({renderMode:n,index:e=0}){const[t,i]=Xn.useState(null),r=Xn.useRef(null),[s,a]=Xn.useState(null),[l,d]=Xn.useState(!0),h=Xn.useRef();return Xn.useEffect(()=>{if(s){const m=()=>{const u=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,g=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;r.current.resize(u,g)};return window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}}},[s]),Xn.useEffect(()=>{r.current&&(["Tracer"].includes(n)?r.current.stop():r.current.start())},[n]),Xn.useEffect(()=>{if(t)try{const m=new kt({autoResize:!1,canvas:t,antialias:!0,alpha:!0,toneMapping:7,loader:{onLoad:()=>d(!1)}});m.addNode(new Uz(e)),r.current=m;const u=g=>d(g);return rr[e].onLoading(u),()=>{m.scene.environment=null,m.scene.remove(...m.scene.children),m.destroy(),rr[e].destroy(),Z4(),rr[e].offLoading(u)}}catch(m){console.error(m)}},[t]),an.jsxs("aside",{className:"w-full h-full select-none overflow-hidden flex justify-center items-center",style:{background:"var(--background)","--background":"radial-gradient(circle at center, rgba(165, 202, 243, 90%), rgba(165, 202, 243, 90%) 40%, rgba(33, 51, 72, 70%))"},id:"canvas-scene",ref:a,children:[Xn.useMemo(()=>an.jsx(an.Fragment,{children:an.jsx("canvas",{ref:i,className:"outline-none hover:cursor-grab active:cursor-grabbing w-full h-full"})}),[]),an.jsx("div",{className:Wz.container,ref:h}),an.jsx("div",{className:"outline-none absolute top-0 left-0 right-0 bottom-0 pointer-events-none",style:{background:"var(--background-tracer)",boxShadow:"inset 0 0 60px rgb(30, 30, 30, 0.7)"},children:l&&an.jsx(Zz,{color:!0,type:"rodin"})})]})}const Jz="_container_c3wv7_1",eH="_header_c3wv7_9",tH="_mobileContainer_c3wv7_16",nH="_creatorBox_c3wv7_23",iH="_avatar_c3wv7_34",rH="_creatorInfoCon_c3wv7_49",sH="_creatorName_c3wv7_56",aH="_creatorInfo_c3wv7_49",oH="_shareCon_c3wv7_77",lH="_shared_c3wv7_96",cH="_hideOnSmallScreen_c3wv7_108",uH="_titleBtn_c3wv7_114",dH="_like_c3wv7_130",hH="_unLike_c3wv7_135",fH="_animateContainer_c3wv7_140",pH="_box_c3wv7_149",mH="_center_c3wv7_170",gH="_opacityChange_c3wv7_1",_H="_body_c3wv7_281",vH="_loadingOverlay_c3wv7_294",yH="_modelContainer_c3wv7_307",bH="_modelIframe_c3wv7_313",xH="_clickArea_c3wv7_319",wH="_carouselContainer_c3wv7_326",SH="_sdfPreview_c3wv7_336",MH="_fadeIn_c3wv7_350",EH="_slider_c3wv7_354",TH="_dragging_c3wv7_354",AH="_categorySelection_c3wv7_359",CH="_sliderBar_c3wv7_378",RH="_categoryContent_c3wv7_405",PH="_categoryBottom_c3wv7_410",LH="_categoryItem_c3wv7_420",IH="_bottomSDFPreview_c3wv7_434",DH="_active_c3wv7_474",kH="_black_c3wv7_520",FH="_red_c3wv7_527",UH="_grey_c3wv7_534",OH="_colorful_c3wv7_541",NH="_gradient_c3wv7_548",BH="_hoverListWrapper_c3wv7_636",zH="_Icon_c3wv7_648",HH="_hoverList_c3wv7_636",GH="_tracerSwitch_c3wv7_675",VH="_signalButton_c3wv7_693",WH="_tracerOn_c3wv7_704",jH="_Brand_c3wv7_744",XH="_brandTitle_c3wv7_760",YH="_closeIcon_c3wv7_764",$H="_border_c3wv7_769",qH="_close_c3wv7_764",KH="_hoverpluginItem_c3wv7_797",ZH="_tempBody_c3wv7_837",QH="_tempContent_c3wv7_853",JH="_downloadImgBtn_c3wv7_877",e8="_loading_c3wv7_294",gd={container:Jz,header:eH,mobileContainer:tH,creatorBox:nH,avatar:iH,creatorInfoCon:rH,creatorName:sH,creatorInfo:aH,shareCon:oH,shared:lH,hideOnSmallScreen:cH,titleBtn:uH,like:dH,unLike:hH,animateContainer:fH,box:pH,center:mH,opacityChange:gH,"top-left":"_top-left_c3wv7_200","top-right":"_top-right_c3wv7_220","bottom-left":"_bottom-left_c3wv7_240","bottom-right":"_bottom-right_c3wv7_260",body:_H,loadingOverlay:vH,modelContainer:yH,modelIframe:bH,clickArea:xH,carouselContainer:wH,sdfPreview:SH,fadeIn:MH,slider:EH,dragging:TH,categorySelection:AH,sliderBar:CH,categoryContent:RH,categoryBottom:PH,categoryItem:LH,bottomSDFPreview:IH,active:DH,black:kH,red:FH,grey:UH,colorful:OH,gradient:NH,hoverListWrapper:BH,Icon:zH,hoverList:HH,tracerSwitch:GH,signalButton:VH,tracerOn:WH,Brand:jH,brandTitle:XH,closeIcon:YH,border:$H,close:qH,hoverpluginItem:KH,tempBody:ZH,tempContent:QH,downloadImgBtn:JH,loading:e8},t8="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAAsCAMAAAAHH4uhAAAAb1BMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8v0wLRAAAAJHRSTlMABgkMDxIfFhwiGSbxhnUpSTzIw7lmqI2TWVDk48mBQzKOf1vO4PlOAAABdklEQVRIx+3Vy5KCMBAFUDEQE54J+H7PDP//jdPdpiZdhIjMwpXXDaY8dTsYdPHJ/5Iks8Ugs9jSBa5esn+oOWwgxpKepMmCVF53Ze9SdptGTFFiwnT9IFtD9KkTDbGAQmu8E+vqsh9NWVNpdMyq92m/d2v2tkL5gjsbCbHnuOT7YwUWndaGLRnc55hL2WRr7dL6tS4dkThoym7MvijIFWz6kmBwYESaMVgVLnsOaZfhpBn7Ci+Ng3z8DGQwKsJj73Mk2dzY0p1gMtK42vlPnW4Ijye/slv5xiHMv1jBel9deubyZ1BeY0fuqjzkcVBJux1zrZVRSFIpqX8C2h60VIqcg2ElSm3r1j/IbXXX6FzhGHxIPKIQc6ghG4vXkrsAumGRBgEGzu8wvLFpBqW5GiSHOnDRJ3lJ0xKlKHqBWqET0BeBj2mJ+iAi5vriUpDlSXF3EISTlEeIF35YkaJFLZCg8myKUpx5sNn/Ogko5qYty+KTt+UXu/NCZQQvRfsAAAAASUVORK5CYII=";function n8(n){const e=n.match(/(.*\/).*$/);return e?e[1]:""}const XS=[{name:"PBR",symbol:"PBR"},{name:"Shaded",symbol:"Shaded"}];function i8({index:n=0}){const e=lz[n](),[t,i]=Xn.useState({model:"",texture_diffuse:"",texture_normal:"",texture_pbr:"",shaded:""}),[r,s]=Xn.useState("PBR");return Xn.useEffect(()=>{const a=({data:{model_path:l}})=>{const d=n8(l);i({model:"/viewfile?"+new URLSearchParams({filepath:l}),texture_diffuse:"/viewfile?"+new URLSearchParams({filepath:`${d}texture_diffuse.png`}),texture_normal:"/viewfile?"+new URLSearchParams({filepath:`${d}texture_normal.png`}),texture_pbr:"/viewfile?"+new URLSearchParams({filepath:`${d}texture_pbr.png`}),shaded:"/viewfile?"+new URLSearchParams({filepath:`${d}shaded.png`})})};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[]),Xn.useEffect(()=>{e.states.ModelAssets={model:t.model,texture_diffuse:t.texture_diffuse,texture_normal:t.texture_normal,texture_pbr:t.texture_pbr,shaded:t.shaded}},[t]),Xn.useEffect(()=>{e.states.renderMode=r},[r]),an.jsxs(an.Fragment,{children:[an.jsx("main",{className:"flex h-5/6 w-5/6 flex-col items-center justify-center gap-0 relative",children:an.jsx("div",{className:"relative flex min-h-0 w-full grow flex-col items-center justify-center bg-white",children:an.jsx(Qz,{index:n,renderMode:r})})}),an.jsxs("div",{className:`${gd.hoverListWrapper}`,children:[an.jsx("div",{className:`${gd.Icon}`,children:an.jsx("img",{src:t8,alt:"viewSwitch"})}),an.jsx("ul",{className:`${gd.hoverList}`,children:XS.slice(0,XS.length).map((a,l)=>an.jsx("li",{onClick:()=>{s(a.symbol)},className:`${gd.hoverpluginItem} `,children:a.name},l))})]})]})}sE(document.getElementById("root")).render(an.jsx(Xn.StrictMode,{children:an.jsx(i8,{})}))});export default r8();